* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: "Roboto", Arial, sans-serif;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sub-panel {
    padding: 0;
}

.videoport-section {
    height: 100vh !important;
    height: 100dvh !important;
}

#video-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

#video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.blanco {
    background-color: #fff;
    padding: 3rem 1rem;
    position: relative;
    z-index: 3;
    flex-grow: 1;
    font-size: 1.3em;
    font-weight: 300;
}

.blanco .contenedor {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* CARRUSEL TITULOS */
.carrusel-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    height: 500px;
}

.carrusel {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.carrusel-slide {
    min-width: 100%;
    height: 100%;
}

.carrusel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Estilos del mapa */

#seccion-mapa {
    scroll-snap-type: y mandatory;
    scroll-snap-align: start;
    min-height: calc(100vh - 254px);
}

.mapa {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;

}

.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    transition: all 0.3s ease;
    /* scroll-snap-align: start; */
}

#info-geoportal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Esto centra correctamente */
    width: 40%;
    max-width: 450px;
    /* Limita el ancho máximo */
    padding: 20px;
    text-align: center;
    /* background: rgba(0, 0, 0, 0.7); */
    color: white;
    z-index: 1000;
    cursor: pointer;
    pointer-events: auto;
}

#info-geoportal .corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px solid white;
    z-index: 1;
}

#info-geoportal .corner.tl {
    top: 30px;
    left: 30px;
    border-right: none;
    border-bottom: none;
}

#info-geoportal .corner.tr {
    top: 30px;
    right: 30px;
    border-left: none;
    border-bottom: none;
}

#info-geoportal .corner.bl {
    bottom: 30px;
    left: 30px;
    border-right: none;
    border-top: none;
}

#info-geoportal .corner.br {
    bottom: 30px;
    right: 30px;
    border-left: none;
    border-top: none;
}

#map {
    width: 100%;
    height: 100%;
}

#map-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    contain: layout style paint;
    will-change: opacity;
}

#expand-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1100;
    background: white;
    border: 1px solid #999;
    padding: 7px;
    cursor: pointer;
    border: thin black;
    border-radius: 4px;
    align-items: center;
    display: flex;
}

.fab-container {
    position: relative;
}

.fab-panel {
    display: none;
    flex-direction: column;
    position: fixed;
    left: 60px;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    z-index: 999;
    width: 300px;
}

.fab-container.active .fab-panel {
    display: flex;
}

.fab-close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    border: none;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    background-color: transparent;
}

.fab-close-btn:hover {
    background: #eee;
}

.tooltip-label {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 9999;
}

.layer-btn-wrapper {
    position: relative;
    background: transparent;
    border: none;
    width: auto;
}

.layer-btn-wrapper,
.fab-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.layer-btn-wrapper:hover .tooltip-label {
    opacity: 1;
}

.fab-container .tooltip-label {
    position: absolute;
    right: 85px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 9999;
    justify-content: space-between;
    flex-direction: row;
}

.layer-btn-wrapper .tooltip-label {
    position: absolute;
    right: 85px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 9999;
    justify-content: space-between;
    flex-direction: row;
}

.fab-container:hover .tooltip-label {
    opacity: 1;
}

/* Estilos para los controles del mapa */
.leaflet-control-attribution {
    font-size: 8px;
    color: #999;
    background: none;
    box-shadow: none;
}

.layer-btn-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.layer-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
    padding-top: 12px;
}

.label-text {
    font-size: 1em !important;
    font-weight: 300;
    word-break: break-word;
    flex: 1;

}

.label-text2 {
    font-size: 1em !important;
    font-weight: 300;
    word-break: break-word;
    flex: 1;
    padding-left: 10px;
}

.conocer {
    font-size: 1rem;
    text-decoration: none;
    line-height: 2rem;
    font-weight: 300;
    position: relative;
    padding-top: 30px;
    padding-bottom: 40px;
    ;
    background: transparent;
    border: none;
    width: auto;

}

.layer-btn:hover img {
    filter: invert(100%);
    transition: filter 0.2s ease;
}

/* Efecto para botones activos */
.layer-btn.active img,
.layer-toggle:checked+.tooltip-label+.layer-btn img {
    filter: invert(100%);
}


#layerButtons {
    position: fixed;
    top: 100px;
    right: 10px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#map-container.fullscreen #layerButtons {
    opacity: 1;
    visibility: visible;
}

.layer-btn {
    height: 70px;
    width: 70px;
    padding: 5px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    background: none;
    border: none;
    display: flex;
    align-items: center;
}

.layer-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: solid 1px #858585;
    border-radius: 50%;
}

.layer-btn.active {
    color: grey;
}

.layer-toggle {
    width: 15px !important;
    height: 15px !important;
    appearance: none;
    background: #fff;
    border: 1.7px solid #000;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    margin-right: 10px;
}

.layer-toggle:checked {
    background: #000;
}

.layer-toggle:hover {
    background: #5d5d5d;
}

.loading,
.error {
    position: absolute;
    bottom: 10px;
    left: 50%;
    width: 100%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 1001;
    text-align: center;
    max-width: 80%;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    pointer-events: all;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;
}

.loading-text {
    padding: 20px 40px;
}

#expand-button .full-icon {
    display: inline-block;
}

#expand-button .min-icon {
    display: none;
}

#map-container.fullscreen #expand-button .full-icon {
    display: none;
}

#map-container.fullscreen #expand-button .min-icon {
    display: inline-block;
}

.error {
    background-color: rgba(255, 0, 0, 0.7);
}


.carrusel-titulo {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 4rem;
    font-weight: bold;
    z-index: 5;
    text-align: center;
    pointer-events: none;
}

.mapa-carrusel-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
}

#mapa2-container {
    flex: 1 1 50%;
    height: 450px;
    min-width: 400px;
    max-width: 500px;
    padding: 40px;
}

.leyenda-ubicacion {
    font-size: 0.95rem;
    margin-top: 0.5rem;
    color: #555;
    text-align: center;
    font-style: italic;
}

.texto-carrusel {
    flex: 1 1 40%;
    background: white;
    border-radius: 8px;
    padding-right: 30px;
    padding-left: 30px;
    height: 500px;
    overflow: hidden;
    min-width: 300px;
    max-width: 500px;
    position: relative;
}

.bloque-mapa2 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.texto-slide {
    position: absolute;
    width: calc(100% - 40px);
    height: calc(100% - 30px);
    opacity: 0;
    transition: opacity 0.5s ease;
    padding-left: 40px;
    padding-right: 40px;
    hyphens: auto;
    word-break: normal;
    line-height: 1.4;
}

.texto-slide.active {
    opacity: 1;
}
.texto-slide p {
    padding: 20px;
}

.texto-prev,
.texto-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    color: black;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 20;
    /* Aumentado para asegurarse que quede por encima */
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    pointer-events: auto;
    z-index: 1000;
}

.texto-prev:hover,
.texto-next:hover {
    background: #f0f0f0;
    transform: translateY(-50%) scale(1.05);
}

.texto-prev {
    left: 15px;

}

.texto-next {
    right: 0;
}

.texto-indicadores {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.indicador {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
}

#carrusel-titulo-dinamico {
    position: absolute;
    /* top: 50%; */
    /* left: 50%; */
    /* transform: translate(-50%, -50%); */
    top: 212px;
    color: white;
    font-size: 4rem;
    font-weight: bold;
    font-family: 'Encode Sans', sans-serif;
    z-index: 5;
    /* text-align: center; */
    pointer-events: none;
}

.indicador.active {
    background: #fec304;
}

#desc-geoportal {
    max-width: 600px;
    padding: 50px;
    font-family: "Roboto", Arial, sans-serif;
    font-size: 1.7em;
    font-weight: 600;
    text-shadow: #3d3d3d;
}

.etiqueta-ranchos,
.etiqueta-villanueva,
.etiqueta-alegre {
    color: white;
    font-weight: bold;
    font-size: 1em;
    white-space: nowrap;
}

.etiqueta-estancias {
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    color: black;
    text-shadow: #5d5d5d;
}

.etiqueta-transparente {
    background: transparent;
    border: none;
}

/* FAB PANEL*/
.panel-toggle-title,
.panel-title {
    font-weight: bold;
    cursor: pointer;
    color: #000;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ddd;
    line-height: 2em;
    font-size: 1.2em;
}

.toggle-icon {
    font-size: 0.8em;
    margin-left: 8px;
    color: #fec304;
}

.toggle-icon.rotado {
    transform: rotate(180deg);
    transition: 500ms;
}

.circuito-descripcion {
    font-size: 0.9rem;
    line-height: 1.8rem;
    font-weight: 300;
    padding-bottom: 15px;
}

.fab-panel-amplio {
    width: 420px;
    font-size: 1em !important;
    padding: 50px;
    max-height: 80vh;
    /* Limita altura en viewport */
    overflow-y: auto;
    /* Habilita scroll vertical */
}

.etiqueta-localidad {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: normal;
    color: #fff;
    text-shadow: 1px 1px 0 rgb(66, 66, 66);
}

.etiqueta-ranchosgeo {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 0 rgb(66, 66, 66);
}

/* Responsive: vertical en pantallas chicas */
.escudo-ruta {
    width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgb(222, 36, 11);
    border: 2px solid rgb(222, 36, 11);
    border-radius: 50%;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    font-size: 10px;
    color: white;
}

#mapa2-boton-container {
    position: relative;
    width: 100%;
}

.mapa2-boton {
    position: absolute;
    bottom: 33px;
    right: 15px;
    z-index: 2000;
    background-color: rgba(255, 255, 255, 0);
    border: solid 0.5px #000;
    padding: 8px 12px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 0.6em;
}

.leaflet-touch .leaflet-bar {
    border: none !important;
}

.popup-personalizado {
    position: absolute;
    background: white;
    border: none;
    min-width: 200px;
    min-height: 200px;
    padding: 10px;
    z-index: 5000;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.popup-personalizado.visible {
    opacity: 1;
    pointer-events: auto;
}

.popup-personalizado img {
    max-width: 100%;
    border-radius: 5px;
}

.popup-close {
    position: absolute;
    top: 3px;
    right: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.etiqueta-inicio,
.etiqueta-fin {
    background: none;
    border: none;
    font-size: 11px;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 1px white;
    padding: 0;
}

.inicio {
    width: 14px;
    height: 14px;
    background: #addb43;
    border-radius: 50%;
    border: solid 2px #232323;
    ;
}

.inicio:hover {
    transform: scale(1.5);
    transition-duration: 500ms;
}

.fin {
    width: 14px;
    height: 14px;
    background: #ff1500;
    border-radius: 50%;
    border: solid 2px #232323;
    ;
}

.fin:hover {
    transform: scale(1.5);
    transition-duration: 500ms;
}

svg.etiqueta-calle text {
    font-weight: normal !important;
    fill: red;
}

.mapa-base-selector {
    width: 40px;
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: border 0.2s ease;

}

.mapa-base-selector:hover {
    border: 2px solid #888;
}

.mapa-base-selector.selected {
    border: 2px solid #333;
}

#map,
.leaflet-container {
    will-change: auto !important;
    transform: none !important;
    backface-visibility: hidden;
    perspective: none;
}

.leaflet-container img.leaflet-tile {
    background-color: transparent !important;
    border: none !important;
    image-rendering: pixelated;
    width: 256px !important;
    height: 256px !important;
    transform: translateZ(0);
    /* fuerza render GPU */
    backface-visibility: hidden;
}

.leaflet-tile-pane {
    will-change: transform;
}

.leaflet-container img.leaflet-tile {
    background-color: transparent !important;
    border: none !important;
    image-rendering: pixelated;
    width: 256px !important;
    height: 256px !important;
    transform: translateZ(0);
}

/* AUDIO */
.audio-header-placeholder {
    display: none;
    align-items: center;
    justify-content: center;
    padding-left: 10px;
}

.audio-header-placeholder .audio-button {
    width: 22px;
    height: 22px;
}

header .audio-button svg {
    width: 22px;
    height: 22px;
}


.snd-ctrl {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 20;
}

.audio-button svg {
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .video-text h1 {
        hyphenate-character: '';
        hyphens: manual;
        padding: 0 50px;
        text-align: left;
    }

    #mensaje-rotativo {
        text-align: left;
        padding: 0 50px;
        font-size: 1.3em;
        font-weight: 300;
    }

    .videoport-section,
    #portada,
    #video-background,
    .video-overlay {
        position: relative;
        z-index: 0;
    }

    section.blanco {
        position: relative;
        padding: 0 !important;
        margin-top: 50px;
        z-index: 5;
    }

    .blanco .contenedor {
        height: auto;
    }

    /* Reordenar con GRID: texto arriba, mapa abajo */
    .mapa-carrusel-wrapper {
        display: grid;
        grid-template-areas:
            "texto"
            "mapa";
        gap: 12px;
        align-items: stretch;
        isolation: isolate;
    }

    .texto-carrusel {
        grid-area: texto;
        position: relative;
        z-index: 2;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: clamp(360px, calc(100svh - 140px), 90svh);
        overflow: hidden;
        border-radius: 8px;
        background: #fff;
    }

    .texto-carrusel .texto-slide {
        position: absolute;
        inset: 0;
        padding: 20px 24px 64px;
        width: 100%;
        height: 100%;
        opacity: 0;
        pointer-events: none;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.9em;
    }

    .texto-carrusel .texto-slide.active {
        opacity: 1;
        pointer-events: auto;
    }

    .texto-carrusel .texto-indicadores {
        position: absolute;
        left: 50%;
        bottom: 12px;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        z-index: 3;
        justify-content: center;
    }

    .texto-carrusel .texto-prev,
    .texto-carrusel .texto-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        pointer-events: auto;
        margin: 0;
    }

    .texto-carrusel .texto-prev {
        left: 8px;
    }

    .texto-carrusel .texto-next {
        right: 8px;
    }

    .bloque-mapa2 {
        grid-area: mapa;
        display: block;
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: auto;
    }

    #mapa2-container {
        position: relative;
        z-index: 1;
        display: block;
        width: 100%;
        height: 360px;
        min-height: 360px;
        padding: 0;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    #map-container {
        width: 100%;
        height: 400px;
        margin: 0;
    }

    .carrusel-container {
        height: auto;
        margin-top: 50px;
    }

    #carrusel-titulo-dinamico {
        top: 90px;
        font-size: 2rem;
    }

    #info-geoportal {
        width: 300px !important;
        height: auto;
        max-width: none;
        padding: 5px;
    }

    #desc-geoportal {
        font-size: 1.3em;
    }

    #info-geoportal .corner {
        width: 18px;
        height: 18px;
    }

    .fab-panel {
        bottom: 0;
        max-width: none;
        top: auto;
        width: 100%;
        left: 0;
    }

    #btnGeneral {
        display: none;
    }
    #btnMapaBase {
        display: none;
    }
    .tooltip-label {
    display: none;
}
.fab-close-btn {
bottom:8px;
top:unset !important;
}
    #map .leaflet-control-zoom {
        display: none !important;
    }
    .footer-top{
  display:grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "left center"
    "right right";
  gap:12px;
  align-items:start;
}

.footer-top-left   { grid-area:left; }
.footer-top-center { grid-area:center; }
.footer-top-right  { grid-area:right; }
#layerButtons {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    right: 0;
    justify-content: center;
}
}

@media (max-width: 480px) {
    #map-container {
        height: 300px;
    }
}

/*GRILLAS*/
.leaflet-tile {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    image-rendering: auto !important;
    /* importante para mapas base satelitales */
}

.leaflet-attribution-flag {
    display: none !important;
}