/* ZimDrive styles */
:root {
  --green: #0b8a4b;
  --green-dark: #076a39;
  --yellow: #ffce00;
  --red: #d33;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #16211b;
  --muted: #64756c;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.14);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body, #app { height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.view { height: 100%; }

/* ---------- auth ---------- */
.auth-view { display: flex; flex-direction: column; background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 60%); overflow-y: auto; }
.auth-hero { padding: 48px 24px 24px; text-align: center; color: #fff; }
.logo-badge { font-size: 56px; background: rgba(255,255,255,.15); width: 96px; height: 96px; border-radius: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.auth-hero h1 { font-size: 34px; letter-spacing: .5px; }
.tagline { margin-top: 8px; opacity: .92; font-size: 15px; line-height: 1.45; }
.auth-card { background: var(--card); margin: 12px 16px 24px; border-radius: 20px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; }
.tab { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted); }
.tab.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
input, select {
  width: 100%; padding: 13px 14px; border: 1.5px solid #dfe6e2; border-radius: 12px;
  font-size: 16px; background: #fff; color: var(--text); outline: none;
}
input:focus { border-color: var(--green); }
.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.outline { background: #fff; color: var(--green-dark); border: 1.5px solid var(--green); }
.btn.danger-outline { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn.big { width: 100%; padding: 15px; }
.btn:disabled { opacity: .55; }
.error { background: #fdecec; color: #a12622; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.or-divider:before, .or-divider:after { content: ""; flex: 1; height: 1px; background: #e2e9e5; }
.btn.google { background: #fff; color: #3c4043; border: 1.5px solid #dfe6e2; }
#gis-button { display: flex; justify-content: center; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 7000; display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.fineprint { font-size: 12.5px; color: var(--muted); text-align: center; }
.fineprint.center { text-align: center; margin: 16px 0; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- map main ---------- */
#view-main { position: relative; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 0; }
.topbar {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.iconbtn {
  width: 46px; height: 46px; border-radius: 14px; border: 0; background: #fff; box-shadow: var(--shadow);
  font-size: 20px; cursor: pointer; flex-shrink: 0;
}
.mode-pill { display: flex; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 4px; }
.mode-btn { border: 0; background: transparent; padding: 9px 22px; border-radius: 11px; font-weight: 700; font-size: 14.5px; color: var(--muted); }
.mode-btn.active { background: var(--green); color: #fff; }

.toast {
  position: absolute; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: #16211b; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 3000;
  font-size: 14.5px; box-shadow: var(--shadow); max-width: 92%; text-align: center;
}
.center-pin {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); font-size: 40px; z-index: 900;
  pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.pin-hint {
  position: absolute; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: #fff; padding: 9px 14px; border-radius: 10px; z-index: 900; font-size: 13.5px; box-shadow: var(--shadow);
}
.pin-confirm { position: absolute; bottom: calc(30px + env(safe-area-inset-bottom)); left: 16px; right: 16px; z-index: 900; }

/* ---------- bottom sheets ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.18);
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; max-height: 72%; overflow-y: auto;
}
.grabber { width: 44px; height: 5px; border-radius: 3px; background: #d8dfdb; margin: 4px auto 2px; flex-shrink: 0; }
.sheet h3 { font-size: 19px; }
.field-row { display: flex; align-items: center; gap: 10px; }
.field-row input { flex: 1; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.minibtn { border: 1.5px solid #dfe6e2; background: #fff; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--green-dark); }
.search-results {
  display: flex; flex-direction: column; border: 1.5px solid #e5ebe8; border-radius: 12px;
  max-height: 38vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; flex-shrink: 0;
}
.search-results button { text-align: left; border: 0; background: #fff; padding: 12px 14px; font-size: 14.5px; border-bottom: 1px solid #eef2f0; flex-shrink: 0; }
.search-results button:active { background: var(--bg); }

.fare-row { display: flex; gap: 10px; align-items: stretch; }
.fare-input-wrap { flex: 1; display: flex; align-items: center; border: 1.5px solid #dfe6e2; border-radius: 12px; padding: 0 12px; background: #fff; }
.fare-input-wrap span { font-weight: 800; font-size: 18px; color: var(--green-dark); }
.fare-input-wrap input { border: 0; font-size: 20px; font-weight: 800; padding: 12px 8px; }
.cur-toggle, .pay-toggle { display: flex; gap: 8px; }
.cur-btn, .pay-btn, .veh-btn {
  border: 1.5px solid #dfe6e2; background: #fff; border-radius: 11px; padding: 10px 14px;
  font-weight: 700; font-size: 14px; color: var(--muted); flex: 1;
}
.cur-btn.active, .pay-btn.active, .veh-btn.active { border-color: var(--green); color: var(--green-dark); background: #ecf7f1; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

/* offers */
.offers-list { display: flex; flex-direction: column; gap: 10px; }
.offer-card {
  border: 1.5px solid #e5ebe8; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #fff;
}
.offer-card.flash { animation: flashin .5s ease; }
@keyframes flashin { from { background: #ecf7f1; transform: translateY(6px); opacity: 0; } to { opacity: 1; } }
.offer-top { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #ecf7f1; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.avatar.big { width: 56px; height: 56px; font-size: 28px; }
.offer-price { margin-left: auto; font-size: 19px; font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.offer-meta { font-size: 13px; color: var(--muted); }
.search-head { display: flex; gap: 12px; align-items: center; }
.spinner { width: 26px; height: 26px; border: 3px solid #dff0e7; border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-note { text-align: center; padding: 10px 0; }

/* trip */
.status-banner { background: #ecf7f1; color: var(--green-dark); font-weight: 800; padding: 11px 14px; border-radius: 12px; text-align: center; font-size: 15.5px; }
.status-banner.warn { background: #fff6dc; color: #8a6d00; }
.trip-card { display: flex; gap: 12px; align-items: center; }
.trip-info { display: flex; flex-direction: column; gap: 2px; }
.trip-price { margin-left: auto; text-align: right; font-size: 19px; color: var(--green-dark); display: flex; flex-direction: column; }
.route-box { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border-radius: 12px; padding: 12px; font-size: 14px; }
.route-box > div { display: flex; gap: 9px; align-items: center; }
.ecocash-box { background: #eaf3ff; border-radius: 12px; padding: 12px; font-size: 14px; color: #1b3f6e; }
.badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 2px 7px; }

/* stars */
.stars { display: flex; justify-content: center; gap: 8px; }
.stars button { font-size: 40px; border: 0; background: none; color: #d6ded9; cursor: pointer; }
.stars button.on { color: var(--yellow); }

/* driver */
.drv-head { display: flex; align-items: center; justify-content: space-between; }
.switch { position: relative; width: 58px; height: 32px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #ccd6d0; border-radius: 20px; transition: .2s; }
.slider:before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(26px); }
.earn-strip { display: flex; background: var(--bg); border-radius: 12px; padding: 10px; }
.earn-strip > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.earn-strip b { font-size: 15px; }
.earn-strip span { font-size: 12px; color: var(--muted); }
.wallet-strip { display: flex; align-items: center; justify-content: space-between; background: #ecf7f1; border-radius: 12px; padding: 12px 14px; }
.wallet-strip > div { display: flex; flex-direction: column; gap: 2px; }
.wallet-strip b { font-size: 20px; color: var(--green-dark); }
.wallet-strip b.low { color: var(--red); }

/* driver photos */
.photo-row { display: flex; gap: 10px; }
.photo-slot {
  position: relative; flex: 1; aspect-ratio: 4/3; border: 2px dashed #c8d4cd; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 14px; color: var(--muted); overflow: hidden; background: #fafcfb;
}
.photo-slot.done { border-style: solid; border-color: var(--green); }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-slot .uploading { position: absolute; inset: 0; background: rgba(255,255,255,.75); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--green-dark); }
.avatar img, .drv-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.offer-carphoto { width: 60px; height: 45px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

/* in-app call */
.call-overlay { background: linear-gradient(170deg, #0b8a4b, #043d20); color: #fff; z-index: 6000; justify-content: space-between; align-items: center; }
.call-body { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16vh; text-align: center; padding: 0 20px; }
.call-body .avatar.big { width: 108px; height: 108px; font-size: 52px; background: rgba(255,255,255,.14); }
.call-body h2 { font-size: 26px; }
.call-status { font-size: 16px; opacity: .9; min-height: 22px; }
.call-body .hint { color: rgba(255,255,255,.75); }
.call-actions { display: flex; gap: 34px; margin-bottom: calc(56px + env(safe-area-inset-bottom)); }
.callbtn { width: 72px; height: 72px; border-radius: 50%; border: 0; font-size: 30px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.callbtn.green { background: #2ecc71; animation: pulse 1.2s ease infinite; }
.callbtn.red { background: #e74c3c; }
.callbtn.grey { background: rgba(255,255,255,.25); }
.callbtn.grey.on { background: #fff; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* overlays (chat, menu) */
.overlay {
  position: fixed; inset: 0; z-index: 5000; background: var(--bg);
  display: flex; flex-direction: column;
}
.overlay-head {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.08);
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.35; }
.msg.me { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.msg time { display: block; font-size: 10.5px; opacity: .7; margin-top: 3px; }
.chat-inputrow { display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: #fff; }
.chat-inputrow input { flex: 1; }

.menu-profile { display: flex; gap: 14px; align-items: center; padding: 18px 16px; background: #fff; margin: 12px; border-radius: 16px; box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.menu-items { display: flex; flex-direction: column; margin: 0 12px; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.menu-item { text-align: left; border: 0; background: #fff; padding: 16px; font-size: 16px; font-weight: 600; border-bottom: 1px solid #f0f4f2; cursor: pointer; }
.menu-item:active { background: var(--bg); }
.history-list { margin: 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.hist-card { background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 14px; box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.hist-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.hist-status { font-size: 12.5px; font-weight: 700; }
.hist-status.completed { color: var(--green-dark); }
.hist-status.cancelled { color: var(--red); }

/* leaflet tweaks */
.leaflet-control-attribution { font-size: 9px !important; }
.leaflet-top { top: calc(64px + env(safe-area-inset-top)) !important; }
.veh-marker { font-size: 26px; text-shadow: 0 2px 4px rgba(0,0,0,.4); }
