/* ============================================================
   PasajeroYa — demo móvil · estilos (v4: Waze 70/30 + inicio)
   ============================================================ */
:root {
  --fondo: #eef1f6;
  --card: #ffffff;
  --tinta: #101828;
  --tinta-suave: #667085;
  --borde: #e4e7ec;
  --azul: #1d4ed8;
  --azul-suave: #dbeafe;
  --naranja: #f79009;
  --naranja-suave: #fef3c7;
  --rojo: #dc2626;
  --rojo-suave: #fee2e2;
  --verde: #16a34a;
  --verde-suave: #dcfce7;
  --radio: 16px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--fondo);
  color: var(--tinta);
  line-height: 1.5;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fondo);
}

/* ---------- Cabecera mínima (solo ☰) ---------- */
.header {
  background: linear-gradient(135deg, #101828, #1d2939);
  color: #fff;
  padding: 8px 12px;
  border-radius: 0 0 18px 18px;
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .18);
}
.header-top { display: flex; align-items: center; justify-content: space-between; }

.hamb {
  border: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.15rem;
  cursor: pointer;
}
.mini-btn {
  border: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: .95rem;
  cursor: pointer;
}
.mini-btn.oscuro { background: var(--fondo); color: var(--tinta); }
.demo-badge {
  background: var(--naranja);
  color: #431407;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .8px;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ---------- Capas ---------- */
.capa { display: none; padding-bottom: 96px; }
.capa.active { display: block; animation: aparecer .22s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Mapa (chofer) ---------- */
.mapa { height: 55dvh; min-height: 320px; z-index: 1; }
#capa-chofer.navegando { display: flex; flex-direction: column; }
#capa-chofer.navegando .mapa { height: 70dvh; min-height: 0; }
.mapa .leaflet-container { font: inherit; }
.mapa .leaflet-control-attribution { font-size: 9px; }

.punto-demanda {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.punto-demanda.pulsa { animation: latir 1.4s ease infinite; }
.punto-demanda.c0 { background: #9aa4b2; }
.punto-demanda.c1 { background: var(--azul); }
.punto-demanda.c2 { background: var(--naranja); }
.punto-demanda.c3 { background: var(--rojo); }
.punto-demanda.pasado { background: #d0d5dd; animation: none; opacity: .5; }
@keyframes latir {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.45); }
}

.punto-atu, .punto-riesgo, .punto-pasajero {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .4);
  animation: latir 1s ease infinite;
}
.punto-atu { background: var(--rojo); }
.punto-riesgo { background: var(--naranja); }
.punto-pasajero { background: var(--verde); }

.punto-chofer {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #101828;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .5);
}

/* ---------- Tarjeta de inicio (Waze pre-Go) ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 16px;
  margin: 12px 14px 0;
}
.card h2 { font-size: 1.02rem; margin-bottom: 4px; }
.muted { color: var(--tinta-suave); font-size: .84rem; }

.inicio-card {
  margin: -90px 14px 0;
  position: relative;
  z-index: 500;
}
.inicio-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ruta-nombre { font-size: .95rem; font-weight: 800; }
.link {
  border: none;
  background: none;
  color: var(--azul);
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  text-decoration: underline;
}

.leyenda { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; }
.ley { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--tinta-suave); font-weight: 600; }
.ley .punto-demanda { width: 14px; height: 14px; border-width: 2px; box-shadow: none; animation: none; }
.ley .punto-atu, .ley .punto-riesgo, .ley .punto-pasajero { width: 18px; height: 18px; font-size: 10px; border-width: 2px; animation: none; }
.ley .punto-chofer.chico { width: 22px; height: 22px; font-size: 12px; border-width: 2px; }

/* ---------- Panel de alertas (30% en navegación) ---------- */
.waze-nav { display: none; }
#capa-chofer.navegando .waze-nav { display: block; }
.alerts {
  height: 30dvh;
  min-height: 210px;
  background: var(--card);
  border-top: 1px solid var(--borde);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alerta-voz {
  font-size: .92rem;
  font-weight: 800;
  background: var(--azul-suave);
  color: var(--azul);
  border-radius: 12px;
  padding: 10px 12px;
}
.alerts-lista { list-style: none; display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; }
.alerta-fila {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid var(--borde);
  border-radius: 12px;
}
.alerta-fila .cuando { font-size: .68rem; font-weight: 800; letter-spacing: .5px; color: var(--tinta-suave); text-transform: uppercase; }
.alerta-fila .valor { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.alerta-fila .valor.vacia { color: #98a2b3; font-weight: 700; }
.alerta-fila.atu { background: var(--rojo-suave); border-color: #fecaca; color: #7f1d1d; }
.alerta-fila.riesgo { background: var(--naranja-suave); border-color: #fde68a; color: #78350f; }

.waze-controles { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.btn-control {
  border: none;
  background: var(--fondo);
  color: var(--tinta);
  font-weight: 800;
  font-size: .85rem;
  padding: 11px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.btn-control:active { transform: scale(.97); }

/* ---------- Pasajero ---------- */
.field-label { display: block; font-size: .82rem; font-weight: 700; color: var(--tinta-suave); margin: 14px 0 6px; }
select {
  width: 100%;
  padding: 14px 12px;
  border: 2px solid var(--borde);
  border-radius: 12px;
  font-size: .95rem;
  font-weight: 600;
  background: #fff;
  color: var(--tinta);
}
select:focus { border-color: var(--azul); }

.cta {
  width: 100%;
  border: none;
  background: var(--azul);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 17px 0;
  border-radius: 16px;
  cursor: pointer;
  margin-top: 16px;
  box-shadow: 0 8px 20px rgba(29, 78, 216, .35);
}
.cta:disabled { background: #b6c4e8; box-shadow: none; }

.mapa-mascara { height: 170px; border-radius: 12px; overflow: hidden; border: 1px solid var(--borde); }
.privacidad {
  margin-top: 12px;
  color: var(--tinta-suave);
  font-size: .78rem;
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 12px;
}
.mascara-anillo { background: rgba(103, 116, 142, .25); border: 2px dashed var(--tinta-suave); border-radius: 50%; }

/* ---------- Menú (hamburguesa) ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
}
.sheet {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: subir .25s ease;
  max-height: 86dvh;
  overflow-y: auto;
}
@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { font-size: 1.1rem; }
.section-title { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--tinta-suave); margin: 16px 0 8px; }
.demo-note { font-weight: 500; font-size: .7rem; color: var(--naranja); background: var(--naranja-suave); padding: 1px 8px; border-radius: 999px; text-transform: none; letter-spacing: 0; }

.modo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modo-btn {
  border: 2px solid var(--borde);
  background: #fff;
  color: var(--tinta);
  font-weight: 800;
  font-size: .95rem;
  padding: 14px 0;
  border-radius: 14px;
  cursor: pointer;
}
.modo-btn.active { border-color: var(--azul); background: var(--azul-suave); color: var(--azul); }

.lista-rutas { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ruta-card {
  width: 100%;
  text-align: left;
  border: 2px solid var(--borde);
  background: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
}
.ruta-card.active { border-color: var(--azul); background: var(--azul-suave); }
.ruta-card .nombre { font-weight: 800; font-size: .92rem; display: block; }
.ruta-card .detalle { color: var(--tinta-suave); font-size: .78rem; }
.ruta-card .meta { display: block; font-size: .7rem; color: var(--tinta-suave); margin-top: 3px; }
.menu-nota { margin-top: 14px; font-size: .74rem; color: #98a2b3; background: #f9fafb; border-radius: 10px; padding: 10px 12px; }

/* ---------- Guía y bondades ---------- */
.pasos { list-style: none; counter-reset: paso; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.pasos li {
  counter-increment: paso;
  position: relative;
  padding: 12px 14px 12px 46px;
  background: #f9fafb;
  border: 1px solid var(--borde);
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.45;
}
.pasos li::before {
  content: counter(paso);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  background: var(--azul);
  color: #fff;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
}
.bondades { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.bondades li {
  font-size: .88rem;
  background: #f9fafb;
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.45;
}
.btn-cierre {
  width: 100%;
  border: none;
  background: var(--tinta);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  padding: 14px 0;
  border-radius: 14px;
  cursor: pointer;
}

/* ---------- FAB y footer ---------- */
.fab {
  position: fixed;
  right: max(16px, calc(50% - 224px));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: var(--tinta);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .35);
  z-index: 1500;
}
.footer {
  margin-top: auto;
  text-align: center;
  color: #98a2b3;
  font-size: .7rem;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
}

/* ---------- "Vale la pena" (dinero) y resumen ---------- */
.vale {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--verde-suave);
  border: 1px solid #bbe7c5;
  border-radius: 12px;
}
.vale-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .84rem; }
.vale-soles { font-weight: 800; color: var(--verde); font-size: .95rem; white-space: nowrap; }
.vale-soles.verde { font-size: .84rem; }

.resumen { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.resumen li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid var(--borde);
  border-radius: 12px;
  font-size: .9rem;
}
.resumen li.destacado { background: var(--verde-suave); border-color: #bbe7c5; }
.resumen strong { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
