/* FILE: public/css/app.css
   PURPOSE: Public form design system. Mobile-first, RTL-safe via logical
   properties (margin-inline, padding-inline, inset-inline) and direction-
   agnostic flex — no hard-coded left/right. Teal brand (#037B63).
   44px min touch targets. */

:root {
  --teal: #037B63;
  --teal-dark: #02614e;
  --teal-tint: #e6f3f0;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 6px 20px rgba(0,0,0,.08);
  --space: 16px;
  --maxw: 720px;

  /* Tokens shared with the booking-site chrome (header / footer / lang switch) */
  --color-primary: #037B63;
  --color-primary-dark: #02614e;
  --color-primary-light: #e6f3f0;
  --color-footer: #208882;
  --color-lang-bg: #0d2d52;
  --color-bg: #ffffff;
  --color-text: #111827;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --font-size-xs: .75rem;
  --font-size-sm: .875rem;
  --font-size-lg: 1.125rem;
  --radius-full: 9999px;
  --transition-fast: 150ms ease;
  --touch-min: 2.75rem;
  --header-height: 3.75rem;
  --container-max: var(--maxw);
  --container-padding: var(--space);
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
}

/* Arabic webfont — matches the booking site. */
@font-face {
  font-family: "Bahij TheSans Arabic";
  src: url("/fonts/Bahij_TheSansArabic-Plain.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bahij TheSans Arabic";
  src: url("/fonts/Bahij_TheSansArabic-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Bahij TheSans Arabic";
  src: url("/fonts/Bahij_TheSansArabic-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  /* sticky footer */
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body.lang-ar {
  font-family: "Bahij TheSans Arabic", "Segoe UI", system-ui, Tahoma, sans-serif;
}

/* ---- Site header (booking-site chrome) ---- */
.site-header {
  background-color: var(--color-bg);
  border-block-end: 1px solid var(--color-border);
  min-height: var(--header-height);
  position: sticky;
  inset-block-start: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--header-height);
  padding-block: var(--space-3);
  padding-inline: var(--container-padding);
  max-width: var(--container-max);
  margin-inline: auto;
}
@media (min-width: 768px) { .header-inner { padding-block: var(--space-4); } }
.header-logo { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; flex-shrink: 0; }
.header-logo img { display: block; height: 2.5rem; width: auto; }
@media (min-width: 768px) { .header-logo img { height: 3.25rem; } }
.header-nav { display: flex; align-items: center; gap: var(--space-1); }
.header-nav-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--touch-min); min-height: var(--touch-min);
  border-radius: var(--radius-full); border: none; background: transparent;
  cursor: pointer; color: var(--color-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none; padding-inline: var(--space-2);
}
.header-nav-btn:hover, .header-nav-btn:focus-visible {
  background-color: var(--color-primary-light); color: var(--color-primary);
}

/* Language toggle — segmented pill */
.lang-switch {
  display: inline-flex; align-items: stretch;
  background-color: var(--color-lang-bg);
  border-radius: var(--radius-full); padding: 3px; line-height: 1;
}
.lang-switch__opt {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2rem; padding-block: var(--space-1); padding-inline: var(--space-3);
  border-radius: var(--radius-full); font-size: var(--font-size-xs); font-weight: 700;
  color: rgba(255,255,255,.65); text-decoration: none; background: transparent; border: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap; cursor: pointer;
}
.lang-switch__opt:hover { color: #fff; background-color: rgba(255,255,255,.12); }
.lang-switch__opt.is-active { background-color: #fff; color: var(--color-lang-bg); box-shadow: var(--shadow-sm); cursor: default; }
.lang-switch__opt:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Screen-reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Page / cards ---- */
.page-main { flex: 1 0 auto; }
.page { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--space); padding-block: 24px 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: clamp(20px, 4vw, 36px);
}
.form-title { margin: 0 0 8px; font-size: clamp(22px, 4vw, 28px); letter-spacing: -.01em; }
.form-intro { margin: 0 0 24px; color: var(--muted); }

/* Honeypot — kept out of view & off the a11y tree without display:none
   (which naive bots detect). */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Fieldsets ---- */
.fieldset {
  border: none;
  margin: 0 0 8px;
  padding: 20px 0 4px;
  border-block-start: 1px solid var(--line);
}
.fieldset:first-of-type { border-block-start: none; padding-block-start: 0; }
.fieldset legend {
  padding: 0;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--teal);
  margin-block-end: 12px;
}

/* ---- Fields ---- */
.field { margin-block-end: 18px; }
.field > label, .field .label {
  display: block;
  font-weight: 600;
  margin-block-end: 7px;
  font-size: 15px;
}
.req { color: var(--danger); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 13px; }

input[type="text"], input[type="number"], input[type="tel"],
input[type="email"], input[type="date"], textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-tint);
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---- Radio / pill rows ---- */
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  user-select: none;
}
.pill input { accent-color: var(--teal); width: 18px; height: 18px; }
.pill:has(input:checked) { border-color: var(--teal); background: var(--teal-tint); color: var(--teal-dark); }
.pill:hover { border-color: var(--teal); }

/* ---- Phones ---- */
.phone-list { display: flex; flex-direction: column; gap: 10px; margin-block-end: 8px; }
.phone-row { display: flex; align-items: center; gap: 8px; }
.phone-row input { flex: 1; }
.phone-remove {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  font-size: 22px; line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.phone-remove:hover { border-color: var(--danger); color: var(--danger); }
.link-btn {
  background: none; border: none; padding: 6px 0;
  color: var(--teal); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---- Session pills ---- */
.session-list { display: flex; flex-direction: column; gap: 10px; }
.session-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.session-pill input { accent-color: var(--teal); width: 18px; height: 18px; }
.session-pill__label { font-weight: 600; }
.session-pill__meta { margin-inline-start: auto; font-size: 13px; color: var(--muted); }
.session-pill:has(input:checked) { border-color: var(--teal); background: var(--teal-tint); }
.session-pill.is-full .session-pill__meta { color: var(--danger); }
.session-pill.is-disabled { opacity: .55; cursor: not-allowed; background: #fafafa; }

/* ---- Consent box ---- */
.consent-box {
  margin-block-start: 6px;
  padding: 18px;
  border: 1px dashed var(--teal);
  border-radius: var(--radius-sm);
  background: var(--teal-tint);
}
.consent-title { margin: 0 0 8px; font-size: 16px; color: var(--teal-dark); }
.consent-body { margin: 0 0 16px; font-size: 14px; color: #374151; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; margin-block-start: 2px; accent-color: var(--teal); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding-inline: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit; font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn--block { width: 100%; margin-block-start: 8px; }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--primary:disabled { opacity: .7; cursor: progress; }
.btn--secondary { background: #fff; color: var(--teal); border-color: var(--teal); margin-block-start: 20px; }
.btn--secondary:hover { background: var(--teal-tint); }

/* ---- Banners / errors ---- */
.banner { padding: 12px 16px; border-radius: var(--radius-sm); margin-block-end: 18px; font-size: 14px; }
.banner--error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.banner--warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.error { color: var(--danger); font-size: 13px; margin: 6px 0 0; min-height: 0; }
.error:empty { margin: 0; }

/* ---- Success ---- */
.success-card { text-align: center; }
.success-icon {
  width: 72px; height: 72px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--teal-tint);
  color: var(--teal); font-size: 34px;
}
.success-detail { color: var(--ink); font-weight: 600; margin-block: 12px 0; }

/* ---- Site footer (booking-site chrome) ---- */
.site-footer {
  background-color: var(--color-footer); color: #fff; text-align: center;
  padding-block: var(--space-3); padding-inline: var(--container-padding);
  font-size: var(--font-size-xs); flex-shrink: 0;
}
.site-footer a { color: rgba(255,255,255,.9); text-decoration: none; unicode-bidi: embed; direction: ltr; display: inline-block; }
.site-footer a:hover { color: #fff; }

/* ---- Rating widget (review-gating) ---- */
.rating-widget { max-width: 28rem; margin-inline: auto; text-align: center; margin-block-start: 20px; }
.rating-heading { margin: 0 0 6px; font-size: 20px; }
.rating-widget .rating-prompt { color: var(--muted); margin-block-end: 16px; }
.rating-stars { display: flex; justify-content: center; gap: .35rem; margin-block-end: 20px; }
.rating-star {
  background: none; border: 0; cursor: pointer; padding: .15rem;
  font-size: 2.5rem; line-height: 1; color: #d8dde3;
  transition: color .12s ease, transform .12s ease;
}
.rating-star:hover { transform: scale(1.14); }
.rating-star:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
.rating-feedback { text-align: start; margin-block-start: 8px; }
.rating-field-label { display: block; text-align: start; font-weight: 600; font-size: .95rem; color: #374151; margin-block-end: 8px; }
.rating-field {
  width: 100%; box-sizing: border-box; display: block; font: inherit; font-size: 1rem; line-height: 1.5;
  color: #1f2937; background: #fff; border: 1.5px solid #d8dde3; border-radius: 12px;
  padding: .8rem .95rem; margin-block-end: 16px; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rating-field::placeholder { color: #9aa3af; }
.rating-field:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(3,123,99,.18); }
textarea.rating-field { resize: vertical; min-height: 7.5rem; }
.rating-thanks { color: var(--teal); font-weight: 600; }
.rating-error { color: var(--danger); margin-block-start: 8px; }
.rating-widget [hidden] { display: none !important; }
.rating-google { margin-block-start: 12px; gap: 8px; }
.rating-g-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #fff; border-radius: 50%; flex-shrink: 0; }
