/* Mapa */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--secundario);
    width: 40px;
    height: 40px;
    animation: spin 0.5s linear infinite;
    margin: 0 auto;
}

#mapLoadingIndicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
}

#map {
    position: relative;
    width: 100%;
    min-width: 0;
    height: clamp(500px, 68vh, 650px);
    height: clamp(500px, 68dvh, 650px);
    overflow: hidden;
}

/* Popup mapa */
.leaflet-popup-content {
    width: min(350px, calc(100vw - 72px)) !important;
    min-width: 0;
    max-width: 100%;
    margin: 16px 18px;
    overflow-wrap: anywhere;
}

.popup_map {
    padding: 10px;
    box-sizing: border-box;
}

.popup_map h4 {
    text-align: center;
    color: var(--secundario);
}

.popup_map .popup_content {
    margin-top: 10px;
    display: flex;
    flex-flow: column nowrap;
    gap: 20px;
}

.popup_map .popup_content h5{
    color: var(--secundario);
}

.popup_map .popup_content .popup_content__prod ul,
.popup_map .popup_content .popup_content__com ul {
    margin-bottom: 10px;
    margin-left: 15px;
    font-size: 14px;
}

.popup_map .popup_content .popup_content__prod ul li a,
.popup_map .popup_content .popup_content__com ul li a{
    color: var(--secundario);
}

.popup_map .popup_content .popup_content__prod ul li a img,
.popup_map .popup_content .popup_content__com ul li a img{
    width: 8px;
}

/* BOTONES */
.button-map {
    float: right;
    padding: 6px 12px !important;
    border-radius: 200px !important;
    background-color: var(--secundario) !important;
    box-shadow: none !important;
    border: none !important;
    color: var(--blanco) !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    text-align: center;
    text-decoration: none;
    touch-action: manipulation;
}

.button-map:hover {
    opacity: 0.9 !important;
    box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, 0.2) !important;
}

/* ANIMACIONES */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* TRANSICIONES */
.smooth-transition {
    transition: opacity 0.2s, fill-opacity 0.2s;
}

/* Tablet */
@media (max-width: 1024px) {
    #map {
        height: clamp(520px, 65vh, 620px);
        height: clamp(520px, 65dvh, 620px);
    }

    .leaflet-popup-content {
        margin: 14px 16px;
    }

    .popup_map .popup_content {
        gap: 16px;
    }
}

/* Teléfono */
@media (max-width: 600px) {
    #map {
        height: clamp(400px, 68vh, 520px);
        height: clamp(400px, 68dvh, 520px);
        min-height: 400px;
    }

    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 40px);
        border-radius: 10px;
    }

    .leaflet-popup-content {
        width: min(270px, calc(100vw - 76px)) !important;
        margin: 12px 14px;
        max-height: min(55vh, 390px);
        max-height: min(55dvh, 390px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .popup_map {
        padding: 4px;
    }

    .popup_map h4 {
        font-size: 18px;
        line-height: 1.2;
    }

    .popup_map .popup_content {
        gap: 14px;
    }

    .popup_map .popup_content h5 {
        font-size: 16px;
    }

    .popup_map .popup_content .popup_content__prod ul,
    .popup_map .popup_content .popup_content__com ul {
        margin-left: 14px;
        font-size: 13px;
    }

    .button-map {
        float: none;
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 9px 12px !important;
        margin-top: 8px;
    }
}

/* En horizontal interesa reservar más anchura que altura al mapa. */
@media (max-width: 900px) and (orientation: landscape) {
    #map {
        height: clamp(360px, 82vh, 520px);
        height: clamp(360px, 82dvh, 520px);
        min-height: 360px;
    }

    .leaflet-popup-content {
        max-height: 60vh;
        max-height: 60dvh;
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .smooth-transition {
        transition: none;
    }
}
