/*
 * Results page modify-search bar (Frontend/flights/new_filter = desktop, phone_filter = mobile).
 * Loaded by international.blade.php right before #modifySearchSection, so it wins over the inline
 * styles in those partials. Desktop: compact bar in the header's dark navy (sk-dark-header.css),
 * white fields, select2-style dropdowns. Mobile edit screen: homepage (gtg) style.
 */
:root {
    --skm-navy: #1e293b;
    --skm-line: #e2e8f0;
    --skm-text: #0f172a;
    --skm-muted: #64748b;
    --skm-blue: #2563eb;
    --skm-cyan: #41d3ff;
    --skm-cyan-hover: #1fc6f7;
}

/* ================================================================ Desktop bar */
@media (min-width: 992px) {
    #modifySearchSection.modifyhead {
        background: var(--skm-navy);
        border-top: 0; /* header and bar read as one dark block */
        padding: 10px 0 12px;
    }
    #modifySearchSection .fs-container {
        background: transparent;
        width: auto;
        padding: 0 !important;
        border-radius: 0;
    }
    #modifySearchSection .fs-main-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        height: auto !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }

    /* Every field: white, rounded, label on top */
    #modifySearchSection .fs-label {
        top: 7px;
        left: 12px;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .6px;
        color: var(--skm-muted);
        z-index: 2;
        pointer-events: none;
    }
    #modifySearchSection .fs-select,
    #modifySearchSection .fs-date-input,
    #modifySearchSection .fs-select-search {
        height: 48px;
        background: #fff;
        border: 1px solid transparent;
        border-radius: 8px;
        color: var(--skm-text);
        font-size: 14px;
        font-weight: 600;
        padding: 18px 12px 0;
        box-shadow: none;
        outline: none;
        cursor: pointer;
    }
    #modifySearchSection .fs-select-search::placeholder { color: #94a3b8; font-weight: 400; }
    #modifySearchSection .fs-select-search:focus,
    #modifySearchSection .fs-date-input:focus,
    #modifySearchSection .fs-select:focus { border-color: var(--skm-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); cursor: text; }

    #modifySearchSection .fs-trip-type { width: 128px; flex: 0 0 128px; }

    /* From ⇄ To: one joined group with a round swap button between */
    #modifySearchSection .fs-location-container {
        display: flex;
        align-items: stretch;
        flex: 1 1 380px;
        min-width: 0;
        position: relative;
        gap: 0;
        height: 48px;
    }
    #modifySearchSection .fs-to .fs-select-search { border-left: 1px solid var(--skm-line) !important; }
    #modifySearchSection .fs-from,
    #modifySearchSection .fs-to { width: auto; flex: 1 1 0; min-width: 0; }
    #modifySearchSection .fs-from .fs-select-search { border-radius: 8px 0 0 8px; padding-right: 22px; }
    #modifySearchSection .fs-to .fs-select-search { border-radius: 0 8px 8px 0; padding-left: 22px; }
    #modifySearchSection .fs-to .fs-label { left: 22px; }
    #modifySearchSection .fs-from .fs-custom-select,
    #modifySearchSection .fs-to .fs-custom-select { border: 0; border-radius: 0; }
    #modifySearchSection .fs-switch-btn {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: #fff;
        border: 1px solid var(--skm-line);
        color: var(--skm-blue);
        font-size: 15px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, .15);
        z-index: 3;
        padding: 0;
    }
    #modifySearchSection .fs-switch-btn:hover { background: #eff6ff; }

    /* Airport name under the city: one short grey line */
    #modifySearchSection .fs-selected-airport {
        position: absolute;
        left: 12px;
        right: 22px;
        bottom: 4px;
        top: auto;
        font-size: 10px;
        line-height: 1.2;
        color: var(--skm-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none;
        display: none;
    }

    #modifySearchSection .fs-date-container { display: flex; gap: 8px; flex: 0 1 260px; max-width: 260px; height: auto; }
    #modifySearchSection .fs-date-container .hidden { display: none !important; }
    #modifySearchSection .fs-departure,
    #modifySearchSection .fs-return { width: auto; flex: 1 1 0; }

    #modifySearchSection .fs-options-container { display: flex; gap: 8px; flex: 0 1 280px; }
    #modifySearchSection .fs-passengers,
    #modifySearchSection .fs-class { position: relative; flex: 1 1 0; width: auto; min-width: 0; }
    #modifySearchSection #passengerSelect { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    #modifySearchSection .fs-search-btn {
        flex: 0 0 auto;
        height: 48px;
        padding: 0 26px;
        background: var(--skm-cyan);
        color: var(--skm-text);
        border: 0;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: .3px;
        box-shadow: none;
        width: auto;
        margin: 0;
    }
    #modifySearchSection .fs-search-btn:hover { background: var(--skm-cyan-hover); color: var(--skm-text); }

    /* Passenger popup: white card */
    #modifySearchSection .fs-passenger-popup {
        top: calc(100% + 6px);
        border: 1px solid var(--skm-line);
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
        z-index: 1000;
    }
    #modifySearchSection .fs-apply-btn { background: var(--skm-blue); border-radius: 6px; }

    /* Airport dropdown: select2-style panel */
    #modifySearchSection .fs-select-options {
        top: calc(100% + 6px);
        left: 0;
        width: 340px;
        max-height: 360px;
        overflow-y: auto;
        background: #fff;
        border: 1px solid var(--skm-line);
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
        padding: 4px 0;
        z-index: 1000;
    }
    #modifySearchSection .fs-select-title,
    #modifySearchSection .fs-select-note {
        padding: 8px 14px 4px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .6px;
        text-transform: uppercase;
        color: var(--skm-muted);
    }
    #modifySearchSection .fs-select-note { text-transform: none; letter-spacing: 0; font-weight: 500; padding: 10px 14px; }
    #modifySearchSection .fs-select-option {
        padding: 8px 14px;
        cursor: pointer;
        border: 0;
        text-align: left;
    }
    #modifySearchSection .fs-select-option:hover,
    #modifySearchSection .fs-select-option.is-active { background: #eff6ff; }
    #modifySearchSection .fs-select-option-city { font-size: 14px; font-weight: 600; color: var(--skm-text); display: flex; justify-content: space-between; gap: 8px; }
    #modifySearchSection .fs-select-option-city b {
        font-size: 11px; font-weight: 700; color: var(--skm-blue); background: #eff6ff;
        border-radius: 4px; padding: 2px 6px; align-self: center;
    }
    #modifySearchSection .fs-select-option-airport { font-size: 12px; color: var(--skm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* Multi-city rows sit on the same dark bar */
    #modifySearchSection .fs-multi-city-row { gap: 8px; }
    #modifySearchSection .fs-add-flight { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .5); border-radius: 8px; }
}

/* ================================================================ select2 (Trip type, Class) */
/* Site-wide select2 rules add 90px height and 55px left padding; reset them inside the bar */
#modifySearchSection .select2-container--skm { height: 48px !important; display: block !important; }
#modifySearchSection .select2-container--skm .select2-selection--single {
    height: 48px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
}
#modifySearchSection .select2-container--skm .select2-selection__rendered {
    padding: 20px 28px 0 12px !important;
    text-align: left !important;
    width: 100% !important;
    height: 48px !important;
    line-height: 20px !important;
}

.select2-container--skm { font-size: 14px; }
.select2-container--skm .select2-selection--single {
    height: 48px;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
}
.select2-container--skm.select2-container--open .select2-selection--single,
.select2-container--skm.select2-container--focus .select2-selection--single { border-color: var(--skm-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.select2-container--skm .select2-selection__rendered {
    display: block;
    padding: 20px 28px 0 12px;
    color: var(--skm-text);
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.select2-container--skm .select2-selection__arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -6px;
    border-right: 2px solid var(--skm-muted);
    border-bottom: 2px solid var(--skm-muted);
    transform: rotate(45deg);
    transition: transform .15s ease;
}
.select2-container--skm.select2-container--open .select2-selection__arrow { transform: rotate(-135deg); margin-top: -2px; }
.select2-container--skm .select2-selection__arrow b { display: none; }
.select2-container--skm .select2-dropdown {
    background: #fff;
    border: 1px solid var(--skm-line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    overflow: hidden;
    margin-top: 6px;
    z-index: 1000000;
}
.select2-container--skm .select2-dropdown--above { margin-top: -6px; }
.select2-container--skm .select2-results__options { padding: 4px 0; max-height: 280px; overflow-y: auto; }
.select2-container--skm .select2-results__option { padding: 9px 14px; color: var(--skm-text); font-size: 14px; }
.select2-container--skm .select2-results__option--highlighted { background: #eff6ff; color: var(--skm-blue); }
.select2-container--skm .select2-results__option[aria-selected="true"] { font-weight: 700; }

/* ================================================================ Mobile edit screen (homepage style) */
@media (max-width: 991px) {
    #modifySearchSection.mc-open { background: #f5f7fa !important; padding: 0 !important; }
    #modifySearchSection.mc-open > .container { padding: 0; max-width: none; }
    #modifySearchSection.mc-open .flight-search,
    #modifySearchSection.mc-open .accordion,
    #modifySearchSection.mc-open .accordion.open { margin: 0 !important; padding-top: 0 !important; top: 0 !important; background: #f5f7fa !important; border-radius: 0 !important; box-shadow: none !important; }
    #modifySearchSection.mc-open .accordion { padding: 0 16px 24px !important; }

    /* Dark header bar like the site header, close button on the right */
    #modifySearchSection.mc-open .accordion-header {
        background: var(--skm-navy) !important;
        margin: 0 -16px 16px !important;
        padding: 14px 16px !important;
        min-height: 56px;
        border-radius: 0 !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 5;
    }
    #modifySearchSection.mc-open .accordion-header h2 { color: #fff !important; font-size: 17px !important; font-weight: 700; margin: 0; }
    #modifySearchSection.mc-open .close-accordion-button {
        background: rgba(255, 255, 255, .12) !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    #modifySearchSection.mc-open .close-accordion-button path { stroke: #fff; }

    /* Trip type: segmented control */
    #modifySearchSection.mc-open .trip-types {
        display: flex;
        background: #e2e8f0;
        border-radius: 10px;
        padding: 4px;
        gap: 4px;
        margin-bottom: 14px;
    }
    #modifySearchSection.mc-open .trip-type-btn {
        flex: 1;
        text-align: center;
        padding: 9px 4px !important;
        border-radius: 8px !important;
        border: 0 !important;
        background: transparent !important;
        color: var(--skm-muted) !important;
        font-size: 13px !important;
        font-weight: 700;
        box-shadow: none !important;
    }
    #modifySearchSection.mc-open .trip-type-btn.active { background: #fff !important; color: var(--skm-text) !important; box-shadow: 0 1px 3px rgba(15, 23, 42, .12) !important; }

    /* Fields: one white card per row, grey uppercase label */
    #modifySearchSection.mc-open .FROM,
    #modifySearchSection.mc-open .TO,
    #modifySearchSection.mc-open .DATE-CONTAINER,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER {
        background: #fff !important;
        border: 1px solid var(--skm-line) !important;
        border-radius: 12px !important;
        margin: 0 0 10px !important;
        padding: 10px 14px !important;
        box-shadow: none !important;
    }
    #modifySearchSection.mc-open .FROM { margin-bottom: 4px !important; }
    #modifySearchSection.mc-open .FROM.highlight,
    #modifySearchSection.mc-open .TO.highlight { border-color: var(--skm-blue) !important; }
    #modifySearchSection.mc-open label {
        color: var(--skm-muted) !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        letter-spacing: .6px !important;
        margin-bottom: 2px !important;
    }
    #modifySearchSection.mc-open .FROM input,
    #modifySearchSection.mc-open .TO input,
    #modifySearchSection.mc-open .DATE-CONTAINER input,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER input {
        color: var(--skm-text) !important;
        font-size: 17px !important;
        font-weight: 700 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        height: auto !important;
    }
    #modifySearchSection.mc-open .RETURN-DATE input::placeholder { color: #94a3b8; font-weight: 500; }

    /* Same width for every card; labels sit above the value instead of on top of it */
    #modifySearchSection.mc-open .FROM,
    #modifySearchSection.mc-open .TO,
    #modifySearchSection.mc-open .DATE-CONTAINER,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER { width: auto !important; box-sizing: border-box; position: relative; }
    #modifySearchSection.mc-open .DATE-CONTAINER,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER { display: flex !important; align-items: stretch; gap: 14px; }
    #modifySearchSection.mc-open .DEPARTURE-DATE,
    #modifySearchSection.mc-open .RETURN-DATE,
    #modifySearchSection.mc-open .PASSENGERS,
    #modifySearchSection.mc-open .CLASS {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        flex: 1 1 0;
        min-width: 0;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    #modifySearchSection.mc-open .date-separator,
    #modifySearchSection.mc-open .passenger-class-separator { width: 1px; align-self: stretch; background: var(--skm-line); margin: 0 !important; height: auto !important; }
    #modifySearchSection.mc-open .FROM label,
    #modifySearchSection.mc-open .TO label,
    #modifySearchSection.mc-open .DATE-CONTAINER label,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER label { position: static !important; display: block; line-height: 1.3 !important; }
    #modifySearchSection.mc-open .DATE-CONTAINER input,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER input { width: 100% !important; line-height: 1.3 !important; }

    /* Search: cyan like the homepage */
    #modifySearchSection.mc-open .search-button,
    #modifySearchSection.mc-open .multicity-search-button {
        background: var(--skm-cyan) !important;
        color: var(--skm-text) !important;
        border: 0 !important;
        border-radius: 10px !important;
        height: 52px;
        font-size: 15px !important;
        font-weight: 700 !important;
        letter-spacing: .3px;
        box-shadow: none !important;
        width: 100%;
        margin: 6px 0 0 !important;
        display: block !important;
        padding: 0 !important;
    }

    /* Airport picker (full screen): dark header, white list, popular title.
       Starts at the very top: the site header is hidden while the edit screen is open. */
    .custom-dropdown { top: 0 !important; height: 100% !important; }
    .custom-dropdown .dropdown-header { background: var(--skm-navy) !important; }
    .custom-dropdown .dropdown-header h3 { color: #fff !important; }
    .custom-dropdown .dropdown-header .close-dropdown { background: rgba(255, 255, 255, .12) !important; }
    .custom-dropdown .dropdown-header .close-dropdown path { stroke: #fff; }
    .custom-dropdown .search-container input:focus { border-color: var(--skm-blue) !important; }
    .custom-dropdown .city-list .city-list-title,
    .custom-dropdown .city-list .city-list-note {
        padding: 12px 16px 6px !important;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: .6px;
        text-transform: uppercase;
        color: var(--skm-muted);
        background: transparent !important;
        border: 0 !important;
        cursor: default;
    }
    .custom-dropdown .city-list .city-list-note { text-transform: none; letter-spacing: 0; font-weight: 500; }
}

/* Keep the select2 chevron inside the box (another site rule sets top: 100%) */
#modifySearchSection .select2-container--skm .select2-selection__arrow { top: 19px !important; margin-top: 0 !important; right: 12px !important; left: auto !important; }
#modifySearchSection .select2-container--skm.select2-container--open .select2-selection__arrow { top: 23px !important; }

/* Mobile edit screen: undo older offsets (left: 10px, fixed 56px height, centred button) so everything lines up */
@media (max-width: 991px) {
    #modifySearchSection.mc-open .FROM,
    #modifySearchSection.mc-open .TO,
    #modifySearchSection.mc-open .DATE-CONTAINER,
    #modifySearchSection.mc-open .PASSENGER-CLASS-CONTAINER { left: auto !important; right: auto !important; height: auto !important; min-height: 0 !important; }
    #modifySearchSection.mc-open .trip-types { margin: 0 0 14px !important; width: auto !important; }
    #modifySearchSection.mc-open .FROM input,
    #modifySearchSection.mc-open .TO input { height: auto !important; line-height: 1.3 !important; }
    #modifySearchSection.mc-open .search-button { position: static !important; left: auto !important; right: auto !important; transform: none !important; width: 100% !important; max-width: none !important; }
}
