/**
 * Timeline / Frise chronologique interactive
 * Design moderne avec animations
 */

/* ══════════════════════════════════════════════════════════════
   CONTENEUR PRINCIPAL
   ══════════════════════════════════════════════════════════════ */

.timeline-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(to bottom, #fafafa 0%, #fff 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ══════════════════════════════════════════════════════════════
   CONTRÔLES ET FILTRES
   ══════════════════════════════════════════════════════════════ */

.timeline-controls {
    padding: var(--space-lg);
    background: white;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    justify-content: space-between;
}

.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.timeline-filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-border);
    background: white;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.timeline-filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.timeline-zoom-controls {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.timeline-zoom-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--color-border);
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-text);
}

.timeline-zoom-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.timeline-zoom-level {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    min-width: 50px;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   VIEWPORT SCROLLABLE
   ══════════════════════════════════════════════════════════════ */

.timeline-viewport {
    position: relative;
    height: 600px;
    overflow-x: auto;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: var(--space-lg) 0;
}

.timeline-content {
    position: relative;
    min-width: 100%;
    height: 100%;
    padding: 0 var(--space-xl);
}

/* ══════════════════════════════════════════════════════════════
   AXE TEMPOREL
   ══════════════════════════════════════════════════════════════ */

.timeline-axis {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 3px solid var(--color-primary);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.timeline-axis-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 var(--space-xl);
    position: relative;
}

.timeline-axis-label {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    position: relative;
}

.timeline-axis-label::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: var(--color-primary);
}

.timeline-axis-label.major {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.timeline-axis-label.major::before {
    height: 15px;
    width: 3px;
}

/* ══════════════════════════════════════════════════════════════
   BANDES DES MOUVEMENTS
   ══════════════════════════════════════════════════════════════ */

.timeline-movements {
    position: relative;
    min-height: 200px;
    margin-top: var(--space-lg);
    padding: var(--space-md) 0;
}

.timeline-movement-band {
    position: absolute;
    height: 50px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.timeline-movement-band:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    z-index: 5;
}

.timeline-movement-band::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    opacity: 0.3;
}

.timeline-movement-label {
    position: relative;
    padding: 0 var(--space-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Couleurs par mouvement */
.timeline-movement-band[data-movement="renaissance"] { background: linear-gradient(135deg, #d4af37, #f4d03f); }
.timeline-movement-band[data-movement="maniérisme"] { background: linear-gradient(135deg, #c39bd3, #d7bde2); }
.timeline-movement-band[data-movement="baroque"] { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.timeline-movement-band[data-movement="classicisme"] { background: linear-gradient(135deg, #2980b9, #3498db); }
.timeline-movement-band[data-movement="rococo"] { background: linear-gradient(135deg, #f8b4d9, #ffccef); }
.timeline-movement-band[data-movement="néo-classicisme"] { background: linear-gradient(135deg, #5499c7, #7fb3d5); }
.timeline-movement-band[data-movement="romantisme"] { background: linear-gradient(135deg, #922b21, #cb4335); }
.timeline-movement-band[data-movement="réalisme"] { background: linear-gradient(135deg, #76448a, #9b59b6); }
.timeline-movement-band[data-movement="impressionnisme"] { background: linear-gradient(135deg, #16a085, #1abc9c); }
.timeline-movement-band[data-movement="post-impressionnisme"] { background: linear-gradient(135deg, #d68910, #f39c12); }
.timeline-movement-band[data-movement="symbolisme"] { background: linear-gradient(135deg, #6c3483, #8e44ad); }
.timeline-movement-band[data-movement="fauvisme"] { background: linear-gradient(135deg, #e67e22, #f39c12); }
.timeline-movement-band[data-movement="expressionnisme"] { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.timeline-movement-band[data-movement="cubisme"] { background: linear-gradient(135deg, #34495e, #5d6d7e); }
.timeline-movement-band[data-movement="surréalisme"] { background: linear-gradient(135deg, #1f618d, #2874a6); }
.timeline-movement-band[data-movement="art-moderne"] { background: linear-gradient(135deg, #117a65, #148f77); }

/* ══════════════════════════════════════════════════════════════
   PEINTRES SUR LA TIMELINE
   ══════════════════════════════════════════════════════════════ */

.timeline-painters {
    position: relative;
    min-height: 300px;
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 2px dashed var(--color-border);
}

.timeline-painter {
    position: absolute;
    width: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timeline-painter:hover {
    transform: translateY(-5px);
    z-index: 10;
}

.timeline-painter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 30px;
    width: 2px;
    height: 100vh;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-painter:hover::before {
    opacity: 0.2;
}

.timeline-painter-portrait {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    background: var(--color-bg-alt);
    transition: all 0.3s ease;
}

.timeline-painter:hover .timeline-painter-portrait {
    border-color: var(--color-primary);
    box-shadow: 0 5px 25px rgba(159, 56, 56, 0.4);
    transform: scale(1.1);
}

.timeline-painter-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-painter-life-line {
    position: absolute;
    top: 30px;
    left: 30px;
    height: 2px;
    background: var(--color-primary);
    opacity: 0.3;
    pointer-events: none;
}

.timeline-painter-name {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.timeline-painter:hover .timeline-painter-name {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   TOOLTIP
   ══════════════════════════════════════════════════════════════ */

.timeline-tooltip {
    position: fixed;
    z-index: 1000;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: var(--space-md);
    max-width: 350px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.timeline-tooltip.visible {
    opacity: 1;
}

.timeline-tooltip-header {
    margin-bottom: var(--space-sm);
}

.timeline-tooltip-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.timeline-tooltip-dates {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.timeline-tooltip-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text);
}

.timeline-tooltip-link {
    display: inline-block;
    margin-top: var(--space-sm);
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.timeline-tooltip-link:hover {
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════
   LÉGENDE
   ══════════════════════════════════════════════════════════════ */

.timeline-legend {
    padding: var(--space-lg);
    background: white;
    border-top: 1px solid var(--color-border);
}

.timeline-legend-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.timeline-legend-color {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(0,0,0,0.1);
}

/* ══════════════════════════════════════════════════════════════
   ÉTATS DE CHARGEMENT
   ══════════════════════════════════════════════════════════════ */

.timeline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

.timeline-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.timeline-error {
    padding: var(--space-xl);
    text-align: center;
    color: var(--color-danger);
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .timeline-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .timeline-filters {
        justify-content: center;
    }
    
    .timeline-zoom-controls {
        justify-content: center;
    }
    
    .timeline-viewport {
        height: 500px;
    }
    
    .timeline-painter {
        width: 50px;
    }
    
    .timeline-painter-portrait {
        width: 50px;
        height: 50px;
    }
    
    .timeline-movement-band {
        height: 40px;
    }
    
    .timeline-movement-label {
        font-size: 0.8rem;
    }
}
