/* ============================================================================
   QuizFlow - Modern Design System
   A beautiful, dark-themed UI with glassmorphism effects
   ============================================================================ */

/* -----------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   ----------------------------------------------------------------------------- */
:root {
    /* Background Colors */
    --bg: #050507;
    --bg-2: #0a0a0f;
    --bg-elevated: #0f0f12;

    /* Surface Colors (Glassmorphism) */
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --surface-active: rgba(255, 255, 255, 0.08);

    /* Border Colors */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(139, 92, 246, 0.5);
    --border-focus: rgba(139, 92, 246, 0.8);

    /* Accent Colors (Purple/Indigo Gradient) */
    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --accent-3: #4f46e5;
    --accent-grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #4f46e5 100%);
    --accent-glow: 0 0 20px rgba(139, 92, 246, 0.35);
    --accent-glow-strong: 0 0 32px rgba(139, 92, 246, 0.55);

    /* Semantic Colors */
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.15);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.15);

    /* Text Colors */
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #475569;

    /* Spacing & Sizing */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 25px 50px rgba(0, 0, 0, 0.6);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Z-index layers */
    --z-base: 1;
    --z-dropdown: 10;
    --z-sticky: 100;
    --z-modal: 1000;
    --z-notification: 1001;
}

/* -----------------------------------------------------------------------------
   Reset & Base Styles
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -----------------------------------------------------------------------------
   Animated Background
   ----------------------------------------------------------------------------- */
body {
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.12;
    pointer-events: none;
    animation: drift 14s ease-in-out infinite alternate;
    z-index: 0;
}

body::before {
    width: 700px;
    height: 700px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    top: -250px;
    left: -250px;
}

body::after {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    bottom: -200px;
    right: -200px;
    animation-delay: -7s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(50px, 40px) scale(1.15);
    }
}

/* -----------------------------------------------------------------------------
   Typography
   ----------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-2);
}

/* -----------------------------------------------------------------------------
   Layout Utilities
   ----------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 420px;
    margin: 0 auto;
    padding: 2.5rem;
}

.center-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

/* -----------------------------------------------------------------------------
   Glassmorphism Cards
   ----------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 0;
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--accent-glow-strong);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #10b981);
    color: #fff;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.35);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 28px rgba(52, 211, 153, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #ef4444);
    color: #fff;
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.35);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 28px rgba(248, 113, 113, 0.5);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-icon {
    padding: 0.625rem;
    border-radius: var(--radius-sm);
}

/* -----------------------------------------------------------------------------
   Form Elements
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    color: var(--text);
    transition: all var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-dim);
}

.form-input.code-field {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    letter-spacing: 0.1em;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    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 0.75rem center;
    padding-right: 2.5rem;
}

.form-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-error {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--danger);
}

/* -----------------------------------------------------------------------------
   Notifications / Alerts
   ----------------------------------------------------------------------------- */
.notification {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transform: translateX(calc(100% + 2rem));
    transition: transform var(--transition);
    z-index: var(--z-notification);
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 3px solid var(--success);
}

.notification.success .notification-icon {
    color: var(--success);
}

.notification.error {
    border-left: 3px solid var(--danger);
}

.notification.error .notification-icon {
    color: var(--danger);
}

.notification.warning {
    border-left: 3px solid var(--warning);
}

.notification.warning .notification-icon {
    color: var(--warning);
}

.notification.info {
    border-left: 3px solid var(--info);
}

.notification.info .notification-icon {
    color: var(--info);
}

.notification-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.notification-content {
    flex: 1;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.notification-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* -----------------------------------------------------------------------------
   Loading States
   ----------------------------------------------------------------------------- */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.sm {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

.loading-spinner.lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 7, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-sequence {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-sequence .loading-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* -----------------------------------------------------------------------------
   Animations
   ----------------------------------------------------------------------------- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

/* Animation utility classes */
.animate-fade-up {
    animation: fadeUp 0.5s ease forwards;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

/* Staggered animations for lists */
.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; }

/* -----------------------------------------------------------------------------
   Badge / Tag Components
   ----------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.badge-success {
    background: var(--success-bg);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    border-color: rgba(251, 191, 36, 0.3);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    border-color: rgba(96, 165, 250, 0.3);
    color: var(--info);
}

.badge-primary {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--accent);
}

/* Live badge with pulsing dot */
.live-badge {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    z-index: var(--z-sticky);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* -----------------------------------------------------------------------------
   Logo & Branding
   ----------------------------------------------------------------------------- */
.logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.logo-box {
    width: 72px;
    height: 72px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--accent-glow), var(--card-shadow);
    position: relative;
}

.logo-box::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    background: var(--accent-grad);
    opacity: 0.35;
    z-index: -1;
}

.logo-small {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: -0.01em;
}

.logo-small svg {
    opacity: 0.8;
}

/* -----------------------------------------------------------------------------
   Hero Section
   ----------------------------------------------------------------------------- */
.hero {
    text-align: center;
    padding: 4rem 1.5rem;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.7;
    max-width: 500px;
    margin: 0 auto 2rem;
}

/* -----------------------------------------------------------------------------
   Button Groups
   ----------------------------------------------------------------------------- */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin: 2rem 0;
}

.button-group-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

.button-group-horizontal .btn {
    flex: 1;
    min-width: 160px;
}

/* -----------------------------------------------------------------------------
   Footer Text
   ----------------------------------------------------------------------------- */
.footer-text {
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-align: center;
    margin-top: 2rem;
}

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

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

.table thead {
    background: var(--surface);
    backdrop-filter: blur(20px);
}

.table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

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

/* -----------------------------------------------------------------------------
   Progress Bars
   ----------------------------------------------------------------------------- */
.progress-container {
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-grad);
    border-radius: 999px;
    transition: width var(--transition);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* -----------------------------------------------------------------------------
   Modal / Dialog
   ----------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 7, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* -----------------------------------------------------------------------------
   Sidebar Navigation
   ----------------------------------------------------------------------------- */
.sidebar {
    width: 260px;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: var(--z-sticky);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--surface);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--surface-active);
    color: var(--accent);
    border: 1px solid var(--border-hover);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   Main Content Area
   ----------------------------------------------------------------------------- */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg);
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.main-title {
    font-size: 1.75rem;
    font-weight: 700;
}

/* -----------------------------------------------------------------------------
   Stats Cards
   ----------------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition);
}

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

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* -----------------------------------------------------------------------------
   Quiz/Question Cards
   ----------------------------------------------------------------------------- */
.quiz-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all var(--transition);
    cursor: pointer;
}

.quiz-card:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
    transform: translateX(4px);
}

.quiz-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.quiz-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.quiz-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Option Cards (for quiz questions)
   ----------------------------------------------------------------------------- */
.option-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-card:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.option-card.selected {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.option-card.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.option-card.incorrect {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.option-card.selected .option-label {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.option-card.correct .option-label {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.option-card.incorrect .option-label {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.option-text {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Score Display
   ----------------------------------------------------------------------------- */
.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 3px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--percentage) * 1%), var(--border) 0);
    -webkit-mask: radial-gradient(transparent 68%, #000 69%);
    mask: radial-gradient(transparent 68%, #000 69%);
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* -----------------------------------------------------------------------------
   Tabs
   ----------------------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-elevated);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    flex: 1;
    padding: 0.625rem 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius-sm) - 2px);
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.tab.active {
    background: var(--accent-grad);
    color: #fff;
}

/* -----------------------------------------------------------------------------
   Empty State
   ----------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* -----------------------------------------------------------------------------
   Divider
   ----------------------------------------------------------------------------- */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--border);
    margin: 0 1.5rem;
}

/* -----------------------------------------------------------------------------
   Utility Classes
   ----------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* -----------------------------------------------------------------------------
   Responsive Design
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --radius: 12px;
        --radius-lg: 16px;
    }
    
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .button-group-horizontal {
        flex-direction: column;
    }
    
    .button-group-horizontal .btn {
        min-width: 100%;
    }
    
    .main-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.8125rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.875rem;
    }
}

@media (max-width: 480px) {
    .container-narrow {
        padding: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    .notification {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    
    .live-badge {
        top: 1rem;
        right: 1rem;
    }
}

/* -----------------------------------------------------------------------------
   Print Styles
   ----------------------------------------------------------------------------- */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    
    body::before,
    body::after {
        display: none;
    }
    
    .card,
    .btn,
    .sidebar,
    .notification,
    .live-badge {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
}

/* -----------------------------------------------------------------------------
   Focus States for Accessibility
   ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
