/**
 * FDF Carto Track - Styles pour la carte des traces d'avions
 */

/* Conteneur principal */
.fdf-track-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

/* Contrôles en haut */
.fdf-track-controls {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

/* Bouton d'actualisation */
.fdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.fdf-btn-primary {
    background: #007cba;
    color: white;
}

.fdf-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.fdf-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.fdf-icon {
    font-size: 16px;
}

/* Légende */
.fdf-track-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fdf-track-legend h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.fdf-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.fdf-color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Carte */
.fdf-track-map {
    width: 100%;
    position: relative;
}

.fdf-track-map .maplibregl-canvas {
    border-radius: 0;
}

/* Contrôles de navigation MapLibre */
.fdf-track-map .maplibregl-ctrl-group {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.fdf-track-map .maplibregl-ctrl-group button {
    border-radius: 0;
}

.fdf-track-map .maplibregl-ctrl-group button:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.fdf-track-map .maplibregl-ctrl-group button:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Informations en bas */
.fdf-track-info {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #6c757d;
}

#aircraft-count {
    font-weight: 600;
    color: #007cba;
}

#last-update {
    font-size: 12px;
    color: #868e96;
}

/* Popups */
.fdf-segment-popup,
.fdf-current-popup {
    min-width: 200px;
}

.fdf-segment-popup h4,
.fdf-current-popup h4 {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.fdf-current-popup h4 {
    color: #007cba;
    font-size: 17px;
}

.popup-details {
    font-size: 13px;
    line-height: 1.4;
}

.popup-details p {
    margin: 6px 0;
    padding: 0;
}

.popup-details strong {
    color: #333;
    font-weight: 600;
}

/* Personnalisation des popups MapLibre */
.maplibregl-popup {
    z-index: 1000;
}

.maplibregl-popup-content {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    padding: 15px;
}

.maplibregl-popup-close-button {
    font-size: 18px;
    color: #6c757d;
    right: 8px;
    top: 8px;
}

.maplibregl-popup-close-button:hover {
    color: #495057;
}

.maplibregl-popup-tip {
    border-top-color: #e9ecef;
}

/* Attribution */
.maplibregl-ctrl-attrib {
    background-color: rgba(255, 255, 255, 0.95) !important;
    font-size: 11px !important;
}

.maplibregl-ctrl-attrib a {
    color: #007cba !important;
}

/* Responsive */
@media (max-width: 768px) {
    .fdf-track-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .fdf-track-legend {
        align-self: center;
    }
    
    .fdf-track-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .fdf-legend-item {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .fdf-track-container {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .fdf-track-controls {
        padding: 12px 15px;
    }
    
    .fdf-track-info {
        padding: 10px 15px;
    }
    
    .fdf-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .fdf-track-legend h4 {
        font-size: 13px;
    }
    
    .fdf-legend-item {
        font-size: 11px;
    }
}

/* Animation de chargement */
.fdf-track-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fdf-track-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: fdf-spin 1s linear infinite;
}

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

/* États de la carte */
.fdf-track-map.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Amélioration de l'accessibilité */
.fdf-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.fdf-track-map:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Styles pour les erreurs */
.fdf-track-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 15px 20px;
    font-size: 14px;
}

.fdf-track-error strong {
    display: block;
    margin-bottom: 5px;
}

/* Indicateur de mise à jour en temps réel */
.fdf-track-live-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 124, 186, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fdf-track-live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    animation: fdf-pulse 2s ease-in-out infinite;
}

@keyframes fdf-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Popup de segment interpolé */
.fdf-interpolated-popup {
    min-width: 220px;
}

.fdf-interpolated-popup h4 {
    margin: 0 0 10px 0;
    padding: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #e67e22;
    border-bottom: 2px solid #f39c12;
}

.fdf-interpolated-popup .popup-details p {
    margin: 6px 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
}

.fdf-interpolated-popup .popup-details strong {
    color: #333;
    font-weight: 600;
}

.fdf-interpolated-popup .popup-details em {
    color: #f39c12;
    font-style: italic;
    font-size: 0.9em;
    font-weight: 500;
    background: rgba(243, 156, 18, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Animation pour les avions en virage */
@keyframes aircraft-turning {
    0%, 100% { 
        transform: scale(1) rotate(var(--aircraft-heading));
        filter: drop-shadow(0 0 8px rgba(52, 152, 219, 0.6));
    }
    50% { 
        transform: scale(1.1) rotate(var(--aircraft-heading));
        filter: drop-shadow(0 0 12px rgba(52, 152, 219, 0.8));
    }
}

/* Classe pour les avions en virage (appliquée via JavaScript) */
.aircraft-turning {
    animation: aircraft-turning 1.5s ease-in-out infinite;
}

/* Effet de lissage sur les traces pendant les virages */
.track-segment-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Indicateur de virage dans les popups */
.turning-indicator {
    color: #3498db;
    font-weight: bold;
    background: rgba(52, 152, 219, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8em;
}

.turning-indicator::before {
    content: "🔄 ";
    animation: fdf-spin 2s linear infinite;
}

/* Indicateur d'avion stationnaire dans les popups */
.stationary-indicator {
    color: #e74c3c;
    font-weight: bold;
    background: rgba(231, 76, 60, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8em;
}

.stationary-indicator::before {
    content: "🔴 ";
}

/* Styles pour les segments de liaison */
.fdf-bridge-popup {
    min-width: 220px;
    border-left: 4px solid #9b59b6;
}

.fdf-bridge-popup h4 {
    margin: 0 0 10px 0;
    padding: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #8e44ad;
    border-bottom: 2px solid #9b59b6;
}

/* Animation pour les traits pointillés des segments de liaison */
@keyframes dash-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 20; }
}

/* Classe pour animer les segments de liaison (appliquée via JavaScript) */
.bridge-segment-animated {
    animation: dash-flow 2s linear infinite;
} 