/* ===========================================================================
   Validation UI — queue, read-only version browser, decision sheet.

   Tokens are used WITHOUT fallbacks on purpose: a fallback hides a typo, and an
   invented token then renders the fallback forever and never picks up dark mode
   or any of the eight themes. Bare var() fails visibly instead.

   --qz-text (NOT --qz-ink): ink is the mascot's constant visor colour and has no
   dark-theme override, which is exactly how a previous surface shipped with
   invisible titles in dark mode.
   =========================================================================== */

.qzr-val-empty {
  padding: 18px;
  text-align: center;
  font-size: var(--qz-fs-sm);
  color: var(--qz-muted);
}

.qzr-val-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qzr-val-card {
  padding: 16px;
  border-radius: var(--qz-r-card);
  background: var(--qz-surface);
  border: 1px solid var(--qz-line);
  box-shadow: var(--qz-shadow-sm);
}

.qzr-val-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.qzr-val-badge {
  font-size: var(--qz-fs-xs);
  font-weight: 700;
  color: var(--qz-accent);
  background: var(--qz-accent-soft);
  padding: 3px 9px;
  border-radius: var(--qz-r-pill);
}

.qzr-val-date { font-size: var(--qz-fs-xs); color: var(--qz-muted); }

.qzr-val-title {
  margin: 0 0 4px;
  font-size: var(--qz-fs-sm);
  font-weight: 700;
  color: var(--qz-text);
  line-height: 1.3;
}

.qzr-val-meta { margin: 0 0 12px; font-size: var(--qz-fs-xs); color: var(--qz-muted); }

.qzr-val-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.qzr-val-btn {
  min-height: 40px;              /* comfortable tap target */
  padding: 9px 16px;
  border: 0;
  border-radius: var(--qz-r-pill);
  font-size: var(--qz-fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.qzr-val-btn--ok    { background: var(--qz-accent); color: var(--qz-on-accent); }
.qzr-val-btn--no    { background: var(--qz-error-bg); color: var(--qz-error-ink); }
.qzr-val-btn--ghost { background: transparent; color: var(--qz-text); border: 1px solid var(--qz-line); }
.qzr-val-btn:active { transform: scale(var(--qz-press-scale)); }

/* ── Version list ──────────────────────────────────────────────────────── */

.qzr-val-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.qzr-val-version {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--qz-r-control);
  background: var(--qz-surface);
  border: 1px solid var(--qz-line);
  color: var(--qz-text);
  font-size: var(--qz-fs-sm);
  text-align: left;
  cursor: pointer;
}

.qzr-val-vmeta { margin-left: auto; font-size: var(--qz-fs-xs); color: var(--qz-muted); }

/* Already-included parcours stay listed rather than vanishing: an author who
   remembers offering it needs to see WHY it is not offerable again. */
.qzr-val-version[disabled] { opacity: .55; cursor: default; }

.qzr-val-chip {
  font-size: var(--qz-fs-xs);
  font-weight: 700;
  color: var(--qz-accent);
  background: var(--qz-accent-soft);
  padding: 2px 8px;
  border-radius: var(--qz-r-pill);
}

/* ── Read-only banner ──────────────────────────────────────────────────── */

/* Deliberately loud. Someone reading an old version must never wonder whether
   their changes would save — there is no save here at all. */
.qzr-val-ro {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--qz-r-control);
  background: var(--qz-warning-bg);
  color: var(--qz-warning-ink);
  font-size: var(--qz-fs-xs);
  font-weight: 700;
}

.qzr-val-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--qz-fs-xs);
  font-weight: 700;
  color: var(--qz-text);
}

.qzr-val-textarea {
  width: 100%;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--qz-r-control);
  border: 1px solid var(--qz-line);
  background: var(--qz-surface);
  color: var(--qz-text);
  font: inherit;
  font-size: var(--qz-fs-sm);
  resize: vertical;
}

.qzr-val-snaptitle { margin: 0 0 12px; font-size: var(--qz-fs-sm); color: var(--qz-text); }

.qzr-val-questions { margin: 0; padding-left: 18px; color: var(--qz-text); font-size: var(--qz-fs-sm); }
.qzr-val-questions > li { margin-bottom: 14px; }
.qzr-val-questions p { margin: 0 0 6px; font-weight: 600; }
.qzr-val-questions ul { margin: 0; padding-left: 16px; color: var(--qz-muted); font-size: var(--qz-fs-xs); }
.qzr-val-questions ul li.is-correct { color: var(--qz-success-ink); font-weight: 700; }

/* ── Sheet ─────────────────────────────────────────────────────────────── */

.qzr-val-sheet {
  position: fixed;
  inset: 0;
  z-index: 1080;                 /* above the app chrome, below native dialogs */
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.qzr-val-sheet__panel {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--qz-screen);
  border-radius: var(--qz-r-card) var(--qz-r-card) 0 0;
  box-shadow: var(--qz-shadow-md);
}

.qzr-val-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--qz-line);
}

/* Le titre prend la place restante ; l'action contextuelle et la croix se
   collent à droite (l'entête est en space-between). */
.qzr-val-sheet__head h3 { flex: 1 1 auto; margin: 0; font-size: var(--qz-fs-sm); color: var(--qz-text); }

/* Retour de sous-vue (diff -> versions). Placé avant le titre : c'est la
   convention « pile de vues », et ça le distingue de la croix qui, elle, ferme
   tout. */
.qzr-val-sheet__back {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin-right: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--qz-r-pill);
  background: var(--qz-screen);
  color: var(--qz-muted);
  cursor: pointer;
}
.qzr-val-sheet__back:hover { color: var(--qz-text); }
.qzr-val-sheet__back .fas { font-size: 13px; }

.qzr-val-sheet__head-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.qzr-val-sheet__action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 13px;
  white-space: nowrap;
}
.qzr-val-sheet__action .fas { font-size: .9em; color: var(--qz-muted); }
@media (max-width: 480px) {
  /* Sur petit écran l'entête n'a pas la place du libellé : on garde l'icône
     seule, le libellé reste accessible via aria-label. */
  .qzr-val-sheet__action { padding: 7px 11px; font-size: 0; gap: 0; }
  .qzr-val-sheet__action .fas { font-size: 15px; }
}

.qzr-val-sheet__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--qz-r-pill);
  background: transparent;
  color: var(--qz-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* The body scrolls, not the page — a long version must never make the app
   scroll sideways or trap the reader below the fold.

   text-align is restated because the sheet is appended to <body> and several
   app surfaces set text-align:center on ancestors — inherited centring turned
   the read-only question list into a centred poem. */
.qzr-val-sheet__body {
  padding: 18px;
  overflow-y: auto;
  overflow-x: auto;
  text-align: left;
  /* Verified in dark mode: without this the body inherited the app's #212529
     from <body> and sat near-black on the dark panel. Children that declare
     their own colour were fine — anything that did not would have been
     invisible. */
  color: var(--qz-text);
}

@media (min-width: 720px) {
  .qzr-val-sheet { align-items: center; }
  .qzr-val-sheet__panel { border-radius: var(--qz-r-card); }
}

/* ── Toast ─────────────────────────────────────────────────────────────────
   Lives here rather than in a shared sheet because this file is loaded on
   every page that can raise one, and `utilities.toast` — which three modules
   probe for — does not exist anywhere in the codebase. */

.qzr-toast-host {
  position: fixed;
  left: 50%;
  bottom: 88px;                  /* clear of the bottom nav bar */
  transform: translateX(-50%);
  z-index: 1090;                 /* above the validation sheet */
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 480px);
}

.qzr-toast {
  padding: 11px 18px;
  border-radius: var(--qz-r-pill);
  background: var(--qz-text);
  color: var(--qz-screen);
  font-size: var(--qz-fs-xs);
  font-weight: 600;
  text-align: center;
  box-shadow: var(--qz-shadow-md);
  animation: qzr-toast-in 220ms ease-out both;
}

.qzr-toast.is-out { animation: qzr-toast-out 300ms ease-in both; }

@keyframes qzr-toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes qzr-toast-out { to   { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .qzr-toast, .qzr-toast.is-out { animation: none; }
}

/* ── Reviewer diff ─────────────────────────────────────────────────────────
   The screen exists to answer one question — what changed — so unchanged
   questions collapse and changed fields carry the colour. */

.qzr-diff-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--qz-line);
}

.qzr-diff-origin  { margin: 0 0 4px; font-size: var(--qz-fs-sm); color: var(--qz-text); }
.qzr-diff-counts  { margin: 0; font-size: var(--qz-fs-xs); color: var(--qz-muted); }

.qzr-diff-list { display: flex; flex-direction: column; gap: 10px; }

.qzr-diff-q {
  padding: 12px 14px;
  border-radius: var(--qz-r-control);
  background: var(--qz-surface);
  border: 1px solid var(--qz-line);
  /* A severity stripe, so status reads before any of the text does. */
  border-left-width: 4px;
}

.qzr-diff-q--modified  { border-left-color: var(--qz-warning-ink); }
.qzr-diff-q--added     { border-left-color: var(--qz-success-ink); }
.qzr-diff-q--removed   { border-left-color: var(--qz-error-ink); }
.qzr-diff-q--unchanged { border-left-color: var(--qz-line); opacity: .75; }

/* <details> needs the same box as <article>; the marker is dropped because the
   badge row already says "unchanged" and the triangle only adds noise. */
details.qzr-diff-q > summary { cursor: pointer; list-style: none; }
details.qzr-diff-q > summary::-webkit-details-marker { display: none; }

.qzr-diff-q__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.qzr-diff-q__title {
  margin: 0;
  font-size: var(--qz-fs-sm);
  font-weight: 600;
  color: var(--qz-text);
  line-height: 1.35;
}

.qzr-diff-badge {
  font-size: var(--qz-fs-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--qz-r-pill);
  background: var(--qz-accent-soft);
  color: var(--qz-accent);
}
.qzr-diff-badge--modified  { background: var(--qz-warning-bg); color: var(--qz-warning-ink); }
.qzr-diff-badge--added     { background: var(--qz-success-bg); color: var(--qz-success-ink); }
.qzr-diff-badge--removed   { background: var(--qz-error-bg);   color: var(--qz-error-ink); }
.qzr-diff-badge--unchanged { background: transparent; color: var(--qz-muted); border: 1px solid var(--qz-line); }
.qzr-diff-badge--moved     { background: transparent; color: var(--qz-muted); border: 1px solid var(--qz-line); }

.qzr-diff-pos { margin-left: auto; font-size: var(--qz-fs-xs); color: var(--qz-muted); }

.qzr-diff-changes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qzr-diff-changes--top { margin: 0 0 16px; }

.qzr-diff-change {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr auto 1fr;
  align-items: baseline;
  gap: 8px;
  font-size: var(--qz-fs-xs);
}

.qzr-diff-field  { font-weight: 700; color: var(--qz-muted); }
.qzr-diff-before { color: var(--qz-muted); text-decoration: line-through; word-break: break-word; }
.qzr-diff-arrow  { color: var(--qz-muted); }
.qzr-diff-after  { color: var(--qz-text); font-weight: 600; word-break: break-word; }

/* One column below the fold — four columns of clipped text is unreadable on a
   phone, and this screen is read on phones. */
@media (max-width: 560px) {
  .qzr-diff-change { grid-template-columns: 1fr; gap: 2px; }
  .qzr-diff-arrow { display: none; }
  .qzr-diff-before::after { content: " →"; }
}
