/*
 * The search page's search bar (resources/views/common/searchs/_main-search-bar.blade.php: country, city,
 * dates; the top bar on a desktop, the "Search" panel on a phone). Its fields read like the home hero box's
 * (public/css/home-hero-search.css, .hhs-input): Poppins, --r2e-text-sm, weight 500, --bs-secondary.
 * They were the bare .form-control: 16px, regular.
 *
 * Country and city are native selects and the dates field is a read-only calendar (flatpickr's alt input),
 * so none of them is typed into: the 16px that stops iOS Safari from zooming on a focused text box is not
 * needed here.
 */
.search-bar .form-control {
    font-family: inherit;
    font-size: var(--r2e-text-sm);
    font-weight: 500;
    line-height: var(--r2e-leading-body);
    color: var(--bs-secondary);
}

/*
 * Room for the words (Victor, 2026-10-19). The three fields were thirds of a quarter of the header: the
 * lists cut "Tous les pays" and "Toutes les villes" at "Tous les pa..." and "Toutes les v". From a tablet up,
 * country and city each start from a width that holds their default label and a typical country name, native
 * arrow included, and the dates field from one that holds its label ("8 -> 20 novembre 2026"). When the bar
 * is narrower than the three together (a 1200px window) the three give way in proportion instead of one
 * being starved. On a phone each field is a full row and needs nothing.
 *
 * The words start 40px in (they started 48px in) and the icon sits 12px from the edge: 8px more for the label.
 */
@media (min-width: 768px) {
    .search-bar {
        flex-wrap: nowrap;
    }

    .search-bar > .col-md-3 {
        flex: 0 1 12.5rem;
        width: auto;
        min-width: 0;
    }

    .search-bar > .col-md-6 {
        flex: 1 1 15rem;
        width: auto;
        min-width: 0;
    }
}

.search-bar .form-icon-input .form-control {
    padding-left: calc(var(--r2e-space-8) + var(--r2e-space-2));
}

.search-bar .form-icon-input .form-icon {
    padding-left: var(--r2e-space-3);
}

/*
 * The submit button, on the desktop bar (Victor, 2026-10-19). From 1400px (xxl) it keeps its word. Below, the word
 * goes and a magnifier stays, square at the height of the fields, so the room it gave back goes to the dates and the
 * city ("8 -> 20 novembre 2026" and "Toutes les villes" were cut at 1280px). The word stays in the markup, visually
 * hidden, as the button's accessible name; the colour, the radius and the height are the button's own.
 */
.search-submit .search-submit__icon {
    display: none;
}

@media (max-width: 1399.98px) {
    /* The field's own height (its line, its padding, its border), used as the width too: a square. */
    .search-submit {
        --search-submit-side: calc(var(--r2e-text-sm) * var(--r2e-leading-body) + 2 * var(--r2e-space-2) + 2 * var(--bs-border-width));
        display: inline-flex;
        align-items: center;
        justify-content: center;
        align-self: start;
        width: var(--search-submit-side);
        height: var(--search-submit-side);
        padding: 0;
        line-height: var(--r2e-leading-body);
    }

    .search-submit .search-submit__icon {
        display: inline-block;
    }

    .search-submit .search-submit__label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }
}

/*
 * While the next page of results is on its way (public/js/search-loading.js): the grid on screen fades and takes no
 * click, the search button spins (form-behaviour.css), and a visually hidden status says it aloud. aria-busy is the
 * one switch; the script clears it when the page comes back from the back/forward cache or the load is cancelled.
 */
[data-search-results] {
    transition: opacity 0.2s ease-in-out;
}

[data-search-results][aria-busy="true"] {
    opacity: 0.4;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    [data-search-results] {
        transition: none;
    }
}
