/**
 * PREMIUM VISUALIZATION STYLES - 2024/2025 Design Trends
 * Inspired by: Tableau, PowerBI, Notion, Linear, Vercel
 * Color Palette: Modern, Accessible, Professional
 */

:root {
    /* Modern Color Palette - Based on 2024/2025 trends */
    --color-primary: #6366f1;        /* Indigo */
    --color-primary-light: #818cf8;
    --color-primary-dark: #4f46e5;
    
    --color-secondary: #8b5cf6;      /* Purple */
    --color-accent: #06b6d4;         /* Cyan */
    --color-success: #10b981;        /* Emerald */
    --color-warning: #f59e0b;        /* Amber */
    --color-danger: #ef4444;         /* Red */
    
    /* Neutrals - Warm tones */
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #0f172a;
    --color-text-secondary: #64748b;
    
    /* Chart Colors - Accessible palette */
    --chart-1: #6366f1;  /* Indigo */
    --chart-2: #8b5cf6;  /* Purple */
    --chart-3: #06b6d4;  /* Cyan */
    --chart-4: #10b981;  /* Emerald */
    --chart-5: #f59e0b;  /* Amber */
    --chart-6: #ef4444;  /* Red */
    --chart-7: #ec4899;  /* Pink */
    --chart-8: #14b8a6;  /* Teal */
}

/* ============================================
   DASHBOARD CONTAINER - MODERN GRID
============================================ */

.visualization-dashboard {
    margin-top: 2rem;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.viz-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
}

/* ============================================
   FILTER PANEL - PREMIUM PROFESSIONAL DESIGN
============================================ */

.viz-filter-panel {
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    animation: slideInLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    width: 320px;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Collapsed state */
.viz-filter-panel.collapsed {
    width: 60px;
}

.viz-filter-panel.collapsed .filter-content {
    display: none;
}

/* Sidebar layout container */
.viz-dashboard-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
}

/* Main visualization area */
.viz-dashboard-main {
    flex: 1;
    min-width: 0; /* Allow flex shrinking */
    width: 100%;
}

/* Ensure viz-dashboard inside main takes full width */
.viz-dashboard-main .viz-dashboard {
    width: 100%;
    max-width: 100%;
}

/* Responsive: Stack filters on small screens */
@media (max-width: 1024px) {
    .viz-dashboard-wrapper {
        flex-direction: column;
    }
    
    .viz-filter-panel {
        width: 100%;
        position: relative;
        max-height: none;
    }
    
    .viz-filter-panel.collapsed {
        width: 100%;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.viz-filter-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradientSlide 3s ease infinite;
}

@keyframes gradientSlide {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 0%; }
}

.filter-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    position: relative;
}

.filter-header:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.06) 100%);
}

.filter-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-header:hover::after {
    width: 100%;
}

.filter-header i:first-child {
    color: var(--color-primary);
    font-size: 1.125rem;
}

.filter-header span {
    flex: 1;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.filter-toggle {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-content {
    padding: 1.75rem;
    background: var(--color-surface);
}

/* Quick Actions Bar */
/* ============================================
   FILTER CUSTOMIZATION SECTION - NEW!
============================================ */

.filter-customization-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(139, 92, 246, 0.03));
    border-radius: 14px;
    border: 1.5px solid rgba(99, 102, 241, 0.1);
}

.customization-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.customization-header i {
    font-size: 1.125rem;
}

.filter-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.quick-filter-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1.5px solid rgba(99, 102, 241, 0.15);
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-filter-btn:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.quick-filter-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Sort Direction Buttons */
.sort-direction-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.sort-btn {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sort-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.sort-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.sort-btn i {
    font-size: 0.9375rem;
}

/* Filter Control Selects */
.filter-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236366f1' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.filter-control:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.filter-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Filter Divider */
.filter-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border), transparent);
    margin: 1.5rem 0;
}

.quick-filter-btn i {
    font-size: 0.875rem;
}

.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fafbfc 0%, #ffffff 100%);
    border-radius: 14px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.filter-group:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.filter-header-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.filter-count {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    background: rgba(99, 102, 241, 0.08);
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-weight: 600;
}

.filter-stats {
    font-size: 0.6875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label i {
    color: var(--color-primary);
    font-size: 0.875rem;
}

/* Search Box */
.filter-search-box {
    position: relative;
    margin-bottom: 0.5rem;
}

.filter-search-box i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.filter-search {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.8125rem;
    transition: all 0.2s;
    background: var(--color-surface);
}

.filter-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

/* Select Dropdown */
.filter-select {
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.8125rem;
    transition: all 0.2s;
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 500;
    min-height: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.filter-select option {
    padding: 0.5rem;
    border-radius: 6px;
}

/* Select All Button */
.select-all-btn {
    padding: 0.5rem 0.875rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    justify-content: center;
}

.select-all-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--color-primary);
}

/* Range Input Group */
.filter-range-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-range-input-wrapper {
    flex: 1;
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
}

.filter-range-input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-weight: 500;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.filter-range-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.range-separator {
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

/* Preset Buttons */
.filter-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 0.875rem;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.preset-btn:active {
    transform: scale(0.98);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.btn-filter-apply,
.btn-filter-reset {
    min-height: 30px;
    padding: 0.4375rem 0.8125rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    letter-spacing: -0.01em;
}

.btn-filter-apply {
    background: var(--color-primary);
    color: white;
    flex: 1;
    box-shadow: none;
}

.btn-filter-apply:hover {
    background: var(--color-primary-dark);
    transform: none;
    box-shadow: none;
    filter: brightness(1.05);
}

.btn-filter-apply:active {
    transform: scale(0.98);
}

.btn-filter-reset {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-filter-reset:hover {
    background: var(--color-bg);
    border-color: var(--color-text-secondary);
    color: var(--color-text);
}

/* ============================================
   KPI CARDS - MODERN MINIMAL DESIGN
============================================ */

.kpi-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 4px 8px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
}

/* KPI Variations with accent colors */
.kpi-card:nth-child(1) {
    border-top: 3px solid var(--chart-1);
}

.kpi-card:nth-child(2) {
    border-top: 3px solid var(--chart-2);
}

.kpi-card:nth-child(3) {
    border-top: 3px solid var(--chart-3);
}

.kpi-card:nth-child(4) {
    border-top: 3px solid var(--chart-4);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.kpi-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #6366f1;
}

.kpi-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kpi-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.kpi-static-value {
    font-family: var(--font-sans);
    font-weight: 700;
}

.kpi-unit {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.kpi-change {
    font-size: 0.8125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border-radius: 8px;
    width: fit-content;
}

.kpi-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.kpi-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* ============================================
   PANELS - CLEAN PROFESSIONAL DESIGN
============================================ */

.viz-panel {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
}

.viz-panel:hover {
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.15);
}

.panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
    position: relative;
}

.panel-header::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width 0.3s ease;
}

.viz-panel:hover .panel-header::after {
    width: 120px;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    letter-spacing: -0.01em;
}

.panel-header i {
    color: var(--color-primary);
    font-size: 1.125rem;
}

.panel-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-left: auto;
    padding: 0.25rem 0.625rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 6px;
}

.chart-container {
    position: relative;
    min-height: 320px;
    max-height: 450px;
}

.chart-container.chart-tall {
    min-height: 400px;
    max-height: 550px;
}

/* ============================================
   DATA TABLE - MODERN MINIMAL DESIGN
============================================ */

.data-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--color-border);
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: all 0.2s;
    animation: fadeInRow 0.4s ease-out both;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.03) 0%, transparent 100%);
}

.data-table td {
    padding: 1rem 1.25rem;
    color: var(--color-text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

/* ============================================
   ANIMATIONS - SMOOTH & PROFESSIONAL
============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* ============================================
   EXPORT BUTTON - MODERN STYLE
============================================ */

.btn-export {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    min-height: 30px;
    padding: 0.4375rem 0.8125rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
}

.btn-export:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: none;
    box-shadow: none;
}

/* ============================================
   GRID LAYOUTS - RESPONSIVE
============================================ */

.viz-row {
    display: grid;
    gap: 1.25rem;
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

.kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    width: 100%;
}

.main-row {
    grid-template-columns: 1.5fr 1fr;
    width: 100%;
}

.viz-full {
    grid-column: 1 / -1; /* Span all columns */
    width: 100%;
}

.bottom-row {
    grid-template-columns: 1fr 1fr 1fr; /* 3 columns for Analysis layout */
    width: 100%;
}

/* 2-column bottom row for other layouts */
.comparison-dashboard .bottom-row,
.geographic-dashboard .bottom-row {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 1400px) {
    .bottom-row {
        grid-template-columns: 1fr 1fr; /* 2 columns on medium screens */
    }
}

@media (max-width: 1024px) {
    .main-row,
    .bottom-row {
        grid-template-columns: 1fr; /* 1 column on small screens */
    }
}

/* ============================================
   DARK MODE SUPPORT - Enhanced
============================================ */

[data-theme="dark"] {
    --color-bg: #101010;
    --color-surface: #1c1c1c;
    --color-border: #334155;
    --color-text: #f1f5f9;
    --color-text-secondary: #94a3b8;
    
    /* Enhanced Chart Colors for Dark Mode */
    --chart-1: #60a5fa;  /* Light Blue */
    --chart-2: #a78bfa;  /* Light Purple */
    --chart-3: #34d399;  /* Light Emerald */
    --chart-4: #fbbf24;  /* Light Amber */
    --chart-5: #f87171;  /* Light Red */
    --chart-6: #fb7185;  /* Light Pink */
    --chart-7: #22d3ee;  /* Light Cyan */
    --chart-8: #4ade80;  /* Light Green */
}

[data-theme="dark"] .viz-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .viz-panel:hover {
    border-color: rgba(44, 143, 234, 0.3);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(44, 143, 234, 0.2),
        0 0 20px rgba(44, 143, 234, 0.1);
}

[data-theme="dark"] .filter-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(44, 143, 234, 0.2);
}

[data-theme="dark"] .data-table thead {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .kpi-card {
    background: linear-gradient(135deg, var(--color-surface) 0%, #1e293b 100%);
    border: 1px solid var(--color-border);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .kpi-card:hover {
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(44, 143, 234, 0.2);
    border-color: rgba(44, 143, 234, 0.4);
}

[data-theme="dark"] .filter-control,
[data-theme="dark"] .filter-search,
[data-theme="dark"] .filter-range-input {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .filter-control:focus,
[data-theme="dark"] .filter-search:focus,
[data-theme="dark"] .filter-range-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 143, 234, 0.2);
}

[data-theme="dark"] .quick-filter-btn {
    background: rgba(44, 143, 234, 0.1);
    border-color: rgba(44, 143, 234, 0.3);
    color: var(--color-text);
}

[data-theme="dark"] .quick-filter-btn:hover {
    background: rgba(44, 143, 234, 0.2);
    border-color: rgba(44, 143, 234, 0.5);
}

[data-theme="dark"] .quick-filter-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(44, 143, 234, 0.4);
}

/* Enhanced Chart Colors for Dark Mode */
[data-theme="dark"] canvas {
    filter: brightness(1.1) contrast(1.05);
}

[data-theme="dark"] .chartjs-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(44, 143, 234, 0.3) !important;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(44, 143, 234, 0.2) !important;
}

/* Enhanced Data Table for Dark Mode */
[data-theme="dark"] .data-table tbody tr {
    transition: all 0.2s ease;
}

[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(44, 143, 234, 0.1) !important;
    transform: translateX(2px);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

/* Enhanced KPI Cards with Gradient Borders */
[data-theme="dark"] .kpi-card {
    position: relative;
}

[data-theme="dark"] .kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--chart-1), var(--chart-2), var(--chart-3));
    opacity: 0.8;
    transition: opacity 0.3s;
}

[data-theme="dark"] .kpi-card:hover::before {
    opacity: 1;
    box-shadow: 0 0 15px rgba(44, 143, 234, 0.5);
}

/* Enhanced Filter Panel */
[data-theme="dark"] .viz-filter-panel {
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .filter-header {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Enhanced Export Button */
[data-theme="dark"] .btn-export {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .btn-export:hover {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    box-shadow: 0 4px 16px rgba(44, 143, 234, 0.5);
    transform: translateY(-2px);
}

/* ============================================
   LOADING STATES - SKELETON SCREENS
============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Dark Mode Skeleton */
[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 0%,
        var(--gray-300) 50%,
        var(--gray-200) 100%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        background-position: -200% 0;
        opacity: 0.6;
    }
}

/* ============================================
   CHART ENHANCEMENTS
============================================ */

canvas {
    max-height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.04));
}

/* Tooltip styling */
.chartjs-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ============================================
   RESPONSIVE DESIGN
============================================ */

@media (max-width: 768px) {
    .viz-panel {
        padding: 1.25rem;
    }
    
    .kpi-card {
        padding: 1.25rem;
    }
    
    .filter-controls {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        min-height: 250px;
    }
}

/* ============================================
   PRINT STYLES
============================================ */

@media print {
    .btn-export,
    .viz-filter-panel {
        display: none;
    }
    
    .viz-panel {
        break-inside: avoid;
        box-shadow: none;
    }
}

