/* --- CARTE PLEIN ÉCRAN --- */
.full-map-page {
    position: relative;
    width: 100%;
    height: calc(100vh - 120px); /* Hauteur par défaut (Header + TopBar) */
    height: calc(100dvh - 120px);
    overflow: hidden;
    z-index: 10;
}

#tracking-map.full-map-container {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
}

/* Bouton Retour */
.map-back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--clr-text-main);
    font-weight: 700;
    font-family: var(--ff-main);
    text-decoration: none;
    border: 1px solid var(--clr-border);
    transition: all 0.2s ease;
}

.map-back-button:hover {
    background: #f8f8f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Ajustements Leaflet */
.full-map-container .leaflet-top.leaflet-right {
    top: 20px;
    right: 20px;
}

.full-map-container .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.full-map-container .leaflet-control-layers {
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
}

/* Contrôles personnalisés */
.custom-map-controls {
    border: none !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.15) !important;
    border-radius: 8px !important;
    overflow: hidden;
    margin-top: 15px !important;
    display: flex;
    flex-direction: column;
}

.custom-map-controls .control-btn {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    background-color: white !important;
    color: var(--clr-text-main) !important;
    font-size: 1.1rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--clr-border) !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.custom-map-controls .control-btn:last-child {
    border-bottom: none !important;
}

.custom-map-controls .control-btn:hover {
    background-color: #f8f8f8 !important;
    color: var(--clr-primary) !important;
}

.custom-map-controls .control-btn.active {
    color: var(--clr-primary) !important;
}

.custom-map-controls .control-btn.toggle-photos:not(.active) {
    color: #ccc !important;
}

/* Styles pour le clustering */
.tracking-photo-cluster {
    background-color: white;
    border: 2px solid var(--clr-primary);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.tracking-photo-cluster:hover {
    transform: scale(1.1);
}

.photo-cluster-icon {
    font-family: var(--ff-main);
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--clr-primary);
}

/* Échelle Leaflet */
.leaflet-control-scale {
    margin-bottom: 20px !important;
    margin-right: 20px !important;
}

.leaflet-control-scale-line {
    border: 2px solid var(--clr-text-main) !important;
    border-top: none !important;
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--clr-text-main) !important;
    font-family: var(--ff-main) !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
}

/* Légende flottante */
.full-map-legend {
    position: absolute;
    bottom: 30px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--clr-border);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.full-map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--clr-text-main);
    transition: opacity 0.3s ease;
}

.full-map-legend .legend-item.is-hidden {
    opacity: 0.4;
}

.full-map-legend .legend-symbol {
    width: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.full-map-legend .legend-label {
    white-space: nowrap;
}

.full-map-legend .legend-camera {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: white;
    border: 1.5px solid var(--clr-primary);
    border-radius: 50%;
    font-size: 0.7rem;
    color: var(--clr-primary);
}

.full-map-legend .legend-line {
    display: block;
    width: 20px;
    height: 3px;
    background-color: #FF5C00; /* Orange trajet réalisé */
    border-radius: 2px;
}

.full-map-legend .legend-line.theoretical {
    background-color: #2563EB; /* Bleu itinéraire théorique */
}

.full-map-legend .legend-dot {
    display: block;
    width: 12px;
    height: 12px;
    background-color: #FF5C00;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 92, 0, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .full-map-page {
        height: calc(100vh - 160px);
        height: calc(100dvh - 160px);
    }
}

@media (max-width: 768px) {
    .map-back-button {
        top: 15px;
        left: 15px;
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .full-map-legend {
        bottom: 80px; /* On remonte pour laisser la place à l'échelle sur mobile */
        left: 10px;
        padding: 10px;
        gap: 8px;
    }
    
    .full-map-legend .legend-item {
        gap: 8px;
        font-size: 0.75rem;
    }

    .full-map-legend .legend-symbol {
        width: 20px;
    }

    .full-map-legend .legend-camera {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }
}

/* --- MODALE DE CHOIX DE TRAJET --- */
.route-choice-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.route-choice-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 540px;
    position: relative;
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.route-choice-modal__dialog {
    padding: 32px;
}

.route-choice-modal__title {
    font-family: var(--font-main);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--clr-text-main);
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.route-choice-modal__desc {
    font-size: 0.95rem;
    color: var(--clr-text-secondary);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.route-choice-modal__options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.route-choice-modal__option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    font-family: var(--font-main);
}

.route-choice-modal__option .option-title {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 2px;
    display: block;
}

.route-choice-modal__option .option-desc {
    font-size: 0.85rem;
    opacity: 0.8;
    display: block;
}

/* Option Réalisé (Orange #FF5C00) */
.route-choice-modal__option--real {
    background-color: rgba(255, 92, 0, 0.08);
    border-color: rgba(255, 92, 0, 0.15);
    color: #FF5C00;
}

.route-choice-modal__option--real:hover:not(:disabled) {
    background-color: #FF5C00;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 92, 0, 0.3);
}

/* Option Théorique (Bleu #2563EB) */
.route-choice-modal__option--theoretical {
    background-color: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.15);
    color: #2563EB;
}

.route-choice-modal__option--theoretical:hover:not(:disabled) {
    background-color: #2563EB;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

.route-choice-modal__option:disabled {
    background-color: #f0f0f0;
    border-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

.route-choice-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.route-choice-modal__close:hover {
    background: #e0e0e0;
    color: var(--clr-text-main);
}

.route-choice-modal__error {
    margin-top: 20px;
    padding: 10px;
    background: rgba(166, 45, 45, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--clr-danger);
    text-align: center;
}

/* Bouton de contrôle sur la carte */
.custom-map-controls .control-btn.btn-route-selector {
    color: var(--clr-primary) !important;
}

/* Responsive modal */
@media (min-width: 640px) {
    .route-choice-modal__options {
        flex-direction: row;
    }
    
    .route-choice-modal__option {
        flex: 1;
        min-height: 100px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .route-choice-modal__dialog {
        padding: 24px 20px;
    }
    
    .route-choice-modal__title {
        font-size: 1.2rem;
    }

    .route-choice-modal__option {
        padding: 14px 16px;
    }
}
