﻿/* ============================================================
   IKHAYALAMI — TRENDS DASHBOARD PREMIUM v3
   Light Theme · Brand: #0E0E11 · #F58220 · #56C4F8
   Mobile-first · Digital Jewelry SVG Icons · i18n-ready
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
    --td-orange: #F58220;
    --td-orange-dark: #e07218;
    --td-orange-light: #fff3e8;
    --td-orange-mid: rgba(245,130,32,0.12);
    --td-blue: #56C4F8;
    --td-blue-light: rgba(86,196,248,0.10);
    --td-charcoal: #0E0E11;
    --td-charcoal-2: #1A1A1F;
    --td-text: #1A1D20;
    --td-muted: #6C757D;
    --td-muted-light: #9CA3AF;
    --td-surface: #ffffff;
    --td-bg: #F7F8FA;
    --td-border: rgba(0,0,0,0.06);
    --td-border-orange: rgba(245,130,32,0.18);
    --td-shadow-sm: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --td-shadow-md: 0 6px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --td-shadow-card: 0 4px 16px rgba(245,130,32,0.10), 0 1px 4px rgba(0,0,0,0.05);
    --td-radius-sm: 10px;
    --td-radius-md: 14px;
    --td-radius-lg: 18px;
    --td-ease: cubic-bezier(0.25, 1, 0.5, 1);
    --td-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ════════════════════════════════════════════════════════════
   OUTER CONTAINER
   ════════════════════════════════════════════════════════════ */
.trends-dashboard {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.55s cubic-bezier(0.4,0,0.2,1), opacity 0.35s ease, margin-top 0.3s ease;
    margin-top: 0;
}

    .trends-dashboard.td-open {
        max-height: 2200px;
        opacity: 1;
        margin-top: 8px;
    }

/* ── Inner card shell ── */
.td-inner {
    background: var(--td-surface);
    border: 1px solid var(--td-border-orange);
    border-radius: var(--td-radius-lg);
    box-shadow: var(--td-shadow-md), 0 0 0 1px rgba(245,130,32,0.08);
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 76vh;
    overflow: hidden;
}

    /* Gradient accent stripe */
    .td-inner::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #F58220 0%, #ffb347 40%, #56C4F8 80%, #3FA9D9 100%);
        background-size: 200% 100%;
        border-radius: var(--td-radius-lg) var(--td-radius-lg) 0 0;
        z-index: 2;
        animation: td-strip-shimmer 4s linear infinite;
    }

@keyframes td-strip-shimmer {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 200% 0%;
    }
}

/* ════════════════════════════════════════════════════════════
   PREMIUM HEADER
   ════════════════════════════════════════════════════════════ */
.td-header {
    flex-shrink: 0;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--td-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: var(--td-surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.td-header-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

.td-header-brand {
    display: flex;
    align-items: center;
    gap: 9px;
}

.td-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--td-orange);
    flex-shrink: 0;
    animation: td-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(245,130,32,0.18);
}

@keyframes td-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.45;
        transform: scale(0.75);
    }
}

.td-title {
    font-size: 0.97rem;
    font-weight: 800;
    color: var(--td-charcoal);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.td-subtitle-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.td-subtitle {
    font-size: 0.69rem;
    color: var(--td-muted);
    font-weight: 500;
    line-height: 1.2;
}

    .td-subtitle.td-loading-pulse::after {
        content: '.';
        animation: td-dots 1.2s steps(3, end) infinite;
    }

@keyframes td-dots {
    0% {
        content: '.';
    }

    33% {
        content: '..';
    }

    66% {
        content: '...';
    }
}

.td-as-of {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #F58220, #ffb347);
    border-radius: 20px;
    padding: 2px 9px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(245,130,32,0.3);
}

/* ── Location + Filter Row ── */
.td-filter-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.td-loc-search-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
}

.td-loc-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--td-muted-light);
    width: 13px;
    height: 13px;
    pointer-events: none;
    display: flex;
    align-items: center;
}

    .td-loc-icon svg {
        width: 13px;
        height: 13px;
        display: block;
    }

.td-loc-input {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1.5px solid rgba(0,0,0,0.09);
    border-radius: var(--td-radius-sm);
    padding: 5px 9px 5px 27px;
    outline: none;
    width: 170px;
    transition: border-color 0.18s, box-shadow 0.18s;
    color: var(--td-text);
    background: var(--td-bg);
}

    .td-loc-input::placeholder {
        color: var(--td-muted-light);
        font-weight: 400;
    }

    .td-loc-input:focus {
        border-color: var(--td-orange);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(245,130,32,0.10);
    }

.td-loc-go {
    background: var(--td-orange);
    color: #fff;
    border: none;
    border-radius: var(--td-radius-sm);
    padding: 5px 11px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: background 0.18s, transform 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .td-loc-go svg {
        width: 13px;
        height: 13px;
    }

    .td-loc-go:hover {
        background: var(--td-orange-dark);
        transform: translateY(-1px);
    }

/* Province select */
.td-province-dropdown-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.td-prov-icon {
    color: var(--td-orange);
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

    .td-prov-icon svg {
        width: 13px;
        height: 13px;
        display: block;
    }

.td-province-select {
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1.5px solid var(--td-border-orange);
    border-radius: 20px;
    padding: 4px 10px;
    color: var(--td-text);
    background: #fff;
    cursor: pointer;
    max-width: 145px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

    .td-province-select:focus,
    .td-province-select:hover {
        border-color: var(--td-orange);
        box-shadow: 0 0 0 2px rgba(245,130,32,0.12);
    }

/* ── Header Right Controls ── */
.td-header-right {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.td-export-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 0.69rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--td-radius-sm);
    border: 1.5px solid var(--td-border-orange);
    background: var(--td-surface);
    color: var(--td-orange);
    cursor: pointer;
    transition: all 0.18s var(--td-ease);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    box-shadow: var(--td-shadow-sm);
}

    .td-export-btn svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
    }

    .td-export-btn:hover {
        background: var(--td-orange);
        color: #fff;
        border-color: var(--td-orange);
        transform: translateY(-1px);
        box-shadow: 0 4px 14px rgba(245,130,32,0.3);
    }

        .td-export-btn:hover svg {
            stroke: #fff;
        }

    .td-export-btn.td-exporting {
        opacity: 0.6;
        pointer-events: none;
    }

.td-close-btn {
    background: none;
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s;
    padding: 0;
    flex-shrink: 0;
    color: var(--td-muted);
}

    .td-close-btn svg {
        width: 13px;
        height: 13px;
    }

    .td-close-btn:hover {
        background: #fee2e2;
        border-color: #ef4444;
        color: #ef4444;
    }

/* ════════════════════════════════════════════════════════════
   SCROLLABLE BODY
   ════════════════════════════════════════════════════════════ */
.td-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245,130,32,0.4) transparent;
    background: var(--td-bg);
    flex: 1;
    min-height: 0;
}

    .td-body::-webkit-scrollbar {
        width: 4px;
    }

    .td-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .td-body::-webkit-scrollbar-thumb {
        background: rgba(245,130,32,0.4);
        border-radius: 4px;
    }

        .td-body::-webkit-scrollbar-thumb:hover {
            background: rgba(245,130,32,0.7);
        }

/* ════════════════════════════════════════════════════════════
   LOADING STATE
   ════════════════════════════════════════════════════════════ */
.td-loading-wrap {
    color: var(--td-muted);
    font-size: 0.8rem;
    padding: 20px 4px 12px;
}

.td-loading-top {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 13px;
    font-size: 0.8rem;
    color: var(--td-muted);
    font-weight: 500;
}

.td-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(245,130,32,0.18);
    border-top-color: var(--td-orange);
    border-radius: 50%;
    animation: td-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes td-spin {
    to {
        transform: rotate(360deg);
    }
}

.td-progress-track {
    position: relative;
    width: 100%;
    height: 3px;
    background: rgba(0,0,0,0.07);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.td-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    border-radius: 10px;
    background: linear-gradient(90deg, #F58220, #56C4F8, #F58220);
    background-size: 200% 100%;
    /* Smooth width transition driven by JS — no indeterminate animation */
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: td-progress-shimmer 2.2s linear infinite;
}

/* Shimmer effect keeps it looking alive even during slow Gemini calls */
@keyframes td-progress-shimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}

.td-progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 12px;
}

.td-ps {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--td-muted-light);
    transition: color 0.35s, font-weight 0.35s;
    white-space: nowrap;
}

    .td-ps.active {
        color: var(--td-orange);
        font-weight: 800;
    }

.td-loading-joke-wrap {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(245,130,32,0.06), rgba(86,196,248,0.06));
    border: 1px dashed rgba(245,130,32,0.22);
    border-radius: var(--td-radius-sm);
}

.td-joke-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--td-orange);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

.td-loading-joke {
    font-size: 0.73rem;
    color: var(--td-text);
    line-height: 1.55;
    font-style: italic;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

    .td-loading-joke.td-joke-fade {
        opacity: 0;
        transform: translateY(4px);
    }

/* ════════════════════════════════════════════════════════════
   ERROR STATE
   ════════════════════════════════════════════════════════════ */
.td-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 14px;
    background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
    border: 1px solid rgba(239,68,68,0.18);
    border-radius: var(--td-radius-md);
    font-size: 0.8rem;
    color: #dc2626;
    flex-wrap: wrap;
}

    .td-error svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

/* ════════════════════════════════════════════════════════════
   AI DISCLAIMER STRIP
   ════════════════════════════════════════════════════════════ */
.td-ai-strip {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 12px;
    /*  margin-bottom: 12px;*/
    background: linear-gradient(135deg, rgba(245,130,32,0.06) 0%, rgba(86,196,248,0.05) 100%);
    /*   border: 1px solid rgba(245,130,32,0.18);
    border-left: 3px solid var(--td-orange);*/
    border-radius: var(--td-radius-sm);
    font-size: 0.68rem;
    color: var(--td-muted);
    line-height: 1.5;
}

    .td-ai-strip .td-svg-icon {
        color: var(--td-orange);
        flex-shrink: 0;
        margin-top: 1px;
        width: 14px;
        height: 14px;
        display: flex;
        align-items: center;
    }

        .td-ai-strip .td-svg-icon svg {
            width: 14px;
            height: 14px;
        }

    .td-ai-strip strong {
        color: var(--td-orange);
    }

/* ════════════════════════════════════════════════════════════
   DIGITAL JEWELRY SVG ICON — base styles
   ════════════════════════════════════════════════════════════ */
.td-svg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .td-svg-icon svg {
        display: block;
    }

/* ════════════════════════════════════════════════════════════
   KPI METRICS — Premium 3-card strip
   ════════════════════════════════════════════════════════════ */
.td-kpi-row--premium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.td-kpi-card {
    /*  background: var(--td-surface);*/
    border: 1px solid var(--td-border);
    /*    border-radius: var(--td-radius-md);*/
    padding: 7px 12px 11px;
    display: flex;
    flex-direction: column;
    /*    gap: 5px;*/
    box-shadow: var(--td-shadow-card);
    transition: transform 0.2s var(--td-ease), box-shadow 0.2s var(--td-ease);
    position: relative;
    overflow: hidden;
}

    .td-kpi-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        border-radius: var(--td-radius-md) var(--td-radius-md) 0 0;
        background: linear-gradient(90deg, var(--kpi-color, #F58220), var(--kpi-color2, #ffb347));
        opacity: 0.9;
    }

    .td-kpi-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(245,130,32,0.14), 0 2px 8px rgba(0,0,0,0.05);
    }

.td-kpi-card--prime {
    --kpi-color: #F58220;
    --kpi-color2: #ffb347;
}

.td-kpi-card--lending {
    --kpi-color: #56C4F8;
    --kpi-color2: #3FA9D9;
}

.td-kpi-card--median {
    --kpi-color: #0E0E11;
    --kpi-color2: #1A1A1F;
}

.td-kpi-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 1px;
}

    .td-kpi-icon-wrap svg {
        width: 15px;
        height: 15px;
        display: block;
    }

.td-kpi-card--prime .td-kpi-icon-wrap {
    background: rgba(245,130,32,0.12);
    color: var(--td-orange);
}

.td-kpi-card--lending .td-kpi-icon-wrap {
    background: rgba(86,196,248,0.12);
    color: var(--td-blue);
}

.td-kpi-card--median .td-kpi-icon-wrap {
    background: rgba(14,14,17,0.07);
    color: var(--td-charcoal);
}

.td-kpi-label {
    font-size: 0.59rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--td-muted-light);
}

.td-kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--td-charcoal);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.td-kpi-card--prime .td-kpi-value {
    color: var(--td-orange);
}

.td-kpi-card--lending .td-kpi-value {
    color: #3FA9D9;
}

.td-kpi-card--median .td-kpi-value {
    color: var(--td-charcoal);
}

.td-kpi-hint {
    font-size: 0.6rem;
    color: var(--td-muted-light);
    font-weight: 400;
    line-height: 1.3;
}

/* ════════════════════════════════════════════════════════════
   AI MARKET INSIGHTS — Card-based section
   ════════════════════════════════════════════════════════════ */
.td-insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
}

.td-section-label {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--td-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

    .td-section-label .td-svg-icon {
        color: var(--td-orange);
        width: 13px;
        height: 13px;
    }

        .td-section-label .td-svg-icon svg {
            width: 13px;
            height: 13px;
        }

/* Headline card */
.td-headline {
    background: var(--td-surface);
    border: 1.5px solid rgba(245,130,32,0.18);
    /*  border-left: 3px solid var(--td-orange);
    border-radius: var(--td-radius-md);*/
    padding: 11px 14px;
    font-size: 0.83rem;
    /*    font-weight: 500;*/
    color: #374151;
    /*   margin-bottom: 11px;
    line-height: 1.6;*/
    /*    font-style: italic;*/
    box-shadow: var(--td-shadow-sm);
    position: relative;
}

    .td-headline::before {
        content: '';
        position: absolute;
        top: -1px;
        left: -1px;
        right: -1px;
        height: 3px;
        background: linear-gradient(90deg, #F58220, transparent);
        border-radius: var(--td-radius-md) var(--td-radius-md) 0 0;
        pointer-events: none;
    }

/* Insight cards grid */
.td-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-bottom: 12px;
}

.td-insight-card {
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: var(--td-shadow-card);
    transition: transform 0.22s var(--td-ease), box-shadow 0.22s;
    cursor: default;
    overflow: hidden;
    position: relative;
}

    .td-insight-card::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--insight-color, rgba(245,130,32,0.3)), transparent);
        opacity: 0;
        transition: opacity 0.2s;
    }

    .td-insight-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    }

        .td-insight-card:hover::after {
            opacity: 1;
        }

.td-insight-icon-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-insight-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--insight-bg, rgba(245,130,32,0.10));
    color: var(--insight-color, var(--td-orange));
}

    .td-insight-icon svg {
        width: 14px;
        height: 14px;
        display: block;
    }

.td-insight-title {
    font-size: 0.73rem;
    font-weight: 800;
    color: var(--td-text);
    letter-spacing: -0.01em;
    flex: 1;
    min-width: 0;
}

.td-insight-text {
    font-size: 0.69rem;
    color: var(--td-muted);
    line-height: 1.55;
}

/* Buzzword spotlight */
.td-buzzword {
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-md);
    padding: 10px 14px;
    margin-bottom: 11px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    box-shadow: var(--td-shadow-sm);
}

.td-buzz-pill {
    background: linear-gradient(135deg, var(--td-orange), #ffb347);
    color: #fff;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.67rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(245,130,32,0.3);
}

.td-buzz-text {
    font-size: 0.74rem;
    color: #374151;
    line-height: 1.55;
}

/* ════════════════════════════════════════════════════════════
   CHARTS SECTION
   ════════════════════════════════════════════════════════════ */
.td-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--td-muted);
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 8px;
    border-left: 3px solid var(--td-orange);
}

    .td-section-title .td-svg-icon {
        color: var(--td-orange);
        width: 13px;
        height: 13px;
    }

        .td-section-title .td-svg-icon svg {
            width: 13px;
            height: 13px;
        }

.td-grid--v2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    margin-bottom: 12px;
}

.td-card--combined {
    grid-column: 1 / -1;
}

.td-card {
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-md);
    padding: 12px;
    box-shadow: var(--td-shadow-card);
}

.td-card-title {
    font-size: 0.59rem;
    font-weight: 700;
    color: var(--td-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .td-card-title .td-svg-icon {
        color: var(--td-orange);
        width: 12px;
        height: 12px;
    }

        .td-card-title .td-svg-icon svg {
            width: 12px;
            height: 12px;
        }

.td-chart-wrap {
    position: relative;
    height: 112px;
}

.td-chart-wrap-sm {
    height: 100px;
}

.td-chart-wrap-xs {
    position: relative;
    width: 100%;
    flex: 1;
}

    .td-chart-wrap-xs canvas {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
    }

.td-combined-charts {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    height: 132px;
}

.td-combined-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.td-combined-divider {
    width: 1px;
    background: #eef0f2;
    margin: 0 8px;
    align-self: stretch;
    flex-shrink: 0;
}

.td-chart-sublabel {
    font-size: 0.59rem;
    font-weight: 700;
    color: var(--td-muted-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    text-align: center;
}

/* ════════════════════════════════════════════════════════════
   HOT AREAS LIST
   ════════════════════════════════════════════════════════════ */
.td-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245,130,32,0.4) rgba(245,130,32,0.06);
}

    .td-list::-webkit-scrollbar {
        width: 3px;
    }

    .td-list::-webkit-scrollbar-track {
        background: rgba(245,130,32,0.05);
        border-radius: 4px;
    }

    .td-list::-webkit-scrollbar-thumb {
        background: rgba(245,130,32,0.4);
        border-radius: 4px;
    }

.td-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    background: var(--td-bg);
    border-radius: 7px;
    border: 1px solid rgba(0,0,0,0.04);
    font-size: 0.7rem;
    transition: background 0.15s;
}

    .td-list-item:hover {
        background: #fff;
    }

.td-list-item-name {
    flex: 1;
    font-weight: 600;
    color: var(--td-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-list-item-pct {
    font-weight: 700;
    font-size: 0.72rem;
    white-space: nowrap;
}

.td-signal-rising {
    color: #22c55e;
}

.td-signal-cooling {
    color: #ef4444;
}

.td-signal-undervalued {
    color: var(--td-orange);
}

.td-signal-badge {
    font-size: 0.56rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
}

    .td-signal-badge.rising {
        background: rgba(34,197,94,0.12);
        color: #16a34a;
    }

    .td-signal-badge.cooling {
        background: rgba(239,68,68,0.12);
        color: #dc2626;
    }

    .td-signal-badge.undervalued {
        background: rgba(245,130,32,0.12);
        color: #d97706;
    }

.td-badge-count {
    font-size: 0.56rem;
    font-weight: 700;
    background: var(--td-orange);
    color: #fff;
    padding: 1px 6px;
    border-radius: 20px;
    margin-left: 3px;
}

/* ════════════════════════════════════════════════════════════
   SECTOR CARDS
   ════════════════════════════════════════════════════════════ */
.td-sectors--v2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    margin-bottom: 12px;
}

@media (min-width: 600px) {
    .td-sectors--v2 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.td-sector-card--v2 {
    background: var(--td-surface);
    border-radius: var(--td-radius-md);
    padding: 12px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--td-shadow-card);
    border: 1px solid var(--td-border);
    transition: transform 0.2s var(--td-ease), box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

    .td-sector-card--v2::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--sector-color, var(--td-orange));
        border-radius: var(--td-radius-md) var(--td-radius-md) 0 0;
        opacity: 0.8;
    }

    .td-sector-card--v2:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(0,0,0,0.09);
    }

.td-sc-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

    .td-sc-icon svg {
        width: 40px;
        height: 40px;
        display: block;
    }

.td-sc-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.td-sc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: wrap;
}

.td-sc-name {
    font-size: 0.73rem;
    font-weight: 800;
    color: var(--td-text);
    letter-spacing: -0.01em;
}

.td-sc-badge {
    font-size: 0.56rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

    .td-sc-badge.rising {
        background: rgba(34,197,94,0.15);
        color: #16a34a;
    }

    .td-sc-badge.stable {
        background: rgba(86,196,248,0.15);
        color: #0284c7;
    }

    .td-sc-badge.cooling {
        background: rgba(239,68,68,0.12);
        color: #dc2626;
    }

.td-sc-outlook {
    font-size: 0.65rem;
    color: var(--td-muted);
    line-height: 1.45;
}

.td-sc-bar-wrap {
    height: 3px;
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 2px;
}

.td-sc-bar {
    height: 100%;
    background: var(--sector-color, var(--td-orange));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    opacity: 0.7;
}

/* ════════════════════════════════════════════════════════════
   SOURCES & DISCLAIMER
   ════════════════════════════════════════════════════════════ */
.td-sources {
    background: var(--td-surface);
    border: 1px solid var(--td-border);
    border-radius: var(--td-radius-md);
    padding: 10px 12px;
    margin-bottom: 9px;
    box-shadow: var(--td-shadow-sm);
}

.td-sources-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--td-muted);
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .td-sources-label .td-svg-icon {
        width: 11px;
        height: 11px;
        color: var(--td-orange);
    }

        .td-sources-label .td-svg-icon svg {
            width: 11px;
            height: 11px;
        }

.td-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.td-source-chip {
    font-size: 0.58rem;
    font-weight: 600;
    color: #0284c7;
    background: rgba(86,196,248,0.09);
    border: 1px solid rgba(86,196,248,0.22);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.td-disclaimer {
    font-size: 0.6rem;
    color: var(--td-muted-light);
    line-height: 1.55;
    padding-top: 7px;
    border-top: 1px solid var(--td-border);
    margin-top: 3px;
}

.td-ai-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(245,130,32,0.04);
    border: 1px solid rgba(245,130,32,0.12);
    border-radius: var(--td-radius-md);
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 0.67rem;
    color: var(--td-muted);
    line-height: 1.5;
}

.td-ai-disclaimer-icon {
    color: var(--td-orange);
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .td-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 11px 14px 9px;
    }

    .td-header-right {
        justify-content: flex-end;
    }

    .td-filter-row {
        gap: 5px;
    }

    .td-loc-input {
        width: 135px;
    }

    .td-kpi-row--premium {
        grid-template-columns: repeat(3, 1fr);
        gap: 7px;
    }

    .td-kpi-value {
        font-size: 1.15rem;
    }

    .td-insights-grid {
        grid-template-columns: 1fr;
    }

    .td-inner {
        max-height: 84vh;
    }
}

@media (max-width: 480px) {
    .td-body {
        padding: 10px 10px 13px;
    }

    .td-header {
        padding: 10px 12px 9px;
    }

    .td-kpi-row--premium {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .td-kpi-card {
        flex-direction: row;
        align-items: center;
        gap: 11px;
        padding: 10px 12px;
    }

        .td-kpi-card::before {
            top: 0;
            left: 0;
            right: auto;
            bottom: 0;
            width: 3px;
            height: auto;
            border-radius: var(--td-radius-md) 0 0 var(--td-radius-md);
        }

    .td-kpi-value {
        font-size: 1.25rem;
    }

    .td-grid--v2 {
        grid-template-columns: 1fr;
    }

    .td-card--combined {
        grid-column: 1;
    }

    .td-sectors--v2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .td-chart-wrap {
        height: 94px;
    }

    .td-chart-wrap-sm {
        height: 85px;
    }

    .td-inner {
        max-height: 90vh;
    }

    .td-loc-search-wrap {
        display: none !important;
    }

    .td-export-btn span {
        display: none;
    }

    .td-export-btn {
        padding: 5px 9px;
    }
}

@media (max-width: 360px) {
    .td-kpi-value {
        font-size: 1.1rem;
    }

    .td-title {
        font-size: 0.87rem;
    }
}

/* ════════════════════════════════════════════════════════════
   PDF EXPORT OVERLAY
   ════════════════════════════════════════════════════════════ */
.td-pdf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14,14,17,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: td-overlay-in 0.25s ease both;
}

@keyframes td-overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.td-pdf-modal {
    background: var(--td-surface);
    border-radius: var(--td-radius-lg);
    padding: 26px 30px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 8px 24px rgba(0,0,0,0.12);
    max-width: 340px;
    width: 90%;
    text-align: center;
    animation: td-modal-in 0.35s var(--td-ease-bounce) both;
}

@keyframes td-modal-in {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(16px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.td-pdf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(245,130,32,0.15);
    border-top-color: var(--td-orange);
    border-radius: 50%;
    animation: td-spin 0.75s linear infinite;
    margin: 0 auto 14px;
}

.td-pdf-modal h3 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--td-text);
    margin: 0 0 5px;
}

.td-pdf-modal p {
    font-size: 0.72rem;
    color: var(--td-muted);
    margin: 0;
    line-height: 1.5;
}
