/* Load Inter font */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* --- Stop cards --- */

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.parada-card.animate-in {
  animation: fadeSlideUp 0.28s ease-out both;
}

/* Stale card: showing last known values after a failed refresh */
.parada-card {
  transition: opacity 0.3s ease;
}

.parada-card.desactualizada {
  opacity: 0.5;
}

/* --- Estimation rows --- */

.estim-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
}

/* Color accent bar per line, fed by --linea-color (set inline in app.js) */
.estim-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--linea-color, #334155);
}

.estim-num {
  transition: color 0.3s ease;
}

/* Loading placeholder while estimations are being fetched */
@keyframes loadingPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

.estim-loading {
  animation: loadingPulse 1.2s ease-in-out infinite;
}

/* Alert: bus arriving in <= 2 min */
@keyframes subtlePulse {
  0%,
  100% {
    background-color: rgba(56, 189, 248, 0.06);
  }
  50% {
    background-color: rgba(248, 113, 113, 0.14);
  }
}

.alerta-llegando {
  animation: subtlePulse 2s ease-in-out infinite;
}

.alerta-llegando .estim-num {
  color: #fca5a5;
}

/* --- Map: flowing dashes that show a line's direction of travel --- */
@keyframes rutaFlujo {
  to {
    stroke-dashoffset: -34;
  }
}

/* Applied to a Leaflet polyline <path> for the selected stop's lines. The dash
   advances from the first point of the path to the last (i.e. toward the
   destination); ida and vuelta flow opposite ways since their coords are reversed.
   Wider gap so the "marching ants" stay legible when zoomed in. */
.ruta-flujo {
  stroke-dasharray: 10 24;
  animation: rutaFlujo 1.1s linear infinite;
}

/* Map shell: real visible height on mobile (100vh ignores the browser bars). */
.mapa-shell {
  height: 100vh; /* fallback */
  height: 100dvh;
}

/* Collapsed bottom sheet: only the header stays; chevron flips. Solo en móvil:
   en >= sm el panel es una tarjeta flotante sin grabber/chevron (sm:hidden), así
   que la clase no debe ocultar las líneas ahí (quedaría un panel vacío e
   inexpandible). Breakpoint sm de Tailwind = 640px. */
@media (max-width: 639.98px) {
  #panel-parada.colapsado #panel-lineas {
    display: none;
  }
  #panel-parada.colapsado .panel-chevron {
    transform: rotate(180deg);
  }
}

/* Stop name labels on the map (hover at mid zoom, permanent chips when zoomed in) */
.etiqueta-parada.leaflet-tooltip {
  background: #10151f;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
/* Little arrow points back to the marker (helps when chips are nudged to a side) */
.etiqueta-parada.leaflet-tooltip-top::before {
  border-top-color: #10151f;
}
.etiqueta-parada.leaflet-tooltip-bottom::before {
  border-bottom-color: #10151f;
}
.etiqueta-parada.leaflet-tooltip-left::before {
  border-left-color: #10151f;
}
.etiqueta-parada.leaflet-tooltip-right::before {
  border-right-color: #10151f;
}

/* --- Buses en tiempo real (marker sobre el mapa) --- */
.bus-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--bc, #0ea5e9);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
.buses-activo {
  background: rgba(56, 189, 248, 0.18) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  color: #e0f2fe !important;
}

/* --- Autocomplete --- */

#autocomplete-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#autocomplete-list::-webkit-scrollbar {
  width: 6px;
}

#autocomplete-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.autocomplete-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .parada-card.animate-in {
    animation: none;
  }
  .alerta-llegando {
    animation: none;
    background-color: rgba(248, 113, 113, 0.12);
  }
  .estim-num {
    transition: none;
  }
  .estim-loading {
    animation: none;
  }
  .ruta-flujo {
    animation: none;
  }
}
