/* Keyframe Animations for a more dynamic feel */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drawLine {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes drawLineVertical {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

/* Apply animations to page elements */
.section.profile .card, .controls, .bus-layout-wrapper, .color-legend-section {
    animation: fadeInUp 0.7s ease-out forwards;
    opacity: 0; /* Start hidden */
}

/* Stagger the animation for a smoother sequence */
.col-xl-8 .card { animation-delay: 0.2s; }
.controls { animation-delay: 0.3s; }
.bus-layout-wrapper { animation-delay: 0.4s; }
.color-legend-section { animation-delay: 0.5s; }

/* Timeline specific animations */
.journey-timeline .timeline-line {
    transform-origin: left;
    animation: drawLine 1s 0.5s ease-out forwards;
}
.timeline-point, .timeline-bus-info {
    animation: fadeInUp 0.8s 0.8s ease-out forwards;
    opacity: 0; /* Start hidden */
}

/* Journey Timeline Styles */
.journey-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    margin-top: 15px;
    margin-bottom: 15px;
}
.timeline-point {
    text-align: center;
    flex: 1;
    position: relative;
}
.timeline-point .place {
    font-weight: 600;
    font-size: 1.1em;
    color: #343a40;
    transition: transform 0.3s ease;
}
.timeline-point .stop-name {
    font-size: 0.85em;
    color: #495057;
}
.timeline-point .time {
    font-size: 0.9em;
    color: #6c757d;
}
.timeline-point:hover .place {
    transform: scale(1.05);
}
.timeline-line {
    flex-grow: 2;
    height: 2px; /* Default horizontal line height */
    background-color: #adb5bd; /* Default line color */
    position: relative;
    margin: 0 10px;
}
.timeline-bus-info {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f8f9fa;
    padding: 0 10px;
    text-align: center;
}
.timeline-bus-info .bus-icon {
    font-size: 1.5em;
}
.timeline-bus-info .reg-no {
    font-size: 0.8em;
    font-weight: 600;
    color: #495057;
    display: block;
}
.start-point .place { color: #28a745; }
.end-point .place { color: #007bff; }

@media (max-width: 576px) {
    .journey-timeline { flex-direction: column; }
    .timeline-line { width: 2px; height: 50px; margin: 15px 0; transform-origin: top; animation: drawLineVertical 1s 0.5s ease-out forwards; }
    .timeline-bus-info .bus-icon { position: relative; transform: rotate(90deg); }
}

/* Animations for haversines_ours.php (bus list) */
#bulllist .row .indibus,
#bulllist .row .unsurebusinfo {
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    border-radius: 12px; /* Add rounded corners for a modern look */
}

#bulllist .row:hover .indibus,
#bulllist .row:hover .unsurebusinfo {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Staggered fade-in animation for the bus list */
#bulllist .row {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Create a staggered delay for the first few items */
#bulllist .row:nth-child(1) { animation-delay: 0.1s; }
#bulllist .row:nth-child(2) { animation-delay: 0.2s; }
#bulllist .row:nth-child(3) { animation-delay: 0.3s; }
#bulllist .row:nth-child(4) { animation-delay: 0.4s; }
#bulllist .row:nth-child(5) { animation-delay: 0.5s; }
#bulllist .row:nth-child(6) { animation-delay: 0.6s; }
}