/* القيم الافتراضية — تُستبدل من config.json عند التحميل */
:root {
  --primary: #13235B;
  --accent: #1D7FDB;
  --accent-light: #19BDEB;
  --bg: #EEF3FA;
  --surface: #FFFFFF;
  --text: #13235B;
  --muted: #5A6788;
  --border: #D5DEEC;
  --error: #C62D3A;
  --success: #13866A;
  --wa: #1FA855;
  --radius: 14px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  /* نقش المعيّنات المستوحى من الشعار */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M24 14l10 10-10 10-10-10z' fill='%231D7FDB' fill-opacity='.07'/%3E%3C/svg%3E");
  background-size: 48px 48px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.demo-banner {
  background: #FFF4D6;
  color: #6B4E00;
  font-size: 13px;
  text-align: center;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding-block: 28px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand { display: flex; justify-content: center; align-items: center; gap: 18px; }
.brand-logo { width: min(260px, 70%); height: auto; min-width: 0; }
.brand.dual .brand-logo { width: auto; height: 78px; max-width: 46%; object-fit: contain; }
.brand.dual .brand-logo-event { height: 84px; }
.brand-sep { width: 1.5px; align-self: stretch; margin-block: 6px; background: var(--border); }
@media (max-width: 380px) { .brand.dual .brand-logo { height: 62px; } .brand.dual .brand-logo-event { height: 68px; } .brand { gap: 12px; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -18px color-mix(in srgb, var(--primary) 45%, transparent);
  overflow: hidden;
  position: relative;
}
.card::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--accent-light), var(--accent), var(--primary));
}

.state { padding: 24px 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.state-center { align-items: center; text-align: center; }

.cover { width: calc(100% + 44px); margin: -24px -22px 4px; max-width: none; aspect-ratio: 16 / 7; object-fit: cover; }

h1 { margin: 0; font-size: 1.45rem; line-height: 1.35; font-weight: 700; text-wrap: balance; color: var(--primary); }
.lead { margin: 0; color: var(--muted); font-size: 0.97rem; max-width: 46ch; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 12px; margin-top: 6px; }
.fields > * { grid-column: 1 / -1; min-width: 0; }
.fields > .field.half { grid-column: auto; }
@media (max-width: 360px) { .fields > .field.half { grid-column: 1 / -1; } }
.cond-slot { display: contents; }
.cond-slot > .field { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.flabel { font-weight: 500; font-size: 0.95rem; }
.field.attached { margin-top: -8px; }

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--accent);
}

.check {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-size: 0.95rem;
  padding: 11px 12px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius) - 4px);
}
.check input { width: 19px; height: 19px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.check:has(input:checked) { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.check.consent { border-style: solid; }
.field.invalid .check { border-color: var(--error); border-style: solid; }
.consent-link { font-size: 0.86rem; color: var(--accent); margin-inline-start: 31px; }
.other-input { margin-top: 2px; }
.field .req { color: var(--error); margin-inline-start: 2px; }
.field .help { font-size: 0.82rem; color: var(--muted); }
.field .err { font-size: 0.84rem; color: var(--error); }

.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 11px 13px;
  width: 100%;
  min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input[type="tel"], .field input[type="email"] { direction: ltr; text-align: right; }
.field input:not([type=radio]):not([type=checkbox]):focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field.invalid input:not([type=radio]):not([type=checkbox]), .field.invalid select, .field.invalid textarea { border-color: var(--error); }
.field.invalid .choice { border-color: color-mix(in srgb, var(--error) 45%, var(--border)); }
.field input[readonly] {
  background: color-mix(in srgb, var(--border) 35%, var(--surface));
  color: var(--muted);
  cursor: not-allowed;
}

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.45;
}
.choices { gap: 7px; }
.choice input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); margin: 0; }
.choice span { min-width: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }

.form-error {
  margin: 0;
  background: color-mix(in srgb, var(--error) 9%, var(--surface));
  color: var(--error);
  border-radius: calc(var(--radius) - 4px);
  padding: 10px 12px;
  font-size: 0.92rem;
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  min-height: 52px;
  padding: 12px 20px;
  width: 100%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn-primary { background: var(--primary); color: #fff; margin-top: 4px; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { filter: brightness(1.07); }

.spinner {
  width: 34px; height: 34px; margin: 30px auto;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.btn .spinner { width: 20px; height: 20px; margin: 0; border-width: 2.5px; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.5rem;
}
.badge-ok { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.badge-wait { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.badge-stop { background: color-mix(in srgb, var(--error) 12%, var(--surface)); color: var(--error); }

.reg-id { margin: 0; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.qr { padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); line-height: 0; }
.qr img, .qr svg { width: 220px; height: 220px; max-width: 100%; }
.url-line { margin: 0; font-size: 0.85rem; color: var(--muted); word-break: break-all; }

.partners { text-align: center; }
.partners h2 { margin: 0 0 12px; font-size: 0.8rem; font-weight: 500; letter-spacing: .04em; color: var(--muted); }
.partners ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.partners li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
.partners a { display: block; line-height: 0; }
.partners img { height: 38px; width: auto; max-width: 140px; object-fit: contain; }

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