/* ==========================================================================
   ride.css — customer web ride flow (/ride, /ride/track) — mockups 02/03.
   Composes cholo.css tokens only (cholo.css itself is frozen).
   Full-bleed map page: map behind, floating chrome, bottom sheet.
   ========================================================================== */

.ride-body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* The pages toggle chrome with the `hidden` attribute; it must always beat
   any class that sets `display` (surge note, driver card, sheets, …). */
.ride-body [hidden] {
  display: none !important;
}

.ride-app {
  position: fixed;
  inset: 0;
}

/* ——— map ——————————————————————————————————————————————————————— */
/* Two-class selector ON PURPOSE: MapLibre's stylesheet is lazy-appended
   AFTER this file and sets `.maplibregl-map { position: relative }` on the
   same element. At equal specificity that late rule wins, `absolute` is
   lost, and the container collapses to height 0 — a blank map. The
   descendant selector outranks it regardless of stylesheet order. */
.ride-app .ride-map {
  position: absolute;
  inset: 0;
  background: #ECEAE4; /* reserved space before tiles load — no jank */
}

.ride-map .maplibregl-ctrl-attrib {
  font-size: 10px;
  background: rgb(255 255 255 / 0.7);
}

/* ——— floating buttons ————————————————————————————————————————— */
.map-fab {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 var(--sp-2);
  border: none;
  border-radius: var(--r-full);
  background: var(--bg-surface);
  color: var(--text-strong);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: transform 150ms ease-out, background 150ms ease-out;
}

.map-fab:active { transform: scale(0.94); }
.map-fab svg { width: 22px; height: 22px; }

.map-fab--back { top: calc(var(--sp-3) + env(safe-area-inset-top, 0px)); left: var(--sp-3); }
.map-fab--lang {
  top: calc(var(--sp-3) + env(safe-area-inset-top, 0px));
  right: var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-primary);
}
.map-fab--locate { right: var(--sp-3); bottom: calc(var(--sheet-peek, 300px) + var(--sp-4)); color: var(--c-primary); }

/* ——— pickup/drop panel (booking) ———————————————————————————————— */
.ride-points {
  position: absolute;
  z-index: 5;
  top: calc(var(--sp-3) + 48px + env(safe-area-inset-top, 0px));
  left: var(--sp-3);
  right: var(--sp-3);
  max-width: 480px;
  margin: 0 auto;
  padding: var(--sp-1) var(--sp-3);
  box-shadow: var(--shadow-2);
}

.ride-point {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) 0;
  border: none;
  background: none;
  text-align: start;
  cursor: pointer;
}

.ride-point__dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: box-shadow 150ms ease-out;
}

.ride-point__dot--pickup { background: var(--c-primary); }
.ride-point__dot--drop { background: var(--c-n900); border-radius: 3px; }

.ride-point.is-active .ride-point__dot { box-shadow: 0 0 0 4px var(--c-primary-100); }

.ride-point__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.ride-point__label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.ride-point__input {
  border: none;
  padding: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--text-strong);
  outline: none;
  width: 100%;
}

.ride-point__input::placeholder { color: var(--c-n500); font-weight: 400; } /* AA */

.ride-points__rule {
  height: 1px;
  margin-inline-start: calc(12px + var(--sp-3));
  background: var(--c-n100);
}

/* §6.4 place-search typeahead — expands the points card downward; while
   results are open the card must paint above the saved-places chip row
   (equal z siblings paint in DOM order, and .saved-row comes later). */
.ride-points.has-results { z-index: 7; }

.search-results {
  max-height: 40vh;
  margin-top: var(--sp-1);
  border-top: 1px solid var(--c-n100);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: var(--sp-2) 0 var(--sp-2) calc(12px + var(--sp-3));
  border: none;
  background: none;
  text-align: start;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible { background: var(--c-primary-50); }

.search-result__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
}

.search-result__addr {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.search-results__empty {
  padding: var(--sp-2) 0 var(--sp-2) calc(12px + var(--sp-3));
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* saved places chip row */
.saved-row {
  position: absolute;
  z-index: 5;
  top: calc(var(--sp-3) + 48px + 116px + env(safe-area-inset-top, 0px));
  left: var(--sp-3);
  right: var(--sp-3);
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.saved-row::-webkit-scrollbar { display: none; }

.saved-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-surface);
  box-shadow: var(--shadow-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}

.saved-chip:active { background: var(--c-primary-50); border-color: var(--c-primary); }
.saved-chip svg { width: 16px; height: 16px; color: var(--c-primary); }

/* center pin + confirm chip */
.center-pin {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 40px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgb(21 25 24 / 0.3));
}

.center-pin svg { position: absolute; inset: 0; }
.center-pin__drop { display: none; }
.ride-app[data-stage="drop"] .center-pin__pickup { display: none; }
.ride-app[data-stage="drop"] .center-pin__drop { display: block; }

.set-here {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: calc(50% + var(--sp-3));
  transform: translateX(-50%);
  box-shadow: var(--shadow-2);
}

/* ——— bottom sheet (always docked) ————————————————————————————— */
.ride-sheet {
  position: absolute;
  z-index: 6;
  inset: auto 0 0 0;
  max-height: 62dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-3);
  padding: var(--sp-1) var(--sp-4)
    calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .ride-sheet {
    inset: auto auto var(--sp-5) 50%;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 2 * var(--sp-5)));
    border-radius: var(--r-lg);
  }
}

.ride-sheet__caption {
  text-align: center;
  font-weight: 600;
  color: var(--text-strong);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-3);
}

.ride-sheet__meta {
  display: block;
  font-weight: 400;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.ride-sheet__hint {
  font-size: var(--fs-xs);
  text-align: center;
  margin: var(--sp-2) 0;
}

.surge-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  background: var(--c-accent-100);
  color: var(--c-accent-600);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* class options (mockup 02: selected = mint fill + 2px green border + check) */
.class-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.class-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  cursor: pointer;
  text-align: start;
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.class-option.is-selected {
  border-color: var(--c-primary);
  background: var(--c-primary-50);
}

.class-option__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--c-primary-100);
  color: var(--c-primary);
}

.class-option__icon svg { width: 26px; height: 26px; }

.class-option__body { flex: 1 1 auto; min-width: 0; }

.class-option__name {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 700;
  color: var(--text-strong);
}

.class-option__check {
  display: none;
  width: 18px;
  height: 18px;
  color: var(--c-primary);
}

.class-option.is-selected .class-option__check { display: inline; }

.class-option__sub {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.class-option__fare {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.class-option__surge {
  display: block;
  text-align: end;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-accent-600);
}

.class-skel {
  height: 66px;
  border-radius: var(--r-lg);
}

/* payment + coupon chips */
.ride-sheet__chips {
  display: flex;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 var(--sp-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}

.chip:active { background: var(--c-primary-50); border-color: var(--c-primary); }
.chip svg { width: 16px; height: 16px; }

/* coupon chip once a code is applied (ride booking §5.7 promo entry) */
.chip.is-applied {
  background: var(--c-primary-50);
  border-color: var(--c-primary);
  color: var(--c-primary);
  letter-spacing: 0.04em;
}

.ride-cta { padding: var(--sp-3); font-size: var(--fs-md); }

/* ——— login sheet ————————————————————————————————————————————— */
.ride-login__sub { margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.ride-login__step { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ——— tracking page (mockup 03) ————————————————————————————————— */
.status-pill {
  position: absolute;
  z-index: 5;
  top: calc(var(--sp-3) + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: calc(100% - 128px);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  background: var(--bg-surface);
  box-shadow: var(--shadow-2);
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

.status-pill__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  animation: pill-pulse 1.4s ease-out infinite;
}

.status-pill__text { min-width: 90px; font-size: var(--fs-sm); }

@keyframes pill-pulse {
  0% { box-shadow: 0 0 0 0 rgb(244 42 65 / 0.45); }
  70% { box-shadow: 0 0 0 8px rgb(244 42 65 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(244 42 65 / 0); }
}

/* searching radar */
.search-block {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}

.search-block__radar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-primary);
  position: relative;
}

.search-block__radar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--c-primary);
  animation: radar 1.6s ease-out infinite;
}

@keyframes radar {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(2.1); opacity: 0; }
}

.search-block__text { font-weight: 700; color: var(--text-strong); }

/* driver card */
.driver-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
}

.driver-card__avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-primary-100);
  color: var(--c-primary);
}

.driver-card__avatar svg { width: 30px; height: 30px; }

.driver-card__body { flex: 1 1 auto; min-width: 0; }

.driver-card__name {
  display: block;
  font-size: var(--fs-lg);
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-card__rating { font-size: var(--fs-sm); color: var(--text-muted); }
.driver-card__rating span[aria-hidden] { color: #E8A213; }

.driver-card__actions { display: flex; gap: var(--sp-2); }

.round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 150ms ease-out, background 150ms ease-out;
}

.round-btn:active { transform: scale(0.92); }
.round-btn svg { width: 22px; height: 22px; }
.round-btn--mint { background: var(--c-primary-100); color: var(--c-primary); }
.round-btn--solid { background: var(--c-primary); color: var(--c-n0); }
.round-btn--solid:active { background: var(--c-primary-600); }

.vehicle-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
  font-size: var(--fs-sm);
}

.plate-chip {
  padding: 2px var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--c-n50);
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

/* 4-step progress (গ্রহণ → আসছে → রাইড → শেষ) */
.steps {
  display: flex;
  margin: var(--sp-2) 0 var(--sp-3);
  padding: 0;
  list-style: none;
}

.steps__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  position: relative;
}

.steps__item::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 50%;
  width: 100%;
  height: 3px;
  background: var(--c-n200);
  transition: background 200ms ease-out;
}

.steps__item:first-child::before { display: none; }

.steps__dot {
  position: relative;
  z-index: 1;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--c-n300);
  transition: background 200ms ease-out, box-shadow 200ms ease-out;
}

.steps__label { font-size: var(--fs-xs); color: var(--text-muted); }

.steps__item.is-done .steps__dot,
.steps__item.is-active .steps__dot { background: var(--c-primary); }
.steps__item.is-done::before,
.steps__item.is-active::before { background: var(--c-primary); }

.steps__item.is-done .steps__dot::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-n0);
  font-size: 11px;
  font-weight: 700;
}

.steps__item.is-active .steps__dot { box-shadow: 0 0 0 4px var(--c-primary-100); }
.steps__item.is-active .steps__label { color: var(--c-primary); font-weight: 700; }

/* fare chip + cancel link */
.fare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--c-n100);
}

.fare-chip {
  display: inline-block;
  min-width: 120px;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--c-n50);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.cancel-link {
  border: none;
  background: none;
  color: var(--c-danger);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
}

/* receipt + rating */
.receipt { margin-top: var(--sp-3); }
.receipt__title { font-size: var(--fs-lg); margin-bottom: var(--sp-2); }

.receipt__lines { margin: 0; }

.receipt__line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-1) 0;
  font-size: var(--fs-sm);
}

.receipt__line dt { color: var(--text-body); }
.receipt__line dt small { color: var(--text-muted); }

.receipt__line dd {
  margin: 0;
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.receipt__line--discount dd { color: var(--c-success); }

.receipt__total {
  display: flex;
  justify-content: space-between;
  padding-top: var(--sp-2);
  margin-top: var(--sp-1);
  border-top: 1px dashed var(--c-n300);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.receipt__again { margin-top: var(--sp-3); }

.rate { margin-top: var(--sp-4); text-align: center; }
.rate__title { font-weight: 700; color: var(--text-strong); margin-bottom: var(--sp-2); }

.rate__stars {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.rate__star {
  border: none;
  background: none;
  font-size: 34px;
  line-height: 1;
  color: var(--c-n300);
  cursor: pointer;
  transition: color 150ms ease-out, transform 150ms ease-out;
}

.rate__star:active { transform: scale(1.15); }
.rate__star.is-on { color: #E8A213; }

/* cancel sheet */
.cancel-sheet__fee {
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--c-warning-bg);
  color: var(--c-warning);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.cancel-sheet__fee.is-free {
  background: var(--c-success-bg);
  color: var(--c-success);
}

.cancel-sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

/* map markers (booking + tracking) */
.mk-pin { width: 30px; height: 38px; filter: drop-shadow(0 3px 5px rgb(21 25 24 / 0.3)); }

.mk-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-n0);
  box-shadow: 0 0 0 4px rgb(0 106 78 / 0.25), var(--shadow-2);
}

.mk-provider svg { width: 22px; height: 22px; }

@media (prefers-reduced-motion: reduce) {
  .status-pill__dot,
  .search-block__radar::after { animation: none; }
}
