/* General Setup & CSS Variables */
:root {
    --green: #28a745;
    --purple: #6f42c1;
    --pink: #e83e8c;
    --blue: #007bff;
    --light-green: #eaf6ec;
    --light-purple: #f0ebf9;
    --light-pink: #fdebf3;
    --light-blue: #e6f2ff;
    --horizontal-bg: #00bfff;
}

/* General Body styles for demo, can be removed in production */
body.elementor-page {
    background-color: #f8f9fa;
    font-family: 'Poppins', sans-serif;
}

.timeline-heading {
    color: #343a40;
    font-family: 'Poppins', sans-serif;
    margin-top: 60px;
    margin-bottom: 40px;
    text-align: center;
}

/* --- Vertical Timeline Styles --- */
.vertical-timeline-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto 80px auto;
}

.vertical-timeline-container::after {
    content: '';
    position: absolute;
    width: 3px;
    background-color: #e9f5ff;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1.5px;
    z-index: 1;
}

.v-timeline-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 20px 0;
    opacity: 0; /* Initially hidden for animation */
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.v-timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-content-container, .timeline-date {
    width: 50%;
    box-sizing: border-box;
}

.v-timeline-item::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border: 4px solid #85d7ff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 2;
}

.v-timeline-item:nth-child(odd) .timeline-content-container { padding-right: 45px; text-align: right; }
.v-timeline-item:nth-child(odd) .timeline-date { padding-left: 35px; text-align: left; }
.v-timeline-item:nth-child(even) .timeline-content-container { padding-left: 45px; text-align: left; }
.v-timeline-item:nth-child(even) .timeline-date { padding-right: 35px; text-align: right; }

.date-text { font-weight: 600; color: #343a40; font-size: 16px; display: block; }
.date-subtext { font-size: 14px; color: #6c757d; display: block; }

.timeline-card {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    position: relative;
    transition: all 0.4s ease;
    text-align: left; /* Ensure card content is left-aligned by default */
}

.timeline-card::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    transition: border-color 0.4s ease;
}

.v-timeline-item:nth-child(odd) .timeline-card::after {
    right: -14px;
    border-width: 15px 0 15px 15px;
    border-color: transparent transparent transparent #ffffff;
}
.v-timeline-item:nth-child(even) .timeline-card::after {
    left: -14px;
    border-width: 15px 15px 15px 0;
    border-color: transparent #ffffff transparent transparent;
}

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.card-title-section .card-subtitle { font-size: 14px; font-weight: 500; margin: 0 0 5px 0; transition: color 0.4s ease; }
.card-title-section .card-title { font-size: 20px; font-weight: 700; color: #343a40; margin: 0; transition: color 0.4s ease; }
.card-description { font-size: 15px; color: #6c757d; line-height: 1.6; margin: 0; transition: color 0.4s ease; }

.card-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.4s ease; }
.card-icon svg, .card-icon i { font-size: 22px; width: 22px; height: 22px; transition: stroke 0.4s, color 0.4s ease; }

.card-bg-icon { position: absolute; right: 15px; bottom: 10px; opacity: 0; transform: scale(0.8); transition: all 0.4s ease; z-index: 0; }
.card-bg-icon svg, .card-bg-icon i { font-size: 100px; width: 100px; height: 100px; fill: #ffffff; color: #ffffff; }

.timeline-card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.1); background-color: var(--event-color); }
.timeline-card:hover .card-title, .timeline-card:hover .card-subtitle, .timeline-card:hover .card-description { color: #ffffff; }
.timeline-card:hover .card-bg-icon { opacity: 0.15; transform: scale(1); }
.timeline-card:hover .card-icon { background-color: #ffffff !important; }
.timeline-card:hover .card-icon svg { stroke: var(--event-color) !important; }
.timeline-card:hover .card-icon i { color: var(--event-color) !important; }

.v-timeline-item:nth-child(odd) .timeline-card:hover::after { border-color: transparent transparent transparent var(--event-color); }
.v-timeline-item:nth-child(even) .timeline-card:hover::after { border-color: transparent var(--event-color) transparent transparent; }

.event-green { --event-color: var(--green); }
.event-green .card-subtitle { color: var(--green); }
.event-green .card-icon { background-color: var(--light-green); }
.event-green .card-icon svg { stroke: var(--green); }
.event-green .card-icon i { color: var(--green); }

.event-purple { --event-color: var(--purple); }
.event-purple .card-subtitle { color: var(--purple); }
.event-purple .card-icon { background-color: var(--light-purple); }
.event-purple .card-icon svg { stroke: var(--purple); }
.event-purple .card-icon i { color: var(--purple); }

.event-pink { --event-color: var(--pink); }
.event-pink .card-subtitle { color: var(--pink); }
.event-pink .card-icon { background-color: var(--light-pink); }
.event-pink .card-icon svg { stroke: var(--pink); }
.event-pink .card-icon i { color: var(--pink); }

.event-blue { --event-color: var(--blue); }
.event-blue .card-subtitle { color: var(--blue); }
.event-blue .card-icon { background-color: var(--light-blue); }
.event-blue .card-icon svg { stroke: var(--blue); }
.event-blue .card-icon i { color: var(--blue); }

/* --- Horizontal Timeline Styles --- */
.horizontal-timeline-wrapper {
    width: 100%;
    background-color: var(--horizontal-bg);
    padding: 80px 40px;
    box-sizing: border-box;
    margin-bottom: 80px;
}
.horizontal-timeline-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}
.horizontal-timeline-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
}
.h-timeline-events {
    display: flex;
    justify-content: space-between;
    position: relative;
}
.h-timeline-event {
    position: relative;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-basis: 0;
    flex-grow: 1;
}
.h-event-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    border: 3px solid white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}
.h-event-title {
    color: white;
    font-weight: 600;
    margin-top: 25px;
    transition: color 0.3s ease;
}
.h-event-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}
.h-event-card {
    position: absolute;
    bottom: calc(100% + 30px);
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 280px;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 10;
}
.h-event-card::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}
.h-timeline-event:hover .h-event-dot {
    background-color: var(--horizontal-bg);
    border-color: #007bff;
}
.h-timeline-event:hover .h-event-card {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 20px);
}

/* --- Simple Vertical Timeline --- */
.simple-v-timeline .v-timeline-item::before {
    border-color: #d1d8e0;
}
.simple-v-timeline .timeline-card {
    text-align: center;
    padding: 30px 20px;
}
.simple-v-timeline .card-title {
    font-size: 18px;
    margin-bottom: 8px;
    color: #343a40;
}
.simple-v-timeline .card-author {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #343a40;
}
.simple-v-timeline .card-time {
    font-size: 13px;
    color: #adb5bd;
}
.simple-v-timeline .card-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 38px;
    height: 38px;
    background-color: transparent !important; /* Override theme background */
}
.simple-v-timeline .card-icon svg, .simple-v-timeline .card-icon i {
    width: 20px;
    height: 20px;
    stroke: var(--event-color);
    color: var(--event-color);
}
.simple-v-timeline .timeline-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    background-color: #ffffff; /* No background color change on hover */
}
.simple-v-timeline .timeline-card:hover .card-title,
.simple-v-timeline .timeline-card:hover .card-author,
.simple-v-timeline .timeline-card:hover .card-time {
    color: inherit; /* No text color change on hover */
}
.simple-v-timeline .v-timeline-item:nth-child(odd) .timeline-card:hover::after,
.simple-v-timeline .v-timeline-item:nth-child(even) .timeline-card:hover::after {
    border-color: transparent transparent transparent #ffffff;
}

.v-timeline-item.event-green { --event-color: #34d399; }
.v-timeline-item.event-purple { --event-color: #a78bfa; }
.v-timeline-item.event-pink { --event-color: #f472b6; }
.v-timeline-item.event-blue { --event-color: #38bdf8; }
.vertical-timeline-container .timeline-card {
    border: 2px solid transparent;
    transition: background 0.2s, border 0.2s, box-shadow 0.2s;
}

.vertical-timeline-container .card-icon {
    background: var(--event-color, #85d7ff);
    color: #fff;
}
.vertical-timeline-container .card-bg-icon {
    color: var(--event-color, #85d7ff);
}

/* --- Responsive Design --- */
@media screen and (max-width: 820px) {
    .vertical-timeline-container::after { left: 9px; }
    .v-timeline-item::before { left: 9px; }
    .v-timeline-item, .v-timeline-item:nth-child(even) { flex-direction: column-reverse; align-items: flex-start; }
    .timeline-content-container, .timeline-date { width: 100%; padding: 0 !important; text-align: left !important; }
    .v-timeline-item .timeline-content-container { padding-left: 40px !important; margin-top: 15px; }
    .v-timeline-item .timeline-date { padding-left: 40px !important; }

    .v-timeline-item:nth-child(odd) .timeline-card::after, .v-timeline-item:nth-child(even) .timeline-card::after {
        left: -14px;
        right: auto;
        border-width: 15px 15px 15px 0;
        border-color: transparent #ffffff transparent transparent;
    }
    .v-timeline-item .timeline-card:hover::after {
        border-color: transparent var(--event-color) transparent transparent !important;
    }
    .simple-v-timeline .v-timeline-item .timeline-card:hover::after {
        border-color: transparent #ffffff transparent transparent !important;
    }
    
    .horizontal-timeline-wrapper { padding: 40px 10px; }
    .h-timeline-events { flex-direction: column; align-items: center; gap: 50px; }
    .horizontal-timeline-container::before { display: none; }
    .h-timeline-event { width: 100%; }
    .h-event-dot { position: static; transform: none; margin-bottom: 15px; }
    .h-event-title { margin-top: 0; color: #343a40; } /* Change color for mobile */
    .h-event-date { color: #6c757d; } /* Change color for mobile */
    .h-event-card {
        position: static;
        transform: none;
        margin-top: 15px;
        opacity: 1;
        visibility: visible;
        width: 100%;
        box-sizing: border-box;
    }
    .h-event-card::after { display: none; }
    .h-timeline-event:hover .h-event-card { bottom: auto; }
}

/* Event color variables for each theme */
.event-green { --event-color: #28a745; }
.event-purple { --event-color: #6f42c1; }
.event-pink { --event-color: #e83e8c; }
.event-blue { --event-color: #007bff; }

/* Default icon color */
.card-icon svg { stroke: #fff; color: #fff; }
.card-icon i { color: #fff; }

/* On hover, use the event color */
.timeline-card:hover .card-icon svg { stroke: var(--event-color) !important; color: var(--event-color) !important; }
.timeline-card:hover .card-icon i { color: var(--event-color) !important; }

/* Optional: background color for card-icon */
.card-icon {
    background-color: var(--event-color, #85d7ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    transition: background 0.3s;
}

/* On hover, background stays white */
.timeline-card:hover .card-icon {
    background-color: #fff !important;
}

/* Card hover background */
.timeline-card {
    transition: background 0.3s, box-shadow 0.3s;
}
.timeline-card:hover {
    background-color: var(--event-color) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
}
.timeline-card:hover .card-title,
.timeline-card:hover .card-subtitle,
.timeline-card:hover .card-description {
    color: #fff !important;
}
