/* Estilos para la línea de tiempo horizontal */
.horizontal-timeline-section {
    position: relative;
    margin-top: 30px;
}

.drag-instructions {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.drag-indicator {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: #0e668d;
    animation: pulse 2s infinite;
}

.drag-indicator svg {
    margin-right: 5px;
    animation: slideRight 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideRight {
    0% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    100% { transform: translateX(-3px); }
}

.horizontal-timeline-container {
    position: relative;
    width: 100%;
    height: 450px; /* Aumentado para acomodar iconos arriba y abajo */
    overflow: hidden;
    cursor: grab;
}

.horizontal-timeline-container.grabbing {
    cursor: grabbing;
}

.horizontal-timeline-wrapper {
    position: relative;
    height: 100%;
    width: max-content;
    min-width: 100%;
    padding: 20px 0;
}

/* Línea base horizontal */
.timeline-base-line {
    position: absolute;
    top: 50%; /* Centrado verticalmente */
    left: 0;
    right: 50px;
    height: 14px;
    background-color: rgba(199, 199, 199, 0.3);
    z-index: 1;
    transform: translateY(-50%);
}

/* Contenedor para grupos de eventos */
.timeline-event-group {
    position: absolute;
    top: 0;
    height: 100%;
}

/* ELIMINADO: Estilo para el año en la línea base (ya no se usa) */

/* Marcador de eventos */
.timeline-event-marker {
    position: absolute;
    left: 0;
    top: 52%; /* Centrado en la línea */
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 5;
    padding: 10px; /* Área de clic más grande */
    margin: -10px; /* Compensar el padding para mantener la posición */
}

/* Punto en la línea */
.timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    /* border: 2px solid white; */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    z-index: 4;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Puntos más pequeños cuando hay múltiples eventos */
.timeline-event-marker.multiple-events .timeline-dot {
    width: 14px;
    height: 14px;
}

.timeline-dot:hover {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}

/* Línea conectora desde el punto al icono */
.timeline-connector {
    position: absolute;
    width: 2px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    opacity: 1;
    transition: all 0.3s ease;
}

.timeline-connector.top {
    bottom: 50%;
}

.timeline-connector.bottom {
    top: 50%;
}

.timeline-event-marker:hover .timeline-connector {
    opacity: 1;
    width: 2px;
}

/* Colores para conectores por clasificación */
.timeline-connector.hidrologia { background-color: #2596be; }
.timeline-connector.gobernanza { background-color: #6b3f95; }
.timeline-connector.ecosistemas { background-color: #958031; }
.timeline-connector.biodiversidad { background-color: #376c6b; }
.timeline-connector.vacio { background-color: #ccc; }
.timeline-connector.lighthouse { background-color: #6b3f95; }

/* Colores de puntos por clasificación */
.timeline-dot.hidrologia {
    background-color: #2596be;
}
.timeline-dot.gobernanza {
    background-color: #6b3f95;
}
.timeline-dot.ecosistemas {
    background-color: #958031;
}
.timeline-dot.biodiversidad{
    background-color: #376c6b;
}
.timeline-dot.vacio {
    background-color: #ccc;
}
.timeline-dot.lighthouse {
    background-color: #6b3f95;
}

/* NUEVO: Estilos para el año individual en cada evento */
.timeline-event-year {
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
    margin: -8px 0;
    /* Sin fondo según lo solicitado */
}

/* Colores de años por clasificación */
.timeline-event-year.hidrologia {
    color: #2596be;
}
.timeline-event-year.gobernanza {
    color: #6b3f95;
}
.timeline-event-year.ecosistemas {
    color: #958031;
}
.timeline-event-year.biodiversidad{
    color: #376c6b;
}
.timeline-event-year.vacio {
    color: #ccc;
}
.timeline-event-year.lighthouse {
    color: #6b3f95;
}

/* Contenedor del contenido del evento */
.timeline-event-content {
    position: absolute;
    width: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2;
    transition: transform 0.3s ease;
}

.timeline-event-content:hover {
    transform: translateX(-50%) scale(1.1);
}

.timeline-event-content.position-top {
    bottom: calc(100% + 20px); /* Posición arriba de la línea */
}

.timeline-event-content.position-bottom {
    top: calc(100% + 20px); /* Posición abajo de la línea */
}

/* Icono del evento - Sin fondo */
.timeline-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Eliminado el fondo blanco y border-radius */
    /* Eliminado box-shadow */
    transition: all 0.3s ease;
}

.timeline-icon:hover {
    /* Eliminado box-shadow del hover */
    transform: translateY(-2px);
}

.timeline-icon img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.timeline-icon svg {
    width: 100%;
    height: 100%;
}

/* Título del evento - ahora visible solo en hover o cuando sea necesario */
.timeline-event-title {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 5px;
    color: #666;
    font-weight: 500;
    display: none; /* Oculto por defecto */
}

/* Mostrar título en hover */
.timeline-event-marker:hover .timeline-event-title {
    display: block;
}

/* ESTILOS DEL TOOLTIP - Aparece desde el dot con direcciones invertidas */
.timeline-tooltip {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    width: 180px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
}

/* INVERTIDO: Tooltip para eventos ARRIBA - aparece DEBAJO del dot apuntando hacia abajo */
.timeline-event-marker.position-top .timeline-tooltip {
    top: calc(50% + 15px); /* Debajo del dot */
}

/* INVERTIDO: Tooltip para eventos ABAJO - aparece ARRIBA del dot apuntando hacia arriba */
.timeline-event-marker.position-bottom .timeline-tooltip {
    bottom: calc(50% + 15px); /* Arriba del dot */
}

.timeline-tooltip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Flecha del tooltip */
.timeline-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    z-index: 999;
}

/* INVERTIDO: Flecha para eventos ARRIBA - apunta hacia ARRIBA (hacia el dot) */
.timeline-event-marker.position-top .timeline-tooltip::after {
    bottom: 100%;
    border-bottom: 8px solid rgba(255, 255, 255, 0.98);
    border-top: none;
}

/* INVERTIDO: Flecha para eventos ABAJO - apunta hacia ABAJO (hacia el dot) */
.timeline-event-marker.position-bottom .timeline-tooltip::after {
    top: 100%;
    border-top: 8px solid rgba(255, 255, 255, 0.98);
    border-bottom: none;
}

.tooltip-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #0e668d;
}

.tooltip-description {
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Animación para la interacción con la línea de tiempo */
.timeline-event-marker {
    transition: transform 0.3s ease;
}

.timeline-event-marker:hover {
    transform: translateY(-50%) scale(1.05);
}

.timeline-event-marker:hover .timeline-dot {
    transform: translate(-50%, -50%) scale(1.3);
}

/* Estilos para la leyenda */
.timeline-legend-container {
    padding: 10px 20px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0 auto 15px;
    max-width: 800px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    position: relative;
    z-index: 10;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 3px rgba(0,0,0,0.2);
}

.legend-dot.hidrologia { background-color: #2596be; }
.legend-dot.gobernanza { background-color: #6b3f95; }
.legend-dot.ecosistemas { background-color: #958031; }
.legend-dot.biodiversidad { background-color: #376c6b; }
.legend-dot.vacio { background-color: #ccc; }

.legend-label {
    font-size: 0.85rem;
    color: #333;
    font-weight: 500;
}

/* Ajustes responsivos */
@media (max-width: 768px) {
    .horizontal-timeline-container {
        height: 380px; /* Ajustado para móvil */
    }

    .timeline-base-line {
        top: 50%;
    }

    .timeline-event-marker {
        top: 50%;
    }

    .timeline-event-year {
        font-size: 1rem;
    }

    .timeline-event-content {
        width: 60px;
    }

    .timeline-icon {
        width: 45px;
        height: 45px;
    }

    .timeline-icon img {
        max-width: 85%;
        max-height: 85%;
    }

    .timeline-event-title {
        font-size: 0.65rem;
    }

    .timeline-tooltip {
        width: 150px;
        font-size: 0.75rem;
    }

    .tooltip-title {
        font-size: 0.8rem;
    }

    .tooltip-description {
        font-size: 0.7rem;
    }

    .timeline-legend-container {
        padding: 8px 12px;
        gap: 8px;
        max-width: 576px;
    }

    .legend-item {
        margin-right: 5px;
        margin-bottom: 5px;
    }

    .legend-label {
        font-size: 0.75rem;
    }
}