/* =========================================================
   CIRCLE SIMULATOR - DESIGN SYSTEM
   Premium Educational SaaS Platform
   Glassmorphism + Holographic Geometry | Serif Headings
   ========================================================= */

/* === COLOR TOKENS === */
:root {
    /* Light Mode Colors */
    --background: #F8FAFC;
    --background-secondary: #F5F7FF;
    --background-tertiary: #EEF4FF;
    --foreground: #1F2937;
    --foreground-secondary: #4B5563;
    --foreground-muted: #94A3B8;
    
    --primary: #3B82F6;
    --primary-foreground: #ffffff;
    --secondary: #6366F1;
    --secondary-foreground: #ffffff;
    --accent: #8B5CF6;
    --accent-foreground: #ffffff;
    
    --success: #22C55E;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --error: #EF4444;
    --error-bg: #FEF2F2;
    --info: #3B82F6;
    --info-bg: #EFF6FF;
    
    --muted: #F1F5F9;
    --muted-foreground: #64748B;
    
    /* Cards - White with subtle transparency */
    --card: rgba(255, 255, 255, 0.72);
    --card-solid: rgba(255, 255, 255, 0.92);
    --card-foreground: #1F2937;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-strong: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-border-strong: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
    --glass-blur: 20px;
    
    /* Borders */
    --border: #E2E8F0;
    --border-light: #EEF2F7;
    
    /* Rings */
    --ring: #3B82F6;
    
    /* Typography */
    --font-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Cinzel', 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    
    --leading-tight: 1.2;
    --leading-normal: 1.6;
    --leading-relaxed: 1.75;
    --leading-loose: 2;
    
    /* Spacing - 8px System */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;
    
    /* Shadows - Premium Soft */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.04);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.06), 0 4px 8px -4px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.08), 0 8px 16px -8px rgb(0 0 0 / 0.05);
    --shadow-2xl: 0 30px 60px -12px rgb(0 0 0 / 0.1);
    
    /* Glow Shadows */
    --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.15);
    --shadow-glow-purple: 0 0 24px rgba(139, 92, 246, 0.15);
    --shadow-glow-blue: 0 0 32px rgba(59, 130, 246, 0.2);
    --shadow-glow-soft: 0 4px 24px rgba(59, 130, 246, 0.1);
    
    /* Transitions - Apple-style easing */
    --transition-fast: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Neutral Scale */
    --neutral-50: #F8FAFC;
    --neutral-100: #F1F5F9;
    --neutral-200: #E2E8F0;
    --neutral-300: #CBD5E1;
    --neutral-400: #94A3B8;
    --neutral-500: #64748B;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1E293B;
    --neutral-900: #0F172A;
    
    /* Primary Scale */
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-800: #1E40AF;
    --primary-900: #1E3A8A;
    
    /* Secondary Scale */
    --secondary-50: #EEF2FF;
    --secondary-100: #E0E7FF;
    --secondary-200: #C7D2FE;
    --secondary-300: #A5B4FC;
    --secondary-400: #818CF8;
    --secondary-500: #6366F1;
    --secondary-600: #4F46E5;
    --secondary-700: #4338CA;
    
    /* Accent Scale */
    --accent-50: #F5F3FF;
    --accent-100: #EDE9FE;
    --accent-200: #DDD6FE;
    --accent-300: #C4B5FD;
    --accent-400: #A78BFA;
    --accent-500: #8B5CF6;
    --accent-600: #7C3AED;
    --accent-700: #6D28D9;
    
    /* Container */
    --container-max: 1280px;
    --container-narrow: 768px;
    
    /* Gradient Presets */
    --gradient-primary: linear-gradient(135deg, #3B82F6 0%, #6366F1 50%, #8B5CF6 100%);
    --gradient-text: linear-gradient(135deg, #2563EB 0%, #4F46E5 50%, #7C3AED 100%);
    --gradient-text-light: linear-gradient(135deg, #60A5FA 0%, #818CF8 50%, #A78BFA 100%);
    --gradient-success: linear-gradient(135deg, #22C55E 0%, #10B981 100%);
    --gradient-warning: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
    --gradient-error: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

/* === DARK MODE === */
.dark, .dark * {
    /* Core Colors */
    --background: #0F172A;
    --background-secondary: #111827;
    --background-tertiary: #1E293B;
    --foreground: #FFFFFF;
    --foreground-secondary: #CBD5E1;
    --foreground-muted: #94A3B8;
    
    --primary: #60A5FA;
    --primary-foreground: #0F172A;
    --secondary: #818CF8;
    --secondary-foreground: #0F172A;
    --accent: #A78BFA;
    --accent-foreground: #0F172A;
    
    --success: #34D399;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #FBBF24;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --error: #F87171;
    --error-bg: rgba(239, 68, 68, 0.15);
    --info: #60A5FA;
    --info-bg: rgba(59, 130, 246, 0.15);
    
    --muted: #1E293B;
    --muted-foreground: #94A3B8;
    
    /* Cards - Dark glass */
    --card: rgba(30, 41, 59, 0.72);
    --card-solid: rgba(30, 41, 59, 0.92);
    --card-foreground: #F1F5F9;
    
    /* Glass */
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-bg-strong: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-strong: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.06);
    
    --ring: #60A5FA;
    
    /* Dark Mode Neutral Scale - Inverted for readability */
    --neutral-50: #0F172A;
    --neutral-100: #1E293B;
    --neutral-200: #334155;
    --neutral-300: #475569;
    --neutral-400: #64748B;
    --neutral-500: #94A3B8;
    --neutral-600: #CBD5E1;
    --neutral-700: #E2E8F0;
    --neutral-800: #F1F5F9;
    --neutral-900: #F8FAFC;
    
    /* Primary Scale - Dark */
    --primary-50: rgba(59, 130, 246, 0.15);
    --primary-100: rgba(59, 130, 246, 0.2);
    --primary-200: rgba(59, 130, 246, 0.3);
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    
    --secondary-50: rgba(99, 102, 241, 0.15);
    --secondary-100: rgba(99, 102, 241, 0.2);
    --secondary-200: rgba(99, 102, 241, 0.3);
    --secondary-300: #A5B4FC;
    --secondary-400: #818CF8;
    --secondary-500: #6366F1;
    --secondary-600: #4F46E5;
    
    --accent-50: rgba(139, 92, 246, 0.15);
    --accent-100: rgba(139, 92, 246, 0.2);
    --accent-200: rgba(139, 92, 246, 0.3);
    --accent-300: #C4B5FD;
    --accent-400: #A78BFA;
    --accent-500: #8B5CF6;
    --accent-600: #7C3AED;
    
    /* Shadows - Dark with soft blue glow */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.5), 0 4px 8px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.6), 0 8px 16px -8px rgb(0 0 0 / 0.4);
    --shadow-2xl: 0 30px 60px -12px rgb(0 0 0 / 0.7);
    
    --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.2);
    --shadow-glow-purple: 0 0 24px rgba(139, 92, 246, 0.2);
    --shadow-glow-blue: 0 0 32px rgba(59, 130, 246, 0.25);
    --shadow-glow-soft: 0 4px 24px rgba(59, 130, 246, 0.15);
    
    --gradient-text: linear-gradient(135deg, #60A5FA 0%, #818CF8 50%, #A78BFA 100%);
}

/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--foreground);
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--background);
    transition: background-color var(--transition-base), color var(--transition-base);
}

img, svg, video {
    max-width: 100%;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

::selection {
    background: var(--primary-100);
    color: var(--primary-700);
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--foreground);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

/* Gradient Text */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.15));
}

.gradient-text-blue {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-purple {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === GLASS CARD === */
.glass {
    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-2xl);
    box-shadow: var(--glass-shadow);
}

.glass-strong {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-strong);
    box-shadow: var(--glass-shadow);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    font-family: var(--font-primary);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
    color: white;
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    color: var(--foreground);
}

.btn-secondary:hover {
    background: var(--glass-bg-strong);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
    color: white;
}

.btn-danger {
    background: var(--gradient-error);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
}

.btn-ghost:hover {
    background: var(--muted);
    color: var(--foreground);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-3xl);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

/* Ripple Effect */
.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* === CARDS === */
.card {
    background: var(--card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    background: var(--glass-bg-strong);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-200);
}

.card-glass {
    background: var(--card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-base);
}

.card-glass:hover {
    background: var(--glass-bg-strong);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
    border-color: var(--primary-200);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--glass-border);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--glass-border);
    background: var(--muted);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    font-family: var(--font-primary);
    color: var(--foreground);
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: var(--space-1);
}

/* === FORM ELEMENTS === */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    color: var(--foreground);
    margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--foreground);
    background: var(--glass-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12), var(--shadow-glow-soft);
    background: var(--glass-bg-strong);
}

.dark .form-input,
.dark .form-textarea,
.dark .form-select {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--border);
    color: var(--foreground);
}

.dark .form-input:focus,
.dark .form-textarea:focus,
.dark .form-select:focus {
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), var(--shadow-glow-soft);
}

.form-input::placeholder {
    color: var(--muted-foreground);
}

.form-input.error {
    border-color: var(--error);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--error);
    margin-top: var(--space-1);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    font-family: var(--font-primary);
    border-radius: var(--radius-full);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.badge-success {
    background: var(--success-bg);
    color: #065F46;
}

.dark .badge-success {
    color: #34D399;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400E;
}

.dark .badge-warning {
    color: #FBBF24;
}

.badge-error {
    background: var(--error-bg);
    color: #991B1B;
}

.dark .badge-error {
    color: #F87171;
}

.badge-neutral {
    background: var(--muted);
    color: var(--muted-foreground);
}

/* === ALERTS === */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: #065F46;
    border-left: 4px solid var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.dark .alert-success {
    color: #34D399;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400E;
    border-left: 4px solid var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.dark .alert-warning {
    color: #FBBF24;
}

.alert-error {
    background: var(--error-bg);
    color: #991B1B;
    border-left: 4px solid var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}

.dark .alert-error {
    color: #F87171;
}

.alert-info {
    background: var(--info-bg);
    color: #1E40AF;
    border-left: 4px solid var(--info);
    border-color: rgba(59, 130, 246, 0.2);
}

.dark .alert-info {
    color: #60A5FA;
}

/* === TABLES === */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table thead {
    background: var(--glass-bg-strong);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: var(--font-semibold);
    font-family: var(--font-primary);
    color: var(--foreground);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--glass-border);
}

.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--glass-border);
    color: var(--foreground);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.04);
}

.dark .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-solid);
    backdrop-filter: blur(32px);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .modal {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--text-xl);
    font-family: var(--font-display);
    color: var(--foreground);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--muted-foreground);
    transition: all var(--transition-fast);
    font-size: 1.125rem;
}

.modal-close:hover {
    background: var(--muted);
    color: var(--foreground);
    transform: rotate(90deg);
}

/* === PROGRESS BAR === */
.progress {
    width: 100%;
    height: 8px;
    background: var(--muted);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.progress-bar.success {
    background: var(--gradient-success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.progress-bar.warning {
    background: var(--gradient-warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

/* === TOOLTIP === */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    color: white;
    background: var(--neutral-800);
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.tooltip:hover::after {
    opacity: 1;
}

/* === THEME TOGGLE === */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--foreground);
    font-size: 1.25rem;
    position: relative;
}

.theme-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}

.theme-toggle:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.theme-toggle .theme-icon {
    transition: transform var(--transition-base);
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

/* === SPINNER === */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--space-12);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
    color: var(--foreground);
}

.empty-state p {
    color: var(--muted-foreground);
    margin-bottom: var(--space-6);
}

/* === DIVIDER === */
.divider {
    width: 100%;
    height: 1px;
    background: var(--glass-border);
    margin: var(--space-6) 0;
}

/* === AVATAR === */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    font-family: var(--font-primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-xl);
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: var(--text-3xl);
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, var(--glass-border) 25%, var(--muted) 50%, var(--glass-border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-2);
    width: 100%;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 24px;
    width: 40%;
    margin-bottom: var(--space-3);
}

.skeleton-card {
    height: 200px;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
    background-clip: content-box;
}

/* === UTILITY === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.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-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-muted { color: var(--muted-foreground); }

.mt-1 { margin-top: var(--space-1); }
.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); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.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); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.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; }
.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); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none; }
.w-full { width: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
/* =========================================================
   CIRCLE RESPONSIVE AUDIT FIX (frontend-only, CSS presentation)
   - Tables/cards/modals/forms stay inside viewport
   - Desktop appearance unchanged
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

.card, .card-glass, .modal, .form-input, .form-select, .form-textarea {
    min-width: 0;
    max-width: 100%;
}

h1, h2, h3, h4, p, td, th, .badge {
    overflow-wrap: break-word;
}

/* Tables: containment + usable horizontal scroll inside container */
.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table { min-width: 560px; }
.table th, .table td {
    white-space: normal;
    overflow-wrap: break-word;
}

/* Modals: never exceed mobile viewport */
.modal-overlay { padding: 16px; }
.modal {
    width: min(560px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}

/* Forms: inputs/buttons wrap safely on narrow screens */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}
.form-row > * {
    flex: 1 1 220px;
    min-width: 0;
}
.btn { max-width: 100%; white-space: normal; }

/* Utility grids used by pages */
@media (max-width: 900px) {
    .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* Leaderboard/cards: stack safely without redesign */
@media (max-width: 640px) {
    .leaderboard-filters { flex-wrap: wrap; }
    .leaderboard-filters .classroom-filter {
        flex: 1 1 100%;
        min-width: 0;
    }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 10px 12px; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }
}