:root {
  --bg-night: #0F1B2D;
  --bg-panel: #16243B;
  --amber: #F5A623;
  --text-main: #E8ECEF;
  --text-dim: #5C6B7A;
  --green-live: #3DDC84;
  --red-off: #E85D5D;
  --border: #223350;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-night);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Header tipo letrero de ruta ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--amber);
  z-index: 10;
}

.route-name {
  font-family: 'Archivo Expanded', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-main);
}

.route-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 3px;
  background: rgba(61, 220, 132, 0.08);
  border: 1px solid rgba(61, 220, 132, 0.25);
  color: var(--green-live);
}

.status-pill.offline {
  background: rgba(232, 93, 93, 0.08);
  border-color: rgba(232, 93, 93, 0.25);
  color: var(--red-off);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---- Mapa ---- */
#map {
  flex: 1;
  filter: saturate(0.85) brightness(0.95);
}

/* ---- Panel inferior tipo tablero de embarque ---- */
.board {
  background: var(--bg-panel);
  border-top: 2px solid var(--border);
  padding: 14px 20px 18px;
  z-index: 10;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 16px;
}

.board-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.board-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

.board-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 500;
  color: var(--amber);
}

.board-value.muted {
  color: var(--text-main);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .board-grid { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
  .route-name { font-size: 1rem; }
}

.address-row {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.address-value {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.3;
}

/* ---- Estado sin datos ---- */
.empty-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Marcador de bus personalizado con indicador de rumbo */
.marker-wrap {
  width: 42px;
  height: 42px;
  position: relative;
}

.bus-marker {
  width: 34px;
  height: 34px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 2px solid #0F1B2D;
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
}
.bus-marker svg { width: 18px; height: 18px; }

/* La flecha rota según el campo "course" de Traccar; el círculo del bus permanece fijo y legible */
.direction-arrow {
  position: absolute;
  top: 0;
  left: 0;
  width: 42px;
  height: 42px;
  z-index: 1;
  transform-origin: center center;
  transition: transform 0.6s ease-out;
}
.direction-arrow svg { width: 42px; height: 42px; }

.leaflet-control-attribution { font-size: 9px !important; }
