/* AstraTaxi — one stylesheet for every page. Logical properties keep Arabic (RTL) right. */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #15181e;
  --muted: #5d6573;
  --line: #e2e5ea;
  --brand: #0b5cff;
  --brand-ink: #ffffff;
  --ok: #128a4a;
  --warn: #b26a00;
  --bad: #c62828;
  --pickup: #128a4a;
  --dropoff: #c62828;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 auto; }
.stack > * + * { margin-block-start: .75rem; }
.spacer { flex: 1; }

/* header */
.topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--card); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--ink); }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.lang { display: flex; gap: .25rem; }
.lang button { border: 1px solid var(--line); background: var(--card); padding: .2rem .5rem; border-radius: 6px; font-size: .8rem; cursor: pointer; color: var(--ink); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pilot-banner { background: #fff4d6; color: #6b4b00; text-align: center; font-size: .85rem; padding: .35rem 1rem; border-block-end: 1px solid #f0dca0; }
.env-banner { background: #6a1b9a; color: #fff; text-align: center; font-size: .8rem; padding: .2rem; }

/* layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.order-layout { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 1rem; padding: 1rem; height: calc(100vh - 92px); }
.order-layout .panel { overflow: auto; }
.order-layout .mapbox { min-height: 300px; }
@media (max-width: 820px) {
  .order-layout { grid-template-columns: 1fr; height: auto; padding: .6rem; }
  .order-layout .mapbox { height: 42vh; order: -1; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.map { width: 100%; height: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #e8ecef; }

/* forms */
label { display: block; font-size: .85rem; color: var(--muted); margin-block-end: .25rem; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.field { position: relative; }
.field .dot { position: absolute; inset-inline-start: .7rem; top: 2.15rem; width: 10px; height: 10px; border-radius: 50%; }
.field .dot.a { background: var(--pickup); }
.field .dot.b { background: var(--dropoff); }
.field.with-dot input { padding-inline-start: 1.8rem; }
.field .tools { display: flex; gap: .4rem; margin-block-start: .35rem; }
.check { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-size: .95rem; margin: 0; }
.check input { width: 18px; height: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: .5rem .9rem; font: inherit; cursor: pointer; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; padding: .6rem 1rem; border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; font-weight: 500; }
.btn.big { width: 100%; padding: .9rem 1rem; font-size: 1.05rem; }
.btn.huge { width: 100%; padding: 1.15rem 1rem; font-size: 1.2rem; border-radius: 14px; }

/* autocomplete */
.ac { position: absolute; inset-inline: 0; z-index: 1200; list-style: none; margin: .2rem 0 0; padding: .25rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 300px; overflow: auto; }
.ac li { padding: .5rem .6rem; border-radius: 7px; cursor: pointer; }
.ac li[aria-selected="true"], .ac li:hover { background: #eef3ff; }
.ac li .k { font-size: .75rem; color: var(--muted); }

/* estimate & notices */
.estimate { background: #f0f5ff; border: 1px solid #d6e3ff; border-radius: 10px; padding: .7rem .8rem; }
.estimate .price { font-size: 1.25rem; font-weight: 700; }
.notice { border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; }
.notice.info { background: #eef3ff; color: #1b3a7a; }
.notice.warn { background: #fff4d6; color: #6b4b00; }
.notice.bad { background: #fdecea; color: #8a1c1c; }
.notice.ok { background: #e7f6ee; color: #0d5c33; }
.toast { position: fixed; inset-inline: 1rem; bottom: 1rem; z-index: 3000; max-width: 480px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 10px; padding: .75rem 1rem; box-shadow: var(--shadow); }

/* tracking */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; color: var(--muted); }
.steps li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now::before { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px #d6e3ff; }
.carbox { display: flex; gap: .8rem; align-items: center; }
.plate { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; border: 2px solid var(--ink); border-radius: 6px; padding: .1rem .45rem; background: #fff; letter-spacing: 1px; }
.eta { font-size: 1.6rem; font-weight: 800; }

/* map markers */
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 12px; }
.pin.a { background: var(--pickup); }
.pin.b { background: var(--dropoff); }
.carpin { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: grid; place-items: center; color: #fff; font-size: 15px; }
.carpin.available { background: var(--ok); }
.carpin.offered { background: var(--warn); }
.carpin.busy { background: var(--brand); }
.carpin.stale { opacity: .45; }
.carpin .lbl { position: absolute; top: 30px; white-space: nowrap; font-size: 11px; background: rgba(255,255,255,.92); color: var(--ink); padding: 0 4px; border-radius: 4px; }

/* driver app */
.driver-app { max-width: 560px; margin: 0 auto; padding: .75rem; }
.status-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #eceff3; }
.status-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa3ae; }
.status-chip.available::before { background: var(--ok); }
.status-chip.offered::before { background: var(--warn); }
.status-chip.busy::before { background: var(--brand); }
.offer-overlay { position: fixed; inset: 0; z-index: 4000; background: rgba(10, 14, 22, .72); display: grid; place-items: center; padding: 1rem; }
.offer-card { background: #fff; border-radius: 18px; padding: 1.2rem; width: 100%; max-width: 480px; }
.countdown { font-size: 2.6rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: #eceff3; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--warn); transition: width 1s linear; }
.addr { display: flex; gap: .55rem; align-items: flex-start; }
.addr .d { margin-block-start: .4rem; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.addr .d.a { background: var(--pickup); }
.addr .d.b { background: var(--dropoff); }
.mini-map { height: 220px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .55rem 0; border-block-end: 1px solid var(--line); }
.list li:last-child { border-block-end: 0; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 6px; background: #eceff3; color: var(--ink); margin-inline-end: .25rem; }
.tag.red { background: #fdecea; color: #8a1c1c; }
.tag.blue { background: #e6eeff; color: #123c96; }
.tag.green { background: #e7f6ee; color: #0d5c33; }
.tag.amber { background: #fff4d6; color: #6b4b00; }

/* dispatcher */
.dispatch-layout { display: grid; grid-template-columns: 1fr 440px; height: calc(100vh - 53px); }
.dispatch-layout .map { border-radius: 0; border: 0; }
.board { overflow: auto; border-inline-start: 1px solid var(--line); background: var(--bg); padding: .75rem; }
.board section { margin-block-end: 1rem; }
.board h3 { display: flex; justify-content: space-between; font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.ride-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; margin-block-end: .45rem; cursor: pointer; }
.ride-item:hover { border-color: var(--brand); }
.ride-item.red { border-color: var(--bad); background: #fff6f5; box-shadow: inset 4px 0 0 var(--bad); }
.ride-item.call { border-color: var(--warn); background: #fffaf0; box-shadow: inset 4px 0 0 var(--warn); }
.ride-item .t { font-weight: 600; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(520px, 100vw); background: #fff; z-index: 2500; box-shadow: -8px 0 24px rgba(0,0,0,.15); overflow: auto; padding: 1rem; }
.events { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.events li { padding: .3rem 0; border-block-end: 1px dashed var(--line); }
@media (max-width: 900px) {
  .dispatch-layout { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; height: auto; }
}

/* admin */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-block-end: 1rem; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .45rem .8rem; cursor: pointer; font: inherit; color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .9rem; }
table.grid th, table.grid td { padding: .5rem .6rem; border-block-end: 1px solid var(--line); text-align: start; vertical-align: top; }
table.grid th { background: #f8f9fb; font-weight: 600; color: var(--muted); font-size: .8rem; }
table.grid tr:last-child td { border-block-end: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.modal-bg { position: fixed; inset: 0; z-index: 3500; background: rgba(10,14,22,.5); display: grid; place-items: center; padding: 1rem; }
.modal { background: #fff; border-radius: 14px; padding: 1.1rem; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; }
.zone-map { height: 520px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-block-end: 1rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem; }
.kpi b { display: block; font-size: 1.4rem; }
.login-box { max-width: 380px; margin: 8vh auto; }
.qr svg { width: 200px; height: 200px; }
.leaflet-container { font: inherit; }
[dir="rtl"] .leaflet-control-attribution { direction: ltr; }
