/* ============================================================
   INTERACTIVE QUIZ WIDGET — Attractive, 3D Hover, RTL-Native,
   Progress Bar, Circular Meter, Review Mode
   ============================================================ */
.up-quiz-widget { direction: rtl; text-align: right; }

/* --- PROGRESS BAR + COUNTER --- */
.up-quiz-progress-wrap { margin-bottom: 24px; }
.up-quiz-progress-bar {
    width: 100%; height: 10px; background: #E2E8F0; border-radius: 20px; overflow: hidden;
}
.up-quiz-progress-fill {
    height: 100%; background: linear-gradient(90deg, #005BAC, #00A651);
    border-radius: 20px; transition: width 400ms ease; width: 0%;
}
.up-quiz-counter { text-align: center; font-size: 13px; color: #64748B; margin-top: 8px; }

/* --- QUESTION CARD --- */
.up-quiz-question {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1.5px solid #E2E8F0; border-radius: 16px; padding: 22px 24px; margin-bottom: 20px;
    position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 91, 172, 0.06);
    transition: box-shadow 300ms ease;
}
.up-quiz-question::before {
    content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px;
    background: linear-gradient(90deg, #005BAC, #00A651, #F9A825);
}
.up-quiz-question:hover { box-shadow: 0 8px 24px rgba(0, 91, 172, 0.12); }
.up-quiz-question-text { font-size: 17px; margin: 6px 0 16px; color: #0F172A; line-height: 1.8; }
.up-quiz-question-text strong {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    background: #005BAC; color: #fff; border-radius: 50%; font-size: 14px; margin-left: 8px; vertical-align: middle;
}

/* --- OPTIONS — 3D HOVER --- */
.up-quiz-options { display: flex; flex-direction: column; gap: 10px; perspective: 800px; }
.up-quiz-option {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px;
    border: 2px solid #E2E8F0; background: #fff; cursor: pointer; font-size: 15px;
    transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 250ms ease, border-color 200ms ease, background 200ms ease;
    transform-style: preserve-3d;
}
.up-quiz-option:hover {
    transform: perspective(800px) rotateX(2deg) translateY(-3px) scale(1.015);
    border-color: #005BAC; background: #F0F7FF; box-shadow: 0 10px 20px rgba(0, 91, 172, 0.15);
}
.up-quiz-option input[type="radio"] { width: 20px; height: 20px; accent-color: #005BAC; flex-shrink: 0; cursor: pointer; }
.up-quiz-option span { flex: 1; }
.up-quiz-option.up-quiz-selected {
    border-color: #005BAC; background: #EAF1FB; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 91, 172, 0.15);
}

/* --- RESULT STATES (after submit) --- */
.up-quiz-option.up-quiz-correct {
    background: linear-gradient(135deg, #E8F8EE, #D4F4E0); border-color: #00A651; color: #0a5c33;
    font-weight: 700; transform: scale(1.02); box-shadow: 0 8px 18px rgba(0, 166, 81, 0.2);
    animation: up-quiz-pop 400ms ease;
}
.up-quiz-option.up-quiz-correct::after {
    content: "✓"; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    background: #00A651; color: #fff; border-radius: 50%; font-size: 13px; font-weight: bold; margin-right: auto;
}
.up-quiz-option.up-quiz-wrong {
    background: linear-gradient(135deg, #FDEDEE, #FBD9DB); border-color: #DC2626; color: #7f1d1d;
    animation: up-quiz-shake 400ms ease;
}
.up-quiz-option.up-quiz-wrong::after {
    content: "✗"; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    background: #DC2626; color: #fff; border-radius: 50%; font-size: 13px; font-weight: bold; margin-right: auto;
}
.up-quiz-option input:disabled { cursor: default; }

@keyframes up-quiz-pop { 0% { transform: scale(1); } 50% { transform: scale(1.06); } 100% { transform: scale(1.02); } }
@keyframes up-quiz-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(4px); } 75% { transform: translateX(-4px); } }

/* --- EXPLANATION --- */
.up-quiz-explanation {
    display: none; margin-top: 14px; padding: 14px 16px; background: linear-gradient(135deg, #FFF7E6, #FFF0CC);
    border: 1.5px solid #F9A825; border-radius: 10px; font-size: 14px; color: #5c4108; line-height: 1.9;
    animation: up-quiz-fadein 400ms ease;
}
.up-quiz-explanation.up-quiz-explanation-visible { display: block; }
.up-quiz-explanation::before { content: "💡 "; }
@keyframes up-quiz-fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* --- BUTTONS --- */
.up-quiz-submit {
    display: block; width: 100%; max-width: 260px; margin: 24px auto 0; padding: 14px; border-radius: 30px;
    border: none; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 250ms ease, box-shadow 250ms ease;
    background: linear-gradient(135deg, #005BAC, #003D75); color: #fff; box-shadow: 0 6px 16px rgba(0, 91, 172, 0.3);
}
.up-quiz-submit:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 24px rgba(0, 91, 172, 0.4); }

/* --- RESULT SCREEN --- */
.up-quiz-result-screen { display: none; text-align: center; margin-top: 30px; }
.up-quiz-result-screen.up-quiz-result-visible { display: block; animation: up-quiz-fadein 500ms ease; }

.up-quiz-score-meter { position: relative; width: 140px; height: 140px; margin: 0 auto 16px; }
.up-quiz-meter-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.up-quiz-meter-track { fill: none; stroke: #E2E8F0; stroke-width: 10; }
.up-quiz-meter-fill { fill: none; stroke: #00A651; stroke-width: 10; stroke-linecap: round; }
.up-quiz-meter-percent {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700; color: #005BAC;
}

.up-quiz-performance-level {
    display: inline-block; font-size: 17px; font-weight: 700; padding: 8px 20px; border-radius: 24px; margin-bottom: 20px;
}
.up-level-excellent { background: #E8F8EE; color: #0a5c33; }
.up-level-verygood { background: #EAF1FB; color: #003d75; }
.up-level-good { background: #FFF7E6; color: #5c4108; }
.up-level-needsimprovement { background: #FDEDEE; color: #7f1d1d; }

.up-quiz-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 480px; margin: 0 auto 24px;
}
.up-quiz-stat {
    background: #F8FAFC; border-radius: 12px; padding: 14px 8px; display: flex; flex-direction: column; gap: 4px;
}
.up-quiz-stat-num { font-size: 22px; font-weight: 700; color: #0F172A; }
.up-quiz-stat span:last-child { font-size: 11.5px; color: #64748B; }
.up-quiz-stat-correct-box .up-quiz-stat-num { color: #00A651; }
.up-quiz-stat-wrong-box .up-quiz-stat-num { color: #DC2626; }

.up-quiz-result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.up-quiz-review-btn, .up-quiz-retry {
    padding: 12px 24px; border-radius: 30px; border: none; font-size: 14.5px; font-weight: 600; cursor: pointer;
    transition: transform 250ms ease, box-shadow 250ms ease;
}
.up-quiz-review-btn { background: #EAF1FB; color: #005BAC; }
.up-quiz-review-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0, 91, 172, 0.2); }
.up-quiz-retry {
    background: linear-gradient(135deg, #00A651, #007A3D); color: #fff; box-shadow: 0 6px 16px rgba(0, 166, 81, 0.3);
}
.up-quiz-retry:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 24px rgba(0, 166, 81, 0.4); }

/* --- COPY LINK BUTTON (chapter-embedded quiz) --- */
.up-quiz-copy-link {
    display: block; width: fit-content; margin: 18px auto 0; padding: 8px 18px; background: transparent;
    border: 1.5px solid #005BAC; color: #005BAC; border-radius: 20px; font-size: 13px; cursor: pointer;
    transition: background 200ms, color 200ms;
}
.up-quiz-copy-link:hover { background: #005BAC; color: #fff; }

@media (max-width: 600px) {
    .up-quiz-question { padding: 16px; border-radius: 12px; }
    .up-quiz-question-text { font-size: 15.5px; }
    .up-quiz-option { padding: 11px 14px; font-size: 14px; }
    .up-quiz-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .up-quiz-score-meter { width: 110px; height: 110px; }
    .up-quiz-meter-percent { font-size: 20px; }
}

/* ============================================================
   REVIEW ANSWERS SECTION — additive only, reuses existing colors
   ============================================================ */
.up-quiz-review-section { display: none; margin-top: 24px; }
.up-quiz-review-section.up-quiz-review-visible { display: block; animation: up-quiz-fadein 400ms ease; }

.up-quiz-review-card {
    background: #FFFFFF; border-radius: 14px; padding: 18px 20px; margin-bottom: 14px;
    border: 1.5px solid #E2E8F0; border-right: 5px solid #E2E8F0;
}
.up-quiz-review-card.up-quiz-review-correct { border-right-color: #00A651; }
.up-quiz-review-card.up-quiz-review-wrong { border-right-color: #DC2626; }

.up-quiz-review-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    font-size: 15px; color: #0F172A; margin-bottom: 10px; line-height: 1.7;
}
.up-quiz-review-badge {
    font-size: 12.5px; font-weight: 700; padding: 4px 14px; border-radius: 20px; flex-shrink: 0;
}
.up-quiz-review-correct .up-quiz-review-badge { background: #E8F8EE; color: #0a5c33; }
.up-quiz-review-wrong .up-quiz-review-badge { background: #FDEDEE; color: #7f1d1d; }

.up-quiz-review-answers { font-size: 14px; color: #334155; line-height: 2; }
.up-quiz-review-label { font-weight: 700; color: #005BAC; }

.up-quiz-review-explanation {
    margin-top: 10px; padding: 12px 14px; background: linear-gradient(135deg, #FFF7E6, #FFF0CC);
    border: 1.5px solid #F9A825; border-radius: 10px; font-size: 13.5px; color: #5c4108; line-height: 1.9;
}

@media (max-width: 600px) {
    .up-quiz-review-card { padding: 14px 16px; }
    .up-quiz-review-header { font-size: 14px; }
}
