/* ===== FUENTE: Ubuntu desde Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap');

/* ===== PALETA OFICIAL ===== */
:root {
  --red:        #D7263D;   /* Rojo principal */
  --red-dark:   #a81c2e;   /* Rojo oscuro para hover */
  --red-light:  #f25265;   /* Rojo claro para scrollbar */
  --navy:       #1B1B2F;   /* Azul oscuro / fondo principal */
  --orange:     #F46036;   /* Naranja acento */
  --bg:         #F5F5F5;   /* Gris claro / fondo secundario */
  --white:      #FFFFFF;
  --gray:       #9E9E9E;
  --gray-dark:  #424242;
  --green:      #2E7D32;
  --green-light:#4CAF50;
  --shadow:     0 4px 20px rgba(0,0,0,0.13);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.18);
  --radius:     16px;
  --radius-sm:  10px;
  --font:       'Ubuntu', 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy);
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
  background: var(--red);
  color: var(--white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(215,38,61,0.35);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .app-name  { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.3px; }
.header .subtitle  { font-size: 0.78rem; opacity: 0.82; margin-top: 1px; }

.btn-logout {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.35);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font);
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.28); }

/* ===== NAVEGADOR DE FECHA (dashboard) ===== */
.date-nav {
  background: var(--navy);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-nav-btn {
  background: rgba(255,255,255,0.12);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  transition: background 0.2s;
  flex-shrink: 0;
}
.date-nav-btn:hover { background: rgba(255,255,255,0.22); }
.date-nav-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font);
  text-align: center;
  cursor: pointer;
}
.date-nav-input::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* ===== FRANJA LINK RESERVAS ===== */
.date-strip {
  background: white;
  padding: 9px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-dark);
  border-bottom: 1px solid #E8E8E8;
}
.date-strip a { color: var(--red); font-weight: 700; text-decoration: none; }

/* ===== CONTENEDOR ===== */
.container { padding: 14px 14px; max-width: 600px; margin: 0 auto; }

/* ===== BOTONES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.97rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  min-height: 48px;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.96); }

.btn-primary  { background: var(--red);    color: white; box-shadow: 0 3px 10px rgba(215,38,61,0.3); }
.btn-primary:hover  { background: var(--red-dark); }

.btn-navy     { background: var(--navy);   color: white; box-shadow: 0 3px 10px rgba(27,27,47,0.25); }
.btn-navy:hover     { background: #2d2d4e; }

.btn-success  { background: var(--green);  color: white; box-shadow: 0 3px 10px rgba(46,125,50,0.3); }
.btn-success:hover  { background: #1B5E20; }

.btn-orange   { background: var(--orange); color: white; box-shadow: 0 3px 10px rgba(244,96,54,0.3); }
.btn-orange:hover   { background: #d44d27; }

.btn-outline  { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn-outline:hover  { background: var(--navy); color: white; }

.btn-ghost    { background: transparent; color: var(--gray-dark); border: 2px solid #DEDEDE; }
.btn-ghost:hover    { background: #F0F0F0; }

.btn-danger   { background: var(--red-dark); color: white; }

.btn-full  { width: 100%; }
.btn-sm    { padding: 8px 13px; min-height: 38px; font-size: 0.855rem; }

/* ===== TARJETAS DE RUTA ===== */
.route-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
  /* borde izquierdo coloreado según estado */
  border-left: 5px solid var(--red);
  transition: transform 0.18s, box-shadow 0.18s;
}
.route-card:hover      { box-shadow: var(--shadow-lg); }
.route-card.full       { border-left-color: var(--gray); }
.route-card.almost-full{ border-left-color: var(--orange); }

.route-header {
  background: var(--red);
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* Bochalema usa azul oscuro como fondo */
.route-header.bochalema { background: var(--navy); }
.route-header.full-bg   { background: #555; }

.route-direction {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.82;
  margin-bottom: 2px;
}
.route-title { font-size: 1.15rem; font-weight: 700; }
.route-time  { font-size: 1.55rem; font-weight: 700; letter-spacing: 0.5px; }

.route-body    { padding: 12px 16px 0; }
.route-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 14px; }

/* ===== BARRA DE PROGRESO ===== */
.progress-wrap  { margin: 8px 0 4px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--gray-dark);
  margin-bottom: 5px;
  font-weight: 600;
}
.progress-bar {
  height: 12px;
  background: #E8E8E8;
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--green-light), var(--green));
  transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.warning { background: linear-gradient(90deg, #ffab76, var(--orange)); }
.progress-fill.full    { background: linear-gradient(90deg, var(--red-light), var(--red)); }

/* ===== SLOTS VISUALES ===== */
.slots-visual { display: flex; gap: 7px; margin: 8px 0; flex-wrap: wrap; }
.slot {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s;
}
.slot.occupied { background: #fdeaed; border: 2px solid var(--red); }
.slot.free     { background: #e8f5e9; border: 2px solid var(--green-light); }

/* ===== LISTA DE PASAJEROS ===== */
.passenger-list { padding: 0 16px 14px; display: none; }
.passenger-list.open { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.passenger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
  gap: 8px;
  border-left: 3px solid transparent;
  transition: border-color 0.2s;
}
.passenger-item.confirmed-item { border-left-color: var(--green); }
.passenger-item.pending-item   { border-left-color: var(--orange); }

.passenger-info  { flex: 1; min-width: 0; }
.passenger-name  { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passenger-detail{ font-size: 0.77rem; color: var(--gray-dark); margin-top: 2px; }
.passenger-actions { display: flex; gap: 5px; flex-shrink: 0; }

.icon-btn {
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all 0.18s;
  font-family: var(--font);
}
.icon-btn.delete  { background: #fdeaed; color: var(--red); }
.icon-btn.delete:hover  { background: var(--red); color: white; }
.icon-btn.edit    { background: #e8eaf6; color: #3949AB; }
.icon-btn.edit:hover    { background: #3949AB; color: white; }
.icon-btn.confirm { background: #e8f5e9; color: var(--green); }
.icon-btn.confirm:hover { background: var(--green); color: white; }

/* ===== BADGES DE ESTADO ===== */
.confirmed-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green-light);
  display: inline-block; margin-right: 5px;
  box-shadow: 0 0 5px rgba(76,175,80,0.5);
}
.pending-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--orange);
  display: inline-block; margin-right: 5px;
}

/* ===== ENCARGOS ===== */
.package-item {
  background: #fff8ec;
  border: 2px solid #FFB300;
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  margin-bottom: 7px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.package-icon { font-size: 1.4rem; }
.package-info { flex: 1; }
.package-name   { font-weight: 700; font-size: 0.95rem; }
.package-detail { font-size: 0.78rem; color: var(--gray-dark); margin-top: 2px; }

/* ===== FORMULARIOS ===== */
.form-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.form-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-group { margin-bottom: 13px; }
.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 5px;
  color: var(--navy);
}
.form-hint {
  font-size: 0.75rem;
  color: var(--gray);
  font-weight: 400;
  margin-left: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--navy);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215,38,61,0.1);
}
.form-group textarea { resize: vertical; min-height: 76px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

/* ===== TOGGLE (viaje / encargo) ===== */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.toggle-option {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: var(--font);
  background: transparent;
  color: var(--gray-dark);
  transition: all 0.2s;
}
.toggle-option.active {
  background: var(--red);
  color: white;
  box-shadow: 0 2px 8px rgba(215,38,61,0.35);
}

/* ===== AUDIO RECORDER ===== */
.audio-recorder { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-record {
  background: var(--navy);
  color: white;
  border: none;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}
.btn-record.recording {
  background: var(--green);
  animation: pulse 1.1s infinite;
}
.audio-status { font-size: 0.83rem; color: var(--gray-dark); font-weight: 600; }

/* ===== LOGIN ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--navy) 0%, #2d2d55 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 34px 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.35);
}
.login-logo     { text-align: center; font-size: 3.8rem; margin-bottom: 6px; }
.login-title    { text-align: center; font-size: 1.55rem; font-weight: 700; color: var(--red); margin-bottom: 3px; }
.login-subtitle { text-align: center; color: var(--gray); font-size: 0.88rem; margin-bottom: 24px; }

/* ===== STATS ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 14px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 13px 10px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}
.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--red); }
.stat-label  { font-size: 0.7rem; color: var(--gray); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }

/* ===== MODAL (sheet desde abajo) ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px;
  background: #E0E0E0;
  border-radius: 4px;
  margin: -10px auto 18px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.modal-close {
  width: 34px; height: 34px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: #E0E0E0; }

/* ===== ALERTA INLINE (cupos completos) ===== */
.inline-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  animation: slideDown 0.3s ease;
}
.inline-alert.error {
  background: #fdeaed;
  border: 2px solid var(--red);
  color: var(--red-dark);
}
.inline-alert.warning {
  background: #fff3e0;
  border: 2px solid var(--orange);
  color: #b34000;
}
.inline-alert .alert-icon { font-size: 1.4rem; flex-shrink: 0; }
.inline-alert .alert-text { flex: 1; line-height: 1.4; }
.inline-alert .alert-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: inherit; padding: 0 0 0 6px;
  align-self: flex-start; opacity: 0.7;
}

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

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--navy);
  color: white;
  padding: 13px 22px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.93rem;
  z-index: 300;
  opacity: 0;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--orange); }

/* ===== SELECCIÓN DE RUTA (reservar.html) ===== */
.reservar-header {
  background: linear-gradient(160deg, var(--red) 0%, #a81c2e 100%);
  padding: 28px 20px 22px;
  color: white;
  text-align: center;
}
.reservar-header h1 { font-size: 1.6rem; font-weight: 700; }
.reservar-header p  { opacity: 0.85; margin-top: 4px; font-size: 0.95rem; }

.route-select-card {
  background: white;
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 11px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 13px;
}
.route-select-card:hover     { border-color: #ddd; transform: translateY(-1px); }
.route-select-card.selected  { border-color: var(--red); background: #fff5f6; }
.route-select-card.disabled  { opacity: 0.5; pointer-events: none; background: var(--bg); }

.route-select-icon  { font-size: 2rem; }
.route-select-info  { flex: 1; }
.route-select-time  { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.route-select-dest  { font-size: 0.88rem; color: var(--gray-dark); margin-top: 1px; }
.route-select-slots { font-size: 0.83rem; font-weight: 700; margin-top: 3px; }
.slots-available    { color: var(--green); }
.slots-none         { color: var(--red); }

/* ===== CONFIGURACIÓN ===== */
.config-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.config-info   { flex: 1; }
.config-time   { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.config-dest   { font-size: 0.83rem; color: var(--gray-dark); margin-top: 2px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 28px; color: var(--gray); }
.empty-state .icon { font-size: 2.8rem; margin-bottom: 10px; }
.empty-state p { font-size: 0.92rem; }

/* ===== FAB ===== */
/* #5: sombra reforzada para que el botón sea visible sobre cualquier fondo */
.fab {
  position: fixed;
  bottom: 22px;
  right: 20px;
  width: 58px; height: 58px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.7rem;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0,0,0,0.25),
    0 2px 5px  rgba(0,0,0,0.15),
    0 0 0 3px  rgba(255,255,255,0.55);  /* anillo blanco de separación */
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  z-index: 50;
}
.fab:hover  { background: var(--red-dark); transform: scale(1.06); }
.fab:active { transform: scale(0.93); }

/* ===== #2: TELÉFONO CLICABLE ===== */
.phone-link {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px dashed var(--navy);
  padding-bottom: 1px;
  transition: color 0.15s;
}
.phone-link:hover,
.phone-link:active { color: var(--red); border-bottom-color: var(--red); }

/* ===== #3: ETIQUETA DE CUPOS POR PASAJERO ===== */
.cupos-badge {
  display: inline-block;
  background: var(--navy);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* ===== PWA: BANNER DE INSTALACIÓN ===== */
.install-banner {
  display: none;                /* JS lo muestra cuando hay prompt disponible */
  align-items: center;
  gap: 12px;
  background: var(--navy);
  color: white;
  padding: 11px 16px;
  border-bottom: 3px solid var(--orange);
  animation: slideDown 0.35s ease;
}
.install-banner.visible { display: flex; }

.install-banner-text {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}
.install-banner-text strong { color: #FFD700; }

.install-banner .btn-install {
  background: var(--orange);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  flex-shrink: 0;
}
.install-banner .btn-install:hover { background: #d44d27; }

.install-banner .btn-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.install-banner .btn-dismiss:hover { color: white; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--red-light); border-radius: 4px; }

/* ===== ANIMACIONES ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.75; transform: scale(0.97); }
}
@keyframes ledBlink {
  0%, 100% { box-shadow: 0 0 6px var(--green-light); }
  50%       { box-shadow: 0 0 18px var(--green-light), 0 0 36px rgba(76,175,80,0.3); }
}
.led-active { animation: ledBlink 2s infinite; }

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .form-row { grid-template-columns: 1fr; }
  .route-time { font-size: 1.3rem; }
}
