/*
 * Multiselect progressive enhancement styling.
 * Adapted from https://code.usecue.com/multiselect/ (WTFPL) and scoped to the
 * booking form, reusing the form's existing colour tokens and checkbox marker.
 */

/* desktop: checkbox list */
.sidebar-body form .multiselect .fieldset {
    border: 1px solid rgba(37, 28, 29, 0.25);
    border-radius: 0;
    padding: 0.25rem 0;
}
.sidebar-body form .multiselect .fieldset label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    padding: 0.3rem 0.75rem;
    font-size: 1rem;
    cursor: pointer;
}
.sidebar-body form .multiselect .fieldset label:hover {
    background: rgba(37, 28, 29, 0.05);
}
.sidebar-body form .multiselect .fieldset .multiselect-group {
    padding: 0.4rem 0.75rem 0.2rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #251C1D;
}
.sidebar-body form .multiselect .fieldset hr {
    border: none;
    border-top: 1px solid rgba(37, 28, 29, 0.15);
    margin: 0.4rem 0 0.2rem;
}

/* the generated checkboxes mirror the form's native .checkbox marker */
.sidebar-body form .multiselect .fieldset label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(37, 28, 29, 0.4);
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}
.sidebar-body form .multiselect .fieldset label input[type="checkbox"]:checked {
    background-color: #251C1D;
    border-color: #251C1D;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23F9FAF5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.85rem;
}

/* mobile: collapsed native select with a count overlay */
.sidebar-body form .multiselect .multiselect-native {
    position: relative;
}
.sidebar-body form .multiselect .multiselect-native:not(.is-expanded) output {
    display: flex;
    align-items: center;
}
.sidebar-body form .multiselect .multiselect-native:not(.is-expanded) .fieldset,
.sidebar-body form .multiselect .multiselect-native.is-expanded output,
.sidebar-body form .multiselect .multiselect-native.is-expanded select {
    display: none;
}
.sidebar-body form .multiselect .multiselect-native select {
    opacity: 0;
}
.sidebar-body form .multiselect .multiselect-count {
    position: absolute;
    top: 1px;
    left: 1px;
    bottom: 1px;
    right: 1px;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    color: #251C1D;
    font-family: inherit;
    font-size: 1rem;
    pointer-events: none;
}

/* where supported, let the browser render its own localized "N selected" */
.sidebar-body form .multiselect .multiselect-native.native-output:not(.is-expanded) output {
    display: none;
}
.sidebar-body form .multiselect .multiselect-native.native-output:not(.is-expanded) select {
    opacity: 1;
    appearance: base-select;
}

/* expand/collapse toggle (shown on mobile so the list can be opened) */
.sidebar-body form .multiselect .multiselect-toggle {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 0 0.4rem;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-family: monospace;
    font-size: 1.1rem;
    line-height: 1;
}
.sidebar-body form .multiselect label:has(.multiselect-toggle) {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
