/* BUILD_STAMP_20260815_1325_PRODUCTION_NEW */
/* styles.css - Clean Light Premium Dashboard */

:root {
    /* Color Palette - Premium Light Mode */
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #64748b;
    
    --accent-blue: #2563eb;
    --accent-cyan: #0284c7;
    --accent-purple: #7c3aed;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-amber: #d97706;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* App Container Layout - Full Width Without Sidebar */
.app-container {
    display: block;
    width: 100%;
    min-height: 100vh;
    background-color: #f8fafc;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.header-title .subtitle {
    font-size: 14px;
    color: #475569;
    margin-top: 4px;
}

/* Glass Panels (White Light Cards) */
.glass-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: #0f172a;
}

/* Grouped Temporal Controls Bar */
.temporal-selector-group {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: var(--shadow-sm);
    color: #0f172a !important;
}

.period-pill {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.period-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.period-pill.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    font-weight: 600;
}

.period-pill:disabled, .period-pill.disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

/* KPI Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    margin: 12px 0 6px 0;
    letter-spacing: -0.5px;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}

/* AI Insights Card */
.insight-card {
    padding: 20px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.insight-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #0369a1;
}

.insight-text {
    color: #1e293b;
    font-size: 14px;
    font-weight: 500;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-cyan {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-secondary {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

select, input[type="text"], input[type="date"] {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
}

select:focus, input:focus {
    outline: none;
    border-color: #2563eb !important;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    padding: 20px;
    background: #ffffff;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

/* Filter Card Drawer */
.filters-card {
    padding: 20px;
    background: #ffffff;
}

.filters-header {
    margin-bottom: 16px;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #0f172a;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

/* Tables */
.table-card {
    padding: 20px;
    background: #ffffff;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.table-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    color: #475569;
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge-model {
    background: #f1f5f9;
    color: #1e293b;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.text-green { color: #16a34a !important; }
.text-red { color: #dc2626 !important; }
.text-cyan { color: #0284c7 !important; }
.text-purple { color: #7c3aed !important; }
.text-muted { color: #64748b !important; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .main-content { padding: 16px; }
}

/* Loading Indicator & Clock Spinner */
.global-loading-indicator {
    position: fixed;
    top: 22px;
    right: 26px;
    z-index: 99999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #0f172a;
    color: #ffffff;
    padding: 9px 18px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.95);
}

.global-loading-indicator.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.spinner-clock-ring {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spinClock 0.7s linear infinite;
}

@keyframes spinClock {
    to { transform: rotate(360deg); }
}

.content-loading {
    opacity: 0.55 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease !important;
}

/* In-Chart Loading Overlays */
.chart-container {
    position: relative;
}

.chart-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 20;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.chart-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.chart-spinner-ring {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spinClock 0.7s linear infinite;
}

.chart-loading-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.2px;
}

/* Brand Deep Dive & Comparator Modal */
.brand-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.brand-modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 980px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.brand-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.brand-modal-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-modal-badge {
    background: #2563eb;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-modal-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.brand-modal-info span {
    font-size: 12px;
    color: #64748b;
}

.brand-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comparator-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 8px;
    transition: border-color 0.15s ease;
}

.comparator-select-wrapper:hover {
    border-color: #94a3b8;
}

.comparator-select-wrapper select {
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    cursor: pointer;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Brand Modal KPI Strip */
.brand-modal-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.brand-kpi-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.brand-kpi-item .kpi-lbl {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.brand-kpi-item .kpi-val {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2px;
}

.brand-kpi-item .kpi-sub {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
}

/* Brand Modal Tabs */
.brand-modal-tabs {
    display: flex;
    gap: 6px;
    padding: 0 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.brand-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.brand-tab-btn:hover {
    color: #0f172a;
}

.brand-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #ffffff;
}

/* Brand Modal Body & Chart Container */
.brand-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 55vh;
    background: #ffffff;
}

.brand-tab-pane {
    width: 100%;
}

.modal-chart-container {
    position: relative;
    width: 100%;
    min-height: 320px;
}

