/* =====================================================
   CONFIGURACIÓN GENERAL
   ===================================================== */

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
}


/* =====================================================
   MAPA
   ===================================================== */

#mapa {
    position: fixed;
    inset: 0;

    /*
       No crear un contexto de apilamiento.
       Esto permite que el popup de Leaflet
       pueda superar los elementos de la interfaz.
    */
    z-index: auto;
}


/* =====================================================
   LOGOS
   ===================================================== */

#logos-visor {
    position: absolute;

    top: 10px;
    left: 20px;

    /*
       Los logos están por encima del mapa,
       pero por debajo de los popups.
    */
    z-index: 1000;

    display: flex;

    align-items: center;

    gap: 10px;
}

#logos-visor img {
    height: 40px;

    width: auto;

    object-fit: contain;

    display: block;

    background-color: #f2f2f243;	
}


/* =====================================================
   TÍTULO
   ===================================================== */

#titulo-visor {
    position: absolute;

    top: 55px;
    left: 5px;

    z-index: 2;

    /* Tamaño de la caja */
    padding: 10px 20px;

    /* Fondo verde claro */
    background: rgba(0, 7, 40, 0.75);

    /* Bordes redondeados */
    border-radius: 18px;

    /* Borde verde suave */
    border: 0px solid #004702;

    font-family: Arial, sans-serif;

    font-size: 30px;

    font-weight: bold;

    pointer-events: none;
}

.titulo-Visor {
    color: #78e2ff;
}

.titulo-Industrial {
    color: #78e2ff;
}

.titulo-Baztan {
    color: #78e2ff;
}

.titulo-Bidasoa {
    color: #78e2ff;
}


/* =====================================================
   ZOOM
   ===================================================== */

#zoom-personalizado {
    position: absolute;

    top: 120px;
    left: 20px;

    z-index: 1000;

    display: flex;

    flex-direction: column;

    gap: 2px;
}

.boton-zoom {
    width: 30px;
    height: 30px;

    border: none;

    border-radius: 5px;

    background: rgb(202, 231, 253);

    font-size: 25px;

    cursor: pointer;

    box-shadow:
        0 0 0 rgba(0, 0, 0, 0.3);
}

.boton-zoom:hover {
    background: rgba(255, 0, 0, 0.44);
}


/* =====================================================
   BUSCADOR DE MUNICIPIOS
   ===================================================== */

#buscador-municipio {
    position: absolute;

    top: 27px;
    right: 120px;

    /*
       Por encima del título.
    */
    z-index: 1001;

    width: 200px;

    display: flex;

    flex-direction: column;

    gap: 0;
}


/* -----------------------------------------------------
   CONTENEDOR DEL INPUT Y BOTÓN
   ----------------------------------------------------- */

#contenedor-buscador-municipio {
    display: flex;

    gap: 6px;

    padding: 2px;

    background: white;

    border-radius: 5px;

    box-shadow:
        0 0 0 rgba(0, 0, 0, 0.25);

    box-sizing: border-box;
}


/* -----------------------------------------------------
   INPUT
   ----------------------------------------------------- */

#entrada-municipio {
    flex: 1;

    min-width: 0;

    padding: 8px;

    border: 1px solid #ccc;

    border-radius: 4px;

    outline: none;

    box-sizing: border-box;

    font-size: 12px;
}

#entrada-municipio:focus {
    border-color: rgb(1, 18, 89);
}


/* -----------------------------------------------------
   BOTÓN
   ----------------------------------------------------- */

#boton-buscar-municipio {
    padding: 8px 12px;

    border: none;

    border-radius: 4px;

    background: rgb(1, 18, 89);

    color: white;

    cursor: pointer;

    white-space: nowrap;
}

#boton-buscar-municipio:hover {
    background: #ff0000;
}


/* -----------------------------------------------------
   RESULTADOS DEL BUSCADOR DE MUNICIPIOS
   ----------------------------------------------------- */

#resultado-municipio {
    display: none;

    margin-top: 5px;

    padding: 7px;

    background: white;

    border-radius: 6px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.25);

    box-sizing: border-box;

    max-height: 200px;

    overflow-y: auto;

    font-size: 13px;
}


/* -----------------------------------------------------
   TÍTULO DE LAS COINCIDENCIAS
   ----------------------------------------------------- */

#resultado-municipio .titulo-resultados {
    display: block;

    margin-bottom: 6px;

    color: rgb(1, 18, 89);

    font-weight: bold;
}


/* -----------------------------------------------------
   BOTONES DE RECOMENDACIONES
   ----------------------------------------------------- */

.boton-recomendacion-municipio {
    display: block;

    width: 100%;

    margin-top: 5px;

    padding: 8px 10px;

    border: 1px solid #ccc;

    border-radius: 4px;

    background: #f5f5f5;

    color: #222;

    cursor: pointer;

    text-align: left;

    box-sizing: border-box;

    font-size: 12px;
}

.boton-recomendacion-municipio:hover {
    background: #e8e8e8;

    border-color: rgb(1, 18, 89);
}


/* -----------------------------------------------------
   MENSAJE DE RESULTADO
   ----------------------------------------------------- */

.mensaje-resultado-municipio {
    padding: 4px;

    color: #555;

    line-height: 1.4;
}


/* =====================================================
   BOTÓN DEL PANEL
   ===================================================== */

#boton-panel {
    position: absolute;

    top: 27px;
    right: 20px;

    z-index: 1001;

    padding: 10px 14px;

    border: none;

    border-radius: 6px;

    background: rgb(1, 18, 89);

    color: white;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

#boton-panel:hover {
    background: rgb(255, 0, 0);
}


/* =====================================================
   PANEL
   ===================================================== */

#panel {
    position: absolute;

    top: 75px;
    right: 20px;

    z-index: 1000;

    width: 290px;

    max-height: calc(100vh - 85px);

    overflow-y: auto;

    background: white;

    border-radius: 8px;

    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.3);

    display: none;
}


/* =====================================================
   SECCIONES
   ===================================================== */

.cabecera-seccion {
    width: 100%;

    padding: 12px;

    border: none;

    border-bottom: 1px solid #ddd;

    background: rgb(1, 18, 89);

    color: white;

    text-align: left;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

.cabecera-seccion:hover {
    background: rgb(255, 0, 0);
}

.flecha {
    float: right;
}

.contenido-seccion {
    display: none;

    padding: 10px;

    border-bottom: 1px solid #ddd;
}

.contenido-seccion.abierto {
    display: block;
}


/* =====================================================
   GRUPOS DE CAPAS
   ===================================================== */

.boton-grupo-capas {
    width: 100%;

    padding: 10px;

    border: none;

    border-bottom: 1px solid #ddd;

    background: #f5f5f5;

    color: rgb(1, 18, 89);

    text-align: left;

    font-size: 12px;

    font-weight: bold;

    cursor: pointer;
}

.boton-grupo-capas:hover {
    background: #bc010173;
}

.contenido-grupo-capas {
    display: none;

    padding: 5px 10px;

    background: rgb(248, 246, 246);
}


/* =====================================================
   CAPAS
   ===================================================== */

.opcion-capa {
    display: block;

    padding: 7px 4px;

    font-size: 12px;

    cursor: pointer;
}

.opcion-capa:hover {
    background: #ff000048;
}

.opcion-capa input {
    margin-right: 8px;
}


/* =====================================================
   CAPAS VISIBLES
   ===================================================== */

#lista-capas-visibles {
    margin: 0;

    padding: 0;

    list-style: none;
}

#lista-capas-visibles li {
    padding: 7px;

    margin-bottom: 5px;

    background: #f3f3f3;

    border-left: 4px solid rgb(2, 145, 255);

    font-size: 12px;
}


/* =====================================================
   BUSCADOR DE RECURSOS
   ===================================================== */

#buscador {
    box-sizing: border-box;

    width: 100%;

    padding: 8px;

    border: 1px solid #ccc;

    border-radius: 4px;

    margin-bottom: 8px;
}

#boton-buscar {
    width: 100%;

    padding: 8px;

    border: none;

    border-radius: 4px;

    background: rgb(1, 18, 89);

    color: white;

    cursor: pointer;
}

#boton-buscar:hover {
    background: #ff000055;
}

#resultado-busqueda {
    margin-top: 10px;

    font-size: 12px;

    color: #555;
}


/* =====================================================
   INFORMACIÓN DEL MAPA
   ===================================================== */

#informacion-mapa {
    position: absolute;

    left: 10px;
    bottom: 10px;

    z-index: 1100;

    display: flex;

    flex-direction: column;

    gap: 6px;

    pointer-events: none;
}

#escala-mapa,
#coordenadas-raton {
    padding: 5px 8px;

    background: rgba(255, 255, 255, 0.46);

    border-radius: 4px;

    box-shadow:
        0 0 0 rgba(0, 0, 0, 0.25);

    font-size: 12px;

    color: #000000;
}

#coordenadas-raton {
    min-width: 155px;
}


/* =====================================================
   ESCALA GRÁFICA
   ===================================================== */

#escala-mapa > div {
    position: relative;

    height: 14px;

    border-top: 1px solid #222;
}

#escala-mapa > div span {
    position: absolute;

    top: 3px;
}


/* =====================================================
   INDICADOR DE CARGA
   ===================================================== */

#indicador-carga {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    z-index: 2000;

    display: none;

    align-items: center;

    gap: 12px;

    padding: 14px 20px;

    background: rgba(255, 255, 255, 0.95);

    border-radius: 8px;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.3);

    font-size: 17px;

    font-weight: bold;

    color: rgb(1, 18, 89);

    pointer-events: none;
}

.spinner {
    width: 24px;

    height: 24px;

    border: 4px solid #ddd;

    border-top-color: rgb(1, 18, 89);

    border-radius: 50%;

    animation: girar 0.8s linear infinite;
}

@keyframes girar {
    to {
        transform: rotate(360deg);
    }
}


/* =====================================================
   POPUPS DE LEAFLET: POR ENCIMA DE TODA LA INTERFAZ
   ===================================================== */

/* Panel general de popups */
.leaflet-popup-pane {
    z-index: 20000 !important;
}

/* Popup individual */
.leaflet-popup {
    z-index: 20001 !important;
}

/* Contenedor exterior */
.leaflet-popup-content-wrapper {
    position: relative;
    background: #ffffff;
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 5px 22px rgba(0, 20, 60, 0.25);
}

/* Contenido general */
.leaflet-popup-content {
    position: relative;
    z-index: 1;
    margin: 0 !important;
    padding: 15px !important;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    max-width: calc(100vw - 40px);
    white-space: normal;
}

/* Punta */
.leaflet-popup-tip {
    background: #ffffff;
}

/* Botón de cierre */
.leaflet-popup-close-button {
    z-index: 10 !important;
}

/* =====================================================
   POPUP MUNICIPAL
   ===================================================== */

.leaflet-popup.popup-municipio {
    margin-bottom: 18px;
}

.leaflet-popup.popup-municipio .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    padding: 0 !important;
    border: 1px solid #d5dce8;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 5px 22px rgba(0, 20, 60, 0.25);
}

.leaflet-popup.popup-municipio .leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #263238;
}

.leaflet-popup.popup-municipio .leaflet-popup-close-button {
    top: 7px !important;
    right: 9px !important;
    color: #ffffff !important;
    font-size: 21px !important;
    font-weight: normal !important;
    opacity: 0.85;
}

.leaflet-popup.popup-municipio .leaflet-popup-close-button:hover {
    color: #ffffff !important;
    opacity: 1;
}

.leaflet-popup.popup-municipio .leaflet-popup-tip {
    background: #ffffff;
}

/* =====================================================
   MÓVILES
   ===================================================== */

@media (max-width: 600px) {

    .leaflet-popup.popup-municipio .leaflet-popup-content {
        width: 310px !important;
        max-width: calc(100vw - 40px) !important;
    }

}



/* =====================================================
   BUSCADOR DE PARCELAS DENTRO DE RECURSOS
   ===================================================== */

#buscador-parcelas-situacion {
    width: 100%;
}


/* CONTENIDO DESPLEGABLE */

.contenido-buscador-parcelas {
    display: none;

    padding: 10px;

    background: #f8f6f6;

    border-bottom: 1px solid #ddd;
}


/* ETIQUETA */

.etiqueta-buscador-parcelas {
    display: block;

    margin-bottom: 7px;

    color: rgb(1, 18, 89);

    font-size: 12px;

    font-weight: bold;
}


/* SELECTOR */

#selector-situacion-parcela {
    width: 100%;

    padding: 9px;

    margin-bottom: 8px;

    border: 1px solid #ccc;

    border-radius: 4px;

    background: white;

    color: #222;

    font-size: 12px;

    box-sizing: border-box;
}


/* BOTÓN BUSCAR */

#boton-buscar-situacion {
    width: 100%;

    padding: 9px;

    border: none;

    border-radius: 4px;

    background: rgb(1, 18, 89);

    color: white;

    font-size: 12px;

    font-weight: bold;

    cursor: pointer;
}

#boton-buscar-situacion:hover {
    background: #ff0000;
}


/* CONTENEDOR DE RESULTADOS */

#resultado-situacion-parcela {
    display: none;

    margin-top: 9px;

    max-height: 230px;

    overflow-y: auto;

    font-size: 12px;
}


/* MENSAJES */

.mensaje-busqueda-parcelas {
    padding: 7px;

    margin-bottom: 5px;

    color: rgb(1, 18, 89);

    font-size: 12px;

    font-weight: bold;

    line-height: 1.4;
}


/* BOTONES DE RESULTADOS */

.resultado-parcela-situacion {
    display: block;

    width: 100%;

    padding: 9px;

    margin-bottom: 5px;

    border: 1px solid #ddd;

    border-left: 3px solid rgb(1, 18, 89);

    border-radius: 4px;

    background: white;

    color: #222;

    font-size: 11px;

    text-align: left;

    overflow-wrap: anywhere;

    cursor: pointer;
}

.resultado-parcela-situacion:hover {
    background: #ff000048;

    border-left-color: red;
}

#fuentes-datos {
    padding: 12px;
    margin-top: 15px;
    border-top: 1px solid #d8dee8;
    font-family: Arial, sans-serif;
    font-size: 11px;
    line-height: 1.5;
    color: #555;
}

#fuentes-datos strong {
    display: block;
    color: #123682;
    margin-bottom: 6px;
}

#fuentes-datos p {
    margin: 5px 0;
}

#fuentes-datos a {
    color: #123682;
    text-decoration: underline;
}



