/* ع الطاير — التصميم
   فكرة التصميم: لوحات الإرشاد في شوارع القاهرة. خط عريض بشكل لافتات الشوارع،
   أصفر التاكسي كلون للأشخاص، وأخضر مزرق لخط سير الأوردرات. العنصر المميز الوحيد:
   خط الرحلة المتقطع اللي بتمشي عليه نقطة مرة واحدة عند فتح الصفحة. */

:root {
  --bg: #F5F6F7;
  --surface: #FFFFFF;
  --fg: #12161C;
  --muted: #566170;
  --line: #DADFE5;
  --taxi: #FFB800;
  --on-taxi: #12161C;
  --route: #0B7A86;
  --on-route: #FFFFFF;
  --wa: #14803F;
  --on-wa: #FFFFFF;
  --night: #12161C;
  --on-night: #F2F4F6;
  --focus: #1B5CFF;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(18, 22, 28, .06), 0 10px 28px rgba(18, 22, 28, .07);

  --font-display: 'Lalezar', 'Cairo', 'Tahoma', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tahoma', system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 32px);
  --radius: 16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1318;
    --surface: #171C23;
    --fg: #EEF1F4;
    --muted: #9AA6B4;
    --line: #2A323C;
    --route: #35BFCB;
    --on-route: #06262A;
    --wa: #2FB868;
    --on-wa: #04210F;
    --night: #070A0D;
    --focus: #7AA2FF;
    --danger: #FF8A80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0F1318;
  --surface: #171C23;
  --fg: #EEF1F4;
  --muted: #9AA6B4;
  --line: #2A323C;
  --route: #35BFCB;
  --on-route: #06262A;
  --wa: #2FB868;
  --on-wa: #04210F;
  --night: #070A0D;
  --focus: #7AA2FF;
  --danger: #FF8A80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100%;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; }
svg { display: block; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- الهيدر ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark { width: 40px; height: 40px; flex: none; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  padding-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: none;
  text-decoration: none;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover { background: var(--line); }
.nav-link[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 3px; text-decoration-color: var(--taxi); }

@media (min-width: 720px) {
  .nav-link { display: inline-block; }
}

/* ---------- الأزرار ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 999px;
  font: 600 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background-color .12s ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }

.btn-taxi { background: var(--taxi); color: var(--on-taxi); }
.btn-taxi:hover { background: #FFC933; }
.btn-route { background: var(--route); color: var(--on-route); }
.btn-wa { background: var(--wa); color: var(--on-wa); }
.btn-wa:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: .9375rem; }

.btn:disabled {
  cursor: not-allowed;
  background: var(--line);
  color: var(--muted);
}

/* ---------- الصفحة الرئيسية ---------- */

.hero { padding-block: clamp(28px, 6vw, 64px) clamp(24px, 4vw, 40px); }

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4.75rem);
  max-width: 14ch;
}

.hero-sub {
  margin-top: 14px;
  max-width: 34rem;
  font-size: 1.125rem;
  color: var(--muted);
}

.hero-route {
  width: 100%;
  height: auto;
  max-height: 130px;
  margin-block: 22px 10px;
  overflow: visible;
}

.route-path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 12;
  opacity: .7;
}

.route-end-a { fill: var(--taxi); stroke: var(--fg); stroke-width: 3; }
.route-end-b { fill: var(--route); stroke: var(--fg); stroke-width: 3; }
.route-rider { fill: var(--taxi); stroke: var(--fg); stroke-width: 3; }

.doors {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .doors { grid-template-columns: 1fr 1fr; gap: 18px; }
}

.door {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: clamp(20px, 3vw, 28px);
  border-radius: 22px;
  text-decoration: none;
  min-height: 210px;
  transition: transform .15s ease;
}

.door:hover { transform: translateY(-2px); }
.door-people { background: var(--taxi); color: var(--on-taxi); }
.door-orders { background: var(--route); color: var(--on-route); }

.door-icon { width: 52px; height: 52px; margin-bottom: 8px; }
.door-title { font-family: var(--font-display); font-size: 2rem; line-height: 1.2; }
.door-text { max-width: 24rem; opacity: .92; }

.door-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.door-cta svg { width: 20px; height: 20px; }

.section { padding-block: clamp(36px, 6vw, 72px) 0; }
.section h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 20px; }

.steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding-block: 16px;
  border-top: 1px solid var(--line);
}

.steps li:last-child { border-bottom: 1px solid var(--line); }

.steps li::before {
  content: counter(step, arabic-indic);
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--taxi);
  color: var(--on-taxi);
  font-family: var(--font-display);
  font-size: 1.4rem;
  padding-top: 4px;
}

.steps h3 { font-size: 1.35rem; margin-bottom: 2px; }
.steps p { color: var(--muted); max-width: 40rem; }

.facts { display: grid; gap: 0; margin: 0; }
.facts div { padding-block: 16px; border-top: 1px solid var(--line); }
.facts div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; font-size: 1.0625rem; }
.facts dd { margin: 2px 0 0; color: var(--muted); max-width: 40rem; }

@media (min-width: 720px) {
  .facts div { display: grid; grid-template-columns: 17rem 1fr; gap: 24px; }
  .facts dd { margin: 0; }
}

.contact {
  margin-top: clamp(36px, 6vw, 72px);
  background: var(--night);
  color: var(--on-night);
  padding-block: clamp(32px, 6vw, 56px);
}

.contact-row { display: grid; gap: 18px; align-items: center; }
.contact h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.contact p { color: #B7C0CB; max-width: 32rem; }
.contact .number { font-size: 1.25rem; font-weight: 600; letter-spacing: .02em; direction: ltr; unicode-bidi: plaintext; text-align: right; color: var(--on-night); }

@media (min-width: 720px) {
  .contact-row { grid-template-columns: 1fr auto; gap: 40px; }
}

.captain-cta {
  display: grid;
  gap: 12px;
  padding-block: clamp(28px, 5vw, 44px);
}

.captain-cta h2 { font-size: 1.75rem; margin: 0; }
.captain-cta p { color: var(--muted); max-width: 34rem; }
.captain-cta .btn { justify-self: start; }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 22px 32px;
  color: var(--muted);
  font-size: .9375rem;
}

.footer-row { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- صفحات النماذج ---------- */

.page-head { padding-block: clamp(24px, 5vw, 48px) 8px; }
.page-head h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
.page-head p { margin-top: 8px; color: var(--muted); max-width: 36rem; }

.form-page { padding-bottom: 56px; }

.form-block {
  display: grid;
  gap: 16px;
  padding-block: 24px;
  border-top: 1px solid var(--line);
}

.form-block > h2 { font-size: 1.5rem; }

.field { display: grid; gap: 6px; min-width: 0; }

.field label, .field .label {
  font-weight: 600;
  font-size: .9375rem;
}

.field .hint { color: var(--muted); font-size: .875rem; }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font: 400 1rem/1.5 var(--font-body);
}

input[type="tel"], input[type="email"], input[type="password"] { direction: ltr; text-align: right; }
input[type="tel"]::placeholder, input[type="email"]::placeholder { direction: rtl; text-align: right; }

textarea { min-height: 84px; resize: vertical; }

input:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
input:user-invalid, textarea:user-invalid { border-color: var(--danger); }

.field-error { color: var(--danger); font-size: .875rem; min-height: 0; }

.two-up { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .two-up { grid-template-columns: 1fr 1fr; } }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 5px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.seg input { position: absolute; opacity: 0; pointer-events: none; }

.seg label {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

.seg input:checked + label { background: var(--fg); color: var(--bg); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.seg-people input:checked + label { background: var(--taxi); color: var(--on-taxi); }
.seg-orders input:checked + label { background: var(--route); color: var(--on-route); }

.map-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

#req-map {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: clamp(300px, 52vh, 440px);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
  direction: ltr;
}

.map-status { min-height: 1.5em; color: var(--muted); font-size: .9375rem; }
.map-status.is-error { color: var(--danger); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9375rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--fg); display: inline-block; }
.legend .dot-a { background: var(--taxi); }
.legend .dot-b { background: var(--route); }

.pin { background: none; border: 0; }
.pin-dot {
  position: absolute;
  top: 6px; left: 2px;
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin-color, #FFB800);
  border: 3px solid #12161C;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}
.pin-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #FFFFFF;
}
.pin-a { --pin-color: #FFB800; }
.pin-b { --pin-color: #0B7A86; }

.leaflet-container { font-family: var(--font-body); }

.pay-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .pay-grid { grid-template-columns: repeat(3, 1fr); } }

.pay-grid input { position: absolute; opacity: 0; pointer-events: none; }

.pay-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.pay-grid label::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  flex: none;
}

.pay-grid input:checked + label { border-color: var(--fg); }
.pay-grid input:checked + label::before { border-color: var(--fg); background: radial-gradient(circle, var(--fg) 0 45%, transparent 50%); }
.pay-grid input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.pending {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 2px dashed var(--muted);
  border-radius: var(--radius);
  background: var(--surface);
}

.pending-tag {
  justify-self: start;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--taxi);
  color: var(--on-taxi);
  font-weight: 600;
  font-size: .875rem;
}

.pending dl { display: grid; gap: 4px; margin: 0; }
.pending dl div { display: flex; justify-content: space-between; gap: 12px; }
.pending dt { color: var(--muted); }
.pending dd { margin: 0; font-weight: 600; }
.pending p { color: var(--muted); font-size: .9375rem; }

.submit-row { display: grid; gap: 12px; }
@media (min-width: 720px) { .submit-row { grid-template-columns: 1fr 1fr; align-items: start; } }
.submit-row .note { color: var(--muted); font-size: .875rem; margin-top: 6px; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-block: 8px 0; }
.tabs button {
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid var(--line);
  background: none;
  color: var(--muted);
  font: 600 1rem var(--font-body);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--taxi); }

.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-preview {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface) center / cover no-repeat;
  flex: none;
}

.narrow { max-width: 34rem; }

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

/* ---------- حسابات الكباتن والإدارة ---------- */

.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: right; }

.msg {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: var(--surface);
}
.msg.is-error { border-color: var(--danger); color: var(--danger); }
.msg.is-ok { border-color: var(--route); }

.avatar {
  width: 72px; height: 72px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 1.75rem;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 48px; height: 48px; font-size: 1.25rem; }

.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  border: 2px solid currentColor;
}
.badge-wait { color: var(--muted); }
.badge-ok { color: var(--route); }
.badge-bad { color: var(--danger); }

#cap-home { display: grid; gap: 16px; margin-top: 8px; }
.cap-card { display: flex; gap: 16px; align-items: center; padding-block: 12px; }
.cap-card-body { display: grid; gap: 4px; min-width: 0; }
.cap-card-body h2 { font-size: 1.5rem; }
.cap-explain { max-width: 34rem; }
#cap-home .btn { justify-self: start; }

.adm-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.cap-list { display: grid; gap: 0; }
.cap-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: center;
  padding-block: 14px;
  border-top: 1px solid var(--line);
}
.cap-row:last-child { border-bottom: 1px solid var(--line); }
.cap-row-body { display: grid; gap: 2px; justify-items: start; min-width: 0; }
.row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
