/**
 * ============================================
 * TELETEXT PERFORMANCE INSIGHTS
 * CSS Custom Properties (Variables)
 * ============================================
 * 
 * Design System Variables
 * Inspired by Datadog, Grafana, New Relic
 */

:root {
    /* ========================================
       COLOR PALETTE
       ======================================== */
    
    /* Primary Brand Colors */
    --color-primary: #2f7bff;
    --color-primary-light: #69a7ff;
    --color-primary-dark: #1b56c8;
    --color-primary-alpha: rgba(47, 123, 255, 0.16);
    
    /* Secondary / Accent */
    --color-secondary: #0ea5b7;
    --color-accent: #f5b942;
    
    /* Background Colors */
    --color-bg-primary: #091222;
    --color-bg-secondary: #101d31;
    --color-bg-tertiary: #172b47;
    --color-bg-elevated: #13243c;
    
    /* Surface Colors */
    --color-surface: #13243c;
    --color-surface-hover: rgba(255, 255, 255, 0.07);
    --color-surface-active: rgba(255, 255, 255, 0.11);
    
    /* Border Colors */
    --color-border: rgba(132, 173, 240, 0.2);
    --color-border-hover: rgba(176, 208, 255, 0.45);
    --color-border-focus: var(--color-primary);
    
    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #d7e5ff;
    --color-text-muted: #9bb1d6;
    --color-text-disabled: #6f86ad;
    
    /* Semantic Colors */
    --color-success: #22c55e;
    --color-success-bg: rgba(34, 197, 94, 0.15);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.15);
    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.15);
    --color-info: #3b82f6;
    --color-info-bg: rgba(59, 130, 246, 0.15);
    
    /* CWV Status Colors */
    --color-cwv-good: #22c55e;
    --color-cwv-needs-improvement: #f59e0b;
    --color-cwv-poor: #ef4444;
    
    /* Chart Colors */
    --chart-color-1: #2f7bff;
    --chart-color-2: #0ea5b7;
    --chart-color-3: #22c55e;
    --chart-color-4: #f59e0b;
    --chart-color-5: #ef4444;
    --chart-color-6: #8b5cf6;
    --chart-color-7: #06b6d4;
    --chart-color-8: #f97316;
    --chart-color-9: #ec4899;
    --chart-color-10: #84cc16;
    
    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, #1f66e5 0%, #2f7bff 40%, #6ea8ff 100%);
    --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-info: linear-gradient(135deg, #3b82f6, #2563eb);
    
    /* ========================================
       TYPOGRAPHY
       ======================================== */
    
    --font-family-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Courier New', monospace;
    
    /* Font Sizes */
    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */
    
    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* ========================================
       SPACING
       ======================================== */
    
    --spacing-1: 0.25rem;   /* 4px */
    --spacing-2: 0.5rem;    /* 8px */
    --spacing-3: 0.75rem;   /* 12px */
    --spacing-4: 1rem;      /* 16px */
    --spacing-5: 1.25rem;   /* 20px */
    --spacing-6: 1.5rem;    /* 24px */
    --spacing-8: 2rem;      /* 32px */
    --spacing-10: 2.5rem;   /* 40px */
    --spacing-12: 3rem;     /* 48px */
    
    /* ========================================
       BORDERS & RADIUS
       ======================================== */
    
    --border-width: 1px;
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-full: 9999px;
    
    /* ========================================
       SHADOWS
       ======================================== */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow-primary: 0 0 24px rgba(47, 123, 255, 0.34);
    --shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.3);
    --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.3);
    
    /* ========================================
       TRANSITIONS
       ======================================== */
    
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;
    
    /* ========================================
       Z-INDEX SCALE
       ======================================== */
    
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-toast: 800;
    
    /* ========================================
       LAYOUT
       ======================================== */
    
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
    --drawer-width: 480px;
    
    /* ========================================
       BREAKPOINTS (for reference)
       ======================================== */
    
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* ============================================
   THEME DEFINITIONS
   ============================================ */

/* Dark Theme (Default) */
[data-theme="dark"],
.dark {
    color-scheme: dark;
    
    --color-bg-primary: #091222;
    --color-bg-secondary: #101d31;
    --color-bg-tertiary: #172b47;
    --color-bg-elevated: #13243c;
    
    --color-surface: #13243c;
    --color-surface-hover: rgba(255, 255, 255, 0.07);
    --color-surface-active: rgba(255, 255, 255, 0.11);
    
    --color-border: rgba(132, 173, 240, 0.2);
    --color-border-hover: rgba(176, 208, 255, 0.45);
    
    --color-text-primary: #ffffff;
    --color-text-secondary: #d7e5ff;
    --color-text-muted: #9bb1d6;
    --color-text-disabled: #6f86ad;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
[data-theme="light"] {
    color-scheme: light;
    
    --color-bg-primary: #f3f6fb;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #e8eef8;
    --color-bg-elevated: #ffffff;
    
    --color-surface: #ffffff;
    --color-surface-hover: rgba(24, 67, 131, 0.06);
    --color-surface-active: rgba(24, 67, 131, 0.1);
    
    --color-border: rgba(24, 67, 131, 0.16);
    --color-border-hover: rgba(24, 67, 131, 0.28);
    
    --color-text-primary: #101c33;
    --color-text-secondary: #2f436b;
    --color-text-muted: #546a92;
    --color-text-disabled: #7b92ba;
    
    --shadow-sm: 0 1px 2px 0 rgba(12, 39, 86, 0.08);
    --shadow-md: 0 8px 16px -8px rgba(12, 39, 86, 0.2);
    --shadow-lg: 0 20px 35px -20px rgba(12, 39, 86, 0.28);
}

/* Light theme specific overrides */
[data-theme="light"] .sidebar {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav-item {
    color: #64748b;
}

[data-theme="light"] .nav-item:hover {
    background-color: rgba(47, 123, 255, 0.09);
    color: #0f172a;
}

[data-theme="light"] .nav-item.active {
    background: var(--gradient-primary);
    color: white;
}

[data-theme="light"] .card {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card-header {
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table th {
    background-color: #f1f5f9;
    color: #475569;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table td {
    border-color: rgba(0, 0, 0, 0.06);
    color: #334155;
}

[data-theme="light"] .data-table tr:hover {
    background-color: rgba(47, 123, 255, 0.05);
}

[data-theme="light"] header {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chart-container canvas {
    filter: none;
}

[data-theme="light"] input,
[data-theme="light"] select {
    background-color: #f8fafc;
    border-color: rgba(0, 0, 0, 0.15);
    color: #0f172a;
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus {
    border-color: var(--color-primary);
    background-color: #ffffff;
}

[data-theme="light"] .skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
}

[data-theme="light"] .pill {
    background-color: rgba(0, 0, 0, 0.06);
    color: #475569;
}

[data-theme="light"] .text-white {
    color: #0f172a;
}

[data-theme="light"] .text-slate-400,
[data-theme="light"] .text-muted {
    color: #64748b;
}

[data-theme="light"] .text-slate-300 {
    color: #475569;
}

[data-theme="light"] .text-slate-500 {
    color: #94a3b8;
}

[data-theme="light"] .bg-surface,
[data-theme="light"] .bg-surface-dark {
    background-color: #f8fafc;
}

[data-theme="light"] .border-white\/\[0\.08\] {
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .bg-white\/\[0\.03\],
[data-theme="light"] .bg-white\/\[0\.05\] {
    background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sec-divider {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

[data-theme="light"] .sec-divider span {
    background-color: #f8fafc;
}

/* Conversion Analytics light mode readability */
[data-theme="light"] #section-conversion .bg-slate-900\/50 {
    background-color: rgba(248, 251, 255, 0.96);
}

[data-theme="light"] #section-conversion .bg-slate-900\/60 {
    background-color: rgba(245, 249, 255, 0.96);
}

[data-theme="light"] #section-conversion .bg-slate-800\/70 {
    background-color: rgba(241, 246, 255, 0.97);
}

[data-theme="light"] #section-conversion .bg-cyan-500\/10 {
    background-color: rgba(8, 145, 178, 0.12);
}

[data-theme="light"] #section-conversion .bg-green-500\/10 {
    background-color: rgba(22, 163, 74, 0.12);
}

[data-theme="light"] #section-conversion .bg-amber-500\/10 {
    background-color: rgba(217, 119, 6, 0.13);
}

[data-theme="light"] #section-conversion .bg-blue-500\/10 {
    background-color: rgba(37, 99, 235, 0.11);
}

[data-theme="light"] #section-conversion .border-cyan-500\/20 {
    border-color: rgba(14, 116, 144, 0.26);
}

[data-theme="light"] #section-conversion .border-cyan-500\/30 {
    border-color: rgba(14, 116, 144, 0.34);
}

[data-theme="light"] #section-conversion .border-green-500\/30 {
    border-color: rgba(21, 128, 61, 0.32);
}

[data-theme="light"] #section-conversion .border-amber-500\/30 {
    border-color: rgba(180, 83, 9, 0.32);
}

[data-theme="light"] #section-conversion .border-blue-500\/20 {
    border-color: rgba(29, 78, 216, 0.25);
}

[data-theme="light"] #section-conversion .border-blue-500\/30 {
    border-color: rgba(29, 78, 216, 0.34);
}

[data-theme="light"] #section-conversion .border-slate-500\/30 {
    border-color: rgba(71, 85, 105, 0.24);
}

[data-theme="light"] #section-conversion .text-cyan-300 {
    color: #0e7490;
}

[data-theme="light"] #section-conversion .text-cyan-200 {
    color: #0f6d86;
}

[data-theme="light"] #section-conversion .text-cyan-100 {
    color: #155e75;
}

[data-theme="light"] #section-conversion .text-green-400 {
    color: #15803d;
}

[data-theme="light"] #section-conversion .text-green-200 {
    color: #166534;
}

[data-theme="light"] #section-conversion .text-green-100 {
    color: #14532d;
}

[data-theme="light"] #section-conversion .text-amber-400 {
    color: #b45309;
}

[data-theme="light"] #section-conversion .text-amber-200 {
    color: #92400e;
}

[data-theme="light"] #section-conversion .text-amber-100 {
    color: #78350f;
}

[data-theme="light"] #section-conversion .text-blue-300 {
    color: #1d4ed8;
}

[data-theme="light"] #section-conversion .text-blue-200 {
    color: #1e40af;
}

[data-theme="light"] #section-conversion .text-slate-500 {
    color: #64748b;
}

[data-theme="light"] #section-conversion .text-slate-400 {
    color: #58677f;
}

[data-theme="light"] #section-conversion .text-slate-300 {
    color: #475569;
}

[data-theme="light"] #section-conversion .text-slate-200 {
    color: #334155;
}

[data-theme="light"] #section-conversion .text-slate-100 {
    color: #1e293b;
}

/* Theme selector styling for light mode */
[data-theme="light"] #theme-selector {
    background-color: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.15);
    color: #334155;
}

[data-theme="light"] #theme-selector:hover {
    background-color: #e2e8f0;
}

/* Smooth theme transition */
body,
.sidebar,
.card,
header,
input,
select {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
