/* Styles pour la modal de carte */
#mapModal .modal-dialog {
    max-width: 95vw;
    margin: 1rem auto;
}

#mapModal .modal-body {
    padding: 0;
}

#map {
    height: 400px;
    width: 100%;
    border-radius: 0.375rem;
}

/* Rendre le texte visible et lisible dans le panneau */
.leaflet-routing-container {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #000 !important;
    font-size: 14px !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.4;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Rendre visibles les titres, durées, distances */
.leaflet-routing-alt h2,
.leaflet-routing-alt h3,
.leaflet-routing-alt span {
    color: #000 !important;
    font-weight: 600;
}

/* Corrige les lignes effacées ou grises */
.leaflet-routing-alt .leaflet-routing-icon,
.leaflet-routing-alt .leaflet-routing-instruction {
    color: #000 !important;
    opacity: 1 !important;
}

/* Empêche les textes d'être écrasés */
.leaflet-routing-alt {
    padding: 10px;
}

/* Amélioration de l'affichage des marqueurs */
.leaflet-marker-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Styles pour le bouton Google Maps */
.leaflet-control a {
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
}

/* 📱 Optimisations pour mobile */
@media screen and (max-width: 768px) {
    #mapModal .modal-dialog {
        max-width: 100vw;
        margin: 0.5rem;
    }
    
    #map {
        height: 350px;
    }
    
    .leaflet-routing-container {
        max-height: 50vh;
        font-size: 13px;
        margin: 10px;
    }
    
    /* Amélioration de la lisibilité sur mobile */
    .leaflet-routing-alt {
        padding: 8px;
    }
    
    /* Bouton Google Maps adapté mobile */
    .leaflet-control a {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
}

/* 📱 Optimisations pour très petits écrans */
@media screen and (max-width: 480px) {
    #map {
        height: 300px;
    }
    
    .leaflet-routing-container {
        max-height: 40vh;
        font-size: 12px;
    }
    
    #route-summary {
        font-size: 12px !important;
        margin-left: 5px !important;
        margin-right: 5px !important;
    }
}

/* Correction pour Safari et iOS */
@supports (-webkit-touch-callout: none) {
    .leaflet-routing-container {
        -webkit-overflow-scrolling: touch;
    }
    
    #map {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Correction pour Firefox */
@-moz-document url-prefix() {
    .leaflet-routing-container {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

/* Amélioration de l'accessibilité */
.leaflet-control a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Animation de chargement */
#route-summary {
    transition: color 0.3s ease;
}

/* État de chargement */
#route-summary[data-loading="true"] {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
