/* BoltOf Mobility — Authentic Bolt Ride-Hailing & Delivery Design System */
:root {
  --bolt-green: #2ce080;
  --bolt-green-dark: #1eb966;
  --bolt-green-soft: rgba(44, 224, 128, 0.14);
  --ink: #12161f;
  --sheet-bg: #ffffff;
  --sheet-subtle: #f4f6f9;
  --sheet-card: #f8fafc;
  --border: rgba(15, 23, 42, 0.09);
  --text-main: #111827;
  --text-sub: #64748b;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.22);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.10);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.dark-mode {
  --sheet-bg: #141923;
  --sheet-subtle: #1d2432;
  --sheet-card: #1a202e;
  --border: rgba(255, 255, 255, 0.09);
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --shadow-lg: 0 18px 54px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: #0f141c;
  color: var(--text-main);
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button { cursor: pointer; }
.hidden { display: none !important; }

/* ===================== FULLSCREEN INTERACTIVE MAP ===================== */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.leaflet-control-zoom, .leaflet-control-attribution {
  display: none !important;
}

/* Center Drag Pinpoint Mode ("Fijar en el mapa") */
#centerMapPinOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 120px;
}

.pin-needle {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.32));
  transform: translateY(-18px);
}

.pin-head {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--bolt-green);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.pin-stem {
  width: 4px;
  height: 18px;
  background: var(--ink);
  border-radius: 2px;
}

.pin-confirm-bar {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 28px));
  background: var(--sheet-bg);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 25;
  border: 1px solid var(--border);
}

/* ===================== TOP FLOATING CONTROLS ===================== */
.top-hud {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.top-hud > * {
  pointer-events: auto;
}

.hud-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: var(--text-main);
  transition: transform 0.14s ease;
}

.hud-circle-btn:active { transform: scale(0.94); }

.role-switcher-pill {
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 999px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.role-btn {
  border: none;
  background: transparent;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.role-btn.active {
  background: var(--bolt-green);
  color: #0b1811;
  box-shadow: 0 2px 10px rgba(44, 224, 128, 0.35);
}

.gps-fab {
  position: fixed;
  right: 14px;
  bottom: calc(330px + var(--safe-bottom));
  z-index: 19;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

/* ===================== MAIN BOTTOM SHEET (MOBILE) / LEFT DOCK (DESKTOP) ===================== */
.bolt-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  background: var(--sheet-bg);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  border-top: 1px solid var(--border);
  padding: 10px 18px calc(18px + var(--safe-bottom));
  max-height: 78vh;
  overflow-y: auto;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.4);
  margin: 2px auto 12px;
}

@media (min-width: 860px) {
  .bolt-sheet {
    top: 74px;
    left: 16px;
    right: auto;
    bottom: auto;
    width: 416px;
    max-height: calc(100vh - 92px);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 18px 20px 20px;
  }
  .sheet-handle { display: none; }
  .gps-fab { bottom: 26px; right: 22px; }
}

/* Bolt Buttons */
.btn-bolt {
  width: 100%;
  background: var(--bolt-green);
  color: #081c11;
  border: none;
  border-radius: 15px;
  padding: 15px 18px;
  font-size: 0.98rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(44, 224, 128, 0.32);
  transition: filter 0.15s, transform 0.12s;
}

.btn-bolt:hover { filter: brightness(1.04); }
.btn-bolt:active { transform: scale(0.985); }
.btn-bolt:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  background: var(--sheet-subtle);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:hover { filter: brightness(0.97); }

/* Where-To Search Trigger */
.where-to-trigger {
  width: 100%;
  background: var(--sheet-subtle);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  margin-top: 8px;
}

.where-to-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 800;
}

.search-green-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bolt-green);
  box-shadow: 0 0 0 4px var(--bolt-green-soft);
}

.quick-places-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 6px;
}

.quick-chip {
  background: var(--sheet-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.recent-place-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.recent-place-row:last-child { border-bottom: none; }

.place-icon-circle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--sheet-subtle);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

/* Category Cards (Bolt Moto, Económico, Comfort, XL, Envíos) */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 12px;
  max-height: 270px;
  overflow-y: auto;
}

.cat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 15px;
  border: 2px solid transparent;
  background: var(--sheet-card);
  cursor: pointer;
  transition: all 0.14s ease;
}

.cat-card:hover { background: var(--sheet-subtle); }

.cat-card.selected {
  border-color: var(--bolt-green);
  background: var(--bolt-green-soft);
}

.cat-emoji {
  font-size: 1.85rem;
  width: 46px;
  text-align: center;
}

.cat-info { flex: 1; min-width: 0; }
.cat-name { font-weight: 800; font-size: 0.94rem; display: flex; align-items: center; gap: 6px; }
.cat-meta { font-size: 0.76rem; color: var(--text-sub); margin-top: 2px; }
.cat-price { text-align: right; }
.cat-price-main { font-weight: 850; font-size: 0.98rem; }
.cat-price-old { font-size: 0.73rem; color: var(--text-muted); text-decoration: line-through; }

/* Mercosur Paraguay License Plate */
.mercosur-plate {
  display: inline-flex;
  flex-direction: column;
  border: 1.5px solid #1e293b;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  color: #0f172a;
  min-width: 94px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.plate-top {
  background: #0038a8;
  color: #ffffff;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1.5px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plate-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 2px 7px;
}

/* Security PIN Pill */
.pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(44, 224, 128, 0.16);
  color: #15803d;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

body.dark-mode .pin-badge { color: #4ade80; }

/* Route Summary Pill */
.route-summary-box {
  background: var(--sheet-subtle);
  border-radius: 14px;
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.82rem;
}

.route-point-line {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Search Modal / Fullscreen Sheet */
.overlay-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 14, 22, 0.62);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 14px;
}

.panel-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.input-field {
  width: 100%;
  background: var(--sheet-subtle);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.input-field:focus { border-color: var(--bolt-green); }

/* Side Navigation Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(3px);
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 84vw);
  z-index: 65;
  background: var(--sheet-bg);
  border-right: 1px solid var(--border);
  padding: calc(20px + var(--safe-top)) 18px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
}

.drawer-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 10px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.drawer-item:hover { background: var(--sheet-subtle); }

/* Driver Incoming Ride Alert */
.incoming-ride-card {
  border: 2px solid var(--bolt-green);
  animation: popIn 0.22s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.93); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.countdown-track {
  height: 6px;
  background: var(--sheet-subtle);
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0 14px;
}

.countdown-fill {
  height: 100%;
  background: var(--bolt-green);
  transition: width 0.25s linear;
}

/* Custom Leaflet Map Markers */
.bolt-car-marker {
  display: grid;
  place-items: center;
  transition: transform 0.35s linear;
}

.bolt-origin-pin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 6px solid #2ce080;
  box-shadow: 0 0 0 8px rgba(44, 224, 128, 0.24), 0 3px 10px rgba(0,0,0,0.35);
}

.bolt-dest-pin {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #111827;
  border: 4px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Admin Full Dashboard Overlay */
#adminDashboard {
  position: fixed;
  top: calc(68px + var(--safe-top));
  left: 14px;
  right: 14px;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 24;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-box {
  background: var(--sheet-subtle);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
}

.kpi-label { font-size: 0.76rem; color: var(--text-sub); font-weight: 700; }
.kpi-val { font-size: 1.45rem; font-weight: 850; margin-top: 4px; }

/* Chat Messages inside Modal */
.ride-chat-log {
  height: 230px;
  overflow-y: auto;
  background: var(--sheet-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.chat-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.chat-mine {
  align-self: flex-end;
  background: var(--bolt-green);
  color: #081c11;
  font-weight: 600;
}

.chat-theirs {
  align-self: flex-start;
  background: var(--sheet-bg);
  border: 1px solid var(--border);
}

/* Toast */
#toastBox {
  position: fixed;
  top: calc(68px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.bolt-toast {
  background: #111827;
  color: #fff;
  border: 1px solid rgba(44, 224, 128, 0.45);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  white-space: nowrap;
}
