/* ═══════════════════════════════════════════════════
   TF Quizzes — Front-End Styles
   Theme: Tawheed Foundation dark palette
   Mobile-first
   ═══════════════════════════════════════════════════ */

:root {
    --tfq-dark:      #000000;
    --tfq-navy:      #0a0a0a;
    --tfq-card:      #111111;
    --tfq-card-alt:  #1a1a1a;
    --tfq-gold:      #c9a84c;
    --tfq-gold-lt:   #e2c070;
    --tfq-white:     #f0f4ff;
    --tfq-muted:     #9ca3af;
    --tfq-green:     #22c55e;
    --tfq-red:       #ef4444;
    --tfq-radius:    10px;
    --tfq-shadow:    0 4px 24px rgba(0,0,0,0.6);
    --tfq-font:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Wrapper ─────────────────────────────────────── */
.tfq-wrap {
    font-family: var(--tfq-font);
    color: var(--tfq-white);
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

/* ── Back link ───────────────────────────────────── */
.tfq-back-link {
    display: inline-block;
    color: var(--tfq-muted);
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.2s;
}
.tfq-back-link:hover { color: var(--tfq-gold); }

/* ── Quiz List ───────────────────────────────────── */
.tfq-list-header {
    text-align: center;
    padding: 32px 16px 24px;
}
.tfq-list-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    color: var(--tfq-gold);
    margin: 0 0 8px;
    letter-spacing: 0.02em;
}
.tfq-list-subtitle {
    color: var(--tfq-muted);
    margin: 0;
    font-size: 0.95rem;
}
.tfq-quiz-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.tfq-list-card {
    background: var(--tfq-card);
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: var(--tfq-radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--tfq-shadow);
    transition: border-color 0.2s, transform 0.15s;
    text-decoration: none;
    color: inherit;
}
.tfq-list-card:hover {
    border-color: var(--tfq-gold);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}
.tfq-list-card-icon { font-size: 2rem; flex-shrink: 0; }
.tfq-list-card-body { flex: 1; min-width: 0; }
.tfq-list-card-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--tfq-white);
}
.tfq-list-card-body p {
    font-size: 0.85rem;
    color: var(--tfq-muted);
    margin: 0;
}
.tfq-list-card-btn {
    background: var(--tfq-gold);
    color: #0a0f1e;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}
.tfq-list-card-btn:hover { background: var(--tfq-gold-lt); color: #0a0f1e; }

/* ── Modal ───────────────────────────────────────── */
.tfq-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.tfq-modal {
    background: var(--tfq-navy);
    border-radius: 14px;
    width: 100%;
    max-width: 680px;
    position: relative;
    margin: auto;
    box-shadow: 0 8px 48px rgba(0,0,0,0.6);
    overflow: hidden;
}
.tfq-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--tfq-muted);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1;
    padding: 4px 8px;
}
.tfq-modal-close:hover { color: var(--tfq-white); }
.tfq-loading {
    text-align: center;
    padding: 48px;
    color: var(--tfq-muted);
}

/* ── Quiz Header ─────────────────────────────────── */
.tfq-quiz-header {
    background: linear-gradient(135deg, #000000 0%, #111111 100%);
    padding: 28px 24px 20px;
    border-bottom: 2px solid rgba(201,168,76,0.3);
    text-align: center;
}
.tfq-quiz-title {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    font-weight: 700;
    color: var(--tfq-gold);
    margin: 0 0 8px;
}
.tfq-quiz-desc {
    color: var(--tfq-muted);
    font-size: 0.9rem;
    margin: 0 0 12px;
}
.tfq-meta-pill {
    background: rgba(201,168,76,0.15);
    color: var(--tfq-gold);
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(201,168,76,0.3);
}

/* ── Name Step ───────────────────────────────────── */
.tfq-name-step { padding: 24px 20px; }
.tfq-name-card {
    background: var(--tfq-card);
    border-radius: var(--tfq-radius);
    padding: 32px 24px;
    text-align: center;
    border: 1px solid rgba(201,168,76,0.15);
}
.tfq-name-icon { font-size: 2.5rem; margin-bottom: 12px; }
.tfq-name-card h3 { font-size: 1.1rem; color: var(--tfq-white); margin: 0 0 8px; }
.tfq-name-card p  { color: var(--tfq-muted); font-size: 0.9rem; margin: 0 0 20px; }
.tfq-name-input {
    width: 100%;
    background: var(--tfq-dark);
    border: 1.5px solid rgba(201,168,76,0.3);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--tfq-white);
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 14px;
    outline: none;
}
.tfq-name-input:focus { border-color: var(--tfq-gold); }
.tfq-name-error { color: var(--tfq-red); font-size: 0.85rem; margin-bottom: 12px; }
.tfq-btn-start {
    background: var(--tfq-gold);
    color: #0a0f1e;
    font-weight: 700;
    font-size: 1rem;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}
.tfq-btn-start:hover { background: var(--tfq-gold-lt); }

/* ── Progress bar ────────────────────────────────── */
.tfq-progress-wrap {
    padding: 16px 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tfq-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    min-width: 0;
}
.tfq-progress-indicator {
    height: 100%;
    background: var(--tfq-gold);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.tfq-progress-label {
    color: var(--tfq-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Question Panel ──────────────────────────────── */
.tfq-question-panel { display: none; padding: 20px; }
.tfq-question-panel.active { display: block; }
.tfq-q-number {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tfq-gold);
    margin-bottom: 8px;
    font-weight: 600;
}
.tfq-q-text {
    font-size: clamp(1rem, 3.5vw, 1.15rem);
    font-weight: 600;
    color: var(--tfq-white);
    line-height: 1.5;
    margin-bottom: 18px;
}

/* ── Hint ────────────────────────────────────────── */
.tfq-hint-wrap { margin-bottom: 16px; }
.tfq-hint-toggle {
    background: transparent;
    border: 1px solid rgba(201,168,76,0.4);
    color: var(--tfq-gold);
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
.tfq-hint-toggle:hover { background: rgba(201,168,76,0.1); }
.tfq-hint-text {
    margin-top: 10px;
    background: rgba(201,168,76,0.08);
    border-left: 3px solid var(--tfq-gold);
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
    color: var(--tfq-gold-lt);
    font-size: 0.9rem;
    font-style: italic;
}

/* ── Answers ─────────────────────────────────────── */
.tfq-answers-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.tfq-answers-grid.tfq-locked .tfq-answer-label {
    cursor: default;
    pointer-events: none;
}
.tfq-answer-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--tfq-card);
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: var(--tfq-radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
    user-select: none;
    min-width: 0;
}
.tfq-answer-label:hover {
    border-color: rgba(201,168,76,0.5);
    background: var(--tfq-card-alt);
}
.tfq-answer-label.selected {
    border-color: var(--tfq-gold);
    background: rgba(201,168,76,0.1);
}
.tfq-answer-label.correct-answer  { border-color: var(--tfq-green) !important; background: rgba(34,197,94,0.12) !important; }
.tfq-answer-label.wrong-answer    { border-color: var(--tfq-red)   !important; background: rgba(239,68,68,0.12)   !important; }
.tfq-answer-radio { display: none; }
.tfq-answer-letter {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    color: var(--tfq-muted);
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.tfq-answer-label.selected   .tfq-answer-letter { background: var(--tfq-gold); color: #0a0f1e; }
.tfq-answer-label.correct-answer .tfq-answer-letter { background: var(--tfq-green); color: #fff; }
.tfq-answer-label.wrong-answer   .tfq-answer-letter { background: var(--tfq-red);   color: #fff; }
.tfq-answer-text {
    font-size: 0.9rem;
    color: var(--tfq-white);
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.45;
    padding-top: 3px;
}

/* ── Navigation ──────────────────────────────────── */
.tfq-q-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.tfq-btn-prev, .tfq-btn-next, .tfq-btn-submit {
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.tfq-btn-prev {
    background: transparent;
    color: var(--tfq-muted);
    border: 1px solid rgba(255,255,255,0.15);
}
.tfq-btn-prev:hover { background: rgba(255,255,255,0.06); color: var(--tfq-white); }
.tfq-btn-next {
    background: var(--tfq-card-alt);
    color: var(--tfq-white);
    border: 1px solid rgba(201,168,76,0.3);
    margin-left: auto;
}
.tfq-btn-next:hover { border-color: var(--tfq-gold); }
.tfq-btn-submit {
    background: var(--tfq-gold);
    color: #0a0f1e;
    margin-left: auto;
}
.tfq-btn-submit:hover { background: var(--tfq-gold-lt); }

/* ── Result Panel ────────────────────────────────── */
.tfq-result-panel { padding: 24px 20px; }
.tfq-result-inner {
    background: var(--tfq-card);
    border-radius: 14px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid rgba(201,168,76,0.2);
}
.tfq-result-icon  { font-size: 3rem; margin-bottom: 12px; }
.tfq-result-title { font-size: 1.4rem; font-weight: 700; color: var(--tfq-gold); margin: 0 0 8px; }
.tfq-result-score { font-size: 2.5rem; font-weight: 800; color: var(--tfq-white); margin: 8px 0 4px; }
.tfq-result-pct   { font-size: 1rem; color: var(--tfq-muted); margin-bottom: 24px; }

/* Review section */
.tfq-review-section { text-align: left; margin: 24px 0; }
.tfq-review-item {
    background: var(--tfq-card-alt);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-left: 4px solid transparent;
}
.tfq-review-item.review-correct { border-color: var(--tfq-green); }
.tfq-review-item.review-wrong   { border-color: var(--tfq-red); }
.tfq-review-q   { font-size: 0.85rem; color: var(--tfq-white); font-weight: 600; margin-bottom: 4px; }
.tfq-review-ans { font-size: 0.82rem; color: var(--tfq-muted); }
.tfq-review-ans .correct { color: var(--tfq-green); }
.tfq-review-ans .wrong   { color: var(--tfq-red); }

.tfq-btn-retry {
    background: transparent;
    border: 1.5px solid var(--tfq-gold);
    color: var(--tfq-gold);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.tfq-btn-retry:hover { background: rgba(201,168,76,0.1); }

/* ── Misc ────────────────────────────────────────── */
.tfq-notice-box {
    background: var(--tfq-card);
    border-radius: var(--tfq-radius);
    padding: 24px;
    text-align: center;
    color: var(--tfq-muted);
}
.tfq-error { color: var(--tfq-red); font-size: 0.9rem; padding: 12px; }

/* ── Submit error ────────────────────────────────── */
.tfq-submit-error {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.4);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

/* ── Review heading ──────────────────────────────── */
.tfq-review-heading {
    color: var(--tfq-gold);
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
}

/* ── Desktop enhancements ────────────────────────── */
@media (min-width: 600px) {
    .tfq-wrap { padding: 24px; }
    /* Only use 2-col grid when there are exactly 4 answers (both rows fill) */
    .tfq-answers-grid.tfq-grid-2col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .tfq-name-input { max-width: 400px; }
    .tfq-list-card { padding: 22px; }
}
