:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --red: #f33;
  --bg: #f1f3f4;
  --text: #202124;
  --gray: #5f6368;
  --green: #188038;
}

body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  padding-bottom: 40px;
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  gap: 8px;
}
.header-left { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.header-left .bus-icon { font-size: 15px; }
.header-left .brand { font-size: 11px; font-weight: 800; letter-spacing: .4px; opacity: .85; }
.header-line {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

main { max-width: 500px; margin: 0 auto; padding: 12px; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.hidden { display: none !important; }

.section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
}

.chip-group { display: flex; gap: 8px; }
.chip-group-3 .chip { font-size: 12px; padding: 10px 6px; }
.chip {
  flex: 1;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid #dadce0;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  transition: all .15s ease;
}
.chip:hover { background: #f2f6ff; }
.chip.active { background: #e8f0fe; color: var(--primary); border-color: var(--primary); }

/* Selector de modo (Urbano/Interurbano): distinto a proposito del resto de
   chips (dia/direccion) -- casi cuadrado con solo un pequeño bisel, borde
   mas grueso y relleno azul oscuro solido al activarse, para que se note
   a simple vista que es una eleccion de otro nivel (cambia toda la app). */
.chip-modo {
  border-radius: 10px;
  border-width: 2px;
  padding: 12px 10px;
  font-size: 14px;
}
.chip-modo.active {
  background: var(--primary-dark);
  color: #fff;
  border-color: var(--primary-dark);
}

label {
  font-size: 11px;
  font-weight: bold;
  color: var(--gray);
  margin-left: 5px;
  text-transform: uppercase;
  display: block;
  margin-top: 8px;
}
select {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #dadce0;
  font-size: 16px;
  margin-top: 5px;
  background: white;
}

.action-row { display: flex; gap: 8px; }
.action-row.mt-10 { margin-top: 12px; }

.btn-principal, .btn-sec, .btn-action {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-principal { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(26,115,232,0.35); }
.btn-principal:hover { background: #1765cc; }
.btn-sec { background: #eee; color: var(--gray); }
.btn-sec:hover { background: #e2e2e2; }
.btn-action { background: #f1f1f1; border: 1px solid #ddd; color: var(--text); }
.btn-action:hover { background: #e7e7e7; }

/* resultado */
.meta { font-size: 12px; color: var(--gray); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.res-container { text-align: center; }
.info-header { font-size: 14px; color: var(--gray); margin-bottom: 6px; font-weight: 600; }
.big-time { font-size: 48px; font-weight: bold; color: var(--text); line-height: 1; margin: 6px 0; }
.h-oficial-big { font-size: 20px; color: var(--gray); text-decoration: line-through; }
.arrival-dest { font-size: 15px; color: var(--primary); font-weight: 700; margin-top: 8px; }
.arrival-dest s { color: var(--gray); font-weight: 500; text-decoration: line-through; margin-right: 4px; }

.notice {
  background: #fff3cd;
  border: 1px solid #f0c36d;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}
.notice-andando {
  background: #e8f0fe;
  border-color: #90caf9;
  color: var(--primary-dark);
  margin-top: 12px;
  margin-bottom: 0;
  text-align: left;
}
.notice-retraso {
  background: #fdeaea;
  border-color: #f3b7b7;
  color: #8a1c1c;
  font-weight: 600;
}

/* Linea de tiempo vertical tipo metro, con el bus indicando la posicion actual */
.timeline { list-style: none; padding: 0 0 0 26px; margin: 6px 0 0; text-align: left; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #dde3ea;
}
.timeline-item {
  position: relative;
  padding: 9px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #b7c0cc;
}
.timeline-item.pasado::before { background: var(--primary); border-color: var(--primary); }
.timeline-item.actual::before { display: none; }
.timeline-item.actual .timeline-bus {
  position: absolute;
  left: -32px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  line-height: 1;
}
.timeline-item .nombre { color: var(--text); }
.timeline-item.pasado .nombre { color: var(--gray); }
.marca-reporte { margin-right: 3px; }
.timeline-item .horas { text-align: right; white-space: nowrap; margin-left: 10px; }
.timeline-item .h-oficial { color: var(--gray); font-size: 11px; text-decoration: line-through; }
.timeline-item .h-real { color: var(--primary-dark); font-weight: 700; }
.timeline-item .h-real.retraso { color: #c62828; }

.result-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip-hour {
  background: #e8f0fe;
  border: 1px solid #90caf9;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  color: var(--primary-dark);
}

.map-box { height: 280px; border-radius: 12px; border: 1px solid #eee; }

footer { text-align: center; padding: 15px; font-size: 12px; color: #999; }

/* Aviso de "añadir a pantalla de inicio" */
.pwa-prompt {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-width: 476px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
  padding: 14px;
  z-index: 2000;
}
.pwa-texto { font-size: 14px; margin-bottom: 10px; color: var(--text); line-height: 1.4; }
.pwa-botones { display: flex; gap: 8px; }
.pwa-botones button { flex: 1; }
.pwa-nunca-mas {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

/* Interruptor GPS estilo iOS */
.gps-control { display: flex; align-items: center; gap: 6px; }
.gps-label { font-size: 11px; font-weight: 700; letter-spacing: .3px; opacity: .85; }
.gps-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.gps-switch input { opacity: 0; width: 0; height: 0; }
.gps-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.3);
  border-radius: 24px;
  transition: background-color .2s ease;
}
.gps-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
}
.gps-switch input:checked + .gps-slider { background-color: var(--green); }
.gps-switch input:checked + .gps-slider::before { transform: translateX(20px); }

/* Contador regresivo */
.countdown-box {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 22px;
  font-weight: 800;
  background: #e6f7ec;
  color: var(--green);
  border: 2px solid #b7e4c7;
}
.countdown-box.retraso { background: #fdeaea; color: #c62828; border-color: #f3b7b7; }
.countdown-box.pasado { background: #f1f1f1; color: var(--gray); border-color: #ddd; }

/* Alertas */
#alertasContenido { font-size: 14px; }
.alerta-linea {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.alerta-linea:last-child { border-bottom: none; }
.alerta-ok { color: var(--green); font-weight: 600; }
.alerta-retraso { color: #c62828; font-weight: 700; }
.alerta-tiempo { color: var(--gray); font-size: 12px; margin-left: auto; }

.btn-alerta { background: #fff3cd; border-color: #f0c36d; color: #7a5b00; }
.btn-alerta:hover { background: #ffe9a8; }

.btn-ya-salimos {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(24,128,56,0.35);
  transition: all .15s ease;
}
.btn-ya-salimos:hover { background: #146c30; }
.btn-ya-salimos:disabled { opacity: 0.6; cursor: default; }

.alerta-estado {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  background: #fdeaea;
  color: #c62828;
}

.alerta-form { margin-top: 12px; }
.alerta-form select {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #dadce0;
  font-size: 15px;
  background: #fff;
}

/* bus pendiente: ya deberia haber pasado y nadie ha avisado de que lo haya hecho */
.big-time-pendiente { color: var(--gray); text-decoration: line-through; text-decoration-thickness: 3px; }
.btn-esperando {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: #e65100;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(230,81,0,0.35);
  transition: all .15s ease;
}
.btn-esperando:hover { background: #bf4400; }
.btn-esperando:disabled { opacity: 0.6; cursor: default; }
.alerta-estado.ok { background: #e6f7ec; color: #188038; }
.todas-sub { font-size: 13px; color: var(--gray); margin: 0 0 12px; line-height: 1.4; }
