@import url('https://fonts.googleapis.com/css2?family=Boogaloo&display=swap');

:root {
    --rojo: #ce1212;
    --amarillo: #FFC107;
    --blanco: #FFFFFF;
    --oscuro: #212121;
    --gris-suave: #f4f4f4;
    --shadow: 0 10px 30px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* --- CONTENEDOR PRINCIPAL (DEBAJO DEL NAV) --- */
.contenedor-mapa-global {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px); /* Resta la altura del navbar */
    margin-top: 0px; 
    overflow: hidden;
    background: var(--gris-suave);
}

#mapa {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- TÍTULO FLOTANTE (ARRIBA IZQUIERDA) --- */
.overlay-titulo-flotante {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: transparent;
    padding: 15px 30px;
   
}
.overlay-titulo-flotante h1 {
    font-family: 'Boogaloo', sans-serif;
    color: #000;
    font-size: clamp(28px, 4vw, 56px);
    line-height: 0.88;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 400; /* Boogaloo solo tiene peso 400 */
    margin: 0;
}
.overlay-titulo-flotante p { color: #666; font-size: 0.85rem; margin: 0; }

/* --- LISTA DE SUCURSALES (IZQUIERDA) --- */
.card-lista-flotante {
    position: absolute;
    top: 120px;
    left: 50px;
    width: 280px;
    max-height: 60vh;
    background: white;
    z-index: 1000;
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lista-header {
    background: var(--rojo);
    color: white;
    padding: 15px 20px;
}
.lista-header h2 { font-size: 1.1rem; margin: 0; }
.lista-header span { font-size: 0.8rem; opacity: 0.8; }

#items-sucursales {
    overflow-y: auto;
    flex: 1;
}

.sucursal-row {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
}
.sucursal-row i { color: var(--rojo); margin-right: 12px; }
.sucursal-row:hover { background: #fff8f8; }
.sucursal-row.active {
    background: #fff0f1;
    color: var(--rojo);
    border-left: 5px solid var(--rojo);
}

/* --- CARD DE DETALLE (DERECHA) --- */
#card-detalle-solar {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 380px;
    background: white;
    z-index: 1001;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#card-detalle-solar.hidden {
    transform: translateX(120%);
    opacity: 0;
}

.detalle-img-container {
    height: 320px;
    width: 100%;
    background: #ddd;
}
.detalle-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detalle-info { padding: 25px; }

.detalle-info h2 {
    background: var(--rojo);
    color: white;
    margin: -25px -25px 20px -25px;
    padding: 20px 25px;
    font-size: 1.4rem;
    font-weight: 900;
    text-align: center;
}

.dato-grupo { margin-bottom: 15px; }
.dato-grupo strong { color: #999; font-size: 0.75rem; text-transform: uppercase; display: block; }
.dato-grupo p { color: var(--oscuro); font-weight: 600; font-size: 1rem; margin: 2px 0; }

.btn-rojo-solar {
    display: block;
    background: var(--rojo);
    color: white;
    text-align: center;
    padding: 15px;
    border-radius: 15px;
    text-decoration: none;
    font-weight: 800;
    transition: 0.3s;
}
.btn-rojo-solar:hover { background: #a00d0d; transform: scale(1.02); }

.btn-cerrar-solar {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    z-index: 10;
}

/* --- RESPONSIVE MÓVIL --- */
@media (max-width: 768px) {

    /* Contenedor: columna, mapa arriba, lista abajo */
    .contenedor-mapa-global {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 72px);
        overflow: hidden;
    }

    /* Mapa: 45% superior */
    #mapa {
        height: 45% !important;
        width: 100%;
        flex-shrink: 0;
        z-index: 1;
    }

    /* Lista: 55% inferior, scrolleable */
    .card-lista-flotante {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: 55% !important;
        max-height: none !important;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        z-index: 2;
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
    }

    .lista-header {
        padding: 12px 16px;
        background: #fff;
        border-bottom: 2px solid var(--rojo);
        flex-shrink: 0;
    }
    .lista-header h2 { color: var(--rojo); font-size: 1rem; font-weight: 800; }
    .lista-header span { color: #888; font-size: 0.75rem; }

    #items-sucursales {
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .sucursal-row { padding: 12px 16px; font-size: 0.85rem; }

    /* Título flotante oculto en móvil */
    .overlay-titulo-flotante { display: none !important; }

    /* Card de detalle: aparece como sheet desde abajo */
    #card-detalle-solar {
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 60vh;
        border-radius: 20px 20px 0 0 !important;
        overflow-y: auto;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.25) !important;
        z-index: 10001;
        transition: transform 0.35s ease, opacity 0.35s ease;
    }

    #card-detalle-solar.hidden {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }

    .detalle-img-container {
        height: 180px;
    }

    .detalle-info {
        padding: 16px;
    }

    .detalle-info h2 {
        font-size: 1.1rem;
        padding: 14px 16px;
        margin: -16px -16px 14px -16px;
    }

    .dato-grupo { margin-bottom: 10px; }
    .dato-grupo p { font-size: 0.9rem; }

    .btn-rojo-solar {
        padding: 12px;
        font-size: 0.85rem;
        margin-top: 8px;
    }

    .btn-cerrar-solar {
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}