* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: #f4f6f9; color: #1f2937; line-height: 1.5; }
.navbar { background: #1e293b; color: #fff; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nav-links a { color: #e2e8f0; text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: #fff; text-decoration: underline; }
.nav-user { background: #334155; padding: 4px 10px; border-radius: 4px; font-size: 0.82rem; }
.container { max-width: 1200px; margin: 26px auto; padding: 0 20px; }
.auth-card { max-width: 440px; margin: 40px auto; background: #fff; padding: 28px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.card { background: #fff; padding: 22px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,0.07); overflow-x: auto; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.text-center { text-align: center; }
.muted { color: #64748b; font-size: 0.88rem; margin-bottom: 12px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"], input[type="file"], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 5px; font-size: 0.92rem;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 14px; }
.stat-card { background: #fff; padding: 16px; border-radius: 8px; border-left: 4px solid #2563eb; box-shadow: 0 1px 5px rgba(0,0,0,0.06); }
.stat-card h3 { font-size: 1.55rem; color: #1e293b; }
.stat-card p { color: #64748b; font-size: 0.88rem; }
.btn { display: inline-block; padding: 8px 15px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.btn-sm { padding: 4px 9px; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #475569; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.float-right { float: right; }
.alert { padding: 12px 15px; border-radius: 5px; margin-bottom: 16px; font-size: 0.92rem; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
th { background: #f8fafc; font-weight: 700; color: #334155; }
.badge { background: #e2e8f0; color: #1e293b; padding: 3px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; }

/* Exam Interface */
.exam-header { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 16px 22px; border-radius: 8px; margin-bottom: 16px; box-shadow: 0 1px 6px rgba(0,0,0,0.07); }
.timer-box { font-size: 1.15rem; font-weight: 700; color: #dc2626; background: #fef2f2; padding: 8px 14px; border-radius: 6px; border: 1px solid #fecaca; }
.save-badge { font-size: 0.85rem; color: #16a34a; font-weight: 600; }
.palette-card { margin-bottom: 16px; }
.palette-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pal-btn { width: 38px; height: 38px; border: none; border-radius: 5px; font-weight: 700; cursor: pointer; color: #fff; }
.pal-btn.unanswered { background: #dc2626; }
.pal-btn.answered { background: #16a34a; }
.question-slide { display: none; }
.question-slide.active { display: block; }
.q-meta { display: flex; justify-content: space-between; color: #64748b; font-weight: 600; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.q-text { font-size: 1.05rem; margin-bottom: 16px; font-weight: 500; }
.option-item { display: block; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 6px; margin-bottom: 10px; cursor: pointer; }
.option-item:hover { background: #f8fafc; }
.slide-controls { margin-top: 20px; padding-top: 14px; border-top: 1px solid #e2e8f0; overflow: hidden; }
.question-review-box { border: 1px solid #cbd5e1; padding: 16px; border-radius: 6px; margin-bottom: 16px; }
.student-response pre { background: #f8fafc; padding: 12px; border-radius: 5px; white-space: pre-wrap; font-family: inherit; margin-top: 6px; border: 1px solid #e2e8f0; }
.footer { text-align: center; padding: 24px; color: #64748b; font-size: 0.85rem; }

@media print {
    .navbar, .no-print, .footer { display: none !important; }
    body { background: #fff; }
    .card, .stat-card { box-shadow: none; border: 1px solid #ccc; }
}

.print-only-header { display: none; }
@media print {
    .print-only-header { display: block !important; text-align: center; margin-bottom: 16px; }
    .print-only-header h2 { font-size: 16pt; margin-bottom: 4px; color: #000; }
    .print-only-header p { font-size: 10pt; color: #333; margin-bottom: 8px; }
    .btn, form select, form input, form textarea { display: none !important; }
    table { font-size: 9pt; }
    th, td { border: 1px solid #999 !important; padding: 6px !important; }
}

.print-only-footer { display: none; }
@media print {
    @page { size: A4; margin: 10mm 10mm 12mm 10mm; }
    .print-only-header { display: block !important; width: 100%; }
    .print-only-footer { display: block !important; width: 100%; page-break-inside: avoid; }
    .container { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
}
