/* ========================================
   TIMELINE CENTRAL SLIDER
   Handle arrastrable en la línea central del timeline
   ======================================== */

/* Handle del slider en la línea central */
.timeline-central-slider {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    cursor: grab;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.timeline-central-slider:active {
    cursor: grabbing;
}

/* Círculo principal del handle */
.timeline-slider-handle-main {
    position: relative;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #D4AF37, #E5C047);
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 
        0 0 0 2px rgba(212, 175, 55, 0.3),
        0 4px 20px rgba(212, 175, 55, 0.6);
    transition: all 0.3s ease;
}

/* Efecto de empuje/squeeze cuando arrastra */
.timeline-central-slider[data-direction="down"] .timeline-slider-handle-main {
    transform: scaleY(0.9) scaleX(1.1);
    box-shadow: 
        0 0 0 2px rgba(212, 175, 55, 0.3),
        0 6px 25px rgba(212, 175, 55, 0.7);
}

.timeline-central-slider[data-direction="up"] .timeline-slider-handle-main {
    transform: scaleY(1.1) scaleX(0.9);
    box-shadow: 
        0 0 0 2px rgba(212, 175, 55, 0.3),
        0 2px 15px rgba(212, 175, 55, 0.7);
}

/* Motion blur effect cuando se mueve rápido */
.timeline-central-slider.dragging[data-direction="down"] .timeline-slider-handle-main::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 4px;
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.4), transparent);
    border-radius: 50%;
    filter: blur(2px);
}

.timeline-central-slider.dragging[data-direction="up"] .timeline-slider-handle-main::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 4px;
    background: linear-gradient(to top, rgba(212, 175, 55, 0.4), transparent);
    border-radius: 50%;
    filter: blur(2px);
}

/* Hover effect */
.timeline-central-slider:hover .timeline-slider-handle-main {
    transform: scale(1.2);
    box-shadow: 
        0 0 0 4px rgba(212, 175, 55, 0.4),
        0 6px 30px rgba(212, 175, 55, 0.8);
}

/* Active/dragging effect */
.timeline-central-slider:active .timeline-slider-handle-main {
    transform: scale(1.15);
    box-shadow: 
        0 0 0 6px rgba(212, 175, 55, 0.5),
        0 8px 40px rgba(212, 175, 55, 0.9);
}

/* Pulso animado continuo */
@keyframes handlePulse {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(212, 175, 55, 0.3),
            0 4px 20px rgba(212, 175, 55, 0.6);
    }
    50% {
        box-shadow: 
            0 0 0 6px rgba(212, 175, 55, 0.2),
            0 4px 25px rgba(212, 175, 55, 0.7);
    }
}

.timeline-slider-handle-main {
    animation: handlePulse 2s ease-in-out infinite;
}

/* Icono de flechas arriba/abajo dentro del círculo */
.timeline-slider-handle-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.timeline-slider-handle-icon i {
    font-size: 0.6rem;
    line-height: 0.6;
}

/* Tooltip con el año - Más grande y visible */
.timeline-slider-tooltip-central {
    position: absolute;
    top: 50%;
    left: 60px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(20, 20, 20, 0.95));
    color: #D4AF37;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Cormorant Garamond', serif;
    white-space: nowrap;
    pointer-events: none;
    border: 2px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 101;
    min-width: 120px;
    text-align: center;
}

/* Animación suave cuando cambia el año */
.timeline-central-slider.dragging .timeline-slider-tooltip-central {
    transition: opacity 0.3s ease, transform 0.1s ease;
}

/* Efecto de "tick" cuando pasa por un año completo */
@keyframes yearTick {
    0%, 100% {
        transform: translateY(-50%) scale(1);
    }
    50% {
        transform: translateY(-50%) scale(1.05);
    }
}

/* Indicador de rango virtual cuando está dragging */
.timeline-slider-tooltip-central::after {
    content: '↕ Arrastra para navegar';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    font-size: 0.7rem;
    color: rgba(212, 175, 55, 0.7);
    white-space: nowrap;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-central-slider.dragging .timeline-slider-tooltip-central::after {
    opacity: 1;
}

/* Flecha del tooltip */
.timeline-slider-tooltip-central::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid rgba(212, 175, 55, 0.5);
}

/* Mostrar tooltip al hover o drag */
.timeline-central-slider:hover .timeline-slider-tooltip-central,
.timeline-central-slider.dragging .timeline-slider-tooltip-central {
    opacity: 1;
}

/* Línea guía vertical cuando está dragging */
.timeline-central-slider-guide {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: rgba(212, 175, 55, 0.3);
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.timeline.dragging .timeline-central-slider-guide {
    opacity: 1;
}

/* Ocultar markers originales cuando el slider está activo (opcional) */
.timeline.slider-active .timeline-marker {
    opacity: 0.3;
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .timeline-slider-handle-main {
        width: 36px;
        height: 36px;
    }
    
    .timeline-slider-tooltip-central {
        font-size: 1.6rem;
        padding: 0.7rem 1.3rem;
        left: 55px;
    }
    
    .timeline-slider-handle-icon {
        font-size: 0.9rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    /* Ajustar posición a la línea que se mueve a la izquierda */
    .timeline-central-slider {
        left: 20px;  /* Coincide con .timeline::before en mobile */
        transform: translate(-50%, -50%);
    }
    
    .timeline-slider-handle-main {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
    
    .timeline-slider-tooltip-central {
        font-size: 1.4rem;
        padding: 0.6rem 1.1rem;
        left: 50px;
    }
    
    .timeline-slider-handle-icon {
        font-size: 0.8rem;
    }
    
    .timeline-slider-handle-icon i {
        font-size: 0.5rem;
    }
}

@media (max-width: 576px) {
    .timeline-slider-handle-main {
        width: 28px;
        height: 28px;
    }
    
    .timeline-slider-tooltip-central {
        font-size: 1.2rem;
        padding: 0.5rem 1rem;
        left: 45px;
    }
}

/* Optimizar para touch en pantallas pequeñas */
@media (max-width: 400px) {
    .timeline-slider-handle-main {
        width: 32px;  /* Más grande para touch */
        height: 32px;
    }
    
    .timeline-slider-tooltip-central {
        font-size: 1.1rem;
        padding: 0.4rem 0.9rem;
        left: 42px;
    }
    
    /* Área táctil más grande */
    .timeline-central-slider::before {
        content: '';
        position: absolute;
        top: -15px;
        left: -15px;
        right: -15px;
        bottom: -15px;
        z-index: -1;
    }
}

/* Asegurar que el slider esté sobre otros elementos */
.timeline {
    position: relative;
}

.timeline-central-slider {
    will-change: top;
}

/* Smooth dragging */
.timeline-central-slider.dragging {
    transition: none;
}

.timeline-central-slider:not(.dragging) {
    transition: top 0.3s ease;
}
