/*
 * Canonical quiz theme — single source of truth for ALL quizzes on the site:
 *   - proeve.php            (logged-in exam, container .quiz-shell)
 *   - GuestQuiz.php         (guest quiz via quizForGuest(), container .guest-quiz-wrapper.quiz-shell)
 *   - blog.php              (guest quiz embedded in blog posts, delegates to GuestQuiz)
 *
 * Edit HERE to restyle every quiz. Do not re-add per-page quiz CSS.
 * Selectors are class-based (shared markup). The few id-based rules target both
 * the proeve ids (#timer-display …) and the guest ids (#guest-timer-display …).
 */
:root {
    --quiz-accent: #30c78d;
    --quiz-accent-deep: #1e9e6b;
    --quiz-border: #d9ece5;
    --quiz-soft: #f5fffb;
    --quiz-text: #1b2f2a;
    --quiz-red: #e74c3c;
}

/* ---- Shell ---- */
.quiz-shell {
    background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
    border: 1.5px solid var(--quiz-border);
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(13, 38, 31, 0.05);
    overflow: hidden;
    margin-bottom: 1rem;
    text-align: left;
}

.quiz-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
}

.quiz-back {
    font-size: 0.85rem;
    font-weight: 600;
    color: #7a8a85;
    text-decoration: none;
    white-space: nowrap;
}

.quiz-back:hover {
    color: var(--quiz-accent-deep);
    text-decoration: none;
}

.quiz-topbar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    font-weight: 700;
    color: var(--quiz-text);
    font-size: 0.95rem;
}

.quiz-type-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--quiz-accent-deep);
    background: rgba(48, 199, 141, 0.12);
    border-radius: 20px;
    padding: 2px 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7a8a85;
    background: #f4f9f7;
    border-radius: 20px;
    padding: 4px 12px;
    user-select: none;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#timer-display,
#guest-timer-display { cursor: pointer; outline: none; }

.quiz-progress {
    height: 5px;
    background: #eef4f1;
}

.quiz-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--quiz-accent) 0%, var(--quiz-accent-deep) 100%);
    transition: width 0.35s ease;
}

.quiz-body {
    padding: 1.5rem 1.5rem 1.75rem;
}

/* ---- Question ---- */
.q-count {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9fb3ac;
    margin-bottom: 0.6rem;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--quiz-text);
    margin-bottom: 1.25rem;
}

.answer-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 2.6rem 0.95rem 1rem;
    margin: 0.6rem 0;
    border: 1.5px solid #e2ece8;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    line-height: 1.45;
    color: #2c423b;
}

.answer-option::before {
    content: attr(data-answer);
    text-transform: uppercase;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f0f6f3;
    color: #7a8a85;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.answer-option::after {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 800;
    font-size: 0.95rem;
}

.answer-option:hover:not(.disabled) {
    border-color: var(--quiz-accent);
    background: var(--quiz-soft);
}

.answer-option:hover:not(.disabled)::before {
    background: rgba(48, 199, 141, 0.15);
    color: var(--quiz-accent-deep);
}

.answer-option:active:not(.disabled) { transform: scale(0.99); }

.answer-option.selected {
    border-color: var(--quiz-accent);
    background: var(--quiz-soft);
}

.answer-option.correct {
    border-color: var(--quiz-accent);
    background: rgba(48, 199, 141, 0.1);
}

.answer-option.correct::before {
    background: var(--quiz-accent);
    color: #fff;
}

.answer-option.correct::after {
    content: "✓";
    color: var(--quiz-accent-deep);
}

.answer-option.incorrect {
    border-color: var(--quiz-red);
    background: rgba(231, 76, 60, 0.06);
}

.answer-option.incorrect::before {
    background: var(--quiz-red);
    color: #fff;
}

.answer-option.incorrect::after {
    content: "✗";
    color: var(--quiz-red);
}

.answer-option.disabled { cursor: default; }

/* ---- Navigation buttons ---- */
.q-nav {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

.q-btn {
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.q-btn-primary {
    background: var(--quiz-accent);
    color: #fff;
}

.q-btn-primary:hover {
    background: var(--quiz-accent-deep);
    color: #fff;
    text-decoration: none;
}

.q-btn-ghost {
    background: #fff;
    border-color: #dbe7e2;
    color: #5c6f69;
}

.q-btn-ghost:hover {
    border-color: var(--quiz-accent);
    color: var(--quiz-accent-deep);
    text-decoration: none;
}

/* ---- Completion screen ---- */
.finish-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #9fb3ac;
    margin-bottom: 0.5rem;
}

#final-score,
#guest-final-score {
    font-size: 2rem;
    font-weight: 800;
    color: var(--quiz-text);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.25rem;
}

#pass-fail-status h4,
#guest-pass-fail-status h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

#timing-stats p,
#guest-timing-stats p {
    font-size: 0.85rem;
    color: #7a8a85;
    white-space: pre-line;
}

.fact-panel {
    background: var(--quiz-soft);
    border: 1.5px solid var(--quiz-border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    text-align: left;
}

.fact-panel h6 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--quiz-accent-deep);
}

.btn-toggle-facts {
    background: none;
    border: none;
    color: var(--quiz-accent-deep);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.finish-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
    margin-top: 1.5rem;
}

.finish-actions .q-btn { min-width: 240px; }

.finish-home-link {
    font-size: 0.85rem;
    color: #7a8a85;
    margin-top: 0.35rem;
}

.finish-home-link:hover { color: var(--quiz-accent-deep); }

/* ---- Results screen ---- */
.results-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--quiz-text);
    margin-bottom: 1rem;
}

.result-card {
    background: #fff;
    border: 1.5px solid var(--quiz-border);
    border-left-width: 4px;
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}

.result-card.ok { border-left-color: var(--quiz-accent); }
.result-card.bad { border-left-color: var(--quiz-red); }

.result-q {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--quiz-text);
    margin-bottom: 0.75rem;
    line-height: 1.45;
}

.result-card .answer-option {
    margin: 0.4rem 0;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    cursor: default;
    font-size: 0.9rem;
}

.result-fact {
    background: var(--quiz-soft);
    border: 1.5px solid var(--quiz-border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ---- Hidden questions note (proeve only) ---- */
.hidden-questions-notification {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #8a7a3f;
    background: #fffbec;
    border: 1.5px solid #f1e4b3;
    border-radius: 10px;
    padding: 7px 12px;
    cursor: help;
    margin-top: 0.25rem;
}

.hidden-question-item {
    margin-bottom: 5px;
    padding: 4px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #c48e93;
}

.hidden-question-text {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 13px;
}

.hidden-question-reason {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.popover { max-width: 100%; }

/* ---- Mobile ---- */
@media (max-width: 576px) {
    .quiz-topbar {
        padding: 0.7rem 0.9rem;
        gap: 0.5rem;
    }

    .quiz-topbar-title { font-size: 0.88rem; }

    .quiz-body { padding: 1.1rem 1rem 1.3rem; }

    .question-text { font-size: 1.05rem; }

    .answer-option {
        padding-top: 1.05rem;
        padding-bottom: 1.05rem;
        font-size: 1rem;
    }

    .q-nav { margin-top: 1.2rem; }

    .q-btn {
        flex: 1;
        min-height: 48px;
        font-size: 1rem;
    }

    .finish-actions .q-btn {
        width: 100%;
        min-width: 0;
    }

    /* Ensure text doesn't get too small on iOS */
    input, textarea, select { font-size: 16px !important; }
}
