/* Styles pour le filtre d'année */
.year-filter {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-filter label {
    font-size: 0.9em;
    color: #555;
    white-space: nowrap;
}

.year-filter select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9em;
    color: #333;
    cursor: pointer;
    min-width: 120px;
}

.year-filter select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Message quand aucun événement n'est disponible */
.no-events {
    padding: 20px;
    text-align: center;
    color: #777;
    font-style: italic;
}

/* Styles pour les marqueurs personnalisés */
.leaflet-marker-icon.custom-marker {
    background: transparent;
    border: none;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 12px 16px;
    line-height: 1.4;
}

.leaflet-popup-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: #2c3e50;
}

.leaflet-popup-content p {
    margin: 5px 0;
}

.leaflet-popup-content .event-popup-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.leaflet-popup-content .event-popup-link {
    display: inline-block;
    margin-top: 10px;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.leaflet-popup-content .event-popup-link:hover {
    text-decoration: underline;
}

/* Styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow: hidden;
}

/* Conteneur principal */
#app {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Conteneur de la timeline */
.timeline-container {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    z-index: 1000;
    transition: all 0.3s ease;
    max-height: 250px;
    display: flex;
    flex-direction: column;
}

.timeline-container.collapsed {
    max-height: 40px;
}

.timeline-container.collapsed .timeline {
    display: none;
}

/* En-tête de la timeline */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #2c3e50;
    color: white;
    cursor: pointer;
    user-select: none;
    margin: 0;
    height: 40px;
    box-sizing: border-box;
}

.timeline-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.toggle-icon {
    margin-left: 10px;
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* Conteneur de défilement horizontal */
.timeline {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 15px;
    padding: 15px;
    background: white;
    scrollbar-width: thin;
    scrollbar-color: #adb5bd #f1f3f5;
    min-height: 180px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

.timeline::-webkit-scrollbar {
    height: 6px;
}

.timeline::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}

.timeline::-webkit-scrollbar-thumb {
    background-color: #adb5bd;
    border-radius: 3px;
}

.timeline::-webkit-scrollbar-thumb:hover {
    background-color: #868e96;
}

/* Style de la barre de défilement pour Firefox */
@supports (scrollbar-width: thin) {
    .timeline {
        scrollbar-width: thin;
        scrollbar-color: #ccc #f5f5f5;
    }
}

/* Carte d'événement dans la timeline */
.event-card {
    display: inline-flex;
    flex-direction: column;
    width: 200px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin: 0 5px;
    position: relative;
    vertical-align: top;
    height: 180px; /* Hauteur fixe pour toutes les cartes */
}

.event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.event-card.active {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.5);
    z-index: 10;
}

.event-card.past {
    opacity: 0.7;
}

/* Effet de surbrillance au survol */
.event-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 7px;
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    transition: box-shadow 0.3s ease;
    pointer-events: none;
}

.event-card:hover::after {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.event-card.active::after {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.4);
}

/* Animation de transition pour le survol */
@keyframes cardHover {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(-3px); }
}

.event-card:hover {
    animation: cardHover 0.3s ease-out forwards;
}

/* Image de l'événement */
.event-image-container {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f8f9fa;
}

.event-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.event-card:hover .event-image {
    transform: scale(1.05);
}

/* Contenu de l'événement */
.event-content {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.event-title {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 34px;
    max-height: 50px;
    flex-shrink: 0;
}

/* Message de chargement de la timeline */
.timeline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
}

/* Styles pour les popups des marqueurs */
.leaflet-popup-content {
    margin: 0;
    line-height: 1.4;
    min-width: 200px;
}

/* Style pour la prévisualisation d'image */
.leaflet-marker-preview {
    position: absolute;
    width: 200px;
    height: 150px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    pointer-events: none;
    overflow: hidden;
    transform: translate(-50%, -100%);
    margin-top: -20px;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.1s ease;
    border: 2px solid white;
}

.leaflet-marker-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaflet-marker-preview-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaflet-popup-content-wrapper {
    border-radius: 6px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content h3 {
    margin: 5px 0 10px 0;
    font-size: 16px;
    color: #2c3e50;
}

.leaflet-popup-content p {
    margin: 5px 0;
    font-size: 13px;
    color: #495057;
}

.leaflet-popup-content .event-number {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
}

.leaflet-popup-content .event-link {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 10px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.leaflet-popup-content .event-link:hover {
    background-color: #2980b9;
}

/* Amélioration de l'accessibilité */
.leaflet-container a.leaflet-popup-close-button {
    color: #6c757d;
    font-size: 20px;
    padding: 5px 8px 0 0;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #343a40;
}

/* Correction pour les écrans tactiles */
.leaflet-touch .leaflet-bar a {
    width: 30px;
    height: 30px;
    line-height: 30px;
}

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

.leaflet-container a:hover {
    color: #1a5276;
}

/* Styles pour le bouton de localisation */
.leaflet-bar a.leaflet-control-location-visible {
    background-color: #4CAF50;
    color: white;
}

.leaflet-bar a.leaflet-control-location-visible:hover {
    background-color: #45a049;
}

.leaflet-bar a.leaflet-control-location-following {
    background-color: #f39c12;
    color: white;
}

.leaflet-bar a.leaflet-control-location-following:hover {
    background-color: #e67e22;
}

/* Correction pour les icônes de localisation */
.leaflet-control-location .leaflet-control-location-toggle {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    width: 30px;
    height: 30px;
    display: block;
}

/* Amélioration de l'accessibilité au clavier */
.leaflet-bar a:focus {
    outline: 2px solid #4d90fe;
    outline-offset: 2px;
}

.event-date,
.event-location {
    margin: 2px 0;
    font-size: 11px;
    color: #6c757d;
    line-height: 1.3;
}

.event-id {
    display: inline-block;
    background: #f1f3f5;
    color: #495057;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-bottom: 4px;
}

.event-location {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: #495057;
    border-top: 1px solid #f1f3f5;
}

.timeline-event-location i {
    color: #adb5bd;
    font-size: 11px;
    width: 14px;
    text-align: center;
}

/* Badge pour les événements spéciaux */
.event-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e64980;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Badge pour les nouveaux événements */
.event-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #e74c3c;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Styles pour les écrans plus petits */
@media (max-width: 768px) {
    .timeline-event {
        width: 200px;
    }
    
    .timeline-event-image-container {
        height: 120px;
    }
    
    .timeline-event-content {
        padding: 12px;
    }
    
    .timeline-event-title {
        font-size: 0.9em;
    }
}

/* Carte */
#map-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Styles pour les contrôles de la carte */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-width: 250px;
    transition: all 0.3s ease;
}

.map-controls h3 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

/* Styles pour le mode mobile */
@media (max-width: 768px) {
    .timeline-container {
        max-width: 90%;
        left: 10px;
        right: 10px;
        margin: 0 auto;
    }
    
    .map-controls {
        left: 10px;
        right: 10px;
        max-width: none;
        top: auto;
        bottom: 20px;
    }
    
    .timeline {
        min-width: 90vw;
        overflow-x: auto;
        padding-bottom: 10px;
    }
}

/* Animation pour les marqueurs */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.highlight-marker {
    animation: pulse 1s infinite;
}

/* Conteneur principal */
#app {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Conteneur de la carte */
#map-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Overlay de la carte */
#map-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    font-size: 12px;
    display: none;
}

/* Tableau des événements */
.events-table-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 40vh;
    overflow-y: auto;
    transform: translateY(calc(100% - 40px));
    transition: transform 0.3s ease;
}

.events-table-container:hover {
    transform: translateY(0);
}

.events-table-container h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1em;
}

/* Styles pour les onglets */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.tab.active {
    background: #3498db;
    color: white;
}

/* Styles pour les écrans très larges */
@media (min-width: 1200px) {
    .events-table-container {
        width: 50%;
        left: auto;
        transform: translateY(0);
    }
    
    .events-table-container.collapsed {
        transform: translateY(calc(100% - 40px));
    }
}
