/* ============================================================
   OSCE THEME & INTERACTIVE COMPONENTS (Adapted for DNB OSCE)
   ============================================================ */

/* TOP PROGRESS BAR & TRACKER */
.osce-top-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1000;
    pointer-events: none;
}

.osce-top-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
    transition: width 0.1s ease-out;
}

.osce-question-tracker {
    position: fixed;
    top: 14px;
    right: 180px;
    z-index: 990;
    display: inline-flex;
    align-items: center;
    pointer-events: auto;
}

.tracker-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9999px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 10px rgba(56, 189, 248, 0.15);
    font-size: 0.82rem;
    color: #f1f5f9;
    user-select: none;
    transition: all 0.2s ease;
}

.tracker-inner:hover {
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 14px rgba(56, 189, 248, 0.25);
}

.tracker-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.tracker-btn:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    transform: scale(1.15);
}

.tracker-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tracker-q-badge {
    font-weight: 600;
    color: #38bdf8;
    white-space: nowrap;
}

.tracker-percent {
    font-size: 0.74rem;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 10px;
}

.tracker-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 2px;
}

.tracker-answers-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #34d399;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
}

.tracker-answers-badge svg {
    color: #34d399;
}

@media (max-width: 900px) {
    .osce-question-tracker {
        top: 10px;
        right: 120px;
    }
    .tracker-inner {
        padding: 4px 10px;
        font-size: 0.75rem;
        gap: 6px;
    }
    .tracker-percent {
        display: none;
    }
}

/* ============================================================
   SPOILERS (ANSWERS HIDING / REVEALING)
   ============================================================ */

.spoiler,
.spoiler-show {
    transition: all 0.25s ease;
    position: relative;
    padding: 1em 1.25em;
    border-radius: 8px;
    margin: 0.85em 0;
    opacity: 1 !important;
}

/* UNOPENED ANSWER: 100% Opaque Amber Glass Cover */
.spoiler {
    cursor: pointer;
    background: linear-gradient(135deg, rgba(30, 24, 12, 0.95), rgba(20, 16, 8, 0.98)) !important;
    border: 1px solid rgba(245, 158, 11, 0.45) !important;
    border-left: 4px solid #f59e0b !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 10px rgba(245, 158, 11, 0.12) !important;
    user-select: none;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Completely hide all content inside hidden spoiler */
.spoiler > * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* REVEALED ANSWER: Crisp Slate/Cyan Glass */
.spoiler-show {
    display: block !important;
    min-height: auto;
    text-shadow: none !important;
    color: #f1f5f9 !important;
    user-select: auto !important;
    cursor: auto !important;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95)) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-left: 4px solid #38bdf8 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.spoiler-show > * {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
    text-shadow: none !important;
}

.spoiler-show img {
    opacity: 1 !important;
    pointer-events: auto;
    filter: none;
}

.spoiler::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    color: #fbbf24;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(245, 158, 11, 0.55);
    border-radius: 20px;
    padding: 6px 20px;
    text-shadow: none !important;
    transition: all 0.2s ease;
    content: "🔒 Show Answer";
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 10px rgba(245, 158, 11, 0.25);
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}

.spoiler-show::before {
    display: none !important;
}

.spoiler:hover::before {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), 0 0 16px rgba(245, 158, 11, 0.45);
    border-color: #fbbf24;
}

.spoiler:hover {
    border-color: rgba(245, 158, 11, 0.7) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25) !important;
}

/* Floating persistent button to show/hide all answers */
.osce-toggle-answers-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    color: #f1f5f9;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 9999px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.2);
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    user-select: none;
}

.osce-toggle-answers-btn:hover {
    background: linear-gradient(135deg, #0284c7, #4f46e5);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4);
}

.osce-toggle-answers-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.osce-toggle-answers-btn .toggle-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.osce-toggle-answers-btn[data-state="shown"] {
    border-color: rgba(244, 63, 94, 0.45);
    color: #fb7185;
}

.osce-toggle-answers-btn[data-state="shown"]:hover {
    background: linear-gradient(135deg, #e11d48, #be123c);
    border-color: #fda4af;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(244, 63, 94, 0.4);
}

@media (max-width: 768px) {
    .osce-toggle-answers-btn {
        bottom: 16px;
        right: 16px;
        padding: 8px 14px;
        font-size: 0.82rem;
    }
}

/* ============================================================
   ANSWERED QUESTION TRACKING (Green Glass)
   ============================================================ */

.spoiler-show.osce-answered {
    opacity: 1 !important;
    border-left: 4px solid #10b981 !important;
    border-color: rgba(52, 211, 153, 0.45) !important;
    background: linear-gradient(135deg, rgba(8, 30, 20, 0.92), rgba(6, 20, 14, 0.95)) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.15) !important;
}

.spoiler.osce-answered {
    opacity: 1 !important;
    border-left: 4px solid #10b981 !important;
    border-color: rgba(52, 211, 153, 0.45) !important;
    background: linear-gradient(135deg, rgba(8, 30, 20, 0.95), rgba(6, 20, 14, 0.98)) !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12) !important;
}

.spoiler.osce-answered::before {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.55);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 10px rgba(52, 211, 153, 0.25);
    content: "✓ Show Answer";
}

.osce-q-answered {
    color: #34d399 !important;
}

.osce-q-answered::after {
    content: " ¹3";
    color: #34d399;
    font-weight: 700;
    font-size: 0.9em;
}

/* Question codes styling */
.osce-q {
    color: #38bdf8;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ============================================================
   OSCE EXAM TIMER (Stacked above Show Answers button)
   ============================================================ */

.osce-timer-widget {
    position: fixed;
    bottom: 74px;
    right: 24px;
    z-index: 98;
}

.osce-timer-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.osce-timer-row:hover {
    border-color: rgba(56, 189, 248, 0.4);
}

.osce-timer-row.osce-timer-warning {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 8px rgba(251, 191, 36, 0.2);
}
.osce-timer-row.osce-timer-warning .osce-timer-display {
    color: #fbbf24;
}

.osce-timer-row.osce-timer-danger {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 10px rgba(239, 68, 68, 0.3);
    animation: osce-timer-pulse 1.5s ease-in-out infinite;
}
.osce-timer-row.osce-timer-danger .osce-timer-display {
    color: #ef4444;
}

@keyframes osce-timer-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(0,0,0,0.3), 0 0 10px rgba(239,68,68,0.3); }
    50% { box-shadow: 0 2px 14px rgba(0,0,0,0.35), 0 0 18px rgba(239,68,68,0.5); }
}

.osce-timer-display {
    font-family: "SF Mono", "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.03em;
    min-width: 58px;
    text-align: center;
}

.osce-timer-sm-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}
.osce-timer-sm-btn:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}
.osce-timer-sm-btn:active {
    transform: scale(0.88);
    color: #38bdf8;
}

/* Collapsible calculator box */
.osce-timer-calc-box {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
}

.osce-timer-calc-label {
    font-weight: 600;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.osce-timer-mpq-input {
    width: 36px;
    height: 22px;
    text-align: center;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #38bdf8;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: "SF Mono", "Cascadia Code", monospace;
    outline: none;
}
.osce-timer-mpq-input:focus {
    border-color: #38bdf8;
}

.osce-timer-calc-apply {
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #f1f5f9;
    background: rgba(56, 189, 248, 0.25);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.osce-timer-calc-apply:hover {
    background: rgba(56, 189, 248, 0.45);
}

.osce-timer-calc-hint {
    font-size: 0.68rem;
    color: #475569;
    font-weight: 500;
}

@media (max-width: 768px) {
    .osce-timer-widget {
        right: 16px;
        bottom: 64px;
    }
    .osce-timer-row {
        padding: 3px 8px;
        gap: 3px;
    }
    .osce-timer-display {
        font-size: 0.75rem;
        min-width: 50px;
    }
    .osce-timer-calc-toggle {
        display: none !important;
    }
}

/* Image zoom cursor */
.osce-zoomable-img {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.osce-zoomable-img:hover {
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25);
}

/* H2 Question Heading Styling */
.note-content h2 {
    color: #38bdf8;
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.5em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
    scroll-margin-top: 90px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-content h2.osce-q-answered {
    color: #34d399 !important;
    border-bottom-color: rgba(52, 211, 153, 0.35);
}

.note-content h2.osce-q-answered::after {
    content: " \2713";
    color: #34d399;
    font-size: 0.9em;
    font-weight: bold;
}
