/* ============================================================
   SecurityForMe — Certification Exam Styles
   assets/css/exam.css?v=1
   ============================================================ */

/* ── Tier Selection Grid ──────────────────────────────── */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 960px;
    margin: 2rem auto;
}
@media (max-width: 768px) {
    .exam-grid { grid-template-columns: 1fr; gap: 1rem; }
}

.exam-card {
    background: var(--card, #fff);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}
.exam-card:hover:not(.exam-card--locked) {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
.exam-card--locked {
    opacity: 0.55;
    cursor: not-allowed;
}
.exam-card--passed {
    border-color: #22c55e;
}

/* Tier icon */
.exam-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

/* Tier badge stripe */
.exam-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
}

.exam-card h3 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
    color: var(--ink, #1a1a2e);
}
.exam-card p {
    font-size: 0.88rem;
    color: var(--muted, #64748b);
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

/* Stats row */
.exam-stats {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.exam-stat {
    text-align: center;
}
.exam-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink, #1a1a2e);
}
.exam-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted, #64748b);
}

/* Prerequisite note */
.exam-prereq {
    font-size: 0.78rem;
    color: var(--muted, #64748b);
    margin-bottom: 0.75rem;
}
.exam-prereq strong { color: var(--ink, #1a1a2e); }

/* CTA button */
.exam-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}
.exam-btn:hover { opacity: 0.88; }
.exam-btn--locked {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}
.exam-btn--start { background: #2563eb; color: #fff; }
.exam-btn--retake { background: #f59e0b; color: #1a1a2e; }
.exam-btn--passed { background: #22c55e; color: #fff; }

/* Best score badge */
.exam-best {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted, #64748b);
}
.exam-best strong {
    color: #22c55e;
    font-weight: 700;
}

/* ── Pre-Exam Rules Screen ────────────────────────────── */
.exam-rules {
    max-width: 560px;
    margin: 2rem auto;
    background: var(--card, #fff);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
}
.exam-rules h2 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem;
    color: var(--ink, #1a1a2e);
}
.exam-rules .exam-rules-tier {
    font-size: 0.88rem;
    color: var(--muted, #64748b);
    margin-bottom: 1.5rem;
}
.exam-rules ol {
    text-align: initial;
    padding-inline-start: 1.5rem;
    margin: 0 0 1.5rem;
}
.exam-rules li {
    font-size: 0.88rem;
    color: var(--ink, #1a1a2e);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.exam-rules-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Active Exam UI ───────────────────────────────────── */
.exam-active {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg, #f5f6fa);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top bar */
.exam-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: #0E3A6B;
    color: #fff;
    flex-shrink: 0;
}
.exam-topbar-title { font-weight: 600; font-size: 0.95rem; }
.exam-topbar-progress { font-size: 0.85rem; opacity: 0.85; }
.exam-timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
}
.exam-timer--warn { background: #f59e0b; color: #1a1a2e; }
.exam-timer--critical { background: #dc2626; color: #fff; animation: timer-pulse 0.8s infinite; }
@keyframes timer-pulse { 50% { opacity: 0.6; } }

/* Question area */
.exam-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: center;
}
.exam-question-wrap {
    max-width: 680px;
    width: 100%;
}
.exam-question-num {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted, #64748b);
    margin-bottom: 0.5rem;
}
.exam-question-prompt {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink, #1a1a2e);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Options */
.exam-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--card, #fff);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.exam-option:hover { border-color: #2563eb; }
.exam-option.is-selected {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.06);
}
.exam-option input { margin-top: 0.2rem; accent-color: #2563eb; flex-shrink: 0; }
.exam-option label {
    font-size: 0.95rem;
    color: var(--ink, #1a1a2e);
    cursor: pointer;
    line-height: 1.45;
}

/* Bottom bar */
.exam-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--card, #fff);
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.exam-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.exam-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.15s;
}
.exam-dot--answered { background: #2563eb; }
.exam-dot--current { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.3); }

/* ── Review Screen ────────────────────────────────────── */
.exam-review {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.exam-review h2 {
    font-size: 1.3rem;
    margin: 0 0 1rem;
    color: var(--ink, #1a1a2e);
}
.exam-review-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: var(--ink, #1a1a2e);
    cursor: pointer;
}
.exam-review-item:hover { background: rgba(37,99,235,0.04); }
.exam-review-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.exam-review-dot--answered { background: #2563eb; }
.exam-review-dot--skipped { background: #f59e0b; }
.exam-review-num { font-weight: 600; min-width: 2rem; }

/* ── Result Screen ────────────────────────────────────── */
.exam-result {
    max-width: 480px;
    margin: 3rem auto;
    text-align: center;
    background: var(--card, #fff);
    border-radius: 16px;
    padding: 2.5rem 2rem;
}
.exam-result-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.exam-result h2 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem;
}
.exam-result--pass h2 { color: #22c55e; }
.exam-result--fail h2 { color: #dc2626; }

.exam-score-ring {
    width: 120px; height: 120px;
    margin: 1.5rem auto;
    position: relative;
}
.exam-score-ring svg { transform: rotate(-90deg); }
.exam-score-ring .ring-bg { stroke: #e2e8f0; }
.exam-score-ring .ring-fill { transition: stroke-dashoffset 1s ease; }
.exam-score-ring .ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.exam-result-meta {
    font-size: 0.88rem;
    color: var(--muted, #64748b);
    margin: 1rem 0 1.5rem;
    line-height: 1.6;
}

.exam-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Fullscreen Warning Overlay ───────────────────────── */
.exam-fs-warn {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
}
.exam-fs-warn-box {
    max-width: 400px;
    padding: 2rem;
}
.exam-fs-warn-box h3 {
    font-size: 1.3rem;
    margin: 0 0 0.75rem;
    color: #f59e0b;
}
.exam-fs-warn-box p {
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    opacity: 0.85;
    line-height: 1.5;
}

/* ── Upgrade CTA (for free users) ─────────────────────── */
.exam-upgrade {
    max-width: 560px;
    margin: 2rem auto;
    background: linear-gradient(135deg, #0E3A6B 0%, #1a5276 100%);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    color: #fff;
}
.exam-upgrade h3 { font-size: 1.2rem; margin: 0 0 0.75rem; }
.exam-upgrade p { font-size: 0.9rem; opacity: 0.85; margin: 0 0 1.25rem; }
.exam-upgrade a {
    display: inline-block;
    background: #D4AF37;
    color: #1a1a2e;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

/* ── RTL adjustments ──────────────────────────────────── */
[dir="rtl"] .exam-rules ol { padding-inline-start: 1.5rem; }
[dir="rtl"] .exam-option { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .exam-review-item { flex-direction: row-reverse; text-align: right; }

/* ── Mobile ≤600px ────────────────────────────────────── */
@media (max-width: 600px) {
    .exam-grid { gap: 1rem; }
    .exam-card { padding: 1.5rem 1rem; }
    .exam-stats { gap: 0.75rem; }
    .exam-topbar { padding: 0.5rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .exam-body { padding: 1.25rem 1rem; }
    .exam-question-prompt { font-size: 1rem; }
    .exam-option { padding: 0.75rem 1rem; }
    .exam-bottombar { padding: 0.5rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .exam-dots { max-width: 60%; }
    .exam-rules { padding: 1.5rem 1.25rem; margin: 1rem; }
    .exam-result { padding: 1.5rem 1.25rem; margin: 1.5rem 1rem; }
}
