/*
 * Select replacement (assets/nice-select.js).
 *
 * Every <select> on the site that opts in with data-nice-select is drawn
 * with this one widget -- the header language / currency pickers, the
 * price-list dropdowns and the booking card's Hotel options, Room and
 * Addons. It replaces bootstrap-select 1.13, which was written for
 * Bootstrap 4 and had to drag a second Bootstrap onto the tour page to
 * work at all; that pairing rendered differently from one browser to the
 * next.
 *
 * The original <select> stays in the DOM and keeps posting the value. It is
 * positioned behind the button at 1px wide rather than hidden outright:
 * a zero-sized or display:none control is not focusable, and the browser
 * then refuses to submit a `required` select with the silent "not
 * focusable" console error instead of showing the validation bubble.
 */

.nice-select {
    display: inline-block;
    position: relative;
    text-align: start;
    width: 100%;
}

.nice-select > select {
    border: 0;
    bottom: 0;
    height: 100%;
    left: 0;
    opacity: 0;
    padding: 0 !important;
    pointer-events: none;
    position: absolute;
    /* !important beats the w-100 / form-control widths the markup already
       carries, which would otherwise stretch this invisible control across
       the field and out past the wrapper. */
    width: 1px !important;
}

.nice-select__button {
    align-items: center;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    color: #626672;
    cursor: pointer;
    display: flex;
    font-size: 15px;
    gap: 8px;
    justify-content: space-between;
    min-height: 48px;
    padding: 8px 14px;
    text-align: start;
    width: 100%;
}

.nice-select__button::after {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: "";
    flex: 0 0 auto;
    height: 8px;
    margin-top: -4px;
    transform: rotate(45deg);
    transition: transform .2s ease;
    width: 8px;
}

.nice-select--open .nice-select__button {
    border-color: #2bc2ee;
}

.nice-select--open .nice-select__button::after {
    margin-top: 2px;
    transform: rotate(-135deg);
}

.nice-select__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Nothing picked yet -- lighter, like a placeholder. */
.nice-select__value.is-placeholder {
    color: #9b9fa8;
}

.nice-select__panel {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    display: none;
    left: 0;
    margin: 4px 0 0;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1040;
}

.nice-select--open .nice-select__panel {
    display: block;
}

/* Above the field when there is no room below (set by the script). */
.nice-select--drop-up .nice-select__panel {
    bottom: 100%;
    margin: 0 0 4px;
    top: auto;
}

.nice-select__search {
    border-bottom: 1px solid #eee;
    padding: 8px;
}

.nice-select__search input {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    color: #626672;
    display: block;
    font-size: 14px;
    padding: 7px 10px;
    width: 100%;
}

.nice-select__search input:focus {
    border-color: #2bc2ee;
    outline: 0;
}

.nice-select__list {
    list-style: none;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}

.nice-select__option {
    align-items: center;
    border-radius: 5px;
    color: #626672;
    cursor: pointer;
    display: flex;
    font-size: 15px;
    gap: 10px;
    padding: 10px 12px;
}

.nice-select__option:hover,
.nice-select__option.is-active {
    background: #f2fafd;
}

.nice-select__option.is-selected {
    background: #2bc2ee;
    color: #fff;
}

.nice-select__option.is-disabled {
    cursor: not-allowed;
    opacity: .5;
}

.nice-select__option[hidden] {
    display: none;
}

/* "No results" line for the search box. */
.nice-select__empty {
    color: #9b9fa8;
    font-size: 14px;
    padding: 12px;
    text-align: center;
}

/*
 * Multi-select. The tick box makes it obvious that picking one option does
 * not drop the others, which a plain highlight does not.
 */
.nice-select__check {
    border: 1px solid #c7cbd4;
    border-radius: 4px;
    flex: 0 0 auto;
    height: 18px;
    position: relative;
    width: 18px;
}

.nice-select__option.is-selected .nice-select__check {
    background: #fff;
    border-color: #fff;
}

.nice-select__option.is-selected .nice-select__check::after {
    border-bottom: 2px solid #2bc2ee;
    border-right: 2px solid #2bc2ee;
    content: "";
    height: 9px;
    left: 5px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg);
    width: 5px;
}

/* A multi-select keeps the list open, so the tick carries the state. */
.nice-select--multiple .nice-select__option.is-selected {
    background: #f2fafd;
    color: #626672;
}

.nice-select--multiple .nice-select__option.is-selected .nice-select__check {
    background: #2bc2ee;
    border-color: #2bc2ee;
}

.nice-select--multiple .nice-select__option.is-selected .nice-select__check::after {
    border-color: #fff;
}

/* Header pills: compact, on the blue bar. */
.nice-select--header {
    width: auto;
}

.nice-select--header .nice-select__button {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 14px;
    min-height: 40px;
    padding: 0 10px;
}

.nice-select--header .nice-select__panel {
    left: auto;
    min-width: 140px;
    right: 0;
}

/* Price table: small inline control inside a cell. */
.nice-select--compact {
    width: auto;
}

.nice-select--compact .nice-select__button {
    border-radius: 6px;
    font-size: 14px;
    min-height: 32px;
    padding: 4px 10px;
}

.nice-select--compact .nice-select__panel {
    left: auto;
    min-width: 120px;
    right: 0;
}

@media (max-width: 991px) {

    /* 16px keeps iOS from zooming the page when the search box is tapped. */
    .nice-select__search input {
        font-size: 16px;
    }
}

/*
 * Phone field: a dial-code picker glued to the number input, so the two read
 * as one control. The picker shows just "+971" (data-short on the option)
 * because the column is narrow; the open list still names the country.
 */

.phone-field {
    align-items: stretch;
    display: flex;
    gap: 8px;
}

.phone-field .nice-select {
    flex: 0 0 116px;
    width: 116px;
}

.phone-field .nice-select__panel {
    /* The button is narrower than the country names, so let the list out. */
    left: 0;
    min-width: 280px;
    right: auto;
}

.phone-field .phone-field__number {
    flex: 1 1 auto;
    min-width: 0;
}

/* The number is never a locale-formatted quantity -- no thousands grouping. */
.phone-field__number {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 575px) {

    .phone-field .nice-select {
        flex-basis: 96px;
        width: 96px;
    }

    .phone-field .nice-select__panel {
        min-width: 240px;
    }
}

/*
 * Nationality: readonly so the value can only come from the flag dropdown
 * (see assets/contact-fields.js). Bootstrap greys a readonly control, which
 * reads as disabled -- this one is still fully interactive, so it keeps the
 * look of every other field and gains a pointer cursor.
 */

.country-select input.country_selector[readonly] {
    background-color: #fff;
    cursor: pointer;
}

.country-select input.country_selector[readonly]:focus {
    border-color: #2bc2ee;
    box-shadow: none;
    outline: 0;
}
