/**
 * Chzzk Metrics Dashboard - Modern Design System v8.0
 * 🎨 Premium Glassmorphism Dashboard Design
 * Inspired by: Black Dashboard, Tremor, Shadcn UI
 * 
 * Features:
 * - Advanced Glass morphism with blur effects
 * - Sophisticated gradient accents
 * - Elevated card system with glow effects
 * - Premium typography and spacing
 * - Smooth animations and micro-interactions
 * - Full dark/light theme support
 */

/* ============================================
   1. CSS Variables - Design Tokens v8.0
   ============================================ */
:root {
    color-scheme: dark light;
    
    /* 🌙 Dark Theme - Default */
    --bg-base: #05050a;
    --bg-primary: #0a0b10;
    --bg-secondary: #0f1015;
    --bg-card: #13141a;
    --bg-card-hover: #1a1b22;
    --bg-elevated: #1a1c24;
    --bg-input: #12131a;
    
    /* Glass Effects */
    --glass-bg: rgba(16, 17, 24, 0.85);
    --glass-bg-light: rgba(255, 255, 255, 0.03);
    --glass-blur: 20px;
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-hover: rgba(255, 255, 255, 0.12);
    --glass-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    --glass-inner-glow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.04);
    --border-strong: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(139, 92, 246, 0.4);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    /* Accent Colors - Vibrant Neon Palette */
    --accent-green: #10b981;
    --accent-green-bright: #34d399;
    --accent-green-soft: rgba(16, 185, 129, 0.12);
    --accent-green-glow: 0 0 30px rgba(16, 185, 129, 0.3);
    
    --accent-purple: #8b5cf6;
    --accent-purple-bright: #a78bfa;
    --accent-purple-soft: rgba(139, 92, 246, 0.12);
    --accent-purple-glow: 0 0 30px rgba(139, 92, 246, 0.3);
    
    --accent-blue: #3b82f6;
    --accent-blue-bright: #60a5fa;
    --accent-blue-soft: rgba(59, 130, 246, 0.12);
    --accent-blue-glow: 0 0 30px rgba(59, 130, 246, 0.3);
    
    --accent-cyan: #06b6d4;
    --accent-cyan-bright: #22d3ee;
    --accent-cyan-soft: rgba(6, 182, 212, 0.12);
    --accent-cyan-glow: 0 0 30px rgba(6, 182, 212, 0.3);
    
    --accent-orange: #f59e0b;
    --accent-orange-bright: #fbbf24;
    --accent-orange-soft: rgba(245, 158, 11, 0.12);
    --accent-orange-glow: 0 0 30px rgba(245, 158, 11, 0.3);
    
    --accent-pink: #ec4899;
    --accent-pink-bright: #f472b6;
    --accent-pink-soft: rgba(236, 72, 153, 0.12);
    --accent-pink-glow: 0 0 30px rgba(236, 72, 153, 0.3);
    
    --accent-red: #ef4444;
    --accent-red-bright: #f87171;
    --accent-red-soft: rgba(239, 68, 68, 0.12);
    --accent-red-glow: 0 0 30px rgba(239, 68, 68, 0.3);
    
    --accent-yellow: #eab308;
    --accent-yellow-bright: #facc15;
    --accent-yellow-soft: rgba(234, 179, 8, 0.12);
    
    /* Premium Gradients */
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-llhls: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    
    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows - Layered for depth */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.5);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    
    /* Card shadows with color */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
    
    /* Typography */
    --font-sans: 'Nanum Gothic', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Font Sizes */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;
    --text-4xl: 36px;
    
    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
    
    /* Z-Index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-toast: 700;
    
    /* Chart Variables */
    --chart-bg: linear-gradient(145deg, rgba(16, 17, 24, 0.95) 0%, rgba(20, 21, 28, 0.98) 100%);
    --chart-border: rgba(255, 255, 255, 0.05);
    --chart-grid: rgba(255, 255, 255, 0.04);
}

/* ============================================
   🌞 Light Theme
   ============================================ */
html[data-theme="light"],
html.theme-light,
[data-theme="light"] {
    color-scheme: light;
    
    --bg-base: #f8fafc;
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-input: #f8fafc;
    
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-bg-light: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-border-hover: rgba(0, 0, 0, 0.1);
    --glass-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 100%);
    --glass-inner-glow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
    
    --border: rgba(0, 0, 0, 0.06);
    --border-light: rgba(0, 0, 0, 0.04);
    --border-strong: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(124, 58, 237, 0.3);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;
    
    /* Light theme accents - slightly muted */
    --accent-green: #059669;
    --accent-green-soft: rgba(5, 150, 105, 0.08);
    --accent-green-glow: 0 0 20px rgba(5, 150, 105, 0.15);
    
    --accent-purple: #7c3aed;
    --accent-purple-soft: rgba(124, 58, 237, 0.08);
    --accent-purple-glow: 0 0 20px rgba(124, 58, 237, 0.15);
    
    --accent-blue: #2563eb;
    --accent-blue-soft: rgba(37, 99, 235, 0.08);
    --accent-blue-glow: 0 0 20px rgba(37, 99, 235, 0.15);
    
    --accent-cyan: #0891b2;
    --accent-cyan-soft: rgba(8, 145, 178, 0.08);
    --accent-cyan-glow: 0 0 20px rgba(8, 145, 178, 0.15);
    
    --accent-orange: #d97706;
    --accent-orange-soft: rgba(217, 119, 6, 0.08);
    --accent-orange-glow: 0 0 20px rgba(217, 119, 6, 0.15);
    
    --accent-pink: #db2777;
    --accent-pink-soft: rgba(219, 39, 119, 0.08);
    
    --accent-red: #dc2626;
    --accent-red-soft: rgba(220, 38, 38, 0.08);
    
    /* Light shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.05);
    
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
    
    --gradient-mesh: radial-gradient(at 40% 20%, rgba(139, 92, 246, 0.05) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, rgba(59, 130, 246, 0.04) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.03) 0px, transparent 50%);
    
    --chart-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
    --chart-border: rgba(0, 0, 0, 0.05);
    --chart-grid: rgba(0, 0, 0, 0.04);
}

/* ============================================
   2. Base Styles
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--bg-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    background-image: var(--gradient-mesh);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--accent-purple);
    color: white;
}

/* ============================================
   3. Layout Components
   ============================================ */
.app-container {
    max-width: 1920px;
    margin: 0 auto;
    padding: var(--space-6);
}

.app-layout {
    display: flex;
    gap: var(--space-6);
    min-height: calc(100vh - 48px);
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* ============================================
   4. Premium Glass Card System
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--glass-highlight);
    pointer-events: none;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-card), var(--glass-inner-glow);
    transition: all var(--duration-normal) var(--ease-out);
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-card-hover), var(--glass-inner-glow);
}

/* Accent Cards */
.card-accent {
    position: relative;
}

.card-accent::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    opacity: 0.9;
}

.card-accent.green::after { background: var(--gradient-success); }
.card-accent.purple::after { background: var(--gradient-primary); }
.card-accent.blue::after { background: var(--gradient-info); }
.card-accent.orange::after { background: var(--gradient-warning); }
.card-accent.pink::after { background: var(--gradient-danger); }
.card-accent.cyan::after { background: var(--gradient-secondary); }

/* ============================================
   5. Stats Card System
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.green::before { background: var(--accent-green); }
.stat-card.purple::before { background: var(--accent-purple); }
.stat-card.blue::before { background: var(--accent-blue); }
.stat-card.orange::before { background: var(--accent-orange); }
.stat-card.cyan::before { background: var(--accent-cyan); }
.stat-card.pink::before { background: var(--accent-pink); }
.stat-card.red::before { background: var(--accent-red); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.stat-card.green:hover { box-shadow: var(--shadow-lg), var(--accent-green-glow); }
.stat-card.purple:hover { box-shadow: var(--shadow-lg), var(--accent-purple-glow); }
.stat-card.blue:hover { box-shadow: var(--shadow-lg), var(--accent-blue-glow); }
.stat-card.orange:hover { box-shadow: var(--shadow-lg), var(--accent-orange-glow); }
.stat-card.cyan:hover { box-shadow: var(--shadow-lg), var(--accent-cyan-glow); }
.stat-card.pink:hover { box-shadow: var(--shadow-lg), var(--accent-pink-glow); }

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform var(--duration-normal) var(--ease-bounce);
}

.stat-icon.green { background: var(--accent-green-soft); color: var(--accent-green); }
.stat-icon.purple { background: var(--accent-purple-soft); color: var(--accent-purple); }
.stat-icon.blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.stat-icon.orange { background: var(--accent-orange-soft); color: var(--accent-orange); }
.stat-icon.cyan { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.stat-icon.pink { background: var(--accent-pink-soft); color: var(--accent-pink); }
.stat-icon.red { background: var(--accent-red-soft); color: var(--accent-red); }

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-1);
    letter-spacing: -0.5px;
}

.stat-value.green { color: var(--accent-green); }
.stat-value.purple { color: var(--accent-purple); }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.orange { color: var(--accent-orange); }
.stat-value.cyan { color: var(--accent-cyan); }
.stat-value.pink { color: var(--accent-pink); }

.stat-unit {
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: var(--space-1);
}

.stat-detail {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-light);
}

/* ============================================
   6. Section Headers
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.section-title i {
    width: 22px;
    height: 22px;
    color: var(--accent-purple);
}

.section-badge {
    font-size: var(--text-xs);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-badge.success {
    background: var(--accent-green-soft);
    color: var(--accent-green);
}

.section-badge.warning {
    background: var(--accent-orange-soft);
    color: var(--accent-orange);
}

.section-badge.info {
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
}

/* ============================================
   7. Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.btn-primary:hover {
    box-shadow: var(--accent-purple-glow);
    filter: brightness(1.1);
}

.btn-success {
    background: var(--accent-green-soft);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-success:hover {
    background: var(--accent-green);
    color: white;
}

.btn-danger {
    background: var(--accent-red-soft);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: var(--accent-red);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

/* ============================================
   8. Badges & Tags
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-green { background: var(--accent-green-soft); color: var(--accent-green); }
.badge-purple { background: var(--accent-purple-soft); color: var(--accent-purple); }
.badge-blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge-orange { background: var(--accent-orange-soft); color: var(--accent-orange); }
.badge-cyan { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.badge-pink { background: var(--accent-pink-soft); color: var(--accent-pink); }
.badge-red { background: var(--accent-red-soft); color: var(--accent-red); }

.badge-live {
    background: var(--gradient-danger);
    color: white;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ============================================
   9. Form Elements
   ============================================ */
.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast);
}

.input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px var(--accent-purple-soft);
}

.input::placeholder {
    color: var(--text-muted);
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* ============================================
   10. Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    padding: var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    text-transform: uppercase;
    font-size: var(--text-xs);
    letter-spacing: 0.5px;
}

.table tr:hover td {
    background: var(--bg-card-hover);
}

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

/* ============================================
   11. Navigation
   ============================================ */
.nav-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    height: fit-content;
    position: sticky;
    top: var(--space-6);
    transition: all var(--duration-normal);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.nav-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-success);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--accent-green-glow);
    transition: all var(--duration-normal) var(--ease-bounce);
}

.nav-logo-icon svg {
    color: white;
    width: 22px;
    height: 22px;
}

.nav-logo:hover .nav-logo-icon {
    transform: scale(1.08) rotate(-3deg);
}

.nav-logo-text {
    display: flex;
    flex-direction: column;
}

.nav-logo-title {
    font-size: var(--text-lg);
    font-weight: 800;
    background: var(--gradient-success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.nav-logo-subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast);
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--accent-purple-glow);
}

.nav-item i {
    width: 18px;
    height: 18px;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-3) 0;
}

.nav-section-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
}

/* ============================================
   12. Charts & Data Visualization
   ============================================ */
.chart-container {
    background: var(--chart-bg);
    border: 1px solid var(--chart-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-base);
    font-weight: 700;
}

.chart-title i {
    color: var(--accent-purple);
}

.chart-legend {
    display: flex;
    gap: var(--space-4);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.legend-dot.green { background: var(--accent-green); }
.legend-dot.orange { background: var(--accent-orange); }
.legend-dot.purple { background: var(--accent-purple); }
.legend-dot.blue { background: var(--accent-blue); }

/* ============================================
   13. Channel Cards
   ============================================ */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-5);
}

.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-strong);
}

.channel-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.channel-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border);
    transition: all var(--duration-normal);
}

.channel-avatar.live {
    border-color: var(--accent-red);
    animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.channel-title {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-meta {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
}

.channel-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.channel-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border-light);
}

.channel-stat {
    background: var(--bg-card);
    padding: var(--space-4);
    text-align: center;
}

.channel-stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.channel-stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ============================================
   14. Player Cards
   ============================================ */
.player-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.player-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.player-card.app::before { background: var(--accent-green); }
.player-card.web::before { background: var(--accent-cyan); }
.player-card.python::before { background: var(--accent-purple); }

.player-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.player-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.player-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform var(--duration-normal) var(--ease-bounce);
}

.player-icon.app {
    background: var(--gradient-success);
    color: white;
    box-shadow: var(--accent-green-glow);
}

.player-icon.web {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: var(--accent-cyan-glow);
}

.player-icon.python {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--accent-purple-glow);
}

.player-card:hover .player-icon {
    transform: scale(1.1) rotate(-5deg);
}

.player-title {
    flex: 1;
    font-weight: 700;
}

.player-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.player-stat {
    background: var(--glass-bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    transition: all var(--duration-fast);
}

.player-stat:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}

.player-stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: var(--space-2);
}

.player-stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.player-stat-value .unit {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: var(--space-1);
}

/* ============================================
   15. Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.animate-fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }
.animate-fade-in-up { animation: fadeInUp var(--duration-normal) var(--ease-out); }
.animate-fade-in-down { animation: fadeInDown var(--duration-normal) var(--ease-out); }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-out); }
.animate-slide-in { animation: slideInRight var(--duration-normal) var(--ease-out); }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Staggered animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ============================================
   16. Utility Classes
   ============================================ */
/* Display */
.hidden { display: none !important; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex utilities */
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

/* Spacing */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-purple { color: var(--accent-purple); }
.text-blue { color: var(--accent-blue); }
.text-orange { color: var(--accent-orange); }
.text-cyan { color: var(--accent-cyan); }
.text-pink { color: var(--accent-pink); }
.text-red { color: var(--accent-red); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.truncate { 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Border radius */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Width & Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ============================================
   17. Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* ============================================
   18. Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .player-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .app-layout {
        flex-direction: column;
    }
    
    .nav-sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: var(--space-4);
    }
    
    .player-grid {
        grid-template-columns: 1fr;
    }
    
    .channel-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }
    
    .player-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   19. Print Styles
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .nav-sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .card,
    .glass-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   20. Modern Chart Styling v8.0
   Premium Chart Design with Gradient Effects
   ============================================ */

/* Chart Container Wrapper */
.chart-container {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    padding: var(--space-4);
    transition: all 0.3s ease;
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--glass-highlight);
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover::before {
    opacity: 1;
}

.chart-container:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                var(--glass-inner-glow);
}

/* Chart Title */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.chart-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.chart-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    font-size: var(--text-lg);
}

.chart-title-icon.green { background: var(--accent-green-soft); }
.chart-title-icon.purple { background: var(--accent-purple-soft); }
.chart-title-icon.blue { background: var(--accent-blue-soft); }
.chart-title-icon.orange { background: var(--accent-orange-soft); }
.chart-title-icon.cyan { background: var(--accent-cyan-soft); }
.chart-title-icon.pink { background: var(--accent-pink-soft); }

.chart-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--accent-purple-soft);
    color: var(--accent-purple-bright);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Chart Area Styling */
.chart-area {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-area-small {
    height: 200px;
}

.chart-area-large {
    height: 360px;
}

/* Canvas Glow Effect */
.chart-area canvas {
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.15));
    transition: filter 0.3s ease;
}

.chart-container:hover .chart-area canvas {
    filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.25));
}

/* Chart Footer / Legend Custom */
.chart-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-light);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

.chart-legend-dot.green { 
    background: var(--accent-green); 
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.chart-legend-dot.orange { 
    background: var(--accent-orange); 
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.chart-legend-dot.purple { 
    background: var(--accent-purple); 
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}
.chart-legend-dot.blue { 
    background: var(--accent-blue); 
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}
.chart-legend-dot.cyan { 
    background: var(--accent-cyan); 
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}
.chart-legend-dot.pink { 
    background: var(--accent-pink); 
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.5);
}

/* Gradient Overlay for Area Charts */
.chart-gradient-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, var(--bg-card), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Chart Loading State */
.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 11, 16, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
    border-radius: inherit;
}

.chart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: chart-spin 0.8s linear infinite;
}

@keyframes chart-spin {
    to { transform: rotate(360deg); }
}

/* Chart Empty State */
.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: var(--space-2);
}

.chart-empty-icon {
    font-size: var(--text-3xl);
    opacity: 0.5;
}

.chart-empty-text {
    font-size: var(--text-sm);
}

/* Tooltip Custom Styling (via JS injection) */
.chartjs-tooltip {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
    padding: 12px 16px !important;
}

/* Light Theme Chart Adjustments */
:root[data-theme="light"] .chart-container,
.light-theme .chart-container,
body.light-mode .chart-container {
    background: var(--bg-card);
    border-color: var(--border);
}

:root[data-theme="light"] .chart-area canvas,
.light-theme .chart-area canvas,
body.light-mode .chart-area canvas {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.1));
}

/* Responsive Chart */
@media (max-width: 768px) {
    .chart-area {
        height: 220px;
    }
    
    .chart-area-large {
        height: 280px;
    }
    
    .chart-footer {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .chart-legend-item {
        font-size: var(--text-xs);
    }
}
