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

:root {
    /* ========================================
       COLOR PALETTE
       ======================================== */
    
    /* Primary Brand Colors */
    --color-primary: #5b2d8e;
    --color-primary-light: #7040aa;
    --color-primary-dark: #4a2473;
    --color-primary-alpha: rgba(91, 45, 142, 0.15);
    
    /* Secondary / Accent */
    --color-secondary: #7040aa;
    --color-accent: #9333ea;
    
    /* Background Colors */
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-bg-elevated: #1e293b;
    
    /* Surface Colors */
    --color-surface: #1e293b;
    --color-surface-hover: rgba(255, 255, 255, 0.05);
    --color-surface-active: rgba(255, 255, 255, 0.08);
    
    /* Border Colors */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    --color-border-focus: var(--color-primary);
    
    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-disabled: #64748b;
    
    /* 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: #5b2d8e;
    --chart-color-2: #7040aa;
    --chart-color-3: #3b82f6;
    --chart-color-4: #22c55e;
    --chart-color-5: #f59e0b;
    --chart-color-6: #ef4444;
    --chart-color-7: #8b5cf6;
    --chart-color-8: #06b6d4;
    --chart-color-9: #ec4899;
    --chart-color-10: #14b8a6;
    
    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    --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: 'Inter', -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 20px rgba(91, 45, 142, 0.3);
    --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: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-bg-elevated: #1e293b;
    
    --color-surface: #1e293b;
    --color-surface-hover: rgba(255, 255, 255, 0.05);
    --color-surface-active: rgba(255, 255, 255, 0.08);
    
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    
    --color-text-primary: #ffffff;
    --color-text-secondary: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-disabled: #64748b;
    
    --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: #f8fafc;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #e2e8f0;
    --color-bg-elevated: #ffffff;
    
    --color-surface: #ffffff;
    --color-surface-hover: rgba(0, 0, 0, 0.04);
    --color-surface-active: rgba(0, 0, 0, 0.08);
    
    --color-border: rgba(0, 0, 0, 0.1);
    --color-border-hover: rgba(0, 0, 0, 0.2);
    
    --color-text-primary: #0f172a;
    --color-text-secondary: #334155;
    --color-text-muted: #64748b;
    --color-text-disabled: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* 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(91, 45, 142, 0.08);
    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(91, 45, 142, 0.04);
}

[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;
}

/* 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;
}
