:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1e3a8a;
    --primary-light: #eff6ff;
    
    /* Semantic Colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    /* Neutrals */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --white: #ffffff;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    padding: 2rem 0;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 70px;
    display: flex;
    align-items: center;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Admin Layout */
.admin-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    gap: 0.75rem;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.admin-main {
    flex-grow: 1;
    padding: 2rem;
    max-width: calc(100% - 260px);
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-size: 0.875rem;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-secondary {
    background: var(--white);
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-main);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-main);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(248, 250, 252, 0.5);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    border-left: 4px solid transparent;
}

.alert-error, .alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--error);
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: var(--success);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left-color: var(--warning);
}

/* 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(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Quiz Specific */
.quiz-focus-layout {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-start-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.92);
}

.quiz-start-overlay.is-hidden {
    display: none;
}

.quiz-start-panel {
    width: min(100%, 420px);
    padding: 2rem;
    border-radius: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.quiz-start-panel h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.quiz-start-panel p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.quiz-start-status {
    min-height: 1.25rem;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.question-card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.question-text {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-option {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    gap: 1rem;
    user-select: none;
    -webkit-user-select: none;
}

.answer-option:hover {
    background: var(--bg-main);
    border-color: var(--primary);
}

.answer-option input[type="radio"] {
    margin-top: 0.35rem;
    width: 1.125rem;
    height: 1.125rem;
}

.answer-option.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.option-code {
    font-weight: 700;
    color: var(--primary);
    min-width: 20px;
}

.option-text {
    flex: 1;
    font-size: 1rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

#timer-sticky {
    position: sticky;
    top: 85px;
    z-index: 40;
    background: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.timer-text {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

/* Utils */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.w-full { width: 100%; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    .admin-main {
        max-width: calc(100% - 200px);
    }
}

@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        padding: 1rem;
    }
    .sidebar-menu {
        display: flex;
        gap: 0.5rem;
    }
    .sidebar-item {
        margin-bottom: 0;
        white-space: nowrap;
    }
    .admin-main {
        padding: 1.5rem;
        max-width: 100%;
    }
    .header .container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    .question-card {
        padding: 1.25rem;
    }
    .btn {
        padding: 0.5rem 1rem;
