/* ==========================================================================
   THEMES & MEDIA QUERIES
   ========================================================================== */

/* Explicit Light Theme */
body, body.light-theme {
    --bg-main: #f1f5f9;
    --card-bg: #ffffff;
    --card-bg-subtle: #f8fafc;
    --border-color: #cbd5e1;
    --border-subtle: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-text: #0f172a;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f1f5f9;
    color-scheme: light;
}

/* Dark Theme Overrides */
body.dark-theme {
    --bg-main: #0b0f19;
    --card-bg: #111827;
    --card-bg-subtle: #1f2937;
    --border-color: #374151;
    --border-subtle: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --input-bg: #1f2937;
    --input-border: #374151;
    --input-text: #f8fafc;
    --dropdown-bg: #1f2937;
    --dropdown-hover: #374151;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}

/* Light Mode Overrides */
body:not(.dark-theme) .dropdown-caret,
body:not(.dark-theme) .combo-arrow-icon {
    color: #475569 !important;
}

body:not(.dark-theme) .combo-dropdown-panel,
body:not(.dark-theme) .combo-dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body:not(.dark-theme) .filter-btn:not(.active) {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

body:not(.dark-theme) .multi-period-btn,
body:not(.dark-theme) .multi-period-btn .btn-text-truncate,
body:not(.dark-theme) .multi-period-btn .btn-text-container {
    color: #0f172a !important;
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
}

body:not(.dark-theme) select,
body:not(.dark-theme) select option,
body:not(.dark-theme) .combo-search-input,
body:not(.dark-theme) .combo-select-btn,
body:not(.dark-theme) #scopeCountrySelect,
body:not(.dark-theme) #scopePackageSelect,
body:not(.dark-theme) #compA_Country,
body:not(.dark-theme) #compA_Package,
body:not(.dark-theme) #compB_Country,
body:not(.dark-theme) #compB_Package {
    color: #0f172a !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 500 !important;
    opacity: 1 !important;
}

/* Dark Mode Overrides */
body.dark-theme select,
body.dark-theme select option,
body.dark-theme .combo-search-input,
body.dark-theme .combo-select-btn,
body.dark-theme .multi-period-btn,
body.dark-theme #scopeCountrySelect,
body.dark-theme #scopePackageSelect,
body.dark-theme #compA_Country,
body.dark-theme #compA_Package,
body.dark-theme #compB_Country,
body.dark-theme #compB_Package {
    color: #f8fafc !important;
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    font-weight: 500 !important;
    opacity: 1 !important;
}

body.dark-theme .dropdown-caret,
body.dark-theme .combo-arrow-icon {
    color: #cbd5e1 !important;
}

body.dark-theme .filter-btn:not(.active) {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border: 1px solid #334155 !important;
}

body.dark-theme .filter-btn.active {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

body.dark-theme .combo-dropdown-panel,
body.dark-theme .combo-dropdown-menu {
    background-color: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.dark-theme .multi-period-option {
    color: #f8fafc !important;
}

body.dark-theme .btn-theme-toggle,
body.dark-theme .btn-reset,
body.dark-theme .btn-reload-data,
body.dark-theme .btn-secondary {
    color: var(--text-primary) !important;
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
}

body.dark-theme .btn-theme-toggle:hover,
body.dark-theme .btn-reset:hover,
body.dark-theme .btn-reload-data:hover,
body.dark-theme .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: #ffffff !important;
}

body.dark-theme canvas {
    color: #f8fafc !important;
}

/* ==========================================================================
   BREAKPOINT MEDIA QUERIES
   ========================================================================== */

/* Medium Laptops & Small Desktops */
@media screen and (max-width: 1200px) {
    .comp-card {
        flex: 1 1 calc(50% - 8px) !important;
    }
}

@media screen and (max-width: 1100px) {
    .gsc-dual-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .gsc-row-4col > div,
    .gsc-row-4col > .metric-card {
        flex: 1 1 calc(25% - 8px) !important;
        max-width: calc(25% - 8px) !important;
    }

    .gsc-row-3col > div,
    .gsc-row-3col > .metric-card {
        flex: 1 1 calc(33.333% - 7px) !important;
        max-width: calc(33.333% - 7px) !important;
    }
}

@media screen and (max-width: 900px) {
    .scope-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .gsc-chart-card {
        height: 240px !important;
    }

    .gsc-row-4col > div,
    .gsc-row-4col > .metric-card,
    .gsc-row-3col > div,
    .gsc-row-3col > .metric-card {
        flex: 1 1 calc(50% - 6px) !important;
        max-width: calc(50% - 6px) !important;
    }

    .gsc-equal-card-row .metric-card {
        min-height: 75px !important;
    }
}

/* Mobile Devices */
@media screen and (max-width: 640px) {
    .comp-card {
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }
}

@media screen and (max-width: 600px) {
    .scope-bar {
        grid-template-columns: 1fr;
    }
    
    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media screen and (max-width: 480px) {
    .gsc-chart-card {
        height: 200px !important;
    }

    .gsc-row-4col > div,
    .gsc-row-4col > .metric-card,
    .gsc-row-3col > div,
    .gsc-row-3col > .metric-card {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}