/* ==================== VARIABLES ==================== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

/* ==================== RESET & BASE ==================== */
/* Cross-browser compatibility: Chrome, Firefox, Safari, Edge */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
}

/* Touch-friendly targets (min 44px for accessibility) */
button,
[type="button"],
[type="submit"],
a.btn,
select {
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

/* ==================== HEADER ==================== */
.header {
    background: var(--gradient);
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.header-logo {
    width: 60px;
    height: auto;
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 0.85rem;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
    background: white;
}

.footer-logo {
    width: 40px;
    height: auto;
    margin-bottom: 10px;
    opacity: 0.7;
}

/* ==================== CARDS ==================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: linear-gradient(135deg, #0891b2, #0e7490);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* Date/Time picker improvements */
input[type="datetime-local"] {
    padding: 12px 16px;
    font-size: 1rem;
    cursor: pointer;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    background: var(--gray-100);
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
    overflow-x: auto;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== LOGIN ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--gradient);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.login-footer .footer-logo {
    width: 40px;
    height: auto;
    margin-bottom: 10px;
    opacity: 0.8;
}

.login-footer p {
    margin: 0;
}

.forgot-password-link {
    margin-top: 20px;
    text-align: center;
}

.forgot-password-link a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.forgot-password-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo img {
    width: 100px;
    height: auto;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--gray-800);
}

/* ==================== QUIZ LIST ==================== */
.quiz-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
    gap: 15px;
    flex-wrap: wrap;
}

.quiz-item:last-child {
    border-bottom: none;
}

.quiz-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.quiz-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.quiz-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s;
}

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

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

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-600);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ==================== TRACKING STATS ==================== */
.tracking-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    background: var(--gray-50);
}

.stat-box {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: var(--radius);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ==================== STUDENT LIST ==================== */
.student-list {
    max-height: 400px;
    overflow-y: auto;
}

.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.student-item:last-child {
    border-bottom: none;
}

.student-name {
    font-weight: 500;
}

.student-status {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.student-item.completed {
    background: #f0fdf4;
}

.student-item.blocked {
    background: #fef2f2;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ==================== QUIZ PARTICIPANT ==================== */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-logo {
    width: 80px;
    height: auto;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.question-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.question-counter {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 25px;
    line-height: 1.5;
}

.options {
    list-style: none;
}

.options li {
    margin-bottom: 12px;
}

.option-btn {
    width: 100%;
    padding: 15px 20px;
    text-align: left;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.option-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.option-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==================== RESULTS ==================== */
.results-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
}

.results-card h2 {
    color: var(--gray-800);
    margin-bottom: 20px;
}

.score-display {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
    margin: 20px 0;
}

.score-label {
    color: var(--gray-500);
    font-size: 1.2rem;
}

/* ==================== WAITING ROOM ==================== */
.waiting-room {
    text-align: center;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.waiting-room h1 {
    color: var(--gray-800);
    margin-bottom: 10px;
}

.waiting-room .classe {
    color: var(--gray-500);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.waiting-badge {
    background: var(--gradient);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    display: inline-block;
    margin: 10px 0 20px;
    box-shadow: var(--shadow);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

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

/* ==================== BLOCKED SCREEN ==================== */
.blocked-screen {
    text-align: center;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blocked-screen h1 {
    color: var(--danger);
    margin-bottom: 20px;
}

.blocked-screen .score-zero {
    font-size: 3rem;
    color: var(--danger);
    font-weight: 700;
    margin: 20px 0;
}

/* ==================== ALREADY COMPLETED ==================== */
.already-completed {
    text-align: center;
    padding: 40px 20px;
}

.already-completed h2 {
    color: var(--warning);
    margin-bottom: 15px;
}

/* ==================== FILE UPLOAD ==================== */
.file-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ==================== QUESTIONS LIST (CREATION) ==================== */
.question-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.question-item-number {
    font-weight: 600;
    color: var(--primary);
    margin-right: 10px;
}

.question-item-text {
    font-weight: 500;
    margin-bottom: 8px;
}

.question-item-answers {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.question-item-answers .correct {
    color: var(--success);
    font-weight: 500;
}

.question-item-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Archived quiz styles */
.quiz-archived {
    opacity: 0.8;
    background: var(--gray-50);
}

.quiz-archived h3 {
    color: var(--gray-500);
}

.quiz-stats {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-300);
    font-size: 0.8rem;
    color: var(--gray-600);
}

.quiz-stats span {
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 4px;
}

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

/* Modal body and footer */
.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form row for side by side inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Button warning style */
.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

/* ==================== PRINT PAGE ==================== */
.print-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 20px;
}

.print-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
}

.qr-code {
    margin: 20px 0;
}

.qr-code img {
    max-width: 200px;
    height: auto;
}

.access-code {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 4px;
    margin: 15px 0;
}

/* ==================== TABLES ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}

.table tr:hover {
    background: var(--gray-50);
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-500);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .quiz-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .tracking-stats {
        grid-template-columns: 1fr;
    }

    .modal {
        max-height: 95vh;
    }

    .question-card {
        padding: 20px;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .option-btn {
        padding: 12px 15px;
    }

    .score-display {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .quiz-meta {
        flex-direction: column;
        gap: 5px;
    }

    .quiz-actions {
        flex-wrap: wrap;
    }

    .quiz-actions .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* ==================== ROLE BADGES ==================== */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-utilisateur {
    background: var(--gray-200);
    color: var(--gray-600);
}

.role-formateur {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-administrateur {
    background: #fef3c7;
    color: #b45309;
}

.role-super_admin {
    background: #fecaca;
    color: #dc2626;
}

/* ==================== USER INFO ==================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
}

.user-info .name {
    font-weight: 600;
}

.user-info .email {
    font-size: 0.8rem;
    opacity: 0.8;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== MODE BUTTONS ==================== */
.mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 40px 20px;
}

.mode-buttons .btn {
    min-width: 200px;
    padding: 20px 30px;
}

.creation-form {
    padding: 20px;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.form-header h3 {
    margin: 0;
}

/* ==================== ANSWER INPUTS ==================== */
.answer-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.answer-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.answer-row .form-control {
    flex: 1;
}

/* ==================== QUIZ TYPE OPTIONS ==================== */
.quiz-type-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.quiz-type-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.quiz-type-options label:hover {
    border-color: var(--primary);
}

.quiz-type-options input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

.quiz-type-options input[type="radio"]:checked ~ span {
    color: var(--primary);
}

.quiz-type-options label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

/* ==================== START QUIZ BUTTON ==================== */
.btn-start-quiz {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-start-quiz:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-start-quiz:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.quiz-started-badge {
    background: var(--success);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
}

/* ==================== CROSS-BROWSER ENHANCEMENTS ==================== */
/* Compatible: Chrome, Firefox, Safari, Edge on Windows, Mac, Linux */

/* Input touch optimization */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    -webkit-appearance: none;
    appearance: none;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
    }

    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-success:hover,
    .btn-danger:hover {
        transform: none;
    }

    .option-btn {
        min-height: 48px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Safe area for notched devices (iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* Large desktops (1024px+) */
@media (min-width: 1024px) {
    .btn:active {
        transform: scale(0.98);
    }
}

/* Extra small devices (less than 360px) */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .card-header h2 {
        font-size: 1rem;
    }
}

/* Custom scrollbar (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

/* ==================== STATISTICS LAYOUT ==================== */
.stats-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.stats-kpi-card {
    height: fit-content;
}

.stats-chart-card {
    min-height: 400px;
}

.stats-chart-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.period-selector {
    display: flex;
    gap: 5px;
}

.period-btn {
    padding: 5px 12px !important;
    min-height: 32px !important;
    font-size: 0.8rem;
}

.period-btn.active {
    background: var(--primary);
    color: white;
}

.chart-container {
    position: relative;
    height: 300px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-card {
    background: linear-gradient(135deg, var(--gray-50), white);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--gray-200);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.stat-label {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Responsive stats */
@media (max-width: 992px) {
    .stats-layout {
        grid-template-columns: 1fr;
    }

    .stats-chart-card {
        order: -1;
    }
}

@media (max-width: 480px) {
    .period-selector {
        width: 100%;
        justify-content: center;
    }

    .stats-chart-card .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-container {
        height: 250px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .btn,
    button,
    .header,
    .footer,
    nav,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    @page {
        margin: 1cm;
    }
}
