.timeline-container {
    position: relative;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    background: #ddd;
    border-radius: 2px;
    transform: translateX(-50%);
    min-height: 100%;
}

.timeline-tick {
    position: absolute;
    left: 50%;
    width: 24px;
    height: 2px;
    background: #333;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.timeline-year-label {
    position: absolute;
    left: 50%;
    transform: translate(-100%, -50%);
    margin-left: -20px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    background: transparent;
    padding: 0;
    border: none;
    white-space: nowrap;
    z-index: 10;
    line-height: 1; /* Reduces vertical space from font metrics */
}


.timeline-content-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 300px;
    max-width: 400px;
    z-index: 15;
    transition: all 0.3s ease;
}

/* MODIFIED: Symmetrical positioning for left and right boxes */
.timeline-content-box.left {
  left: 40%;
  transform: translateY(-50%) translateX(calc(-100%));
}

.timeline-content-box.left.animate-in {
  opacity: 1;
  transform: translateY(-50%);
}

.timeline-content-box.right {
    left: 57%;
    transform: translateY(-50%);
}

.timeline-content-box.right.animate-in {
  opacity: 1;
  transform: translateY(-50%);
}


.timeline-content-box::before {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 12px solid transparent;
}

.timeline-content-box.left::before {
    right: -24px;
    border-left-color: #fff;
}

.timeline-content-box.right::before {
    left: -24px;
    border-right-color: #fff;
}

.timeline-content-box::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 13px solid transparent;
    z-index: -1;
}

.timeline-content-box.left::after {
    right: -26px;
    border-left-color: #ddd;
}

.timeline-content-box.right::after {
    left: -26px;
    border-right-color: #ddd;
}

.timeline-content-box h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.timeline-content-box p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

.timeline-content-box img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-content-box img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.timeline-content-box .elementor-widget {
    margin-bottom: 15px;
}

.timeline-content-box .elementor-widget:last-child {
    margin-bottom: 0;
}

/* MODIFIED: Removed transform from hover to prevent position shifting */
.timeline-content-box:hover {
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.timeline-item {
    position: absolute;
    width: 100%;
    min-height: auto;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .timeline-line {
        left: 40px;
    }
    
    .timeline-tick {
        left: 40px;
    }
    
    .timeline-year-label {
        left: 45px;
        font-size: 12px;
        padding: 0px 4px;
    }
    
    .timeline-content-box {
        left: 80px !important;
        box-sizing:border-box;              /* include padding/border in width calc   */
        width:calc(100% - 100px);           /* instead of only max-width              */
        min-width:0;                        /* let it shrink further if it must       */
        transform: translateY(-50%) translateX(0) !important; /* Reset transform for mobile */
    }

    .timeline-content-box.left {
        transform: translateY(-50%) translateX(0) !important; /* Ensure left boxes are also reset */
    }
    
    .timeline-content-box::before,
    .timeline-content-box::after {
        left: -24px !important;
        right: auto !important;
        border-left-color: transparent !important;
        /* Remove the hardcoded border-right-color to allow inline styles to work */
    }

    .timeline-content-box::after {
        left: -26px !important;
        /* Remove the hardcoded border-right-color to allow inline styles to work */
    }
    
    .timeline-content-box h4 {
        font-size: 16px;
    }
    
    .timeline-content-box p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .timeline-container {
        padding: 15px 10px;
    }
    
    .timeline-content-box {
        min-width: 200px;
        max-width: calc(100% - 80px);
        padding: 12px;
    }
    
    .timeline-content-box h4 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .timeline-content-box p {
        font-size: 12px;
        margin-bottom: 10px;
    }
}

    /* Timeline Periods */
    .timeline-period {
        position: absolute;
        left: 50%; /* Start from timeline center */
        border-radius: 4px;
        z-index: 8;
        transition: all 0.3s ease;
    }

    .timeline-period:hover {
        background-color: rgba(255, 255, 255, 0.8); /* Fallback color with opacity, overridden by inline styles */
        transform: translateX(2px);
        z-index: 11;
    }

    .timeline-period-label {
        position: absolute;
        right: -10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        color: #333;
        background: #ffffff;
        padding: 2px 6px;
        border-radius: 3px;
        white-space: nowrap;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 10;
    }

    .timeline-period:hover .timeline-period-label {
        opacity: 1;
    }

    /* Mobile responsive for periods */
    @media (max-width: 768px) {
        .timeline-period {
            left: 60px;
            transform: none;
        }
        
        .timeline-period-label {
            font-size: 10px;
            padding: 1px 4px;
        }
    }