/* Searchable select (public/js/searchable-select.js). Uses the theme's CSS variables so
   light and dark mode follow the rest of the admin. */

.ss-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.ss {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.ss.ss-inline {
    display: inline-block;
    width: auto;
    vertical-align: middle;
}

.input-group > .ss.ss-in-group {
    flex: 1 1 auto;
    width: 1%;
}

.input-group > .ss.ss-in-group:not(:first-child) .ss-toggle {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group > .ss.ss-in-group:not(:last-child) .ss-toggle {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.ss-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.ss-inline .ss-toggle {
    width: auto;
}

.ss-toggle .ss-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ss-toggle .ss-prefix {
    color: var(--app-muted-strong);
}

.ss-toggle.is-placeholder .ss-label {
    color: var(--app-muted-strong);
}

.ss-toggle:disabled {
    cursor: not-allowed;
    background-color: var(--vz-tertiary-bg);
    opacity: 1;
}

/* Focus ring: 2px gap + 2px ring, 7.62:1 (light) / 7.53:1 (dark) against the card.
   Drawn with box-shadow because the theme sets button { outline: none !important }. */
.ss .ss-toggle:focus-visible,
.ss-panel .ss-search:focus-visible {
    box-shadow: 0 0 0 2px var(--vz-secondary-bg), 0 0 0 4px var(--app-focus);
}

.ss.is-open .ss-toggle {
    border-color: var(--app-focus);
}

.ss-panel {
    position: fixed;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    padding: .5rem;
    background-color: var(--vz-secondary-bg);
    color: var(--vz-body-color);
    border: 1px solid var(--vz-border-color);
    border-radius: var(--vz-border-radius);
    box-shadow: var(--vz-box-shadow-lg);
}

.ss-panel[hidden] {
    display: none;
}

.ss-search {
    flex: 0 0 auto;
    margin-bottom: .375rem;
}

/* Short lists focus the list itself; the 2px ring on the active option is the focus indicator. */
.ss-list:focus-visible {
    outline: none;
}

.ss-list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.ss-option,
.ss-empty,
.ss-group {
    padding: .5rem .625rem;
    font-size: .8125rem;
    line-height: 1.4;
    border-radius: calc(var(--vz-border-radius) - 1px);
    overflow-wrap: anywhere;
}

.ss-option {
    cursor: pointer;
}

/* Keyboard/hover position: tint plus a 2px inset ring so it never relies on the tint alone. */
.ss-option.is-active {
    background-color: rgba(var(--vz-primary-rgb), .12);
    box-shadow: inset 0 0 0 2px var(--app-focus);
}

.ss-option.is-selected {
    font-weight: 600;
}

.ss-option.is-disabled {
    cursor: not-allowed;
    color: var(--app-muted-strong);
}

.ss-group {
    padding-bottom: .25rem;
    font-weight: 600;
    color: var(--app-muted-strong);
    cursor: default;
}

.ss-empty {
    color: var(--app-muted-strong);
    cursor: default;
}

@media (pointer: coarse) {
    .ss-toggle {
        min-height: 44px;
    }

    .ss-option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}
