:root {
    --rojo: #e30613;
    --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: Arial, Helvetica, sans-serif;
}

/* --- CONTENEDOR PRINCIPAL --- */
.contenedor-mapa-global {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--gris-suave);
    z-index: 0;
}

#mapa {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Franja amarilla del tÃ­tulo, compacta como la del menÃº. */
.overlay-titulo-flotante {
    position: absolute;
    top: var(--solar-nav-h, 72px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #f2a900;
    padding: 10px 5% 12px;
}
.overlay-titulo-flotante h1 {
    font-family: 'Roboto', Arial, Helvetica, sans-serif;
    color: #1a1a1a;
    font-size: clamp(24px, 4.6vh, 58px);
    line-height: 1.02;
    text-transform: uppercase;
    letter-spacing: -.05em;
    font-weight: 900;
    margin: 0;
}
.overlay-titulo-flotante p { color: #666; font-size: 0.85rem; margin: 0; }

/* --- Lista flotante --- */
.card-lista-flotante {
    position: absolute;
    top: 180px;
    left: 50px;
    width: 280px;
    max-height: 60vh;
    background: white;
    z-index: 1000;
    border-radius: .5rem 2rem;
    box-shadow: 0px 15px 20px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lista-header {
    background: var(--rojo);
    color: white;
    padding: 15px 20px;
    border-radius: .5rem 2rem 0 0;
}
.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) â€” modelo reference --- */
#card-detalle-solar {
    position: absolute;
    top: calc(var(--solar-nav-h, 72px) + 80px);
    right: 20px;
    width: 440px;              /* antes 340px â€” la foto quedaba muy pequeÃ±a */
    max-height: calc(100vh - var(--solar-nav-h, 72px) - 100px);
    overflow-y: auto;
    z-index: 1001;
    border-radius: .5rem 2rem;
    box-shadow: 0px 15px 20px -5px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: white;
}

#card-detalle-solar.hidden {
    transform: translateX(120%);
    opacity: 0;
}

/* Imagen */
.detalle-img-container {
    display: block;
    border-radius: .5rem 2rem .5rem .5rem;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.detalle-img-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* descripciÃ³n flotante sobre la imagen */
.detalle-img-desc {
    position: absolute;
    bottom: .5rem;
    left: .5rem;
    width: calc(100% - 1rem);
    padding: .4rem 1rem;
    backdrop-filter: blur(.1rem);
    -webkit-backdrop-filter: blur(.1rem);
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: .5rem 2rem;
    transition: all 0.5s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}

.detalle-img-desc:hover {
}

.detalle-img-desc span {
    color: aliceblue;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Info */
.detalle-info {
    padding: 18px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detalle-info h2 {
    font-size: 1rem;
    font-weight: 900;
    color: var(--oscuro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    background: none;
    padding: 0;
    text-align: left;
}

.dato-grupo { margin: 0; }
.dato-grupo strong {
    color: #999;
    font-size: 0.7rem;
    text-transform: uppercase;
    display: block;
    letter-spacing: 0.5px;
}
.dato-grupo p {
    color: var(--oscuro);
    font-weight: 600;
    font-size: 0.85rem;
    margin: 2px 0 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: 10px;
    right: 10px;
    background: rgba(255,255,255,0.85);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* â”€â”€ Imagen de la sucursal: presentaciÃ³n bonita y acorde a la marca â”€â”€ */
.detalle-img-container {
    height: 340px;              /* antes 200px */
    background: #f5f5f5;         /* gris claro neutro en lugar de oscuro */
}

.detalle-img-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.5s ease;
}
.detalle-img-container img.loaded {
    opacity: 1;
}
.detalle-img-container.sin-imagen img { display: none; }

/* Degradado suave abajo para que la etiqueta siempre se lea bien */
.detalle-img-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.25), transparent);
    pointer-events: none;
    z-index: 1
}

/* Etiqueta de nombre: pÃ­ldora amarilla de marca */
.detalle-img-desc {
    position: absolute;
    bottom: 14px;
    left: 14px;
    max-width: calc(100% - 124px);
    padding: 8px 16px;
    background: #fffbeb;                   /* amarillo pastel sÃ³lido */
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(227, 6, 19, 0.15);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}
.detalle-img-desc::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e30613;
    margin-right: 8px;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.28);
}
.detalle-img-desc span {
    display: inline;
    color: #5c0000;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* BotÃ³n YANGO integrado en el cuadro de la foto */
.btn-yango {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--amarillo);
    color: var(--oscuro);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 1.4px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, background 0.2s ease;
}
.btn-yango:hover {
    transform: translateY(-2px);
    background: #ffd633;
}

/* â”€â”€ BotÃ³n "Ver en mapa": posiciÃ³n limpia dentro de la card â”€â”€ */
.sucursal-btn-wrapper {
    position: static;
    top: auto;
    left: auto;
    width: 100%;
    height: auto !important;
    margin-top: 14px;
    transform: none !important;
    display: block !important;
}
.sucursal-btn {
    width: 100%;
    justify-content: center;
    padding: 0.9em 1.5em 0.9em 3em;
    font-size: 0.9em;
}
.sucursal-btn-wrapper:has(.sucursal-btn:hover) { transform: none !important; }

/* --- 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 compacto visible tambiÃ©n en mÃ³vil. */
    .overlay-titulo-flotante {
        display: block !important;
        top: var(--solar-nav-h, 56px);
        padding: 8px 5% 9px;
    }
    .overlay-titulo-flotante h1 { font-size: clamp(24px, 8vw, 44px); }

    /* Card de detalle: aparece como sheet desde abajo */
    #card-detalle-solar {
        position: fixed !important;
        bottom: calc(90px + env(safe-area-inset-bottom)) !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 88vh;
        border-radius: 20px 20px 0 0 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.25) !important;
        z-index: 9997;  /* por debajo del bottom nav (9998) */
        transition: transform 0.35s ease, opacity 0.35s ease;
    }

    #card-detalle-solar.hidden {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }

    /* La imagen de referencia baja un poco para no dominar la pantalla */
    .detalle-img-container {
        height: 44vh;
        min-height: 240px;
        border-radius: 20px 20px 0 0;
        flex: 0 0 auto;
        background: #f5f5f5;
    }

    .detalle-img-container img {
        height: 44vh;
        min-height: 240px;
        object-fit: cover;
    }
    .detalle-img-container img.loaded {
        opacity: 1;
    }

    /* Degradado suave abajo para que la etiqueta siempre se lea bien (mÃ³vil) */
    .detalle-img-container::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 35%;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
        pointer-events: none;
        z-index: 1
    }

    .detalle-info {
        padding: 14px 16px 16px;
        gap: 8px;
    }

    /* Quitar el margin negativo del h2 que lo sacaba del flujo */
    .detalle-info h2 {
        font-size: 1rem;
        padding: 0;
        margin: 0 0 8px 0;
        background: none;
        text-align: left;
    }

    .dato-grupo { margin-bottom: 6px; }
    .dato-grupo p { font-size: 0.85rem; }

    .btn-rojo-solar {
        padding: 12px;
        font-size: 0.85rem;
        margin-top: 8px;
        border-radius: 10px;
    }

    .btn-cerrar-solar {
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
    }

    /* BotÃ³n "Ver en mapa" â€” resetear posiciÃ³n relativa rara */
    .sucursal-btn-wrapper {
        position: static;
        top: auto;
        left: auto;
        margin-top: 8px;
        font-size: 16px;
        width: 100%;
    }
    .sucursal-btn {
        width: 100%;
        justify-content: center;
        padding: 0.8em 1em 0.8em 2.5em;
        font-size: 0.85em;
    }
}

/* â”€â”€ BotÃ³n Ver en mapa â”€â”€ */
.sucursal-btn-wrapper {
    --btn-color: #e30613;
    --text-color: #fff;
    --land-color: #ffdd9f;
    --veg-color: #36ad5aa9;
    --water-color: #b3e3ff;
    --transition-dur: 0.3s;
    position: relative;
    top: -40px;      /* â† mueve arriba/abajo: negativo = sube */
    left: 130px;     /* â† mueve izq/der: positivo = derecha */
    display: inline-flex;
    align-items: center;
    font-size: 26px;
    user-select: none;
    overflow: hidden;
    contain: paint;
    border-radius: 50ch;
    clip-path: inset(0 round 50ch);
    box-shadow: 0px -1px 2px rgba(3,7,18,0.005), 0px -5px 6px rgba(3,7,18,0.009),
                0px -12px 12px rgba(3,7,18,0.015), 0px -20px 22px rgba(3,7,18,0.02),
                0px -32px 32px rgba(3,7,18,0.06);
    transition: transform var(--transition-dur) ease;
    margin-top: 16px;
}
.sucursal-btn {
    cursor: pointer;
    padding: 1em 1.5em 1em 3.5em;
    border-radius: 50ch;
    background-color: var(--btn-color);
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1em;
    transition: color var(--transition-dur) ease-in-out,
                background-color var(--transition-dur) ease-in-out;
}
.sucursal-pin {
    pointer-events: none;
    position: absolute;
    height: 60%;
    aspect-ratio: 1;
    top: 20%;
    left: 0.75em;
    border-radius: 50%;
    background-color: var(--text-color);
    transform: rotateZ(45deg);
    mask-image: radial-gradient(circle at center, #0000 0%, #0000 32%, #fff 36%);
    filter: blur(0.25px);
    transition: background-color var(--transition-dur) ease-in-out,
                transform var(--transition-dur) ease-in-out,
                border-radius calc(var(--transition-dur) + 0.1s) ease;
    z-index: 1;
}
.sucursal-map-container {
    pointer-events: none;
    position: absolute;
    left: 40px;
    top: 140%;
    perspective: 120px;
    transform: perspective(120px) rotateX(35deg) scaleX(0);
    transform-origin: 3em 0.5em;
    transition: transform var(--transition-dur) ease-in-out,
                opacity var(--transition-dur) ease-in-out;
    opacity: 0;
    z-index: 0;
}
.sucursal-map {
    position: absolute;
    bottom: 0;
    width: 120px;
    height: 200px;
    background-color: var(--water-color);
    background-image: linear-gradient(to bottom, #fff2, 30%, #0000);
    transform-origin: left bottom;
}
.sucursal-map::after {
    content: "";
    top: -40px; left: 12px;
    width: 100%; height: 200%;
    background-color: var(--land-color);
    position: absolute;
    filter: url(#land);
    box-shadow: inset 0 0 48px 24px var(--veg-color);
    z-index: 0;
}
.sucursal-fold-1, .sucursal-fold-2,
.sucursal-fold-3, .sucursal-fold-4 {
    mask-image: linear-gradient(to top, #fff, 97%, #0000);
    overflow: hidden;
}
.sucursal-fold-1 { left: -60px;  transform: rotateY(10deg)  translateZ(30px); }
.sucursal-fold-2 { left: 60px;   transform: rotateY(-10deg) translateZ(10px); }
.sucursal-fold-3 { left: -169px; transform: rotateY(-15deg) translateZ(-1px); }
.sucursal-fold-4 { left: 166px;  transform: rotateY(15deg)  translateZ(31px); }
.sucursal-fold-1::before, .sucursal-fold-2::before,
.sucursal-fold-3::before, .sucursal-fold-4::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    box-shadow: inset 0 10px 16px 3px #0004;
    z-index: 1;
}
.sucursal-btn-wrapper:has(.sucursal-btn:hover) { transform: scale(1.1); }
.sucursal-btn:hover { background-color: var(--text-color); color: #00000025; }
.sucursal-btn:hover + .sucursal-pin {
    background-color: var(--btn-color);
    border-radius: 50% 50% 0 50%;
    transform: rotateZ(45deg) translate(-0.3em, -0.3em);
}
.sucursal-btn:hover ~ .sucursal-map-container {
    transform: perspective(100px) rotateX(35deg) scaleX(0.8);
    opacity: 1;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   TÃTULO unificado â€” misma fuente y tamaÃ±o que "NUESTRO MENU"
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.overlay-titulo-flotante h1 {
    font-family: 'Roboto', Arial, Helvetica, sans-serif;
    font-size: clamp(24px, 4.6vh, 58px);
    line-height: 1.02;
    text-transform: uppercase;
    letter-spacing: -.05em;
    color: #1a1a1a;
    font-weight: 900;
}

/* La tarjeta de sucursales se agranda solo en escritorio. */
@media (min-width: 769px) {
    .card-lista-flotante {
        width: 360px;
        max-height: 68vh;
    }

    /* Foto de la sucursal mÃ¡s grande en escritorio */
    #card-detalle-solar {
        width: clamp(460px, 42vw, 580px);
    }
    .detalle-img-container,
    .detalle-img-container img {
        height: min(58vh, 460px);
    }

    /* El logo no debe tapar los controles de zoom del mapa */
    .header.header--map > .logo {
        transform: translateX(38px);
    }
}

/* En mÃ³vil el tÃ­tulo conserva el mismo lenguaje que "Ãšnete a nuestro equipo". */
@media (max-width: 768px) {
    .overlay-titulo-flotante h1 {
        font-size: clamp(24px, 8vw, 44px);
        line-height: 1.02;
    }
}

@media (max-width: 420px) {
    .overlay-titulo-flotante h1 {
        font-size: 30px;
        letter-spacing: .5px;
    }
}
