/* ===== CORREÇÕES ESPECÍFICAS PARA O MAPA LEAFLET ===== */

/* Em grid (ex.: página contato): evitar que o item encolha */
.localizacao-content .mapa-container {
    min-height: 500px !important;
    height: 500px !important;
    align-self: stretch !important;
}
.localizacao-content .mapa-container #map {
    height: 500px !important;
    min-height: 500px !important;
}

/* Reset completo para o container do mapa */
.mapa-container {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
    max-height: 500px !important;
    margin: 2rem 0 !important;
    padding: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    background: #f8f9fa !important;
    z-index: 1 !important;
}

/* Reset completo para o elemento do mapa */
#map {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    position: relative !important;
    background: #f8f9fa !important;
    z-index: 1 !important;
}

/* Correções específicas para o Leaflet */
.mapa-container .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Garantir que os tiles sejam exibidos corretamente */
.leaflet-tile {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: optimize-contrast !important;
    border: none !important;
    outline: none !important;
}

/* Corrigir problemas de sobreposição */
.leaflet-pane {
    z-index: 1 !important;
}

.leaflet-overlay-pane {
    z-index: 4 !important;
}

.leaflet-marker-pane {
    z-index: 600 !important;
}

.leaflet-tooltip-pane {
    z-index: 650 !important;
}

.leaflet-popup-pane {
    z-index: 640 !important;
}

/* Garantir que os controles sejam visíveis */
.leaflet-control {
    z-index: 800 !important;
}

/* Correções para dispositivos móveis */
@media (max-width: 768px) {
    .mapa-container {
        height: 400px !important;
        min-height: 400px !important;
        max-height: 400px !important;
    }
    
    .mapa-container #map {
        height: 400px !important;
        min-height: 400px !important;
        max-height: 400px !important;
    }
}

@media (max-width: 480px) {
    .mapa-container {
        height: 350px !important;
        min-height: 350px !important;
        max-height: 350px !important;
    }
    
    .mapa-container #map {
        height: 350px !important;
        min-height: 350px !important;
        max-height: 350px !important;
    }
}

/* Forçar quebra de linha para evitar conflitos */
.mapa-container,
#map,
.leaflet-container {
    display: block !important;
    float: none !important;
    clear: both !important;
}

/* Garantir que não haja margens ou paddings conflitantes */
.mapa-container *,
#map *,
.leaflet-container * {
    box-sizing: border-box !important;
}

/* Correção específica para problemas de renderização */
.leaflet-tile-container {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Garantir que o mapa seja visível */
.leaflet-map-pane {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
}
