/* ========================================
   ENHANCED ELEGANT TIMELINE
   Clean, Modern & Responsive Design
======================================== */

:root {
    --timeline-primary: #2d5a27;
    --timeline-secondary: #e63946;
    --timeline-accent: #1d3557;
    --timeline-bg: #ffffff;
    --timeline-card-bg: #ffffff;
    --timeline-text: #2b2d42;
    --timeline-text-light: #6c757d;
    --timeline-line: linear-gradient(180deg, var(--timeline-secondary) 0%, var(--timeline-primary) 100%);
    --timeline-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --timeline-shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.15);
    --timeline-radius: 16px;
    --timeline-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Timeline Container */
.timeline {
    position: relative;
    padding: 40px 0;
    box-sizing: border-box;
}

.timeline *,
.timeline *:after,
.timeline *:before {
    box-sizing: inherit;
}

/* Central Timeline Line - Gradient Effect */
.timeline:not(.timeline--horizontal):before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    margin-left: -1.5px;
    background: var(--timeline-line);
    border-radius: 3px;
    z-index: 1;
}

/* Timeline Wrapper */
.timeline__wrap {
    position: relative;
    overflow: hidden;
    z-index: 2;
}

/* Timeline Items Container */
.timeline__items {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Individual Timeline Item */
.timeline__item {
    position: relative;
    width: 50%;
    padding: 0 50px 0 0;
    z-index: 2;
    opacity: 1;
    transform: translateY(0);
    transition: var(--timeline-transition);
}

/* Timeline Node/Dot */
.timeline__item:after {
    content: "";
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--timeline-bg);
    border: 4px solid var(--timeline-secondary);
    border-radius: 50%;
    z-index: 3;
    transition: var(--timeline-transition);
    box-shadow: 0 0 0 6px rgba(230, 57, 70, 0.15);
}

.timeline__item:hover:after {
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 0 0 10px rgba(230, 57, 70, 0.2);
    background: var(--timeline-secondary);
}

/* Left Side Items */
.timeline__item--left {
    left: 0;
    text-align: right;
}

/* Right Side Items */
.timeline__item--right {
    left: 50%;
    padding: 0 0 0 50px;
    text-align: left;
}

.timeline__item--right:after {
    left: -12px;
    right: auto;
}

/* Timeline Content Card */
.timeline__content {
    position: relative;
    display: block;
    background: var(--timeline-card-bg);
    border: none;
    border-radius: var(--timeline-radius);
    padding: 24px;
    box-shadow: var(--timeline-shadow);
    transition: var(--timeline-transition);
    overflow: hidden;
}

.timeline__content:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--timeline-line);
    border-radius: var(--timeline-radius) var(--timeline-radius) 0 0;
    opacity: 0;
    transition: var(--timeline-transition);
}

.timeline__content:hover {
    transform: translateY(-8px);
    box-shadow: var(--timeline-shadow-hover);
}

.timeline__content:hover:before {
    opacity: 1;
}

/* Arrow Pointers */
.timeline__content:after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border: 12px solid transparent;
    transition: var(--timeline-transition);
}

.timeline__item--left .timeline__content:after {
    right: -24px;
    border-left-color: var(--timeline-card-bg);
    border-right: none;
}

.timeline__item--right .timeline__content:after {
    left: -24px;
    border-right-color: var(--timeline-card-bg);
    border-left: none;
}

/* Hover effect for arrows */
.timeline__content:hover:after {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Year Badge */
.timeline__year {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--timeline-bg);
    background: linear-gradient(135deg, var(--timeline-secondary) 0%, var(--timeline-primary) 100%);
    padding: 8px 16px;
    border-radius: 30px;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
    z-index: 4;
    white-space: nowrap;
}

.timeline__item--left .timeline__year {
    right: -85px;
}

.timeline__item--right .timeline__year {
    left: -85px;
}

/* Content Typography */
.timeline__content h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--timeline-text);
    margin: 0 0 12px;
    line-height: 1.4;
    transition: var(--timeline-transition);
}

.timeline__content:hover h2 {
    color: var(--timeline-secondary);
}

.timeline__content p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--timeline-text-light);
    margin: 0;
}

/* Timeline Image */
.timeline_img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin: 16px 0;
    transition: var(--timeline-transition);
}

.timeline__content:hover .timeline_img {
    transform: scale(1.02);
}

/* Link Styling */
.timeline__item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ========================================
   HORIZONTAL TIMELINE
======================================== */

.timeline--horizontal {
    padding: 0 60px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
}

.timeline--horizontal .timeline-divider {
    position: absolute;
    left: 50px;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    height: 3px;
    background: var(--timeline-line);
    border-radius: 3px;
    z-index: 1;
}

.timeline--horizontal .timeline__items {
    display: inline-flex;
    flex-direction: row;
    gap: 20px;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.timeline--horizontal .timeline__item {
    display: inline-block;
    width: auto;
    min-width: 300px;
    padding: 0 0 50px;
    vertical-align: top;
    white-space: normal;
    text-align: center;
}

.timeline--horizontal .timeline__item:after {
    left: 50%;
    right: auto;
    top: auto;
    bottom: -12px;
    transform: translateX(-50%);
}

.timeline--horizontal .timeline__item .timeline__content {
    height: 100%;
}

.timeline--horizontal .timeline__item .timeline__content:after {
    top: auto;
    bottom: -24px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-top-color: var(--timeline-card-bg);
    border-bottom: none;
    border-left-color: transparent;
    border-right-color: transparent;
}

.timeline--horizontal .timeline__year {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    display: inline-block;
    margin-bottom: 20px;
}

/* Bottom Items in Horizontal */
.timeline--horizontal .timeline__item--bottom {
    padding: 50px 0 0;
}

.timeline--horizontal .timeline__item--bottom:after {
    top: -12px;
    bottom: auto;
}

.timeline--horizontal .timeline__item--bottom .timeline__content:after {
    top: -24px;
    bottom: auto;
    border-bottom-color: var(--timeline-card-bg);
    border-top: none;
}

/* ========================================
   NAVIGATION BUTTONS
======================================== */

.timeline-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--timeline-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--timeline-transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-nav-button:hover {
    background: var(--timeline-secondary);
    box-shadow: 0 8px 30px rgba(230, 57, 70, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.timeline-nav-button:hover:before {
    filter: brightness(0) invert(1);
}

.timeline-nav-button:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.timeline-nav-button:before {
    content: "";
    width: 12px;
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: var(--timeline-transition);
}

.timeline-nav-button--prev {
    left: 0;
}

.timeline-nav-button--prev:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b2d42' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E");
}

.timeline-nav-button--next {
    right: 0;
}

.timeline-nav-button--next:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b2d42' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ========================================
   ANIMATIONS
======================================== */

.timeline__item.animated {
    opacity: 0;
    transform: translateY(40px);
}

.timeline__item.fadeIn {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.timeline__item--left.fadeIn {
    animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.timeline__item--right.fadeIn {
    animation: fadeInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Staggered animation delay */
.timeline__item:nth-child(1) { animation-delay: 0.1s; }
.timeline__item:nth-child(2) { animation-delay: 0.2s; }
.timeline__item:nth-child(3) { animation-delay: 0.3s; }
.timeline__item:nth-child(4) { animation-delay: 0.4s; }
.timeline__item:nth-child(5) { animation-delay: 0.5s; }
.timeline__item:nth-child(6) { animation-delay: 0.6s; }
.timeline__item:nth-child(7) { animation-delay: 0.7s; }
.timeline__item:nth-child(8) { animation-delay: 0.8s; }
.timeline__item:nth-child(9) { animation-delay: 0.9s; }
.timeline__item:nth-child(10) { animation-delay: 1s; }

/* ========================================
   MOBILE RESPONSIVE
======================================== */

.timeline--mobile,
@media (max-width: 768px) {
    .timeline:not(.timeline--horizontal):before {
        left: 20px;
        margin-left: 0;
    }

    .timeline__item,
    .timeline__item--left,
    .timeline__item--right {
        left: 0;
        width: 100%;
        padding: 0 0 0 60px;
        text-align: left;
    }

    .timeline__item:after,
    .timeline__item--left:after,
    .timeline__item--right:after {
        left: 8px;
        right: auto;
    }

    .timeline__item--left .timeline__content:after,
    .timeline__item--right .timeline__content:after {
        left: -24px;
        right: auto;
        border-right-color: var(--timeline-card-bg);
        border-left-color: transparent;
    }

    .timeline__year {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        display: inline-block;
        margin-bottom: 15px;
    }

    .timeline__item--left .timeline__year,
    .timeline__item--right .timeline__year {
        left: auto;
        right: auto;
    }

    .timeline__content {
        padding: 20px;
    }

    .timeline_img {
        height: 140px;
    }
}

/* ========================================
   RTL SUPPORT
======================================== */

.rtl .timeline__content {
    text-align: right;
    direction: rtl;
}

.rtl .timeline__content h2,
.rtl .timeline__content p {
    text-align: right;
}

/* LTR wrapper for overall timeline if needed */
.ltr .timeline {
    direction: ltr;
}

/* ========================================
   DARK MODE (Optional)
======================================== */

@media (prefers-color-scheme: dark) {
    .timeline--dark {
        --timeline-bg: #1a1a2e;
        --timeline-card-bg: #16213e;
        --timeline-text: #edf2f4;
        --timeline-text-light: #8d99ae;
        --timeline-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        --timeline-shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.4);
    }
}

/* ========================================
   UTILITY CLASSES
======================================== */

.timeline--compact .timeline__item {
    padding: 0 40px 0 0;
}

.timeline--compact .timeline__item--right {
    padding: 0 0 0 40px;
}

.timeline--compact .timeline__content {
    padding: 16px;
}

.timeline--large .timeline__content {
    padding: 32px;
}

.timeline--large .timeline__content h2 {
    font-size: 1.3rem;
}

.timeline--large .timeline_img {
    height: 200px;
}
