/* ═══════════════════════════════════════════════════════════════
   Quiz-Gen — "Modern Academy" tokens, shared with omri-iram.co.il
   and Site-quiz: deep navy authority, ochre CTA, light blue surfaces.
   Rubik (display) + Assistant (UI). RTL throughout.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #f9f9ff;
  --bg-alt: #f0f3ff;
  --bg-card: #ffffff;
  --bg-chip: #dee8ff;

  --navy: #002045;
  --navy-container: #1a365d;
  --navy-soft: #d6e3ff;

  --ochre: #ffc250;
  --ochre-deep: #d69e2e;
  --ochre-text: #7d5700;
  --ochre-soft: #ffdeaa;

  --ink: #121c2c;
  --ink-soft: #43474e;
  --line: #c4c6cf;
  --error: #ba1a1a;
  --ok: #1a7f37;

  --shadow-soft: 0 4px 12px rgba(18, 28, 44, .05);
  --shadow-lift: 0 8px 16px rgba(18, 28, 44, .08);
  --radius: 8px;
  --radius-card: 16px;
  --font-display: "Rubik", sans-serif;
  --font-ui: "Assistant", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(214, 227, 255, .55), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(255, 222, 170, .35), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
.wrap-wide { max-width: 1040px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; color: var(--navy); }
h1 { font-size: clamp(24px, 5vw, 34px); font-weight: 700; }
h2 { font-size: clamp(19px, 3.5vw, 24px); font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
p { margin-bottom: 12px; }
a { color: var(--navy-container); }

/* ── progress ─────────────────────────────────────────── */
.progress {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 12px 0 10px;
  margin-bottom: 8px;
}
.progress-track {
  height: 6px; border-radius: 99px; background: var(--navy-soft); overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--navy); border-radius: 99px;
  width: 0; transition: width .3s ease;
}
.progress-label {
  font-size: 13px; color: var(--ink-soft); margin-top: 6px; text-align: center;
}

/* ── cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: clamp(20px, 4vw, 32px);
  margin-bottom: 16px;
}

.lede { color: var(--ink-soft); font-size: 17px; }

/* ── answers ──────────────────────────────────────────── */
.question-text {
  font-family: var(--font-display); font-size: clamp(19px, 4vw, 24px);
  font-weight: 600; color: var(--navy); margin-bottom: 20px;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: block; width: 100%; text-align: right;
  background: var(--bg-alt);
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  padding: 15px 18px;
  font: inherit; font-size: 16px; color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.option:hover { background: var(--bg-chip); }
.option:active { transform: scale(.995); }
.option:focus-visible { outline: 3px solid var(--ochre-deep); outline-offset: 2px; }
/* Selection is shown only after a click. Nothing is ever pre-selected — a
   default answer is an answer the respondent did not give. */
.option.is-picked { background: var(--navy-soft); border-color: var(--navy); }

/* ── buttons ──────────────────────────────────────────── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 16px;
  padding: 13px 26px; border-radius: var(--radius);
  background: var(--ochre); color: var(--navy);
  transition: background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--ochre-deep); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line); font-weight: 600;
}
.btn-ghost:hover { background: var(--bg-alt); }
.btn-sm { padding: 7px 14px; font-size: 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { justify-content: space-between; }
.spacer { flex: 1; }

/* ── gender picker ────────────────────────────────────── */
.gender {
  display: flex; gap: 10px; margin: 18px 0 4px;
}
.gender button {
  flex: 1; font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--bg-card); color: var(--ink);
}
.gender button.is-picked { border-color: var(--navy); background: var(--navy-soft); }
.gender-hint { font-size: 14px; color: var(--ink-soft); }

/* ── forms ────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 16px;
  padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg-card); color: var(--ink);
  /* Explicit, not inherited: an RTL page with an LTR input (an email field,
     a URL field) still has to place the caret and the text correctly. */
  direction: rtl;
}
input[type=email], input[type=url], input.ltr { direction: ltr; text-align: left; }
textarea { min-height: 120px; resize: vertical; font-family: var(--font-ui); }
textarea.code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  direction: ltr; text-align: left; font-size: 13px; min-height: 420px;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--navy-container); outline-offset: 1px;
}
.is-invalid { border-color: var(--error); }
.field { margin-bottom: 14px; }
.field-hint { font-size: 13px; color: var(--ink-soft); font-weight: 400; margin-top: 4px; }

/* ── messages ─────────────────────────────────────────── */
.error, .notice {
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
  font-size: 15px;
}
.error { background: #ffdad6; color: #410002; }
.notice { background: var(--ochre-soft); color: var(--ochre-text); }
.error ul { margin: 6px 18px 0 0; }

/* ── result ───────────────────────────────────────────── */
.outcome-title {
  font-family: var(--font-display); font-size: clamp(22px, 5vw, 30px);
  font-weight: 700; color: var(--navy); margin-bottom: 14px;
}
.outcome-body { font-size: 17px; }
.outcome-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.outcome-block h3 { color: var(--ochre-text); margin-bottom: 6px; }
.score-pill {
  display: inline-block; background: var(--bg-chip); color: var(--navy);
  border-radius: 99px; padding: 5px 14px; font-weight: 700; font-size: 14px;
  margin-bottom: 12px;
}
.share-box {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.share-box input { flex: 1; min-width: 220px; }

/* ── admin ────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { font-weight: 700; color: var(--navy); font-size: 14px; }
.table-scroll { overflow-x: auto; }

.badge {
  display: inline-block; border-radius: 99px; padding: 2px 10px;
  font-size: 13px; font-weight: 700;
}
.badge-draft { background: var(--bg-chip); color: var(--navy-container); }
.badge-published { background: #d7f5dd; color: #0b5c22; }
.badge-ok { background: #d7f5dd; color: #0b5c22; }
.badge-failed { background: #ffdad6; color: #410002; }
.badge-pending { background: var(--ochre-soft); color: var(--ochre-text); }

.bar-track {
  height: 10px; background: var(--bg-alt); border-radius: 99px; overflow: hidden;
  min-width: 90px;
}
.bar-fill { height: 100%; background: var(--navy); }

.topbar {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 14px 0; margin-bottom: 10px; border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--font-display); font-weight: 700; color: var(--navy); }
.muted { color: var(--ink-soft); font-size: 14px; }
.mono { font-family: ui-monospace, Consolas, monospace; direction: ltr;
        display: inline-block; font-size: 13px; }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .wrap { padding: 16px 14px 60px; }
  .card { padding: 18px 16px; }
}
