/* ===========================================================================
   goRo design system - shared by the passenger, driver and dispatcher apps.

   The logo sets the rules: one strong yellow, near-black ink, geometric shapes
   with fully rounded ends. Buttons are pills, cards are softly rounded, and
   colour is used sparingly so the yellow always means "this is the action".
   =========================================================================== */
:root {
  --yellow: #fdc604;          /* goRo brand yellow */
  --yellow-dark: #e0ae00;
  --yellow-soft: #fff4cf;     /* tint for quiet highlights */
  --ink: #17181a;             /* goRo ink */
  --ink-soft: #2c2e33;
  --muted: #71757d;
  --line: #e7e8ec;
  --bg: #ffffff;
  --bg-soft: #f6f6f4;
  --green: #12874f;
  --red: #d92d20;
  --blue: #2563eb;
  --orange: #f97316;

  /* frosted glass: panels let the photo (or the map) through, blurred */
  --glass: rgba(255, 255, 255, .78);
  --glass-strong: rgba(255, 255, 255, .88);
  --glass-line: rgba(255, 255, 255, .55);
  --glass-blur: saturate(160%) blur(16px);
  --glass-shadow: 0 8px 32px rgba(23, 24, 26, .18);

  --radius: 20px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(23, 24, 26, .08);
  --shadow: 0 6px 24px rgba(23, 24, 26, .12);
  --shadow-lg: 0 -8px 40px rgba(23, 24, 26, .18);
  --sheet-max: 520px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior: none;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: 10px; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-pill); padding: 14px 18px;
  background: var(--bg-soft); color: var(--ink); font-weight: 600;
  cursor: pointer; transition: transform .12s ease, background .15s ease, opacity .15s;
  min-height: 48px; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* yellow is the app's "do it" colour, ink is the quieter second voice */
.btn-primary { background: var(--yellow); color: var(--ink); font-weight: 700; }
.btn-primary:hover { background: var(--yellow-dark); }
.btn-accent { background: var(--yellow); color: var(--ink); font-weight: 700; }
.btn-accent:hover { background: var(--yellow-dark); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-soft); }
.btn-danger { background: #fdeceb; color: var(--red); }
.btn-success { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; }
.btn-outline { background: transparent; border: 1.5px solid var(--ink); }
.btn-outline:hover { background: var(--bg-soft); }
.btn-block { width: 100%; }
.btn-lg { padding: 17px 20px; font-size: 17px; min-height: 56px; letter-spacing: .2px; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm); display: grid; place-items: center; cursor: pointer;
}

/* --- forms -------------------------------------------------------------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: rgba(255, 255, 255, .92); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow-soft); }
textarea.input { resize: vertical; min-height: 74px; }

/* --- cards / lists ------------------------------------------------------ */
.card {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 16px;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.card.soft { background: rgba(246, 246, 244, .72); border-color: transparent; }
/* Where a solid surface is genuinely needed (print, dense tables), opt out. */
.card.opaque { background: #fff; border-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left;
}
.list-row:last-child { border-bottom: 0; }
.pin { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--yellow-soft); flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-soft); color: var(--muted);
}
.badge.ok { background: #dff3e6; color: #0d6b3f; }
.badge.warn { background: var(--yellow-soft); color: #7a5c00; }
.badge.info { background: var(--ink); color: var(--yellow); }
.badge.err { background: #fdeceb; color: #97231a; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--yellow);
  display: grid; place-items: center; font-weight: 800; color: var(--ink); flex: none; font-size: 18px;
  background-size: cover; background-position: center;
}
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.stars { color: var(--yellow-dark); letter-spacing: 1px; }
.rating-stars span.on { color: var(--yellow-dark); }

/* --- map ---------------------------------------------------------------- */
#map, .map { position: absolute; inset: 0; z-index: 1; background: var(--bg-soft); }
.leaflet-container { font-family: var(--font); }
.marker-taxi {
  width: 38px; height: 38px; display: grid; place-items: center;
  transition: transform .2s linear;
}
.marker-taxi svg { filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.marker-pin { display: grid; place-items: center; }
.marker-me {
  width: 20px; height: 20px; border-radius: 50%; background: var(--ink);
  border: 3px solid var(--yellow); box-shadow: 0 0 0 6px rgba(253, 198, 4, .35), var(--shadow-sm);
}
.marker-label {
  background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700;
  box-shadow: var(--shadow-sm); white-space: nowrap;
}

/* --- sheets / modals ---------------------------------------------------- */
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(0);
  bottom: 0; width: min(100%, var(--sheet-max)); z-index: 40;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-line);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 18px calc(18px + var(--safe-bottom));
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  max-height: 88vh; overflow-y: auto;
}
.sheet.down { transform: translateX(-50%) translateY(110%); }
.sheet-handle { width: 44px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 12px; }

.overlay {
  position: fixed; inset: 0; background: rgba(16,17,20,.45); z-index: 50;
  display: grid; place-items: center; padding: 18px; backdrop-filter: blur(2px);
  animation: fade .18s ease;
}
.modal {
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-radius: 20px; padding: 22px; width: min(100%, 440px);
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
  animation: pop .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

/* --- toasts / status ---------------------------------------------------- */
#toasts {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(94%, 460px);
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 14px; animation: pop .2s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
.toast.warn { background: var(--orange); }

.conn-indicator {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  background: var(--red); color: #fff; text-align: center; font-size: 13px; padding: 6px;
  transform: translateY(-100%); transition: transform .25s ease;
}
.conn-indicator.show { transform: none; }
.conn-indicator.ok { background: var(--green); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .8s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(16,17,20,.2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg) } }

.pulse-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.pulse-dot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--green); opacity: .6; animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { to { transform: scale(1.6); opacity: 0 } }

.progress-track { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--yellow); border-radius: 999px; transition: width .4s ease; }

/* --- the photo backdrop ------------------------------------------------- */
/*
 * One picture behind everything, fixed so it does not scroll away, with a soft
 * wash on top: the glass panels need something bright to sit on, but text needs
 * contrast. The portrait crop is used on phones so the road stays visible.
 */
.backdrop {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.72)),
    url('/assets/backdrop.jpg') center / cover no-repeat fixed,
    var(--yellow-soft);
}
@media (max-width: 720px) {
  .backdrop {
    background:
      linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.7)),
      url('/assets/backdrop-portrait.jpg') center / cover no-repeat fixed,
      var(--yellow-soft);
  }
}
/* iOS ignores background-attachment: fixed - a fixed layer behind does the job */
@supports (-webkit-touch-callout: none) {
  .backdrop { background-attachment: scroll; }
}

/* --- shared app chrome -------------------------------------------------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 0; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
/* the wordmark itself, on a yellow chip so it reads on top of the map */
.brand-logo {
  display: inline-flex; align-items: center; height: 38px; padding: 0 14px;
  background: var(--yellow); border-radius: var(--radius-pill); box-shadow: var(--shadow-sm);
}
.brand-logo img { height: 20px; width: auto; display: block; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--yellow);
  display: grid; place-items: center; font-size: 16px;
}
.brand-mark img { width: 22px; height: 22px; display: block; }
.lang-switch { display: inline-flex; background: var(--bg-soft); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: 0; background: none; padding: 5px 11px; border-radius: 999px;
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted);
}
.lang-switch button.active { background: var(--yellow); color: var(--ink); box-shadow: var(--shadow-sm); }

.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

@media (min-width: 900px) {
  .sheet { border-radius: 22px; bottom: 18px; }
}
