/* =========================================
   1. VARIABLES, RESETEO Y MODO OSCURO
   ========================================= */
   :root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --panel-bg: #ffffff;
    --border-color: #eee;
    --primary-color: #007bff; /* Azul Koox */
    --nav-green: #e8f5e9;     /* Fondo header navegación */
    --nav-green-text: #1b5e20;
    --secondary-bg: #f8f8f8;
    --shadow-color: rgba(0,0,0,0.2);
    --map-filter: none;
}

/* --- MODO OSCURO --- */
body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --panel-bg: #1e1e1e;
    --border-color: #333;
    --primary-color: #4dabf5;
    --nav-green: #1b2e1e;
    --nav-green-text: #a5d6a7;
    --secondary-bg: #2d2d2d;
    --shadow-color: rgba(0,0,0,0.5);
    /* Invierte el mapa base para efecto nocturno */
    --map-filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* --- ACCESIBILIDAD --- */
body.large-text { font-size: 18px; }
body.large-text h3 { font-size: 1.5em; }
body.large-text button { font-size: 1.1em; padding: 15px; }

body.high-contrast {
    --primary-color: #0044cc;
    --text-color: #000000;
    --border-color: #000000;
}
body.high-contrast button, 
body.high-contrast .opcion-ruta { border: 2px solid #000 !important; }

/* RESETEO GENERAL */
body, html {
    margin: 0; padding: 0; height: 100%; width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background-color: var(--bg-color); color: var(--text-color);
}

/* Espacio inferior para la barra de navegación */
body { padding-bottom: 65px; box-sizing: border-box; }

/* Mapa ocupa todo el fondo */
#map { height: 100%; width: 100%; z-index: 1; }

/* Filtro para mapa oscuro */
.leaflet-layer, .leaflet-control-zoom-in, .leaflet-control-zoom-out { filter: var(--map-filter); }
.leaflet-marker-icon, .leaflet-popup-content-wrapper, .leaflet-tooltip { filter: none !important; }


/* =========================================
   2. PANELES DESLIZANTES (Control y Navegación)
   ========================================= */
#panel-control, #panel-navegacion {
    position: absolute;
    top: 0; left: 0;
    width: 100%; 
    max-width: 400px; /* En escritorio no ocupa todo */
    height: auto;
    max-height: calc(100% - 70px); /* Respetar barra inferior */
    background-color: var(--panel-bg);
    color: var(--text-color);
    box-shadow: 0 4px 15px var(--shadow-color);
    z-index: 1000;
    
    /* CORRECCIÓN ANIMACIÓN: display flex !important anula el display:none de .oculto */
    display: flex !important; 
    flex-direction: column;
    
    /* ANIMACIÓN SUAVE */
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 15px;
}

/* Estado oculto: Se desliza hacia ARRIBA (fuera de vista) */
#panel-control.oculto, #panel-navegacion.oculto {
    transform: translateY(-120%) !important;
    pointer-events: none; /* Evitar clicks fantasmas */
}

/* ENCABEZADOS DE PANEL */
.panel-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}

/* Encabezado especial verde para Navegación Activa */
.panel-header-nav {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--nav-green);
    color: var(--nav-green-text);
    display: flex; align-items: center; justify-content: space-between;
}

.panel-header h3 { margin: 0; font-size: 1.2em; flex-grow: 1; margin-left: 10px; }

/* Botones de Cabecera (Ajustes, Info) */
.header-buttons { display: flex; gap: 10px; }
.icon-btn, .info-btn {
    width: 36px; height: 36px; background-color: var(--secondary-bg);
    border: 1px solid var(--border-color); border-radius: 50%;
    color: var(--text-color); cursor: pointer; 
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2em; transition: background 0.2s;
}
.icon-btn:active { background-color: #ddd; }

/* Botón Minimizar (Flecha simple) */
.icon-btn-simple {
    background: none; border: none; padding: 5px;
    font-size: 1.8em; color: var(--text-color);
    cursor: pointer; display: flex; align-items: center;
}


/* =========================================
   3. CONTENIDOS DE PANELES
   ========================================= */
/* Inputs y Formularios */
.control-grupo { margin-bottom: 15px; }
.control-grupo label { display: block; font-size: 0.85em; font-weight: bold; margin-bottom: 5px; opacity: 0.8; }
.control-grupo input, .control-grupo select {
    width: 100%; padding: 12px; box-sizing: border-box; 
    border: 1px solid #ccc; border-radius: 8px;
    background-color: var(--secondary-bg); color: var(--text-color); border-color: var(--border-color);
    font-size: 1em;
}

/* Sub-paneles internos */
#panel-viaje, #panel-explorar, #panel-reporte {
    display: flex; flex-direction: column;
    overflow-y: auto; /* Scroll si el contenido es largo */
    max-height: 60vh;
}
#panel-viaje.oculto, #panel-explorar.oculto, #panel-reporte.oculto { display: none; }

#controles-viaje, #controles-explorar, #controles-reporte { padding: 15px; }
#panel-instrucciones, #panel-instrucciones-explorar { padding: 15px; border-top: 1px solid var(--border-color); }

/* --- ESTILOS RESTAURADOS PARA REPORTES Y CONTACTO --- */

/* Botones Grandes de Reporte */
.reporte-botones-grupo {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px;
}
.btn-reporte {
    padding: 15px 10px;
    font-size: 0.95em; font-weight: bold; color: var(--text-color);
    background-color: var(--secondary-bg); border: 1px solid var(--border-color);
    border-radius: 8px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    transition: background 0.2s, transform 0.1s;
}
.btn-reporte:active { transform: scale(0.98); background-color: #eee; }

/* Botones Azules/Gris de Contacto (Info) */
.info-botones-contacto {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.btn-info-accion {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 12px;
    border-radius: 8px; text-decoration: none;
    font-weight: bold; font-size: 1em;
    transition: transform 0.2s, opacity 0.2s;
    border: none; color: white;
}
.btn-info-accion:active { transform: scale(0.97); }

.btn-azul { background-color: #007bff; box-shadow: 0 4px 6px rgba(0,123,255,0.2); }
.btn-gris { background-color: #6c757d; box-shadow: 0 4px 6px rgba(108,117,125,0.2); }
.btn-secundario { color: var(--text-color) !important; background-color: #e2e6ea; border: 1px solid #dae0e5; }

.info-seccion { margin-bottom: 20px; }
.info-seccion h5 { margin: 0 0 10px 0; font-size: 1em; color: var(--primary-color); }
.separador-suave { border: 0; border-top: 1px solid #eee; margin: 20px 0; }


/* =========================================
   4. BARRA DE NAVEGACIÓN INFERIOR
   ========================================= */
.bottom-nav {
    position: fixed; bottom: 0; left: 0;
    width: 100%; height: 65px;
    background-color: var(--panel-bg);
    display: flex; justify-content: space-around; align-items: center;
    box-shadow: 0 -2px 10px var(--shadow-color);
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border-color);
}

.nav-item {
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #999; font-size: 0.75em; cursor: pointer;
    width: 20%; padding: 5px 0;
    transition: color 0.2s;
}
.nav-item i { font-size: 1.5em; margin-bottom: 2px; transition: transform 0.2s; }
.nav-item.activo { color: var(--primary-color); font-weight: bold; }
.nav-item.activo i { transform: translateY(-3px); }


/* =========================================
   5. PANTALLAS COMPLETAS (Saldo / Recargas)
   ========================================= */
.pantalla-completa {
    position: fixed; top: 0; left: 0;
    width: 100%; height: calc(100% - 65px);
    background-color: var(--secondary-bg);
    z-index: 1500;
    display: flex; justify-content: center; align-items: center;
    padding: 20px; box-sizing: border-box;
}
.placeholder-content { text-align: center; color: var(--text-color); }
.icono-grande { font-size: 5em; color: #ccc; display: block; margin-bottom: 20px; }
.badge-desarrollo {
    display: inline-block; background-color: #ffc107; color: #333;
    padding: 6px 12px; border-radius: 20px; font-size: 0.85em; font-weight: bold; margin-top: 15px;
}


/* =========================================
   6. MODALES (Ajustes, Info)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 2100;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-content {
    background-color: var(--panel-bg); width: 90%; max-width: 450px; max-height: 85vh;
    padding: 0; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 15px 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    background-color: var(--secondary-bg);
}
.modal-header h4 { margin: 0; font-size: 1.1em; }

.modal-close {
    font-size: 2em; line-height: 0.8; cursor: pointer; color: #aaa;
}
.modal-close:hover { color: var(--text-color); }

/* Ajuste del cuerpo del modal */
.settings-content, .info-body { 
    padding: 20px; overflow-y: auto; max-height: 70vh; 
}
.info-body p { margin: 10px 0; line-height: 1.5; }

/* Caja verde para transbordo gratis */
.alerta-verde {
    background-color: #d4edda; color: #155724; padding: 10px; border-radius: 5px;
    margin: 10px 0; text-align: center; border: 1px solid #c3e6cb;
}

/* Switches de Ajustes */
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.setting-item:last-child { border-bottom: none; }
.setting-label { display: flex; flex-direction: column; }
.setting-label span { font-weight: 500; }

.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(24px); }


/* =========================================
   7. ELEMENTOS DEL MAPA & CHOICES
   ========================================= */
/* Botones primarios */
#btnIniciarRuta, #btnLimpiar, #btnLimpiarExplorar, .btn-primario-full {
    display: block; width: 100%; box-sizing: border-box;
    margin: 10px 0; padding: 14px;
    font-size: 1em; font-weight: bold; color: white;
    border: none; border-radius: 8px; cursor: pointer;
    text-align: center;
}
#btnIniciarRuta, .btn-primario-full { background-color: var(--primary-color); }
#btnLimpiar, #btnLimpiarExplorar { background-color: #6c757d; }

/* Correcciones Choices.js */
.choices__inner, .choices__list--dropdown {
    background-color: var(--secondary-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}
.choices__item--choice { color: var(--text-color) !important; }

/* Marcadores */
.paradero-icono-koox, .paradero-icono-transbordo, .paradero-icono-destino {
    border: 3px solid white; border-radius: 50%; width: 16px; height: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.paradero-icono-koox { background-color: #007bff; }
.paradero-icono-transbordo { background-color: #ffc107; }
.paradero-icono-destino { background-color: #dc3545; }
.bus-vivo-icono {
    background-color: #28a745; border: 2px solid white; border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5); color: white;
    font-weight: bold; font-size: 14px; text-align: center; line-height: 26px;
}


/* =========================================
   8. UTILS (Offline, Alertas, Splash)
   ========================================= */
.oculto { display: none !important; }

#offline-indicator, #alert-indicator {
    position: fixed; bottom: 65px; left: 0; width: 100%;
    text-align: center; font-size: 0.9em; font-weight: bold;
    z-index: 1900; padding: 8px;
    transform: translateY(100%); transition: transform 0.3s ease;
}
#offline-indicator { background-color: #333; color: white; }
#alert-indicator { background-color: #ffc107; color: #333; }

#offline-indicator:not(.oculto), #alert-indicator:not(.oculto) { transform: translateY(0); }

/* Ajustes de posición Leaflet */
.leaflet-bottom { bottom: 75px !important; }

/* =========================================
   SPLASH SCREEN (PANTALLA DE CARGA)
   ========================================= */
   #web-splash {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-color); 
    z-index: 99999;
    /* Centrado del contenedor principal */
    display: flex; 
    justify-content: center; 
    align-items: center;
    transition: opacity 0.5s ease-out;
}

.splash-content {
    /* Centrado de los elementos internos */
    display: flex;
    flex-direction: column; /* Apila logo, texto y loader */
    align-items: center;    /* Centra horizontalmente */
    text-align: center;
}

.splash-logo { 
    width: 120px; /* Un poco más grande para que luzca */
    height: auto;
    margin-bottom: 15px; 
    /* Animación opcional de latido */
    animation: pulse 2s infinite; 
}

.splash-content h2 {
    margin: 10px 0 20px 0;
    font-size: 1.5em;
    color: #888; /* Color gris suave o usa var(--primary-color) */
    font-weight: bold;
}

.loader {
    border: 4px solid #f3f3f3; 
    border-top: 4px solid var(--primary-color);
    border-radius: 50%; 
    width: 40px; 
    height: 40px;
    animation: spin 1s linear infinite; 
}

/* Animaciones */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* =========================================
   ESTILOS DE CONTROLES DE NAVEGACIÓN
   ========================================= */

   #controles-nav {
    display: flex;
    gap: 15px; /* Espacio entre botones */
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Estilo Base del Botón de Navegación */
.btn-nav {
    flex: 1; /* Para que ocupen el mismo ancho */
    padding: 12px 15px;
    border: none;
    border-radius: 12px; /* Bordes redondeados modernos */
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Espacio entre icono y texto */
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Efecto al presionar */
.btn-nav:active {
    transform: scale(0.96);
    box-shadow: none;
}

/* --- Variantes de Color --- */

/* 1. Botón Siguiente (Primario - Azul) */
.btn-nav-primario {
    background-color: var(--primary-color);
    color: white;
}
.btn-nav-primario:hover {
    background-color: #0056b3; /* Azul un poco más oscuro */
}

/* 2. Botón Anterior (Secundario - Gris) */
.btn-nav-secundario {
    background-color: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.btn-nav-secundario:hover {
    background-color: #e2e6ea;
}

/* 3. Botón Finalizar (Danger - Rojo) */
.btn-nav-danger {
    background-color: #dc3545; /* Rojo Bootstrap */
    color: white;
}
.btn-nav-danger:hover {
    background-color: #bd2130;
}

/* --- Estado Deshabilitado --- */
.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef;
    color: #6c757d;
    box-shadow: none;
    transform: none; /* No animar si está deshabilitado */
}

/* =========================================
   ESTILOS DE OPCIONES DE RUTA (Tarjetas)
   ========================================= */

/* El contenedor de cada opción (La tarjeta) */
.opcion-ruta {
    background-color: var(--bg-color); /* Fondo según tema (blanco/oscuro) */
    border: 1px solid var(--border-color);
    border-radius: 16px; /* Bordes redondeados */
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Sombra suave */
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Efecto hover en escritorio (opcional) */
.opcion-ruta:hover {
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

/* Título de la opción (Ej: Opción 1) */
.opcion-ruta h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* La lista de pasos (1. Dirígete a...) */
.opcion-ruta ol {
    padding-left: 20px;
    margin-bottom: 20px;
    color: var(--text-color);
}

.opcion-ruta li {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 0.95em;
}

/* --- EL BOTÓN DE SELECCIÓN --- */
.btn-seleccionar {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600; /* Texto semi-negrita */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Espacio entre texto e icono */
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2); /* Sombra azulada */
}

/* Estados del botón */
.btn-seleccionar:hover {
    background-color: #0056b3; /* Azul más oscuro */
    transform: translateY(-1px);
}

.btn-seleccionar:active {
    transform: scale(0.98); /* Efecto de click */
    box-shadow: none;
}

/* Ajuste para Modo Oscuro (asegura legibilidad) */
body.dark-mode .opcion-ruta {
    background-color: #1e1e1e;
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* =========================================
   ESTILOS DE BÚSQUEDA Y CHIPS
   ========================================= */

/* Contenedor Input + Botón */
.input-con-boton {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

/* Botón Lupa */
.btn-lupa {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    border-radius: 8px;
    width: 46px; /* Ancho fijo */
    cursor: pointer;
    font-size: 1.2em;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.btn-lupa:active { background-color: #ddd; transform: scale(0.95); }

/* Mensaje de resultado */
.info-busqueda {
    display: block; margin-top: 5px; font-size: 0.85em;
    color: #28a745; background-color: #e8f5e9;
    padding: 5px 10px; border-radius: 6px; border: 1px solid #c8e6c9;
}

/* --- CHIPS (Categorías) --- */
.chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto; /* Scroll horizontal */
    padding: 5px 2px 15px 2px; /* Padding abajo para la sombra */
    margin-top: 10px;
    /* Ocultar barra de scroll fea pero permitir scroll */
    scrollbar-width: none; 
}
.chips-scroll::-webkit-scrollbar { display: none; }

.chip {
    white-space: nowrap; /* No romper línea */
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 20px; /* Forma de píldora */
    font-size: 0.85em;
    color: var(--text-color);
    cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.1s, background 0.2s;
}

.chip i { font-size: 1.1em; color: #777; }

.chip:active { transform: scale(0.95); background-color: #f0f0f0; }

/* Chip Especial Turismo */
.chip-turismo {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white; border: none; font-weight: bold;
}
.chip-turismo i { color: white; }

/* Modo Oscuro Chips */
body.dark-mode .chip { background-color: #2d2d2d; border-color: #444; }
body.dark-mode .chip:active { background-color: #444; }

/* =========================================
   NUEVOS ICONOS DEL MAPA (Leaflet DivIcons)
   ========================================= */

/* 1. USUARIO (Efecto GPS Pulsante) */
.user-gps-marker {
    background-color: #2196f3; /* Azul Google */
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    /* Animación de onda expansiva */
    animation: gps-pulse 2s infinite; 
}
@keyframes gps-pulse {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

/* 2. PARADERO (Subida / Bajada) */
.icono-mapa-bus {
    background-color: white;
    border: 2px solid #0d47a1; /* Azul oscuro */
    border-radius: 8px; /* Cuadrado redondeado */
    color: #0d47a1;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: bold;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 3. TRANSBORDO (Intercambio) */
.icono-mapa-transbordo {
    background: linear-gradient(135deg, #ff9800, #f57c00); /* Naranja vibrante */
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(245, 124, 0, 0.4);
}

/* 4. DESTINO FINAL (Meta) */
.icono-mapa-destino {
    color: #d32f2f; /* Rojo */
    font-size: 32px;
    filter: drop-shadow(0 3px 2px rgba(0,0,0,0.3));
    /* ELIMINADO: margin-top: -15px; -> Esto lo desalineaba */
    display: block; /* Asegura que ocupe el espacio correcto */
    line-height: 32px; /* Centrado vertical perfecto */
}

/* Estilo para la Marca en el Header */
.marca-header {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit; /* IMPORTANTE: Hereda el color (negro o blanco) según tu tema */
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-grow: 1; /* Ocupa el espacio central */
    margin: 0 10px; /* Separación de los botones laterales */
}

.marca-header:hover {
    opacity: 0.7; /* Efecto visual al tocar */
}

.logo-mini {
    height: 28px; /* Tamaño perfecto para header móvil */
    width: auto;
    margin-right: 8px;
    border-radius: 6px; /* Bordes suaves estilo iOS */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra sutil */
}

/* Aseguramos que el H3 se comporte bien dentro del link */
.marca-header h3 {
    margin: 0;
    font-size: 1.15rem;
    white-space: nowrap; /* Evita que el texto se rompa en dos líneas */
}

/* --- Overlay de Carga --- */
.overlay-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6); /* Blanco semi-transparente */
    backdrop-filter: blur(5px); /* DIFUMINADO DEL FONDO */
    z-index: 9999; /* Encima de todo, incluido el mapa */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader-content {
    background: white;
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
    font-weight: 600;
    color: #444;
}

.loader-content p {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Utilidad para ocultar */
.oculto {
    display: none !important;
}

/* --- ESTILO DE LA PASTILLA FLOTANTE --- */
.marca-flotante-top {
    position: fixed; /* Fixed para que flote sobre todo */
    
    /* 🧠 CÁLCULO INTELIGENTE: 
       15px base + lo que mida la barra de estado del celular (safe-area) */
    top: calc(env(safe-area-inset-top) + 15px);
    
    left: 50%;
    transform: translateX(-50%); /* Centrado perfecto */
    
    /* Diseño Cristal (Glassmorphism) */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    
    padding: 8px 20px;
    border-radius: 50px; /* Bordes totalmente redondos */
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); /* Sombra suave */
    
    z-index: 2000; /* Por encima del mapa y paneles */
    
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #1a1a1a; /* Texto oscuro */
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.marca-flotante-top:active {
    transform: translateX(-50%) scale(0.95); /* Efecto de click */
}

.logo-flotante {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    border-radius: 5px;
}

/* --- SOPORTE MODO OSCURO (Opcional, si usas la clase .dark-mode en body) --- */
body.dark-mode .marca-flotante-top {
    background: rgba(30, 30, 30, 0.95);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- 1. SOLUCIÓN AL BLOQUEO DEL TOUR (Z-INDEX) --- */

/* La caja de texto y botones del tour (Popover) */
.driver-popover {
    z-index: 1000000000 !important; /* Mil millones: Siempre visible */
}

/* El menú desplegable de Choices.js */
.choices__list--dropdown, 
.choices__list[aria-expanded="true"] {
    z-index: 1000000001 !important; /* Mil millones + 1: Encima del tour */
    visibility: visible !important;
    opacity: 1 !important; 
}

/* Asegurar que el contenedor del buscador resalte sobre lo oscuro */
.driver-active-element {
    z-index: 1000000000 !important;
    position: relative !important;
}

/* --- 2. BOTÓN DE RECORRIDO (Diseño Compacto) --- */
/* Reemplaza cualquier estilo anterior de #btnIniciarRecorrido con este */
#btnIniciarRecorrido {
    background-color: #007bff !important;
    color: white !important;
    border: none;
    
    /* TAMAÑO COMPACTO */
    padding: 6px 14px !important;    /* Menos relleno */
    border-radius: 20px !important;  /* Estilo 'Chip' redondo */
    width: auto !important;          /* Que se ajuste al texto */
    display: inline-flex !important; /* Evita que ocupe todo el ancho */
    float: right;                    /* Alineado a la derecha */
    
    margin-top: 10px;
    font-weight: 600;
    font-size: 0.8rem !important;    /* Letra más pequeña */
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.2s, background 0.2s;
}

#btnIniciarRecorrido:hover {
    background-color: #0056b3 !important;
    transform: scale(1.05);
}

/* =========================================
   SOLUCIÓN FINAL: TOUR TRANSPARENTE INTERACTIVO
   ========================================= */

/* 1. HACE QUE EL FONDO INVISIBLE NO BLOQUEE CLICS */
.driver-overlay, 
.driver-overlay path {
    pointer-events: none !important; /* La magia: los clics atraviesan el fondo */
}

/* 2. PERO LA BURBUJA DEL TOUR SÍ DEBE RECIBIR CLICS (Siguiente/Atrás) */
.driver-popover {
    z-index: 2147483647 !important; /* Máxima altura posible */
    pointer-events: auto !important; /* Reactiva los clics en la burbuja */
}

/* 3. ASEGURAR QUE EL PANEL RESALTADO TAMBIÉN RECIBA CLICS */
.driver-active-element,
.driver-highlighted-element {
    z-index: 2147483646 !important; 
    pointer-events: auto !important;
}
/* =========================================
   SOLUCIÓN FINAL: DESBLOQUEO TOTAL
   ========================================= */

/* 1. SEGURO DE VIDA: Evita que la capa invisible bloquee la app */
/* Driver.js v1 usa este ID o clase para el fondo */
#driver-page-overlay,
.driver-overlay {
    pointer-events: none !important; /* ¡LA CLAVE! Los clics atraviesan el fondo */
    opacity: 0 !important;           /* Asegura invisibilidad */
}

/* 2. Reactivar clics SOLO en la burbuja de texto (botones Siguiente/Atrás) */
.driver-popover {
    pointer-events: auto !important; 
    z-index: 999999999 !important;   /* Siempre encima de todo */
}

/* =========================================
   CORRECCIÓN FINAL: FIJAR POSICIÓN DEL MENÚ
   ========================================= */

/* Esto evita que el menú desaparezca o salte al ser resaltado */
.bottom-nav.driver-active-element {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 2147483647 !important; /* Máxima prioridad */
}

/* Ajuste del recuadro blanco para el menú */
.bottom-nav.driver-active-element::after {
    content: '';
    display: block;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Un borde sutil para que se vea bonito */
    box-shadow: inset 0 0 0 2px var(--primary-color);
    pointer-events: none;
}

/* =========================================
   BANNER INTELIGENTE DE ESTADO (MOTOR)
   ========================================= */
#banner-inteligente-koox {
    position: absolute; 
    top: 85px; /* Justo debajo del buscador */
    left: 50%; 
    transform: translateX(-50%);
    z-index: 2000; 
    padding: 10px 20px; 
    border-radius: 30px;
    font-weight: bold; 
    font-size: 0.9em; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    display: flex; 
    align-items: center; 
    gap: 8px; 
    width: max-content; 
    max-width: 90%; 
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    opacity: 0; 
    pointer-events: none; 
    margin-top: -20px;
}
#banner-inteligente-koox.visible { 
    opacity: 1; 
    margin-top: 0; 
}
.status-critico { background: #dc3545; color: white; border: 2px solid #b02a37; }
.status-nocturno { background: #312e81; color: #e0e7ff; border: 2px solid #4338ca; }
.status-trafico { background: #f59e0b; color: white; border: 2px solid #d97706; }