:root {
    /* Base theme variables */
    --form-color: #0d1c38;
    --accent-color: #3575e6;
    --light-color: #e8ebf1;
    --navbar-color: #162042;

    --title-color: #0d1c38;
    --animation-color: #fdfdff;

    /* Additional theme variables */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --text-primary: #333333;
    --text-secondary: #777777;
    --border-color: #e0e0e0;
    --card-shadow: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
    --form-color: #1a2b4d;
    --accent-color: #4682ed;
    --light-color: #2c3034;
    --navbar-color: #1a2542;

    --title-color: #d2cec8;
    --animation-color: #d2cec8;

    --bg-primary: #212529;
    --bg-secondary: #2c3034;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #495057;
    --card-shadow: rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar {
    background-color: var(--navbar-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 10px;
    transition: background-color 0.3s ease;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.main-form {
    padding: 2rem;
    background-color: var(--navbar-color);
    color: white;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.headline {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
}

#routeFormSection {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.form-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.form-control {
    border-color: var(--border-color);
    border-radius: 5px;
    padding: 12px 15px;
    font-size: 16px;
    width: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.suggestion-box {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    border-radius: 5px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    position: absolute;
    width: 100%;
    transition: background-color 0.3s ease;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.suggestion-item:hover {
    background-color: var(--bg-secondary);
}

#fromDiv, #toDiv {
    position: relative;
}

#startButton {
    background-color: var(--accent-color);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.3s ease;
}

#startButton:hover {
    background-color: var(--form-color);
}

/* Responsive adjustments */
@media (max-width: 800px) {
    .benefit-card, .step-card, .route-card, .testimonial-card {
        margin-bottom: 20px;
    }
}

.headline-wrapper {
    position: relative;
    margin-bottom: 2rem;
}


.headline {
    display: flex;
    align-items: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0;
}

.animated-phrase {
    color: var(--animation-color);
    position: relative;
    display: inline-block;
    margin-right: 10px;
    transition: opacity 0.5s ease, transform 0.5s ease, color 0.3s ease;
}

.animated-phrase.fade-out {
    opacity: 0;
    transform: translateY(30px);
}

.animated-phrase.fade-in {
    opacity: 0;
    transform: translateY(-30px);
    animation: slideDown 0.5s forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.static-phrase {
    display: inline-block;
    color: var(--animation-color);
    transition: color 0.3s ease;
}

.section-title {
    color: var(--title-color);
    font-weight: bold;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}

.benefits-section {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.benefit-card {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 25px;
    height: 100%;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s ease;
    text-align: center;
}

.benefit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.benefit-icon {
    color: var(--accent-color);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.how-it-works-section {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.step-card {
    background-color: var(--bg-primary);
    border-radius: 10px;
    padding: 30px 20px;
    height: 100%;
    box-shadow: 0 5px 15px var(--card-shadow);
    transition: transform 0.3s, background-color 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.step-card:hover {
    transform: translateY(-5px);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: var(--form-color);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 20px;
    transition: background-color 0.3s ease;
}

.popular-routes-section {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.route-card {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 20px;
    transition: transform 0.3s, background-color 0.3s ease, box-shadow 0.3s ease;
}

.route-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.route-cities {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

.route-arrow {
    color: var(--accent-color);
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.route-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.route-time {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.route-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.route-btn:hover {
    background-color: var(--form-color);
}

/* Testimonials */
.testimonials-section {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.testimonial-card {
    background-color: var(--bg-primary);
    border-radius: 10px;
    padding: 25px;
    height: 100%;
    box-shadow: 0 5px 15px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.testimonial-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.testimonial-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.testimonial-author {
    font-weight: 600;
    font-size: 0.95rem;
}

.testimonial-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.testimonial-route {
    color: var(--accent-color);
    font-weight: 500;
}

.testimonial-stars {
    color: #FFD700;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 0;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    background-color: var(--navbar-color);
    color: white;
}

.cta-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: white;
}

.cta-text {
    font-size: 1.1rem;
    opacity: 0.7;
    margin-bottom: 25px;
}

.cta-btn {
    background-color: var(--accent-color);
    color: white;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1rem;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background-color: var(--form-color);
    color: white;
}

/* Footer */
.footer-section {
    background-color: var(--navbar-color);
    color: rgba(255, 255, 255, 0.8);
    padding: 60px 0 20px;
    transition: background-color 0.3s ease;
}

.footer-content {
    margin-bottom: 40px;
}

.footer-brand h2 {
    color: white;
    font-weight: bold;
    margin-bottom: 15px;
}

.footer-brand p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
}

.social-link:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
}

.footer-links h4, .footer-contact h4 {
    color: white;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links ul li a:hover {
    color: white;
    text-decoration: underline;
}

.contact-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.contact-info svg {
    margin-right: 10px;
}

#darkModeToggle {
    font-size: 0.8rem;
}

/* Swap button */
.swap-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.swap-btn:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Recent searches */
.recent-searches-container {
    margin-top: 15px;
}

.recent-searches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-search-chip {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.recent-search-chip .chip-label {
    cursor: pointer;
}

.recent-search-chip:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.recent-search-chip .chip-arrow {
    color: var(--accent-color);
}

.chip-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 15px;
    line-height: 1;
    margin-left: 2px;
    transition: opacity 0.2s ease;
}

.chip-remove:hover {
    opacity: 1;
}

/* Loading spinner */
.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 800px) {
    .row.g-1 {
        flex-direction: column;
    }

    .row.g-1 .col-4 {
        width: 100%;
        margin-bottom: 8px;
    }

    #startButton {
        width: 100%;
        margin-top: 15px;
    }

    #swapDiv {
        justify-content: center;
        width: 100%;
        margin: 5px 0;
    }

    .swap-btn {
        transform: rotate(90deg);
    }

    .headline {
        flex-direction: column;
        align-items: flex-start;
    }

    .animated-phrase, .static-phrase {
        display: block;
        margin-bottom: 5px;
    }

    #routeFormSection .row {
        flex-direction: column;
    }

    #routeFormSection .col-md-3,
    #routeFormSection .col-md-4,
    #routeFormSection .col-md-1 {
        width: 100%;
        margin-bottom: 15px;
    }

    .main-form {
        padding: 1.5rem 1rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    nav.navbar {
        padding: 10px;
    }

    .navbar-brand {
        display: flex;
        align-items: center;
        margin-bottom: 0;
    }

    .navbar-nav {
        flex-direction: row;
        align-items: center;
        margin-bottom: 0;
    }

    .nav-item {
        margin: 0 5px;
    }

    .navbar-brand .badge {
        display: inline-block;
        vertical-align: middle;
    }

    .navbar-dark .navbar-nav {
        margin-left: auto;
    }

    .form-check {
        padding-left: 1.5rem;
    }

    #animatedPhrase {
        font-size: 2rem;
    }

    #staticPhrase {
        font-size: 1.5rem;
    }

    .cta-title {
        font-size: 1.5rem;
    }
}
