/* TaxiNav — applications passager et chauffeur */
:root {
  --brand: #0E1726;
  --accent: #FFC629;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(17, 24, 39, .14), 0 2px 6px rgba(17, 24, 39, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Helvetica Neue", Tahoma, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); overflow: hidden; font-size: 16px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#map { position: fixed; inset: 0; background: #e8e5df; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* Barre du haut */
.topbar { position: fixed; top: 0; inset-inline: 0; display: flex; align-items: center; gap: 8px; padding: max(12px, env(safe-area-inset-top)) 14px 12px; z-index: 20; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: #fff; border-radius: 999px; padding: 8px 14px 8px 10px; font-weight: 800; letter-spacing: .2px; box-shadow: var(--shadow); }
.brand-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: var(--brand); font-size: 13px; }
.spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.sos-btn { height: 44px; border-radius: 999px; border: 0; background: var(--danger); color: #fff; font-weight: 800; padding: 0 16px; box-shadow: var(--shadow); cursor: pointer; letter-spacing: .5px; }
.status-pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; }
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; }
.status-pill.on .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(5, 150, 105, .18); }
.demo-banner { position: fixed; top: calc(max(12px, env(safe-area-inset-top)) + 54px); inset-inline: 14px; z-index: 19; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 600; display: none; }
body.is-demo .demo-banner { display: block; }

/* Feuille du bas */
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--card); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -8px 30px rgba(17, 24, 39, .16); padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; overscroll-behavior: contain; transition: transform .25s ease; }
.sheet::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: #d1d5db; margin: 0 auto 12px; }
.sheet.full { top: 0; max-height: none; border-radius: 0; padding-top: max(16px, env(safe-area-inset-top)); }
.sheet.full::before { display: none; }
@media (min-width: 860px) {
  .sheet, .sheet.full { inset-inline-start: 20px; inset-inline-end: auto; bottom: 20px; top: auto; width: 420px; border-radius: var(--radius); max-height: calc(100vh - 110px); }
  .sheet.full { top: 90px; }
  .sheet::before { display: none; }
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.sheet .sub { color: var(--ink-2); margin: 0 0 16px; }
.muted { color: var(--ink-3); font-size: 14px; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 14px; border: 0; font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .05s ease, opacity .15s; }
.btn:active { transform: scale(.985); }
.btn.block { width: 100%; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.accent { background: var(--accent); color: var(--brand); }
.btn.ghost { background: #f3f4f6; color: var(--ink); }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.link { background: none; color: var(--ink-2); min-height: 40px; font-weight: 600; text-decoration: underline; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn.ghost.is-busy::after, .btn.accent.is-busy::after { border-color: rgba(17, 24, 39, .25); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn { padding: 0 12px; font-size: 15px; line-height: 1.15; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 52px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; padding: 12px 14px; font-size: 16px; outline: none; }
textarea.input { min-height: 74px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 23, 38, .08); }
.phone-wrap { display: flex; align-items: stretch; gap: 8px; }
.phone-prefix { display: grid; place-items: center; min-width: 74px; border: 1.5px solid var(--line); border-radius: 14px; font-weight: 800; background: #f9fafb; direction: ltr; }
.phone-wrap .input { direction: ltr; letter-spacing: .5px; font-weight: 700; }
.otp { letter-spacing: 12px; text-align: center; font-size: 26px; font-weight: 800; direction: ltr; }
.demo-code { background: #fef3c7; color: #92400e; border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 12px; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1em; margin: 4px 0 8px; }

/* Recherche d'adresses */
.where-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; border: 0; background: #f3f4f6; border-radius: 16px; padding: 0 16px; font-size: 18px; font-weight: 800; cursor: pointer; text-align: start; }
.where-btn .sq { width: 12px; height: 12px; background: var(--ink); flex: none; }
.pickup-line { display: flex; align-items: center; gap: 10px; padding: 12px 4px; color: var(--ink-2); font-size: 14px; }
.pickup-line .ring { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--accent); flex: none; background: #111827; }
.addr-inputs { position: relative; display: flex; flex-direction: column; gap: 8px; padding-inline-start: 26px; }
.addr-inputs::before { content: ""; position: absolute; inset-inline-start: 9px; top: 26px; bottom: 26px; width: 2px; background: #d1d5db; }
.addr-inputs .dotA, .addr-inputs .dotB { position: absolute; inset-inline-start: 4px; width: 12px; height: 12px; }
.addr-inputs .dotA { top: 20px; border-radius: 50%; background: var(--accent); border: 2px solid #111827; }
.addr-inputs .dotB { bottom: 20px; background: #111827; }
.results { list-style: none; margin: 10px 0 0; padding: 0; }
.results li { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid #f3f4f6; cursor: pointer; }
.results li:hover, .results li:focus { background: #f9fafb; outline: none; }
.results .ic { width: 36px; height: 36px; border-radius: 50%; background: #f3f4f6; display: grid; place-items: center; flex: none; }
.results .t1 { font-weight: 700; }
.results .t2 { color: var(--ink-3); font-size: 13px; }

/* Repère central (choix sur la carte) */
.center-pin { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -100%); z-index: 15; pointer-events: none; display: none; }
.center-pin.show { display: block; }
@media (min-width: 860px) { .center-pin { left: calc(50% + 220px); top: 50%; } }

/* Catégories */
.options { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid transparent; border-radius: 16px; background: #f9fafb; cursor: pointer; text-align: start; width: 100%; }
.opt.sel { border-color: var(--brand); background: #fff; box-shadow: 0 4px 14px rgba(17, 24, 39, .08); }
.opt .car { width: 58px; height: 40px; flex: none; }
.opt .nm { font-weight: 800; }
.opt .ds { color: var(--ink-3); font-size: 13px; }
.opt .pr { margin-inline-start: auto; text-align: end; font-weight: 800; white-space: nowrap; }
.opt .pr small { display: block; color: var(--ink-3); font-weight: 600; font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #eef2ff; color: #3730a3; margin-inline-start: 6px; vertical-align: middle; }
.tag.taxi { background: #fef3c7; color: #92400e; }
.info-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin: 4px 0; }

/* Course en cours */
.status-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.status-head h2 { margin: 0; }
.pulse { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); position: relative; flex: none; display: grid; place-items: center; }
.pulse::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--accent); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.driver-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: #f9fafb; border-radius: 16px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
.plate { display: inline-block; border: 2px solid var(--ink); border-radius: 8px; padding: 2px 8px; font-weight: 900; letter-spacing: 1px; background: #fff; direction: ltr; }
.trip-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--brand); color: #fff; margin-top: 10px; }
.trip-code b { font-size: 28px; letter-spacing: 6px; direction: ltr; }
.trip-code span { font-size: 13px; opacity: .85; max-width: 60%; }
.addr-mini { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: 14px; }
.addr-mini div { display: flex; gap: 10px; align-items: baseline; }
.addr-mini i { width: 10px; height: 10px; flex: none; display: inline-block; }
.addr-mini i.a { border-radius: 50%; background: var(--accent); border: 2px solid var(--ink); }
.addr-mini i.b { background: var(--ink); }
.price-big { font-size: 34px; font-weight: 900; letter-spacing: -.5px; }
.receipt { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 15px; }
.receipt td { padding: 6px 0; }
.receipt td:last-child { text-align: end; font-weight: 700; }
.receipt tr.total td { border-top: 1px solid var(--line); padding-top: 10px; font-size: 18px; font-weight: 900; }
.stars { display: flex; gap: 6px; justify-content: center; margin: 10px 0; direction: ltr; }
.stars button { width: 48px; height: 48px; border: 0; background: none; font-size: 38px; color: #d1d5db; cursor: pointer; line-height: 1; }
.stars button.on { color: var(--accent); text-shadow: 0 1px 0 #b45309; }

/* Marqueurs */
.mk { display: grid; place-items: center; }
.mk.me { width: 22px; height: 22px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .25); }
.mk.car svg { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3)); transition: transform .4s linear; }

/* Panneaux plein écran (historique, profil, aide) */
.panel { position: fixed; inset: 0; z-index: 60; background: #fff; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 22px; font-weight: 800; }
@media (min-width: 860px) { .panel { inset-inline-start: auto; width: 460px; box-shadow: var(--shadow); } }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 6px; border: 0; border-bottom: 1px solid #f3f4f6; background: none; font-size: 17px; font-weight: 700; cursor: pointer; text-align: start; }
.hist-item { padding: 14px 4px; border-bottom: 1px solid #f3f4f6; }
.hist-item .row { justify-content: space-between; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #f3f4f6; color: var(--ink-2); }
.badge.completed { background: #d1fae5; color: #065f46; }
.badge.cancelled, .badge.no_driver { background: #fee2e2; color: #991b1b; }
.emergency-list a { display: flex; justify-content: space-between; align-items: center; padding: 16px; margin-bottom: 8px; border-radius: 14px; background: #fef2f2; color: var(--danger); font-weight: 800; text-decoration: none; font-size: 18px; }

/* Fenêtre modale */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(17, 24, 39, .55); display: grid; place-items: end center; }
@media (min-width: 640px) { .modal-back { place-items: center; } }
.modal { width: min(520px, 100%); background: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto; }
@media (min-width: 640px) { .modal { border-radius: var(--radius); } }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }

/* Message */
.toast { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 60px); transform: translate(-50%, -20px); z-index: 100; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s ease; max-width: calc(100% - 28px); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* Chauffeur : offre */
.offer-back { position: fixed; inset: 0; z-index: 90; background: rgba(14, 23, 38, .72); display: grid; place-items: end center; }
.offer { width: min(520px, 100%); background: #fff; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@media (min-width: 640px) { .offer-back { place-items: center; } .offer { border-radius: 24px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 900; }
.offer .price-big { color: var(--ink); }
.offer .accept { min-height: 64px; font-size: 20px; }

/* Chauffeur : barre d'état et étapes */
.earn-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800; box-shadow: var(--shadow); border: 0; cursor: pointer; }
.big-toggle { width: 100%; min-height: 64px; border-radius: 18px; font-size: 19px; }
.step-title { font-size: 13px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: #e5e7eb; }
.steps span.on { background: var(--brand); }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.doc-row .nm { flex: 1; font-weight: 700; font-size: 15px; }
.doc-row .st { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #f3f4f6; color: var(--ink-3); }
.doc-row .st.pending { background: #e0e7ff; color: #3730a3; }
.doc-row .st.ok { background: #d1fae5; color: #065f46; }
.doc-row .st.rejected { background: #fee2e2; color: #991b1b; }
.doc-row .note { display: block; color: var(--danger); font-size: 12px; font-weight: 600; }
.kind-choice { display: grid; gap: 8px; }
.kind-choice label { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 14px; padding: 14px; font-weight: 700; cursor: pointer; }
.kind-choice input:checked + span { color: var(--brand); }
.kind-choice label:has(input:checked) { border-color: var(--brand); background: #f9fafb; }
.earn-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.earn-grid div { background: #f9fafb; border-radius: 16px; padding: 14px; }
.earn-grid b { display: block; font-size: 24px; font-weight: 900; margin-top: 4px; }

/* Arabe */
[dir="rtl"] .results li, [dir="rtl"] .opt { text-align: right; }
