/* Markhor Junior Exam Portal — Student Exam Panel
   Child-friendly, gaming-inspired, premium, distraction-free.
   Deliberately uses NO sidebar/topbar chrome — just the exam. */

* { box-sizing: border-box; }

body.exam-body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(160deg, #eef2ff 0%, #fdf4ff 50%, #fff7ed 100%);
    color: #1f2937;
    min-height: 100vh;
}

.exam-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ---- Top status bar: progress + timer ---- */
.exam-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 18px;
    padding: 14px 20px;
    box-shadow: 0 8px 20px rgba(79,70,229,0.08);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.exam-topbar .exam-name {
    font-weight: 700;
    font-size: 15px;
    color: #4338ca;
}

.exam-progress-bar {
    flex: 1;
    min-width: 140px;
    height: 10px;
    background: #eef2ff;
    border-radius: 999px;
    margin: 0 20px;
    overflow: hidden;
}

.exam-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
}

.exam-timer.low-time {
    background: #fef2f2;
    color: #b91c1c;
    animation: pulse-warn 1s infinite;
}

@keyframes pulse-warn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ---- Question palette (jump to any question) ---- */
.question-palette {
    background: #fff;
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 8px 20px rgba(79,70,229,0.06);
    margin-bottom: 20px;
}

.palette-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.palette-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #4b5563;
    background: #f3f4f6;
    transition: transform 0.12s ease;
}
.palette-btn:hover { transform: translateY(-2px); }
.palette-btn.current { outline: 3px solid #4f46e5; outline-offset: 2px; }
.palette-btn.answered { background: #d1fae5; color: #047857; }
.palette-btn.unanswered { background: #f3f4f6; color: #6b7280; }

.palette-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
}
.palette-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---- Question card ---- */
.question-card {
    background: #fff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 12px 28px rgba(79,70,229,0.10);
    margin-bottom: 20px;
}

.question-number-badge {
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.question-marks-badge {
    display: inline-block;
    background: #fff7ed;
    color: #c2410c;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    margin-left: 8px;
}

.question-text {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.5;
    color: #1f2937;
    margin-bottom: 16px;
}

.question-image {
    max-width: 100%;
    max-height: 320px;
    border-radius: 16px;
    display: block;
    margin-bottom: 20px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 3px solid #eef0f4;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    background: #fafafa;
}

.option-choice:hover { border-color: #c7d2fe; transform: translateY(-1px); }

.option-choice.selected {
    border-color: #6366f1;
    background: #eef2ff;
}

.option-choice input[type="radio"] {
    width: 22px;
    height: 22px;
    accent-color: #4f46e5;
    flex-shrink: 0;
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #e5e7eb;
    color: #4b5563;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.option-choice.selected .option-letter { background: #4f46e5; color: #fff; }

.option-text { font-size: 15px; flex: 1; }

.option-image { max-width: 100px; max-height: 100px; border-radius: 10px; }

/* ---- Action bar ---- */
.exam-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.exam-btn {
    padding: 14px 24px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.exam-btn:active { transform: scale(0.97); }

.exam-btn-prev { background: #f3f4f6; color: #374151; }
.exam-btn-next { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; box-shadow: 0 8px 18px rgba(99,102,241,0.35); }
.exam-btn-skip { background: #fff7ed; color: #c2410c; }
.exam-btn-review { background: #fef3c7; color: #92400e; }
.exam-btn-submit { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; box-shadow: 0 8px 18px rgba(22,163,74,0.35); font-size: 16px; padding: 16px 30px; }
.exam-btn-disabled { opacity: 0.4; pointer-events: none; }

.autosave-indicator {
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
}
.autosave-indicator.saved { color: #047857; }

/* ---- Instructions / start / success screens ---- */
.exam-intro-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 16px 40px rgba(79,70,229,0.12);
    text-align: center;
    max-width: 560px;
    margin: 60px auto;
}

.exam-intro-icon { font-size: 56px; margin-bottom: 10px; }
.exam-intro-card h1 { font-size: 24px; margin: 0 0 8px; color: #1f2937; }
.exam-intro-card p { color: #6b7280; font-size: 15px; line-height: 1.6; }

.exam-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0;
}
.exam-info-item {
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px 10px;
}
.exam-info-item .value { font-size: 20px; font-weight: 700; color: #4338ca; }
.exam-info-item .label { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-success { background: #ecfdf5; color: #047857; }
.alert-info { background: #eff6ff; color: #1d4ed8; }

/* ---- Form inputs (login screens) ---- */
.exam-form-group { margin-bottom: 18px; text-align: left; }
.exam-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #4338ca;
    margin-bottom: 6px;
}
.exam-form-group input[type="text"],
.exam-form-group input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 3px solid #eef0f4;
    border-radius: 16px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s ease;
    font-family: inherit;
}
.exam-form-group input[type="text"]:focus,
.exam-form-group input[type="password"]:focus {
    border-color: #a5b4fc;
}
.exam-pw-field { position: relative; }
.exam-pw-field input { padding-right: 78px !important; }
.exam-toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #eef2ff;
    color: #4338ca;
    border: none;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.exam-toggle-password:hover { background: #e0e7ff; }

/* ---- Tab-switch warning banner (non-blocking, dismissible) ---- */
.tab-warning-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff7ed;
    border: 2px solid #fed7aa;
    color: #9a3412;
    border-radius: 16px;
    padding: 12px 18px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    animation: slide-down 0.3s ease;
}
.tab-warning-banner.show { display: flex; }
.tab-warning-banner button {
    background: none;
    border: none;
    color: #9a3412;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
@keyframes slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Confirmation modal ---- */
.confirm-overlay {
    position: fixed; inset: 0; background: rgba(17,24,39,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 200;
    padding: 20px;
}
.confirm-box {
    background: #fff; border-radius: 22px; padding: 30px; max-width: 400px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.confirm-box h2 { font-size: 18px; margin: 0 0 10px; }
.confirm-box p { color: #6b7280; font-size: 14px; margin-bottom: 22px; }
.confirm-buttons { display: flex; gap: 10px; }
.confirm-buttons .exam-btn { flex: 1; justify-content: center; }

@media (max-width: 640px) {
    .exam-info-grid { grid-template-columns: 1fr; }
    .question-card { padding: 20px; }
    .exam-actions { flex-direction: column; align-items: stretch; }
    .exam-actions .exam-btn { width: 100%; justify-content: center; }
    .exam-intro-card { padding: 26px 20px; margin: 20px auto; }
    .exam-intro-icon { font-size: 44px; }
    .exam-intro-card h1 { font-size: 20px; }
}
