@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

/* ═══════════════════════════════════════════════════════
   EXAM PAGE — BFA Ground Class
   Active exam + review mode
   Responsive: Mobile / Tablet / Desktop
═══════════════════════════════════════════════════════ */

body {
    font-family: 'Outfit', sans-serif;
    background: #f0f4ff;
    color: #0f172a;
}

.dashboard-content {
    background: #f0f4ff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ════════════════════════════════════════
   STICKY EXAM HEADER
════════════════════════════════════════ */
.exam-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid #e8edf5;
    padding: 14px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    overflow: hidden;
}

.exam-header::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #4f5fe0, #818cf8);
}

.exam-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #6366f110 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
}

.exam-header-left {
    position: relative;
    z-index: 1;
}

.exam-eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: #4f5fe0;
    font-weight: 600;
    margin-bottom: 3px;
}

.exam-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: #0f172a;
    line-height: 1.1;
    margin: 0;
    text-transform: capitalize;
}

.exam-header-right {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Review mode badge */
.review-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4f5fe0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 99px;
}

/* Timer */
.timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 99px;
    padding: 6px 16px;
    font-size: 16px;
    font-weight: 700;
    color: #dc2626;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    transition: background 0.3s, border-color 0.3s;
}

.timer.urgent {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.75; }
}

.timer-icon { font-size: 14px; }

/* Progress tracker */
.exam-progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.exam-progress-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.exam-progress-bar {
    width: 120px;
    height: 5px;
    background: #e8edf5;
    border-radius: 99px;
    overflow: hidden;
}

.exam-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f5fe0, #818cf8);
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ════════════════════════════════════════
   QUESTIONS WRAPPER
════════════════════════════════════════ */
.questions-wrapper {
    padding: 28px 40px 48px;
    flex: 1;
    max-width: 1100px;
    width: 100%;
}

/* ════════════════════════════════════════
   QUESTION CARD
════════════════════════════════════════ */
.question-card {
    display: flex;
    gap: 0;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e8edf5;
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, border-color 0.2s;
    animation: qFadeUp 0.4s ease both;
}

.question-card:nth-child(1)  { animation-delay: 0.03s; }
.question-card:nth-child(2)  { animation-delay: 0.06s; }
.question-card:nth-child(3)  { animation-delay: 0.09s; }
.question-card:nth-child(4)  { animation-delay: 0.12s; }
.question-card:nth-child(5)  { animation-delay: 0.15s; }
.question-card:nth-child(6)  { animation-delay: 0.18s; }

/* Answered */
.question-card.answered {
    border-color: #d1fae5;
    box-shadow: 0 2px 10px rgba(16,185,129,0.07);
}

/* ── NUMBER SPINE ── */
.question-spine {
    width: 44px;
    background: #f8fafc;
    border-right: 1px solid #f1f5f9;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 22px;
    flex-shrink: 0;
}

.question-spine span {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.04em;
}

.question-card.answered .question-spine {
    background: #f0fdf4;
    border-color: #d1fae5;
}

.question-card.answered .question-spine span {
    color: #10b981;
}

/* ── QUESTION LEFT ── */
.question-left {
    flex: 1.5;
    padding: 22px 24px 20px;
    min-width: 0;
}

.question-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.6;
    margin-bottom: 18px;
}

/* ── OPTIONS ── */
.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.option {
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 400;
    color: #334155;
    background: #fafbfc;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

@media (hover: hover) {
    .option:not(.correct):not(.wrong):not(.selected):hover {
        border-color: #818cf8;
        background: #eef2ff;
        color: #3730a3;
        transform: translateY(-1px);
    }
}

.option:active:not(.correct):not(.wrong) {
    transform: scale(0.98);
}

/* Selected (saved server-side) */
.option.selected {
    border-color: #4f5fe0;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 500;
}

/* Correct (review mode) */
.option.correct {
    background: #f0fdf4;
    border-color: #10b981;
    color: #065f46;
    font-weight: 500;
}

/* Wrong (review mode — selected but incorrect) */
.option.wrong {
    background: #fff1f2;
    border-color: #f43f5e;
    color: #881337;
    font-weight: 500;
}

/* ── QUESTION RIGHT — explanation ── */
.question-right {
    flex: 1;
    border-left: 1px solid #f1f5f9;
    padding: 20px 22px;
    background: #fafbfc;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Correct answer badge */
.correct-answer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 5px 10px;
    line-height: 1.3;
}

.correct-answer::before {
    content: '✓';
    font-size: 11px;
    font-weight: 700;
}

/* Explanation box */
.explanation-box {
    background: #ffffff;
    border: 1px solid #e8edf5;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13.5px;
    color: #374151;
    line-height: 1.65;
    flex: 1;
    overflow-y: auto;
    max-height: 260px;
}

.explanation-box p {
    margin-bottom: 8px;
}

.explanation-box p:last-child {
    margin-bottom: 0;
}

.explanation-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    display: block;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* ════════════════════════════════════════
   SUBMIT BUTTON
════════════════════════════════════════ */
.submit-container {
    text-align: center;
    margin-top: 12px;
    padding-bottom: 10px;
}

.submit-btn {
    padding: 13px 40px;
    background: #4f5fe0;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.18s;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.submit-btn:hover {
    background: #3d4dc8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,95,224,0.3);
}

.submit-btn:active { transform: translateY(0); box-shadow: none; }

/* ════════════════════════════════════════
   RESULT MODAL
════════════════════════════════════════ */
.result-modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modalIn 0.2s ease;
}

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

.result-box {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    padding: 36px 32px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18);
    animation: boxPop 0.3s cubic-bezier(.22,.68,0,1.2) both;
}

@keyframes boxPop {
    from { opacity: 0; transform: scale(0.88) translateY(20px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.modal-close {
    position: absolute;
    top: 14px; right: 18px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.modal-close:hover { background: #e2e8f0; color: #0f172a; }

/* Score ring */
.score-ring-wrap {
    margin: 0 auto 18px;
    width: 100px;
    height: 100px;
    position: relative;
}

.score-ring-wrap svg {
    transform: rotate(-90deg);
    width: 100%; height: 100%;
}

.score-ring-bg {
    fill: none;
    stroke: #e8edf5;
    stroke-width: 8;
}

.score-ring-fill {
    fill: none;
    stroke: #4f5fe0;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251.2;
    stroke-dashoffset: 251.2;
    transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1);
}

.score-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.result-box h2 {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    color: #0f172a;
    margin-bottom: 18px;
}

/* Stat grid */
.result-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.result-stat-card {
    background: #f8fafc;
    border: 1px solid #e8edf5;
    border-radius: 10px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.result-stat-card .rsc-val {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.result-stat-card .rsc-lbl {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.result-stat-card.correct { border-color: #a7f3d0; background: #f0fdf4; }
.result-stat-card.correct .rsc-val { color: #059669; }
.result-stat-card.wrong   { border-color: #fecdd3; background: #fff1f2; }
.result-stat-card.wrong   .rsc-val { color: #e11d48; }
.result-stat-card.skip    { border-color: #fed7aa; background: #fff7ed; }
.result-stat-card.skip    .rsc-val { color: #d97706; }

/* Modal buttons */
.result-modal-btns {
    display: flex;
    gap: 10px;
}

.result-cta-btn {
    flex: 1;
    padding: 12px;
    background: #4f5fe0;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-appearance: none;
}

.result-cta-btn:hover { background: #3d4dc8; }

.result-cta-btn.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.result-cta-btn.secondary:hover { background: #e2e8f0; color: #0f172a; }

/* ════════════════════════════════════════
   TABLET  640px – 1023px
════════════════════════════════════════ */
@media (max-width: 1023px) {
    .exam-header    { padding: 12px 24px; }
    .exam-header h1 { font-size: 16px; }
    .questions-wrapper { padding: 20px 24px 36px; }
    .exam-progress-bar { width: 90px; }

    .question-card  { flex-direction: column; }

    .question-right {
        border-left: none;
        border-top: 1px solid #f1f5f9;
    }

    .question-spine {
        width: 100%;
        height: 34px;
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
        padding: 0 16px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
}

/* ════════════════════════════════════════
   MOBILE  < 640px
════════════════════════════════════════ */
@media (max-width: 639px) {
    .exam-header {
        padding: 10px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        position: relative;
        margin-top: 58px;
    }

    .exam-header h1 { font-size: 15px; }

    .exam-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .exam-progress-bar { flex: 1; width: auto; }
    .exam-progress-wrap { flex-direction: row; align-items: center; gap: 8px; }
    .exam-progress-label { white-space: nowrap; }

    .timer { font-size: 14px; padding: 5px 12px; }

    .questions-wrapper { padding: 12px 12px 28px; }

    .question-left  { padding: 14px 14px 12px; }
    .question-title { font-size: 14px; margin-bottom: 14px; }

    .options { grid-template-columns: 1fr; gap: 8px; }
    .option   { font-size: 13px; padding: 10px 12px; }

    .question-right   { padding: 12px 14px; }
    .explanation-box  { font-size: 13px; max-height: 200px; }

    .submit-btn { width: 100%; padding: 14px; font-size: 15px; }

    .result-box { padding: 28px 20px 22px; }
    .result-stats-grid { gap: 8px; }
    .result-modal-btns { flex-direction: column; }
}

/* ── ANIMATION ── */
@keyframes qFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
