.timeline-direttiva-section {
    padding: 5rem 0;
    background: var(--bg-light);
    border-bottom: 2px solid var(--primary-color);
}

.timeline-direttiva-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.timeline-direttiva-header {
    text-align: center;
    margin-bottom: .5rem;
}

.timeline-direttiva-header p {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Filtri Timeline */
.timeline-filters {
    background: #cbe8f1;
    padding: 1.5rem;
    border-radius: 0 0 12px 12px;
    margin-bottom: 3rem;
}

.timeline-filters-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.timeline-filter-btn {
    padding: 0.4rem 0.7rem;
    border: 1px solid #c0c0c0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark);
}

.timeline-filter-btn:hover {
    border-color: var(--text-dark);
    background: #f0f7ff;
}

.timeline-filter-btn.active {
    border: none;
    background: #535960;
    color: white;
}

.timeline-filter-btn.all.active {
    background: #111111;
    color: white;
    border: none;
}

/* Legenda Timeline */
.timeline-legend {
    background: #cbe8f1;
}

.timeline-legend-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.timeline-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: center;
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: .7rem;
    font-weight: 600;
}

.timeline-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Timeline principale */
.timeline-direttiva-wrapper {
    background: #cbe8f1;
    padding: 3rem 2rem;
    border-radius: 12px 12px 0 0;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
}

.timeline-direttiva-scroll {
    min-width: 2400px;
    position: relative;
    padding: 80px 0 0 0;
}

.timeline-direttiva-line {
    position: absolute;
    top: 87%;
    left: 40px;
    right: 40px;
    height: 4px;
    background: linear-gradient(90deg, 
        #42A5F5 0%,
        #AB47BC 20%,
        #FFA726 40%,
        #66BB6A 60%,
        #26C6DA 80%,
        #00897B 100%);
    border-radius: 2px;
    z-index: 1;
}

.timeline-direttiva-events {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
}

.timeline-direttiva-event {
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s;
}

.timeline-direttiva-event.hidden {
    opacity: 0.2;
    pointer-events: none;
}

.timeline-event-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 4px solid white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    z-index: 3;
}

.timeline-direttiva-event:hover .timeline-event-dot {
    transform: scale(1.4);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.timeline-event-year {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}

.timeline-event-date {
    position: absolute;
    top: -75px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Date già passate: sfondo grigio */
.timeline-event-date.past {
    background: #9e9e9e;
}

/* TOOLTIP VERSO IL BASSO */
.timeline-event-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    min-width: 320px;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    border-top: 4px solid;
}

.timeline-direttiva-event:hover .timeline-event-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Freccia verso l'ALTO (tooltip verso il basso) */
.timeline-event-tooltip::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

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

.timeline-tooltip-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline-tooltip-content li {
    padding: 0.4rem 0;
    padding-left: 1.2rem;
    position: relative;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-dark);
}

.timeline-tooltip-content li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.timeline-tooltip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.timeline-tooltip-tag {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--text-dark);
}

/* Categorie colori */
.timeline-cat-solare .timeline-event-dot { background: #FFA726; }
.timeline-cat-solare .timeline-event-tooltip { border-top-color: #FFA726; }

.timeline-cat-efficienza .timeline-event-dot { background: #66BB6A; }
.timeline-cat-efficienza .timeline-event-tooltip { border-top-color: #66BB6A; }

.timeline-cat-tecnologia .timeline-event-dot { background: #42A5F5; }
.timeline-cat-tecnologia .timeline-event-tooltip { border-top-color: #42A5F5; }

.timeline-cat-incentivi .timeline-event-dot { background: #AB47BC; }
.timeline-cat-incentivi .timeline-event-tooltip { border-top-color: #AB47BC; }

.timeline-cat-certificazioni .timeline-event-dot { background: #26C6DA; }
.timeline-cat-certificazioni .timeline-event-tooltip { border-top-color: #26C6DA; }

.timeline-cat-neutralita .timeline-event-dot { background: #00897B; }
.timeline-cat-neutralita .timeline-event-tooltip { border-top-color: #00897B; }

/* Responsive */
@media (max-width: 768px) {
    .timeline-direttiva-header p {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .timeline-direttiva-scroll {
        min-width: 2200px;
    }
    
    .timeline-event-tooltip {
        min-width: 280px;
    }
    .timeline-direttiva-section {
        padding: 4rem 0 2rem 0;
    }
}
