/* ===================================================
   Styles pour la carte interactive Leaflet
   =================================================== */

/* Conteneur principal de la carte */
#map {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    /* Fix pour éviter les traits blancs */
    min-height: 600px;
}

/* S'assurer que le conteneur parent a aussi une hauteur définie */
#map:empty {
    min-height: 600px;
}

/* Responsive : adaptation sur mobile */
@media (max-width: 768px) {
    #map {
        height: 400px;
        border-radius: 4px;
    }
}

/* ===================================================
   Personnalisation des popups Leaflet
   =================================================== */

/* Popup principale */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content {
    margin: 0px!important;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    width: 100%!important;
    max-width: 900px;
}

@media screen and (max-width:1100px) {
    .leaflet-popup-content {
        max-width: 750px;
    }
}

@media screen and (max-width:600px) {
    .leaflet-popup-content {
        max-width: 750px;
    }
    .oaka-popup {
        flex-direction: column;
    }
    .oaka-popup-text {
        width: 100%!important;
    }
}



/* Titre dans la popup */
.leaflet-popup-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

/* Flèche de la popup */
.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

/* Bouton de fermeture de la popup */
.leaflet-popup-close-button {
    color: #7f8c8d !important;
    font-size: 20px;
    padding: 4px 8px;
}

.leaflet-popup-close-button:hover {
    color: #2c3e50 !important;
}

/* ===================================================
   Personnalisation des contrôles de zoom
   =================================================== */

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.leaflet-control-zoom a {
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 18px;
    border: none !important;
    background-color: #fff;
    color: #333;
}

.leaflet-control-zoom a:hover {
    background-color: #f8f9fa;
}

/* ===================================================
   Attribution (copyright en bas à droite)
   =================================================== */

.leaflet-control-attribution {
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.9) !important;
    padding: 2px 5px;
    border-radius: 4px;
}

/* ===================================================
   Personnalisation des marqueurs
   =================================================== */

/* Effet de pulse sur le marqueur au survol */
.leaflet-marker-icon:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* ===================================================
   Animation de chargement
   =================================================== */

/* Loader pendant le chargement de la carte */
#map::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 9999;
}

/* Une fois Leaflet chargé, on cache le loader */
#map.leaflet-container::before {
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===================================================
   Accessibilité
   =================================================== */

/* Amélioration du contraste pour l'accessibilité */
.leaflet-container a {
    color: #0066cc;
}

.leaflet-container a:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ===================================================
   Print styles (si impression de la page)
   =================================================== */

@media print {
    #map {
        height: 500px;
        page-break-inside: avoid;
    }
    
    .leaflet-control-zoom,
    .leaflet-control-attribution {
        display: none;
    }
}




/* Limite l'image dans les popups BO */
.leaflet-popup-content img {
    max-width: 270px;
    height: auto;
    display: block;
}

.oaka-popup {
    display: flex;
    padding: 20px;
}

.oaka-popup h4 {
    font-weight: 600;
}

.oaka-popup-text {
    padding-left: 10px;
    width: max-content;
    display: flex;
    flex-direction: column;
}
.oaka-popup-text h4 {
    margin-bottom: 10px;
    margin-top: 10px;
    font-size: 18px;
}
.oaka-popup-text p {
    margin: 0px;
}

.oaka-popup-image {
    display: flex;
    align-items: flex-start;
}

.oaka-popup-image img {
    z-index: 10;
    background: white;
    margin-top: 0;
    align-self: flex-start;
}

.leaflet-popup-content-wrapper.has-overflow .oaka-popup-image img {
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
}





/* ===================================================
   Styles pour les marqueurs personnalisés Font Awesome
   =================================================== */

/* Conteneur de l'icône personnalisée */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Effet de drop shadow pour mieux voir l'icône */
.custom-marker-icon i {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

/* Effet au survol */
.custom-marker-icon:hover i {
    transform: scale(1.15);
}

/* Animation d'apparition des marqueurs */
@keyframes markerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-marker-icon {
    animation: markerFadeIn 0.3s ease-out;
}