/* Timeline Component Styles */

.timeline-container {
    position: relative;
    padding: 2rem 0;
}

.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background: var(--gradient-primary);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(24, 188, 156, 0.3);
    z-index: 0; /* Changed from 1 to 0 to ensure the line stays behind other elements */
}

/* Timeline items */
.timeline-item {
    position: relative;
    width: 50%;
    padding: 10px 40px;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.2s ease-in-out;
    z-index: 1;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Right side items */
.timeline-item-right {
    left: 50%;
}

/* Left side items */
.timeline-item-left {
    left: 0;
}

/* Timeline badges */
.timeline-badge {
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
    box-shadow: 0 5px 15px rgba(24, 188, 156, 0.4);
    transition: all 0.2s ease;
    transform-origin: center;
    top: 0px; /* Adjusted to center on the timeline */
}

.timeline-item-right .timeline-badge {
    left: -30px;
}

.timeline-item-left .timeline-badge {
    right: -30px;
}

.timeline-badge i {
    font-size: 1.5rem;
}

.timeline-year {
    position: absolute;
    bottom: 70px; /* Position above the badge */
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--primary);
    background: white;
    padding: 4px 10px;
    border-radius: 15px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transform: translateX(-50%);
    left: 50%;
    z-index: 3; /* Increased to be above the badge */
    white-space: nowrap; /* Prevent wrapping of year text */
}

/* Timeline panels */
.timeline-panel {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    margin-top: 15px; /* Add space between badge/year and panel */
}

.timeline-item-right .timeline-panel::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -15px;
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 15px solid white;
}

.timeline-item-left .timeline-panel::before {
    content: '';
    position: absolute;
    top: 20px;
    right: -15px;
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 15px solid white;
}

.timeline-title {
    color: var(--secondary);
    margin-bottom: 10px;
    font-weight: 600;
}

.timeline-body p {
    color: #6c757d;
    line-height: 1.6;
}

/* Active state for mobile interaction */
.timeline-item.active .timeline-panel {
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(-5px);
}

.timeline-item.active .timeline-badge {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(24, 188, 156, 0.5);
}

/* Responsive design */
@media (max-width: 767px) {
    .timeline::after {
        left: 31px;
    }
    
    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
        margin-bottom: 40px; /* Increased spacing between items in mobile view */
    }
    
    .timeline-item-right,
    .timeline-item-left {
        left: 0;
    }
    
    .timeline-item-right .timeline-badge,
    .timeline-item-left .timeline-badge {
        left: 0;
        top: 0px; /* Maintain the same top position in mobile view */
    }
    
    .timeline-item-left .timeline-panel::before {
        left: -15px;
        right: auto;
        border-right: 15px solid white;
        border-left: 0;
    }
    
    .timeline-year {
        left: 60px; /* Position to the right of the badge in mobile view */
        transform: none;
        bottom: auto; /* Reset bottom positioning */
        top: -30px; /* Position above the badge in mobile view */
    }
}

/* Animation for timeline items */
@keyframes timelineItemAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-item.visible {
    animation: timelineItemAppear 0.6s ease-out forwards;
}


/* Timeline items center */
.timeline-item-center {
    left: 25%;
    width: 50%;
    text-align: center;
    margin-top: 50px;
    margin-bottom: 50px; /* Add more space after the centered item */
}

.timeline-item-center .timeline-badge {
    left: 50%;
    transform: translateX(-50%);
}

.timeline-item-center .timeline-panel::before {
    display: none;
}

/* Responsive design for centered item */
@media (max-width: 767px) {
    .timeline-item-center {
        left: 0;
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
        text-align: left;
        margin-top: 40px;
        margin-bottom: 40px;
    }
    
    .timeline-item-center .timeline-badge {
        left: 0;
        transform: none;
    }
}

/* Animation for timeline items */
@keyframes timelineItemAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-item.visible {
    animation: timelineItemAppear 0.6s ease-out forwards;
}
