:root {
  --navy: #172840;
  --blue: #2558a5;
  --blue-soft: #edf4ff;
  --ink: #14223a;
  --muted: #66748a;
  --border: #dce3ed;
  --bg: #f4f6fa;
  --green: #0d805b;
  --green-soft: #edf9f3;
  --red: #b73737;
  --red-soft: #fff1f1;
  --gold: #a86b00;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--blue); }

h1 { font-size: clamp(22px, 3.2vw, 30px); line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 19px; margin: 0 0 8px; }

/* ---------- Header ---------- */
.topbar { background: linear-gradient(115deg, #172840, #305899); color: #fff; }
.topbar-inner {
  max-width: 1150px; margin: auto; padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
}
.brand { color: #fff; font-weight: 800; font-size: 18px; text-decoration: none; margin-inline-end: auto; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.nav a, .nav .linklike { color: #d6e3fb; text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover, .nav .linklike:hover { color: #fff; }
.nav-cta { background: #ffffff1f; padding: 6px 12px; border-radius: 99px; color: #fff !important; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
form.inline { display: inline; margin: 0; }
.langs { display: flex; gap: 4px; }
.lang { color: #d6e3fb; text-decoration: none; font-size: 13px; padding: 4px 8px; border-radius: 8px; }
.lang.active { background: #fff; color: var(--navy); font-weight: 700; }

/* ---------- Layout ---------- */
.shell { max-width: 1150px; margin: auto; padding: 22px 16px 40px; }
.footer { max-width: 1150px; margin: auto; padding: 0 16px 30px; color: var(--muted); font-size: 12px; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(16px, 3vw, 26px); box-shadow: 0 8px 28px #1833540b;
}
.card.narrow { max-width: 520px; margin: 0 auto; }
.center { text-align: center; }

.hero { margin-bottom: 16px; }
.hero p { margin: 0; color: var(--muted); }
.hint { font-size: 14px; margin-top: 6px !important; }

.section { margin: 26px 0 12px; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.mini { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tile { display: block; text-decoration: none; color: inherit; transition: transform .1s; }
.tile:hover { transform: translateY(-2px); }
.tile p { margin: 4px 0 0; }
.tile-icon { font-size: 28px; }
.primary-tile { border-color: #b9cdee; background: linear-gradient(180deg, #fff, var(--blue-soft)); }

.modules { display: grid; gap: 10px; }
.module {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
  padding: 14px 18px;
}
.module:hover { border-color: #9db8e3; }
.module.locked { opacity: .75; }
.module-num {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue); font-weight: 800;
}
.module-body { flex: 1; display: flex; flex-direction: column; }
.module-body small { color: var(--muted); }
.module-tag { flex: none; color: var(--muted); font-size: 20px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: #eef1f6; color: var(--muted); }
.badge.free { background: var(--green-soft); color: var(--green); }
.badge.premium { background: #fff3d6; color: var(--gold); }

.banner { display: block; padding: 14px 18px; border-radius: var(--radius); margin: 0 0 16px; text-decoration: none; }
.banner.ok { background: var(--green-soft); color: var(--green); font-weight: 700; }
.banner.cta { background: var(--navy); color: #fff; display: flex; flex-direction: column; gap: 2px; }
.banner.cta span { color: #c6d6f3; font-size: 14px; }
.banner.small { font-size: 14px; margin-top: 16px; }

.fr { display: block; color: var(--muted); font-style: italic; font-size: .9em; }

/* ---------- Buttons & forms ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 650; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.wide { width: 100%; margin-top: 10px; }
.grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions.col { flex-direction: column; margin-top: 0; }

label { display: block; font-weight: 600; font-size: 14px; margin-top: 12px; }
.field { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; margin-top: 4px; }
.field:focus { outline: 2px solid #9db8e3; border-color: var(--blue); }
.error { color: var(--red); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
input[type=range] { width: 100%; accent-color: var(--blue); }

/* ---------- Quiz ---------- */
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.side { align-self: start; position: sticky; top: 12px; }
.labelrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { background: #eaf0fb; color: #224575; border-radius: 99px; padding: 6px 11px; font-size: 12px; font-weight: 700; }
.line { height: 8px; background: #e1e8f4; border-radius: 10px; overflow: hidden; margin: 12px 0 16px; }
.line span { display: block; height: 100%; background: var(--blue); transition: width .2s; }

.question { font-size: clamp(20px, 2.8vw, 26px); margin: 6px 0 6px; }
.question-fr { margin: 0 0 14px; }

.options { display: grid; gap: 10px; margin-top: 14px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; text-align: start; width: 100%;
  border: 1.5px solid var(--border); background: #fff; border-radius: 12px;
  padding: 13px 15px; font: inherit; color: inherit; cursor: pointer; line-height: 1.45;
}
.option:hover:not(:disabled) { border-color: #9db8e3; }
.option:disabled { cursor: default; }
.option.selected { border-color: #5284ce; background: var(--blue-soft); }
.option.correct { border-color: var(--green); background: var(--green-soft); }
.option.wrong { border-color: var(--red); background: var(--red-soft); }
.letter {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #eef1f6; font-weight: 800; font-size: 13px;
}
.option.selected .letter { background: var(--blue); color: #fff; }
.option.correct .letter { background: var(--green); color: #fff; }
.option.wrong .letter { background: var(--red); color: #fff; }
.opt-text { flex: 1; }

.feedback { margin: 18px 0 0; padding: 14px 16px; border-inline-start: 4px solid var(--green); background: var(--green-soft); border-radius: 8px; }
.feedback.bad { border-color: var(--red); background: var(--red-soft); }
.feedback p { margin: 6px 0 0; }
.status { padding: 10px; border-radius: 10px; background: #f2f6fc; font-size: 13px; }

/* ---------- Results ---------- */
.score { font-size: 54px; font-weight: 850; }
.score.good { color: var(--green); }
.score.bad { color: var(--red); }
.review { padding-inline-start: 20px; }
.review li { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: #f7f9fd; }
.review li.ko { background: var(--red-soft); }
.review li p { margin: 2px 0; }
.review-q { font-weight: 700; }

/* ---------- Paywall ---------- */
.price { font-size: 32px; font-weight: 850; color: var(--blue); margin: 0 0 6px; }
.features { list-style: none; padding: 0; }
.features li { padding: 6px 0; }
.guarantee { background: #fff8e8; border: 1px solid #f1dfb2; border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 14px; }
.guarantee p { margin: 4px 0 0; }

/* ---------- Blazor error bar ---------- */
#blazor-error-ui {
  background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
  display: none; inset-inline: 0; padding: .7rem 1.25rem; position: fixed; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: .75rem; top: .5rem; }

@media (max-width: 820px) {
  .quiz-layout { grid-template-columns: 1fr; }
  .side { position: static; }
}

/* Sign-in code */
.code-field { font-size: 28px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.resend { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ---------- Admin dashboard ---------- */
.admin-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.admin-head .muted { color: var(--muted); font-size: 13px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 16px; }
.admin-stats .stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.admin-stats .stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.admin-stats .stat strong { font-size: 22px; }
.admin-stats .stat.ok strong { color: var(--green); }
.admin-stats .stat.ko strong { color: var(--red); }
.admin-toolbar { display: flex; gap: 10px; margin-bottom: 10px; }
.admin-toolbar .field { flex: 1; margin: 0; }
.admin-grid { height: 560px; width: 100%; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; line-height: 20px; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.ko { background: var(--red-soft); color: var(--red); }
.days.ok { color: var(--green); font-weight: 700; }
.days.warn { color: var(--gold); font-weight: 700; }
.days.ko { color: var(--red); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; line-height: 1.4; }
.nav-admin { font-weight: 700; }
.footer-support { margin-top: 4px; }

/* ---------- Reviews ---------- */
.stars { color: #e3a008; letter-spacing: 1px; }
.reviews-avg { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0 14px; }
.review-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.review-card { display: flex; flex-direction: column; gap: 8px; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.review-head .mini { margin-inline-start: auto; }
.review-text { margin: 0; white-space: pre-line; }
.review-form { max-width: 640px; margin-bottom: 18px; }
.rating-input { border: 0; padding: 0; margin: 0 0 10px; }
.rating-input legend { font-weight: 600; margin-bottom: 6px; }
.star-choice { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-size: 18px; color: #e3a008; }
.status.ok { color: var(--green); font-weight: 600; }
.muted { color: var(--muted); }
.admin-section { margin-top: 26px; }
.reviews-grid { height: 420px; }
.pill.wait { background: #fff3d6; color: var(--gold); }
