:root {
    /* Paleta basada en Logo: Azul Pin y Coral Achoque */
    --brand-blue: #007aff;  
    --brand-coral: #ff746c; 
    --brand-hover: #0062cc;

    /* Tema Claro (Uber Style) */
    --bg-main: #f3f4f6;       
    --bg-panel: #ffffff;      
    --text-primary: #000000;  
    --text-secondary: #545454;
    --border-color: #e2e2e2;  
    --hover-bg: #f8f8f8;
    --shadow-color: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    /* Tema Oscuro */
    --bg-main: #000000;       
    --bg-panel: #1a1a1a;      
    --text-primary: #ffffff;  
    --text-secondary: #a0a0a0;
    --border-color: #333333;  
    --hover-bg: #2a2a2a;      
    --shadow-color: rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main); color: var(--text-primary);
    height: 100vh; overflow: hidden; display: flex; flex-direction: column;
}

/* Pantalla de Carga (Loading Screen) */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-panel); z-index: 9999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.5s ease;
}
#loading-screen img {
    width: 120px; height: auto;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Header Navbar */
header {
    background-color: var(--bg-panel); padding: 12px 20px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 5px var(--shadow-color); z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 35px; width: auto; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 600; }

/* Toggle Switch para Modo Oscuro */
.theme-switch-wrapper { display: flex; align-items: center; gap: 8px; }
.theme-switch-wrapper span { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.theme-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.theme-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(--brand-blue); }
input:checked + .slider:before { transform: translateX(24px); }

/* Contenedor Principal */
#main-container { display: flex; flex: 1; position: relative; }

/* Mapa */
#map { flex: 1; width: 100%; height: 100%; z-index: 1; }

/* Menú de Rutas (Bottom Sheet para Móviles / Sidebar para PC) */
#sidebar {
    background: var(--bg-panel);
    position: absolute; bottom: 0; left: 0; width: 100%;
    max-height: 70vh; min-height: 15vh; border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -4px 15px var(--shadow-color); z-index: 1000;
    display: flex; flex-direction: column; transition: transform 0.3s ease-in-out;
}

/* Agarradera (Drag Handle) para móviles */
.drag-handle {
    width: 40px; height: 5px; background-color: var(--border-color);
    border-radius: 3px; margin: 12px auto;
}

#lista-rutas { padding: 0 20px 20px 20px; overflow-y: auto; flex: 1; }

.ruta-item {
    padding: 15px 0; border-bottom: 1px solid var(--border-color);
    cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.ruta-item:last-child { border-bottom: none; }
.ruta-item h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.ruta-item p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.ruta-item:hover h3 { color: var(--brand-blue); }

/* Recuadro flotante de calles */
#info-calles-box {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
    background: var(--bg-panel); padding: 15px; border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color); z-index: 1000;
    width: 90%; max-width: 400px; display: none;
    border-top: 4px solid var(--brand-coral);
}
#info-calles-box h4 { margin: 0 0 5px 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
#info-calles-box p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-secondary); }

/* Estilos para PC */
@media (min-width: 768px) {
    #main-container { flex-direction: row; }
    #sidebar {
        position: relative; width: 350px; height: 100%; max-height: 100%;
        border-radius: 0; border-right: 1px solid var(--border-color);
        box-shadow: 2px 0 10px var(--shadow-color);
    }
    .drag-handle { display: none; }
    #info-calles-box { top: 20px; left: 370px; transform: none; }
}