/* ═══════════════════════════════════════════════
   PrépaConcours — Styles QCM / Rائز
═══════════════════════════════════════════════ */

/* ── Héro du test ──────────────────────────── */
.test-hero {
  color: #fff;
  padding: calc(4rem + 1.5rem) 0 2rem;
}
.test-hero__tag {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(255,255,255,.15);
  border-radius: 99px;
  padding: .25rem .75rem;
  margin-bottom: .75rem;
}
.test-hero__title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  margin-bottom: .5rem;
  font-family: 'Cairo', 'Playfair Display', sans-serif;
}
.test-hero__meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  opacity: .85;
  font-size: .9375rem;
  margin-top: .75rem;
}

/* ── Conteneur Quiz ────────────────────────── */
.quiz-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

/* ── En-tête progression ───────────────────── */
.qz-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.qz-progress {
  flex: 1;
  height: 7px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
}
.qz-progress__fill {
  height: 100%;
  background: var(--clr-primary);
  border-radius: 99px;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}
.qz-header__meta {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}
.qz-counter {
  font-size: .875rem;
  font-weight: 700;
  color: var(--clr-muted);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: center;
}
.qz-timer {
  font-size: .875rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  padding: .15rem .55rem;
  border-radius: 99px;
  background: rgba(29,78,216,.08);
  color: var(--clr-primary);
  transition: background .4s, color .4s;
}
.qz-timer--yellow  { background: #fef9c3; color: #854d0e; }
.qz-timer--red     { background: #fee2e2; color: #b91c1c; animation: qz-pulse .8s infinite alternate; }
.qz-timer--expired { background: #fee2e2; color: #b91c1c; }
@keyframes qz-pulse { from { opacity: 1; } to { opacity: .55; } }

/* ── Question ──────────────────────────────── */
.qz-body { margin-bottom: 1.5rem; }
.qz-q {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--clr-heading);
  margin-bottom: 1.5rem;
}

.qz-q__img, .qz-ri__img {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
  padding: .75rem;
  background: #f8fafc;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md, .75rem);
}
.qz-q__img img, .qz-ri__img img {
  max-width: 100%;
  height: auto;
  border-radius: .4rem;
}
html[data-theme="dark"] .qz-q__img, html[data-theme="dark"] .qz-ri__img {
  background: #0f172a;
}

/* ── Options ───────────────────────────────── */
.qz-opts {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.qz-opt {
  display: flex;
  align-items: center;
  gap: .875rem;
  width: 100%;
  padding: .875rem 1.125rem;
  background: var(--clr-surface);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--clr-body);
  text-align: start;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s;
}
.qz-opt:hover:not(:disabled) {
  border-color: var(--clr-primary);
  background: var(--clr-primary-lt);
  transform: translateX(-2px);
}
[dir="ltr"] .qz-opt:hover:not(:disabled) { transform: translateX(2px); }

.qz-opt__letter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--clr-primary-lt);
  color: var(--clr-primary);
  font-weight: 800;
  font-size: .8125rem;
}

/* États après réponse */
.qz-opt--correct {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
}
.qz-opt--correct .qz-opt__letter { background: #bbf7d0; color: #15803d; }

.qz-opt--wrong {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}
.qz-opt--wrong .qz-opt__letter { background: #fecaca; color: #b91c1c; }

/* ── Feedback ──────────────────────────────── */
.qz-feedback {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  margin-top: 1rem;
  padding: .875rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  line-height: 1.55;
  border-inline-start: 4px solid transparent;
}
.qz-feedback--ok {
  background: #f0fdf4;
  border-inline-start-color: #16a34a;
  color: #15803d;
}
.qz-feedback--ko {
  background: #fef2f2;
  border-inline-start-color: #dc2626;
  color: #991b1b;
}
.qz-feedback__icon { font-size: 1.1em; margin-top: .05em; flex-shrink: 0; }

/* ── Navigation ────────────────────────────── */
.qz-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--clr-border);
  margin-top: 1rem;
}

/* ── Écran résultat ────────────────────────── */
.qz-result { display: flex; flex-direction: column; gap: 2rem; }

.qz-score {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 2px solid;
}
.qz-score--great { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.qz-score--ok    { border-color: #f59e0b; background: #fffbeb; color: #b45309; }
.qz-score--low   { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }

.qz-score__ring {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qz-score__num {
  position: absolute;
  font-size: 1.375rem;
  font-weight: 900;
}
.qz-score__stat {
  font-size: 1.125rem;
  font-weight: 800;
  margin-bottom: .375rem;
}
.qz-score__msg { font-size: .9375rem; line-height: 1.5; opacity: .9; }

/* ── Révision des réponses ─────────────────── */
.qz-review { display: flex; flex-direction: column; gap: .5rem; }
.qz-review-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-heading);
  margin-bottom: .5rem;
}

.qz-ri {
  display: flex;
  gap: .875rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
}
.qz-ri--ok { border-color: #bbf7d0; background: #f0fdf4; }
.qz-ri--ko { border-color: #fecaca; background: #fef2f2; }

.qz-ri__num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 800;
}
.qz-ri--ok .qz-ri__num { background: #16a34a; color: #fff; }
.qz-ri--ko .qz-ri__num { background: #dc2626; color: #fff; }

.qz-ri__q { font-size: .875rem; font-weight: 600; color: var(--clr-heading); margin-bottom: .25rem; }
.qz-ri__correct { font-size: .8125rem; color: #15803d; }
.qz-ri__yours   { font-size: .8125rem; color: #b91c1c; }

.qz-result__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: .5rem;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 600px) {
  .qz-q { font-size: 1.0625rem; }
  .qz-opt { padding: .75rem .875rem; font-size: .875rem; }
  .qz-score { flex-direction: column; align-items: center; text-align: center; }
  .qz-result__actions { flex-direction: column; }
  .qz-result__actions .btn { width: 100%; justify-content: center; }
}


/* ── Quiz usability enhancements ─────────────── */
.qz-hint {
  margin-top: .75rem;
  color: var(--clr-muted);
  font-size: .78rem;
}
.qz-opt:focus-visible,
.qz-foot .btn:focus-visible,
.qz-result__actions .btn:focus-visible {
  outline: 3px solid rgba(29,78,216,.35);
  outline-offset: 3px;
}
.qz-opt--none {
  border-style: dashed;
}
.qz-review {
  max-height: 34rem;
  overflow: auto;
  padding-inline-end: .25rem;
}
@media (max-width: 600px) {
  .qz-foot { position: sticky; bottom: 0; background: #fff; padding-bottom: .75rem; z-index: 2; }
  .qz-foot .btn { flex: 1; justify-content: center; }
  .qz-ri { align-items: flex-start; }
}


/* ── Academy theme quiz refinements ──────────── */
.test-hero {
  background: linear-gradient(135deg, #172033, #1d4ed8 58%, #b45309) !important;
}
.qz-wrap,
.qz-card,
#quiz-root {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.qz-header {
  background: linear-gradient(135deg, #ffffff, #f4f8ff);
  border-bottom-color: var(--clr-border);
}
.qz-counter {
  color: var(--clr-primary-dk);
  background: var(--clr-primary-lt);
  border: 1px solid rgba(29,78,216,.16);
}
.qz-q {
  color: var(--clr-heading);
}
.qz-feedback--ok {
  background: #ecfdf5;
  border-inline-start-color: var(--clr-primary);
  color: var(--clr-primary-dk);
}
.qz-feedback--ko {
  background: #eff6ff;
  border-inline-start-color: #1d4ed8;
  color: #1e3a8a;
}
.qz-ri--ok { border-color: #a7f3d0; background: #ecfdf5; }
.qz-ri--ko { border-color: #bfdbfe; background: #eff6ff; }
.qz-ri--ok .qz-ri__num { background: var(--clr-primary); }
.qz-review-title,
.qz-ri__q { color: var(--clr-heading); }

/* ── Dark mode overrides ─────────────────────────────── */
html[data-theme="dark"] .qz-opt--correct {
  background: rgba(22,163,74,.15) !important;
  border-color: #166534 !important;
  color: #86efac !important;
}
html[data-theme="dark"] .qz-opt--correct .qz-opt__letter {
  background: rgba(22,163,74,.25) !important;
  color: #86efac !important;
}
html[data-theme="dark"] .qz-opt--wrong {
  background: rgba(220,38,38,.15) !important;
  border-color: #991b1b !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .qz-opt--wrong .qz-opt__letter {
  background: rgba(220,38,38,.25) !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .qz-feedback--ok {
  background: rgba(22,163,74,.12) !important;
  border-inline-start-color: #4ade80 !important;
  color: #86efac !important;
}
html[data-theme="dark"] .qz-feedback--ko {
  background: rgba(37,99,235,.12) !important;
  border-inline-start-color: #60a5fa !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .qz-score--great {
  background: rgba(22,163,74,.12) !important;
  border-color: #166534 !important;
  color: #86efac !important;
}
html[data-theme="dark"] .qz-score--ok {
  background: rgba(245,158,11,.10) !important;
  border-color: #92400e !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .qz-score--low {
  background: rgba(220,38,38,.12) !important;
  border-color: #991b1b !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .qz-ri--ok {
  border-color: rgba(74,222,128,.25) !important;
  background: rgba(22,163,74,.10) !important;
}
html[data-theme="dark"] .qz-ri--ko {
  border-color: rgba(147,197,253,.25) !important;
  background: rgba(37,99,235,.10) !important;
}
html[data-theme="dark"] .qz-ri__correct { color: #86efac !important; }
html[data-theme="dark"] .qz-ri__yours   { color: #fca5a5 !important; }
