/* Calendar/Date Picker Z-Index Fix */
/* This ensures date pickers appear above all elements ONLY in search areas */

/* EXCLUDE header and navbar calendars from high z-index */
header .datepicker-dropdown,
header .datepicker,
.navbar .datepicker-dropdown,
.navbar .datepicker {
    z-index: auto !important;
}

/* ONLY target calendar elements in search areas - not header */
.main_search .datepicker-dropdown,
.main_search .datepicker,
.search-panel .datepicker-dropdown,
.search-panel .datepicker,
.flight-search-results .datepicker-dropdown,
.flight-search-results .datepicker,
.modify_search .datepicker-dropdown,
.modify_search .datepicker {
    z-index: 9999 !important;
    position: absolute !important;
}

/* Main search calendar elements - more specific targeting */
.main_search .date-picker,
.main_search .flatpickr-calendar,
.main_search .daterangepicker,
.main_search .ui-datepicker,
.main_search .bootstrap-datepicker,
.main_search [class*="calendar"],
.main_search [class*="datepick"],
.main_search [class*="Calendar"],
.search-panel .date-picker,
.search-panel .flatpickr-calendar,
.search-panel .daterangepicker,
.search-panel .ui-datepicker,
.search-panel .bootstrap-datepicker,
.search-panel [class*="calendar"],
.search-panel [class*="datepick"],
.search-panel [class*="Calendar"],
.flight-search-results .date-picker,
.flight-search-results .flatpickr-calendar,
.flight-search-results .daterangepicker,
.flight-search-results .ui-datepicker,
.flight-search-results .bootstrap-datepicker,
.flight-search-results [class*="calendar"],
.flight-search-results [class*="datepick"],
.flight-search-results [class*="Calendar"],
.modify_search .date-picker,
.modify_search .flatpickr-calendar,
.modify_search .daterangepicker,
.modify_search .ui-datepicker,
.modify_search .bootstrap-datepicker,
.modify_search [class*="calendar"],
.modify_search [class*="datepick"],
.modify_search [class*="Calendar"] {
    z-index: 9999 !important;
    position: absolute !important;
}

/* Specific calendar containers and wrappers - ONLY in search areas */
.main_search .flatpickr-wrapper,
.search-panel .flatpickr-wrapper,
.flight-search-results .flatpickr-wrapper,
.modify_search .flatpickr-wrapper,
.main_search .daterangepicker-container,
.search-panel .daterangepicker-container,
.flight-search-results .daterangepicker-container,
.modify_search .daterangepicker-container,
.main_search .date-container,
.search-panel .date-container,
.flight-search-results .date-container,
.modify_search .date-container,
.main_search .datepicker-date,
.search-panel .datepicker-date,
.flight-search-results .datepicker-date,
.modify_search .datepicker-date {
    position: relative !important;
    z-index: 200 !important;
}

/* EXCLUDE header calendar containers from high z-index */
header .flatpickr-wrapper,
.navbar .flatpickr-wrapper,
header .daterangepicker-container,
.navbar .daterangepicker-container,
header .date-container,
.navbar .date-container,
header .datepicker-date,
.navbar .datepicker-date {
    z-index: auto !important;
}

/* Calendar dropdowns in specific contexts - high priority */
.flights_listing .main_search .datepicker,
.flights_listing .main_search .date-picker,
.flights_listing .main_search .flatpickr-calendar,
.flights_listing .main_search .daterangepicker,
.flights_listing .main_search .ui-datepicker,
.flights_listing .main_search .bootstrap-datepicker,
.flights_listing .main_search .datepicker-dropdown {
    z-index: 10000 !important;
    position: absolute !important;
}

/* Bootstrap Datepicker specific classes - ONLY in search areas */
.main_search .datepicker-picker,
.search-panel .datepicker-picker,
.flight-search-results .datepicker-picker,
.modify_search .datepicker-picker,
.main_search .datepicker .datepicker-picker,
.search-panel .datepicker .datepicker-picker,
.flight-search-results .datepicker .datepicker-picker,
.modify_search .datepicker .datepicker-picker,
.main_search .datepicker .datepicker-dropdown,
.search-panel .datepicker .datepicker-dropdown,
.flight-search-results .datepicker .datepicker-dropdown,
.modify_search .datepicker .datepicker-dropdown {
    z-index: 9999 !important;
    position: absolute !important;
}

/* EXCLUDE header calendar elements from high z-index */
header .datepicker-picker,
.navbar .datepicker-picker,
header .datepicker .datepicker-picker,
.navbar .datepicker .datepicker-picker,
header .datepicker .datepicker-dropdown,
.navbar .datepicker .datepicker-dropdown {
    z-index: auto !important;
}

/* Specific date input field containers - ONLY in search areas */
.main_search .checkin + .datepicker-dropdown,
.search-panel .checkin + .datepicker-dropdown,
.flight-search-results .checkin + .datepicker-dropdown,
.modify_search .checkin + .datepicker-dropdown,
.main_search .checkout + .datepicker-dropdown,
.search-panel .checkout + .datepicker-dropdown,
.flight-search-results .checkout + .datepicker-dropdown,
.modify_search .checkout + .datepicker-dropdown,
.main_search .depart + .datepicker-dropdown,
.search-panel .depart + .datepicker-dropdown,
.flight-search-results .depart + .datepicker-dropdown,
.modify_search .depart + .datepicker-dropdown,
.main_search .return + .datepicker-dropdown,
.search-panel .return + .datepicker-dropdown,
.flight-search-results .return + .datepicker-dropdown,
.modify_search .return + .datepicker-dropdown,
.main_search .carfrom + .datepicker-dropdown,
.search-panel .carfrom + .datepicker-dropdown,
.flight-search-results .carfrom + .datepicker-dropdown,
.modify_search .carfrom + .datepicker-dropdown,
.main_search .carto + .datepicker-dropdown,
.search-panel .carto + .datepicker-dropdown,
.flight-search-results .carto + .datepicker-dropdown,
.modify_search .carto + .datepicker-dropdown {
    z-index: 10000 !important;
    position: absolute !important;
}

/* Mobile responsiveness - ONLY target search areas */
@media (max-width: 767px) {
    /* Mobile calendar z-index - EXCLUDE header */
    header .datepicker,
    header .date-picker,
    header .flatpickr-calendar,
    header .daterangepicker,
    header .ui-datepicker,
    header .bootstrap-datepicker,
    .navbar .datepicker,
    .navbar .date-picker,
    .navbar .flatpickr-calendar,
    .navbar .daterangepicker,
    .navbar .ui-datepicker,
    .navbar .bootstrap-datepicker {
        z-index: auto !important;
    }

    /* Mobile calendar z-index - ONLY in search areas */
    .main_search .datepicker,
    .search-panel .datepicker,
    .flight-search-results .datepicker,
    .modify_search .datepicker,
    .main_search .date-picker,
    .search-panel .date-picker,
    .flight-search-results .date-picker,
    .modify_search .date-picker,
    .main_search .flatpickr-calendar,
    .search-panel .flatpickr-calendar,
    .flight-search-results .flatpickr-calendar,
    .modify_search .flatpickr-calendar,
    .main_search .daterangepicker,
    .search-panel .daterangepicker,
    .flight-search-results .daterangepicker,
    .modify_search .daterangepicker,
    .main_search .ui-datepicker,
    .search-panel .ui-datepicker,
    .flight-search-results .ui-datepicker,
    .modify_search .ui-datepicker,
    .main_search .bootstrap-datepicker,
    .search-panel .bootstrap-datepicker,
    .flight-search-results .bootstrap-datepicker,
    .modify_search .bootstrap-datepicker {
        z-index: 9999 !important;
        position: absolute !important;
    }

    .flights_listing .main_search .datepicker,
    .flights_listing .search-panel .datepicker,
    .flights_listing .flight-search-results .datepicker,
    .flights_listing .modify_search .datepicker,
    .flights_listing .main_search .date-picker,
    .flights_listing .search-panel .date-picker,
    .flights_listing .flight-search-results .date-picker,
    .flights_listing .modify_search .date-picker,
    .flights_listing .main_search .flatpickr-calendar,
    .flights_listing .search-panel .flatpickr-calendar,
    .flights_listing .flight-search-results .flatpickr-calendar,
    .flights_listing .modify_search .flatpickr-calendar,
    .flights_listing .main_search .daterangepicker,
    .flights_listing .search-panel .daterangepicker,
    .flights_listing .flight-search-results .daterangepicker,
    .flights_listing .modify_search .daterangepicker {
        z-index: 10000 !important;
        position: absolute !important;
    }
}