:root {
    --primary-bg: #f2f2f2;
    --white: #ffffff;
    --blue-accent: #008cff;
    --blue-dark: #0056b3;
    --text-black: #000000;
    --text-gray: #4a4a4a;
    --text-light: #9b9b9b;
    --border-color: #e7e7e7;
    --font-stack: 'Lato', sans-serif;
    --header-height: 60px;
}

/* Global Reset for better WP compatibility */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: auto;
    /* Prevent forcing fixed height */
    overflow-x: hidden;
    /* Prevent horizontal scrollbar */
    font-family: var(--font-stack);
    background-color: var(--primary-bg);
    color: var(--text-black);
}

/* Header & Background */
.main-header {
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1)), url('https://imgak.mmtcdn.com/pwa_v3/pwa_commons_assets/desktop/bg7.jpg');
    background-size: cover;
    background-position: center;
    min-height: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ensure no margin collapse creates a white bar on top */
}

.top-bar {
    width: 100%;
    padding: 10px 40px;
    display: flex;
    justify-content: flex-start;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.2);
}

.site-logo {
    height: 30px;
}

.header-content {
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Headline */
.header-headline {
    color: var(--white);
    font-weight: 900;
    font-size: 1.8rem;
    margin-bottom: 40px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

/* Booking Widget Card */
.booking-widget {
    background: var(--white);
    border-radius: 10px;
    padding: 20px 0;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    margin-bottom: -50px;
}

/* Trip Type Radio Tabs */
.booking-type-tabs {
    display: flex;
    gap: 20px;
    padding: 0 40px 15px 40px;
    border-bottom: 1px solid var(--border-color);
}

.radio-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-gray);
}

.radio-tab input[type="radio"] {
    accent-color: var(--blue-accent);
    width: 18px;
    height: 18px;
}

.radio-tab:has(input:checked) {
    color: var(--text-black);
}

/* Form Grid */
.form-container {
    padding: 20px 20px;
}

.form-content-grid {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    height: 100px;
    position: relative;
}

/* Strict Columns */
.form-item {
    flex: 1 1 0px;
    /* Force equal width */
    width: 0;
    /* Fallback for rigorous flex behavior */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 20px;
    border-right: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    /* overflow: hidden; Removed to allow dropdowns */
}

.form-item:last-child {
    border-right: none;
}

.form-item:hover {
    background: #eaf5ff;
}

/* Input Styling */
.lbl-sm {
    font-size: 0.85rem;
    color: var(--text-gray);
    font-weight: 400;
    margin-bottom: 5px;
    display: block;
}

.main-input {
    border: none;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-black);
    width: 100%;
    outline: none;
    background: transparent;
    padding: 0;
    line-height: 1.2;
    font-family: var(--font-stack);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-input::placeholder {
    color: #cfcfcf;
}

.main-input-select {
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    width: 100%;
    outline: none;
    background: transparent;
}

.sub-text {
    font-size: 0.8rem;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-text {
    font-size: 0.9rem;
    color: var(--text-gray);
}

/* Swap Icon */
.swap-icon-container {
    position: absolute;
    left: 20%;
    /* Exactly 1/5th */
    top: 50%;
    transform: translate(-50%, -50%);
    width: 35px;
    height: 35px;
    background: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--blue-accent);
    z-index: 10;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.swap-icon-container:hover {
    transform: translate(-50%, -50%) rotate(180deg);
}

/* Search Button */
.search-btn-container {
    display: flex;
    justify-content: center;
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
}

.primary-search-btn {
    background: linear-gradient(to right, #53b2fe, #065af3);
    color: var(--white);
    border: none;
    padding: 12px 60px;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.4);
    transition: transform 0.2s;
}

.primary-search-btn:hover {
    transform: translateY(-2px);
}

.add-stops-area {
    padding: 0 20px;
    margin-top: -10px;
    margin-bottom: 30px;
}

.add-stop-link {
    color: var(--blue-accent);
    font-weight: 700;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Offers Section */
.offers-section {
    background: var(--primary-bg);
    padding-top: 60px;
    padding-bottom: 60px;
    display: flex;
    justify-content: center;
}

.offers-container {
    width: 100%;
    max-width: 1200px;
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.offers-nav {
    display: flex;
    gap: 30px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.offers-nav span {
    cursor: pointer;
    color: var(--text-gray);
    font-weight: 600;
    position: relative;
}

.offers-nav span.active {
    color: var(--blue-accent);
}

.offers-nav span.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--blue-accent);
}

.offers-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.offer-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    padding: 10px;
    gap: 15px;
    height: 150px;
    align-items: center;
}

.offer-details h3 {
    margin: 5px 0;
    font-size: 1rem;
}

.offer-sub {
    font-size: 0.7rem;
    color: var(--text-light);
}

.book-now {
    color: var(--blue-accent);
    text-decoration: none;
    font-weight: 900;
    font-size: 0.8rem;
    margin-top: 10px;
    display: inline-block;
}

/* Flatpickr Customization */
.flatpickr-calendar {
    font-family: var(--font-stack) !important;
}

/* --- AUTOCOMPLETE STYLES --- */
.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    font-size: 0.9rem;
    color: var(--text-black);
    text-align: left;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.autocomplete-active {
    background-color: DodgerBlue !important;
    color: #ffffff;
}

/* Stop Input Styled */
.stop-input-styled {
    width: 60%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
}

/* --- CUSTOM TIME PICKER STYLES --- */
.time-picker-popup {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1000;
    width: 320px;
    font-family: var(--font-stack);
}

.time-picker-popup.active {
    display: block;
}

.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

#tp-display {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--text-black);
}

#tp-apply {
    background: var(--blue-accent);
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.8rem;
}

.tp-columns {
    display: flex;
    height: 250px;
    overflow: hidden;
}

.tp-col {
    flex: 1;
    overflow-y: auto;
    border-right: 1px solid #eee;
    padding: 10px 0;
}

.tp-col:last-child {
    border-right: none;
}

.tp-col::-webkit-scrollbar {
    width: 6px;
}

.tp-col::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.tp-item {
    padding: 10px 0;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-gray);
    transition: all 0.2s;
}

.tp-item:hover {
    background: #f0f0f0;
}

.tp-item.selected {
    background: var(--blue-accent);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        padding: 0 10px;
    }

    .form-content-grid {
        flex-direction: column;
        height: auto;
    }

    .form-item {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
        width: auto;
        /* reset grid width */
        flex: 1;
    }

    .swap-icon-container {
        display: none;
    }

    .booking-type-tabs {
        flex-wrap: wrap;
    }

    .main-input {
        font-size: 1.4rem;
    }
}
