/* --------------------------------------------------------------------
   TIMELINE ÉDUCATIVE AVEC GALERIE AVANCÉE - CSS
   Version: 1.0
   Auteur: Emile SNYERS
   Licence: CC BY-NC-SA 4.0
   Rappel : Tous utilisateur, vous devez respecter les conditions de la licence CC BY-NC-SA 4.0.
            -  Vous pouvez utiliser ce code pour un usage non commercial.
            -  Vous devez attribuer l'œuvre à l'auteur original (Emile SNYERS).
            -  Vous devres toujour citer le lien vers l'œuvre originale.
            -  Vous devez partager les œuvres dérivées sous la même licence.
   -------------------------------------------------------------------- */

/* --------------------------------------------------------------------
   VARIABLES PRINCIPALES
   -------------------------------------------------------------------- */





/* --------------------------------------------------------------------
    VARIABLES AMÉLIORÉES
    -------------------------------------------------------------------- */
:root {
    --accent-color: #c69c6d;
    --card-radius: 12px;
    --tl-accent: #2563eb;
    --tl-bg: #ffffff;
    --tl-bg-dark: #f1f5f9;
    --tl-text: #334155;
    --tl-radius: 12px;
    --theme-primary: #2563eb;
    --theme-secondary: #e2e8f0;
    --theme-tertiary: #ffffff;
    --theme-text: #334155;
    --theme-text-titre: #1e293b;
    --theme-button-primary-text: #ffffff;
    --theme-button-secondary-text: #2563eb;
    
    /* Nouvelles variables pour la galerie */
    --gallery-gap: 1rem;
    --image-border-radius: 8px;
    --modal-backdrop: rgba(0, 0, 0, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-bg-strong: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------------------
    BASE STYLES
    -------------------------------------------------------------------- */
* {
    box-sizing: border-box;
}


/* --------------------------------------------------------------------
    SECTION & HEADER
    -------------------------------------------------------------------- */
.history-home {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.history-header {
    text-align: center;
    margin-bottom: 2rem;
}

.history-header h1 {
    background: linear-gradient(135deg, var(--theme-primary), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.history-header input[type="search"] {
    width: 100%;
    max-width: 420px;
    padding: 0.65rem 1.2rem;
    border: 2px solid var(--accent-color);
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.history-header input[type="search"]:focus {
    background: #f9f4ee;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(198, 156, 109, 0.2);
}

/* ─── Filtres prédéfinis ──────────────────────────────────── */
.preset-filters {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.preset-btn {
    border: 2px solid var(--tl-accent);
    border-radius: 10px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--tl-bg);
    color: var(--tl-accent);
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.preset-btn:hover,
.preset-btn:focus {
    background: var(--tl-accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* --------------------------------------------------------------------
    TIMELINE
    -------------------------------------------------------------------- */
.timeline {
    position: relative;
    list-style: none;
    padding-left: 0.1rem;
    border-left: 4px solid var(--theme-primary);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    align-items: flex-start;
    color: var(--theme-text);
    padding-left: 0.5rem;
}

.timeline-point {
    position: absolute;
    left: -1.15rem;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--theme-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 0 0 4px var(--tl-bg), 0 4px 15px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    z-index: 500;
}

.timeline-point:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px var(--tl-bg), 0 6px 20px rgba(37, 99, 235, 0.4);
}

.timeline-content {
    background: var(--theme-tertiary);
    border: 1px solid var(--theme-secondary);
    border-radius: var(--card-radius);
    padding: 1rem 1.25rem;
    flex: 1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.timeline-content h3 {
    margin-top: 0;
    font-size: 1.25rem;
    color: var(--theme-text-titre);
    font-weight: 600;
}

.timeline-date {
    font-weight: 600;
    margin: 0.4rem 0 0.6rem;
    color: var(--tl-accent);
    display: block;
    font-size: 0.9rem;
}
/* --------------------------------------------------------------------
    BOUTONS (Votre code existant amélioré)
    -------------------------------------------------------------------- */
.actions {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
/* --------------------------------------------------------------------
    LAYOUT PRINCIPAL AVEC BOUTONS À DROITE
    -------------------------------------------------------------------- */
.content-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.main-content {
    flex: 1;
}

.side-actions {
    flex-shrink: 0;
    width: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------
    GALERIE D'IMAGES RESTRUCTURÉE
    -------------------------------------------------------------------- */
.image-gallery {
    margin: 1rem 0;
    display: grid;
    gap: var(--gallery-gap);
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.image-gallery.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.image-gallery.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.image-gallery.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gallery-image {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--image-border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gallery-image:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.gallery-image:hover img {
    transform: scale(1.05);
}

.gallery-image .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(37, 99, 235, 0.8), rgba(198, 156, 109, 0.8));
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.gallery-image:hover .overlay {
    opacity: 1;
}

/* Légende toujours en dessous, jamais par-dessus */
.image-caption {
    background: var(--glass-bg-strong);
    color: var(--tl-text);
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--image-border-radius);
    text-align: center;
    line-height: 1.3;
    border: 1px solid var(--theme-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------------------
    BOUTONS LATÉRAUX AMÉLIORÉS
    -------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 2px solid var(--theme-secondary);
    background: var(--theme-primary);
    color: var(--theme-button-primary-text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    width: calc(33.33% - 0.5rem);
    justify-content: center;
    min-width: 100px;
}

.btn:hover {
    background: var(--theme-secondary);
    border: 2px solid var(--theme-secondary);
    color: var(--theme-button-secondary-text);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------
    MODAL LIGHTBOX AMÉLIORÉ
    -------------------------------------------------------------------- */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    backdrop-filter: blur(20px);
}

.lightbox-modal.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    max-width: 90vw;
    max-height: 90vh;
    transition: all 0.4s ease;
}

.lightbox-modal.active .lightbox-container {
    transform: translate(-50%, -50%) scale(1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    transform-origin: center;
    cursor: grab;
    user-select: none;
}

.lightbox-image.dragging {
    cursor: grabbing;
}

/* Compteur d'images en haut au centre */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    color: var(--tl-text);
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lightbox-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg-strong);
    border: 2px solid var(--glass-border);
    color: var(--tl-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: var(--theme-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--glass-bg-strong);
    border: 2px solid var(--glass-border);
    color: var(--tl-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
    background: var(--theme-primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.nav-btn.prev {
    left: 20px;
}

.nav-btn.next {
    right: 20px;
}

/* Conteneur des informations sur l'image affichée dans la lightbox */
.lightbox-info {
    /* Positionnement en dessous de l'image */
    position: relative;
    /* Alignement en bas */
    bottom: 20px;
    /* Centrage horizontal */
    left: 50%;
    /* Ajustement pour un centrage parfait */
    transform: translateX(-50%);
    /* Fond avec effet verre dépoli renforcé */
    background: var(--glass-bg-strong);
    /* Bordure fine pour l'effet verre */
    border: 1px solid var(--glass-border);
    /* Effet de flou pour l'arrière-plan */
    backdrop-filter: blur(15px);
    /* Couleur du texte adaptée au thème */
    color: var(--tl-text);
    /* Espacement interne pour le contenu */
    padding: 15px 25px;
    /* Coins arrondis pour style cohérent */
    border-radius: 25px;
    /* Alignement du texte au centre */
    text-align: center;
    /* Limitation de la largeur pour éviter de déborder */
    max-width: 80%;
    /* Ombre portée pour effet de profondeur */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Alignement en bas */
    bottom: 20px;
    /* Centrage horizontal */
    left: 50%;
    /* Ajustement pour un centrage parfait */
    transform: translateX(-50%);
    /* Fond avec effet verre dépoli renforcé */
    background: var(--glass-bg-strong);
    /* Bordure fine pour l'effet verre */
    border: 1px solid var(--glass-border);
    /* Effet de flou pour l'arrière-plan */
    backdrop-filter: blur(15px);
    /* Couleur du texte adaptée au thème */
    color: var(--tl-text);
    /* Espacement interne pour le contenu */
    padding: 15px 25px;
    /* Coins arrondis pour style cohérent */
    border-radius: 25px;
    /* Alignement du texte au centre */
    text-align: center;
    /* Limitation de la largeur pour éviter de déborder */
    max-width: 80%;
    /* Ombre portée pour effet de profondeur */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
}

/* --------------------------------------------------------------------
    RESPONSIVE PERFECTIONNÉ
    -------------------------------------------------------------------- */
@media (max-width: 768px) {
    .content-layout {
        flex-direction: column;
        gap: 1rem;
    }
    
    .side-actions {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .image-gallery.cols-4,
    .image-gallery.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lightbox-controls {
        top: 10px;
        right: 10px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }
    
    .lightbox-counter {
        top: 10px;
        padding: 10px 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .timeline {
        padding-left: 1.4rem;
    }
    
    .timeline-point {
        width: 1.5rem;
        height: 1.5rem;
        left: -0.85rem;
        font-size: 0.8rem;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
    }
    
    .nav-btn.prev {
        left: 10px;
    }
    
    .nav-btn.next {
        right: 10px;
    }
    .actions {
        flex-direction: column;
    }
}

/* --------------------------------------------------------------------
    ANIMATIONS PERSONNALISÉES
    -------------------------------------------------------------------- */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-item {
    animation: slideInUp 0.6s ease forwards;
}

.timeline-item:nth-child(even) {
    animation-delay: 0.1s;
}

.timeline-item:nth-child(odd) {
    animation-delay: 0.2s;
}