/* Modern Booking Bar Styles */

.banner {
    position: relative;
}

.banner-form {
    position: relative;
    z-index: 1060 !important;
    --booking-bar-border-color: color-mix(in srgb, var(--theme-primary-color) 45%, #e2e8f0);
}

/* Specific override for the section containing the booking bar to prevent dropdown clipping */
.hero-search-section {
    overflow: visible !important;
    position: relative;
    z-index: 100; /* Ensure it stays above subsequent sections */
}
/* Ensure the Tom Select dropdown itself has maximum priority within that context */
.ts-dropdown {
    z-index: 9999 !important; 
}

/* Overlay positioning over the hero slider */
.booking-widget-overlay {
    position: absolute;
    margin-top: -27.5vh;
    left: 0;
    width: 100%;
    z-index: 1050 !important; /* Extremely high to stay above ribbons and badges */
}

.modern-booking-bar-wrapper {
    background: #ffffff;
    padding: 25px;
    border-radius: 0px 15px 15px 15px;
    border-top: 4px solid var(--theme-primary-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: nowrap; /* the bar is always one row -- fields never drop to a second line */
    width: 100%;
    position: relative;
    z-index: 1; /* renders above the toggle tabs, tucking their lower edge behind it */
}

/* ========================================= */
/*      BOOKING TYPE TOGGLE (OVERNIGHT/DAY USE) */
/* ========================================= */
/* Real folder/browser-style tabs that sit above the card. The active tab is
   lifted and painted with the theme's primary color; inactive tabs sit
   slightly recessed with a muted, faintly brand-tinted fill. */

.booking-type-toggle-wrapper {
    position: relative;
    z-index: 0; /* sits behind the card so the tab's bottom edge tucks under it */
    display: flex;
    justify-content: flex-start;
    margin-bottom: -4px; /* pull the card up just enough to tuck the tab's bottom edge behind it */
    max-width: 100%;
}

.booking-type-toggle {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    max-width: 100%;
}

.booking-type-toggle .toggle-option {
    /* Colored border on every tab (not just the active one) so the top-left
       corner always shows a matching outline, whichever tab sits there. */
    border: 1px solid;
    background: #fff;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    padding: 13px 26px;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
    transform: translateY(3px) scale(0.98);
}

.booking-type-toggle .toggle-option:hover {
    background: color-mix(in srgb, var(--theme-primary-color) 12%, #f1f5f9);
}

.booking-type-toggle .toggle-option.active {
    background: linear-gradient(color-mix(in srgb, var(--theme-primary-color) 92%, #fff) 0%, var(--theme-primary-color) 100%);
    color: #fff;
    border-color: var(--theme-primary-color);
    transform: translateY(0);
    z-index: 3;
}

.booking-type-toggle .toggle-option.active:hover {
    background: linear-gradient(color-mix(in srgb, var(--theme-primary-color) 92%, #fff) 0%, var(--theme-primary-color) 100%);
}

.booking-field.occupancy-field {
    flex: 0 0 215px;
    padding: 8px 12px;
}

.booking-field.promo-field {
    flex: 0 0 190px;
    padding: 8px 12px;
}

.booking-field {
    display: flex;
    flex-direction: column;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
    position: relative;
    overflow: visible;
    padding: 8px 12px;
}

.booking-field:hover,
.booking-field:focus-within {
    z-index: 10;
    border-color: var(--theme-primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary-color) 12%, transparent);
}

.booking-field.flex-grow-3 {
    /* Explicit pixel flex-basis (not "auto"), grows to absorb leftover row
       width but never shrinks below the ~25-character floor. An "auto"
       basis pulls in descendants' browser-default intrinsic sizes instead
       of respecting this box's own min-width. */
    flex: 1 0 300px;
    /* Give Tom Select's own control box a flat, borderless look so the
       field's outer box reads as the single visible border. */
    padding: 8px 12px 8px;
}

.booking-field.flex-grow-3 .ts-wrapper.tom-select-premium {
    width: 100% !important;
}

.booking-field.flex-grow-3 .ts-wrapper.tom-select-premium .ts-control {
    box-shadow: none !important;
    height: auto !important;
    min-height: 30px !important;
    padding: 0 !important;
}

/* A property name that still exceeds the available width wraps onto a
   second line at a word boundary (never mid-word) instead of being
   truncated or clipped -- the control's auto height (above) grows with it. */
.booking-field.flex-grow-3 .ts-wrapper.tom-select-premium .ts-control .item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 14px;
    font-weight: 600;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

.booking-field.flex-grow-3 .ts-wrapper.tom-select-premium .ts-control .item span {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    min-width: 0;
}

.booking-field label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 0;
    white-space: nowrap;
}

.booking-field .field-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
}

.booking-field .field-content i.fa {
    color: var(--theme-primary-color); /* Premium gold/brown color */
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.booking-field .form-control {
    border: none !important;
    padding: 0 !important;
    height: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
    overflow: visible;
    flex: 1 1 0%;
    min-width: 0;
}

.booking-field .form-control::placeholder {
    color: #858585;
    font-weight: 500;
    font-size: 14px;
}

/* Ensure inputs and selects don't truncate text */
.booking-field input.form-control,
.booking-field select.form-control {
    text-overflow: clip;
    white-space: nowrap;
    min-width: 0;
}

.booking-field select.form-control {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: none;
}

.booking-field .chevron-icon {
    font-size: 10px;
    color: #ccc;
    flex-shrink: 0;
    margin-left: auto;
}

/* Field boxes are now self-contained (bordered + spaced with flex gap), so
   the old vertical divider bars are collapsed away rather than removed from
   the markup -- keeps the template's structure/logic untouched. */
.field-divider-80 {
    width: 0;
    height: auto;
    background-color: transparent;
}

/* Check In / Check Out are merged into a single bordered box, split by an
   internal divider, instead of two separate field boxes. */
.booking-dates-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 0 0 340px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.booking-dates-row:hover,
.booking-dates-row:focus-within {
    z-index: 10;
    border-color: var(--theme-primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary-color) 12%, transparent);
}

/* When the Hotel field isn't rendered (single-property sites), the row loses
   its only growing field (.flex-grow-3) and the rest stay at their fixed
   flex-basis, leaving dead space on the right. Let them share that space
   proportionally instead. */
.modern-booking-bar-wrapper:not(:has(.flex-grow-3)) .booking-dates-row {
    flex: 1 1 340px;
}
.modern-booking-bar-wrapper:not(:has(.flex-grow-3)) .booking-field.occupancy-field {
    flex: 1 1 215px;
}
.modern-booking-bar-wrapper:not(:has(.flex-grow-3)) .booking-field.promo-field {
    flex: 1 1 190px;
}

.booking-dates-row .booking-field {
    flex: 1;
    border: none;
    padding: 8px 12px;
}

.booking-dates-row .booking-field:hover,
.booking-dates-row .booking-field:focus-within {
    box-shadow: none;
}

.booking-dates-row > .field-divider-80 {
    width: 1px;
    height: auto;
    align-self: stretch;
    margin: 8px 0;
    background-color: #e2e8f0;
}

.occupancy-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: 280px;
    margin-top: 10px;
}

/* ========================================= */
/*      TOMSELECT PREMIUM DROPDOWN STYLING   */
/* ========================================= */

/* Main Wrapper - Fixed width with expansion logic */
.ts-wrapper.tom-select-premium {
    width: 340px !important;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* The Main Control Box */
.ts-wrapper.tom-select-premium .ts-control {
    border: 0px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s ease !important;
    height: 50px !important;
    /* display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important; */
}

/* Focus State */

/* Custom Dropdown Arrow */
.ts-wrapper.tom-select-premium .ts-control::after {
    content: "\f107" !important;
    font-family: "FontAwesome" !important;
    font-size: 12px !important;
    color: #94a3b8 !important;
    position: absolute !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.3s ease !important;
}

.ts-wrapper.tom-select-premium.open .ts-control::after {
    transform: translateY(-50%) rotate(180deg) !important;
}

/* Selected item styling */
.ts-wrapper.tom-select-premium .ts-control .item {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Dropdown Menu styling */
.ts-wrapper.tom-select-premium .ts-dropdown,
.ts-dropdown.tom-select-premium-dropdown {
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 6px !important;
    margin-top: 8px !important;
    background: #ffffff !important;
    animation: ts-dropdown-fade 0.2s ease-out !important;
}

@keyframes ts-dropdown-fade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Individual Options */
.ts-wrapper.tom-select-premium .ts-dropdown .option {
    border-radius: 8px !important;
    padding: 10px 12px !important;
    margin-bottom: 2px !important;
    transition: all 0.2s ease !important;
    font-size: 14px !important;
    color: #475569 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Hover/Active State */
.ts-wrapper.tom-select-premium .ts-dropdown .active {
    background-color: #ecf2f7 !important;
}

/* Selected State in Menu */
.ts-wrapper.tom-select-premium .ts-dropdown .selected {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    font-weight: 600 !important;
}

/* --- Dropdown Search Input (Plugin: dropdown_input) --- */
.ts-dropdown .ts-dropdown-input-wrap {
    padding: 12px 12px 8px 12px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.ts-dropdown .ts-dropdown-input {
    width: 100% !important;
    padding: 10px 15px 10px 35px !important;
    border-radius: 20px !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
    font-size: 14px !important;
    color: #475569 !important;
    outline: none !important;
}

.ts-dropdown .ts-dropdown-input-wrap::before {
    content: "\f002" !important;
    font-family: "FontAwesome" !important;
    position: absolute !important;
    left: 25px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    z-index: 1 !important;
    margin-top: -2px !important;
}

/* Above state for collision detection */
.ts-dropdown.ts-dropdown--above {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    border-radius: 12px !important;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Hide the default input in the control box when using dropdown_input plugin */
.ts-wrapper.tom-select-premium .ts-control > input {
    display: none !important;
}

/* Add to modern-general-style.css */
@media (max-width: 767px) {
    .ts-wrapper.tom-select-premium {
        width: 100% !important; /* Prevents horizontal scroll on small phones */
    }
}

/* Responsive adjustments */
@media (max-width: 1199px) {
    .modern-booking-bar-wrapper {
        flex-wrap: wrap;
        gap: 12px;
    }
    .booking-field {
        flex: 1 1 45%;
    }
    .booking-dates-row {
        flex: 1 1 100%;
    }
}

@media (max-width: 991px) {
    .booking-widget-overlay {
        position: relative;
        bottom: auto;
        margin-top: -30px;
        padding: 0 15px;
    }

    .modern-booking-bar-wrapper {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 10px;
    }

    .booking-field {
        flex: 1 1 auto;
    }

    .booking-dates-row {
        flex-direction: row;
    }

    .booking-action {
        margin-left: 0;
        margin-top: 4px;
    }

    .booking-action .btn {
        width: 100%;
    }

    .booking-field.occupancy-field,
    .booking-field.promo-field,
    .booking-dates-row,
    .booking-field.flex-grow-3 {
        flex: 0 0 0px;
    }
}

@media (max-width: 480px) {
    .booking-dates-row {
        flex-direction: column;
    }

    .booking-dates-row > .field-divider-80 {
        width: auto;
        height: 1px;
        margin: 0 12px;
    }

    .booking-type-toggle .toggle-option {
        padding: 10px 16px;
        font-size: 13px;
    }
}

.booking-field label.error {
    display: block;
    color: #dc3545;
    font-size: 0.7rem;
    font-weight: 600;
}

.booking-field:has(input.error) {
    border-color: #dc3545;
}

.booking-field input.error {
    color: #dc3545;
}
