/* Montag: صفحة التسجيل المسبق. استبيان بشاشة وحدة، كريمي وداكن، والبرتقالي للأزرار المهمة والتحديد بس. */

:root {
  --cream: #E8DCC8;
  --card: #F1E8D7;
  --ink: #1C1A19;
  --orange: #E8892B;
  --orange-hover: #F09A3E;
  --muted: #4D463E;
  --on-ink: #E8DCC8;
  --on-ink-muted: #BDB19E;
  --line: rgba(28, 26, 25, 0.2);
  --err: #A3261A;
  --radius: 10px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --head: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

/* hidden يغلب أي display (الأزرار inline-flex) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.8;
}

p { margin: 0; }
p + p { margin-top: 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--head);
  font-weight: 600;
  line-height: 1.4;
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 3vw, 2.75rem); line-height: 1.3; }
h2 { font-size: clamp(1.375rem, 1.1rem + 1.4vw, 1.875rem); }
h3 { font-size: 1.1875rem; }

a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

code, .mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }

.wrap { width: min(1040px, 100% - 40px); margin-inline: auto; }

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -64px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
}
.skip:focus { top: 12px; }

/* الشعار (صورة: الحروف داكنة والدائرة برتقالية، فيمشي على الخلفيات الفاتحة بس) */
.logo { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.logo img { display: block; width: auto; height: 28px; }
@media (min-width: 820px) { .logo img { height: 32px; } }

.site-header { padding: 20px 0 0; }

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 12px 28px;
  border: 0;
  border-radius: var(--radius);
  background: var(--orange);
  color: var(--ink);
  font: 600 1.0625rem/1.3 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.btn:hover { background: var(--orange-hover); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.btn-quiet {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: 1rem;
}
.btn-quiet:hover { background: rgba(28, 26, 25, 0.08); }

.btn-link {
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 1rem var(--font);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.btn-link:hover { color: var(--ink); }

/* ---------------------------------------------------------------
   الشاشة: استبيان بس، بدون أقسام تحت
   --------------------------------------------------------------- */
.screen { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.screen-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(640px, 100% - 40px);
  margin-inline: auto;
  padding: 18px 0 14px;
}
.step-count { font-size: 0.9375rem; color: var(--muted); }
.progress { height: 3px; background: var(--line); }
.progress span { display: block; width: 25%; height: 100%; background: var(--ink); transition: width 200ms ease; }

.screen-main { flex: 1; width: min(640px, 100% - 40px); margin-inline: auto; padding: 22px 0 24px; }
.intro { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.intro p { margin-top: 8px; font-size: 1rem; line-height: 1.7; color: var(--muted); }

.screen-foot { padding: 12px 20px 16px; font-size: 0.875rem; color: var(--muted); text-align: center; }
.screen-foot ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }

/* السؤال */
.q { margin: 0; padding: 0; border: 0; min-width: 0; }
.q-title { padding: 0; margin: 0; font-family: var(--head); font-size: clamp(1.375rem, 1.1rem + 1.4vw, 1.875rem); font-weight: 600; line-height: 1.45; }
.q-hint { margin-top: 4px; font-size: 0.9375rem; color: var(--muted); }

/* الخيارات: صفوف عريضة، والمربع أو الدائرة توضح هل يختار واحد أو أكثر */
.options { display: grid; gap: 8px; margin-top: 16px; }
.opt { position: relative; display: block; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opt span {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-weight: 500;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.opt span::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 5px;
}
.opt input[type="radio"] + span::before { border-radius: 50%; }
.opt input:hover + span { border-color: var(--ink); }
.opt input:checked + span { background: var(--orange); border-color: var(--orange); }
.opt input:checked + span::before { background: var(--ink); box-shadow: inset 0 0 0 3px var(--orange); }
.opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

.q-fields { display: grid; gap: 14px; margin-top: 20px; }
.q-fields .err:empty { min-height: 0; }

.survey-nav { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.survey-nav .btn { flex: 1; }
.form-error { margin-top: 16px; }

/* ---------------------------------------------------------------
   الحقول
   --------------------------------------------------------------- */
.field { display: grid; gap: 8px; }
label, legend { font-weight: 600; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.hint { font-weight: 400; font-size: 0.9375rem; color: var(--muted); }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"] {
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: 400 1.0625rem var(--font);
}
input[type="text"]:hover, input[type="email"]:hover, input[type="tel"]:hover, input[type="password"]:hover { border-color: var(--ink); }
input[type="email"], input[type="tel"] { direction: ltr; text-align: right; }
input::placeholder { color: #6B6358; }

.consent { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; font-weight: 400; }
.consent input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--ink); }

.err { min-height: 1.5em; font-size: 0.9375rem; color: var(--err); }
.form-error { padding: 12px 16px; border: 1px solid var(--err); border-radius: var(--radius); color: var(--err); }

/* خانة الفخ للبوتات: تنخفي عن الناس وعن قارئات الشاشة */
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------
   بعد التسجيل: الكود، والدعوة، والأسئلة الشائعة
   --------------------------------------------------------------- */
.thanks:focus { outline: none; }
.thanks h1 { margin-bottom: 6px; }
.thanks .rank { color: var(--muted); }
.codebox { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0; }
.code {
  /* الكود ما ينكسر على سطرين: ياخذ السطر كامل وزر النسخ ينزل تحته */
  flex: 1 1 100%;
  white-space: nowrap;
  padding: 14px 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card);
  font-family: var(--mono);
  font-size: 1.625rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: center;
  direction: ltr;
}
.terms { display: grid; gap: 4px; margin-bottom: 28px; padding-inline-start: 18px; list-style: disc; color: var(--muted); }
.invite { display: grid; gap: 10px; padding-top: 24px; border-top: 1px solid var(--line); }
.invite h2, .after-faq h2 { font-size: 1.125rem; }
.thanks .muted { color: var(--muted); }
.invite .row { display: flex; flex-wrap: wrap; gap: 10px; }
.invite input { flex: 1 1 14rem; direction: ltr; font-family: var(--mono); font-size: 0.9375rem; }
.after-faq { margin-top: 36px; }
.after-faq .faq { margin-top: 8px; }

/* الأسئلة الشائعة */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font-family: var(--head);
  font-weight: 500;
  font-size: 1.0625rem;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); font-size: 1.375rem; line-height: 1.2; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { padding-bottom: 20px; color: var(--muted); }

/* ---------------------------------------------------------------
   الفوتر (سياسة الخصوصية)
   --------------------------------------------------------------- */
.site-footer { padding: 32px 0; border-top: 1px solid var(--line); color: var(--ink); }
.site-footer .foot { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* سياسة الخصوصية */
.doc { max-width: 44rem; padding: 48px 0 80px; }
.doc h1 { font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.5rem); margin-bottom: 12px; }
.doc h2 { margin-top: 40px; margin-bottom: 8px; font-size: 1.375rem; }
.doc ul { margin: 8px 0 0; padding-inline-start: 22px; list-style: disc; }
.doc li + li { margin-top: 6px; }
.doc .muted { color: var(--muted); }

/* ---------------------------------------------------------------
   لوحة المتابعة
   --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; text-align: start; border-bottom: 1px solid var(--line); }
@media (min-width: 600px) { th, td { padding: 16px 20px; } }
tr:last-child td { border-bottom: 0; }
th { font-size: 0.9375rem; font-weight: 600; color: var(--muted); }
td:first-child { font-weight: 600; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }

.admin-wrap { width: min(1240px, 100% - 32px); }
.admin { padding: 28px 0 80px; }
.login { display: grid; gap: 16px; max-width: 24rem; margin-top: 24px; }
.login .err.ok { color: var(--ink); }
.pw-change { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.pw-change h2 { font-size: 1.25rem; }
.pw-change .login { margin-top: 12px; }

.admin-bar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.count-box { display: flex; align-items: baseline; gap: 10px; }
.count-box b { font-size: 3rem; font-weight: 500; line-height: 1; }
.count-box span { font-size: 1.125rem; color: var(--muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sm { min-height: 36px; padding: 4px 14px; font-size: 0.9375rem; }
.search { margin-bottom: 16px; }
input[type="search"] {
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: 400 1rem var(--font);
}

/* جدول المسجلين: جدول على الكمبيوتر، وبطاقات على الجوال */
.people-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.people { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.people th, .people td { padding: 12px 14px; vertical-align: top; }
.people td:first-child { font-weight: 400; }
.people td.n { color: var(--muted); }
.people td.name { font-weight: 600; }
.people td a { text-decoration: none; border-bottom: 1px solid var(--line); }
.people td a:hover { border-bottom-color: var(--ink); }
.people .act { text-align: end; }
.people-wrap .empty { padding: 20px; color: var(--muted); }

@media (max-width: 999px) {
  .people thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .people, .people tbody, .people tr, .people td { display: block; width: 100%; }
  .people tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .people tr:last-child { border-bottom: 0; }
  .people td { display: grid; grid-template-columns: 7.5rem 1fr; gap: 8px; padding: 4px 0; border: 0; }
  .people td::before { content: attr(data-label); color: var(--muted); font-family: var(--font); font-weight: 400; }
  .people td > .mono, .people td > .ltr { justify-self: start; }
  .people td.name { font-size: 1.0625rem; }
  .people td.act { display: block; padding-top: 10px; text-align: start; }
  .people td.act::before, .people td.n::before { content: none; }
  .people td.n { display: none; }
}

/* ملف الشخص للطباعة (PDF): مخفي على الشاشة */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 18mm; }
  body.printing { background: #fff; }
  body.printing .admin-page { display: none !important; }
  body.printing .print-sheet { display: block; color: #000; font-size: 12pt; line-height: 1.7; }
  .ps-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10pt; border-bottom: 1pt solid #000; }
  .ps-head img { display: block; width: auto; height: 34pt; }
  .ps-sub { font-size: 10pt; }
  .ps-name { margin: 18pt 0 12pt; font-size: 22pt; }
  .ps-list { display: grid; grid-template-columns: 38mm 1fr; margin: 0; border-top: 0.5pt solid #999; }
  .ps-list dt, .ps-list dd { margin: 0; padding: 7pt 0; border-bottom: 0.5pt solid #999; }
  .ps-list dt { color: #444; }
  .ps-list dd { font-weight: 600; }
  .ps-foot { margin-top: 18pt; font-size: 9.5pt; color: #444; }
}

@media (min-width: 820px) {
  .screen-main { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
