/* Combobox with search — used for country/city on Add user and Settings → City */

/* Cards use overflow:hidden for rounded corners; that clips absolute dropdowns — allow overflow when this widget is present */
.add-user-card:has(.searchable-select),
.add-client-card:has(.searchable-select) {
    overflow: visible;
}

.add-user-card--combo-overflow,
.add-client-card--combo-overflow {
    overflow: visible;
}

.searchable-select {
    position: relative;
    width: 100%;
    z-index: 1;
}

.searchable-select.is-open {
    z-index: 40;
}

.searchable-select__control {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.light-mode .searchable-select__control {
    background: #fff;
}

.searchable-select__control:hover {
    border-color: var(--accent-color);
}

.searchable-select__control:focus-visible {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

.searchable-select.is-open .searchable-select__control {
    border-color: var(--accent-color);
}

.searchable-select__control .bx-chevron-down {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.searchable-select.is-open .searchable-select__control .bx-chevron-down {
    transform: rotate(180deg);
}

.searchable-select__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select__value--placeholder {
    color: var(--text-secondary);
}

.searchable-select__dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 5000;
    flex-direction: column;
    max-height: min(320px, 55vh);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

body.light-mode .searchable-select__dropdown {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* UA uses [hidden]{display:none!important} — re-show as flex when opened */
.searchable-select__dropdown:not([hidden]) {
    display: flex !important;
}

.searchable-select__dropdown[hidden] {
    display: none !important;
}

.searchable-select__search {
    flex-shrink: 0;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    outline: none;
}

body.light-mode .searchable-select__search {
    background: #f5f5f8;
}

.searchable-select__search::placeholder {
    color: var(--text-secondary);
}

.searchable-select__list {
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.searchable-select__option {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.1s ease;
}

.searchable-select__option:hover,
.searchable-select__option.is-highlighted {
    background: rgba(108, 92, 231, 0.12);
}

.searchable-select__empty {
    margin: 0;
    padding: 1rem 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.searchable-select--adduser .searchable-select__control,
.searchable-select--client .searchable-select__control {
    min-height: auto;
    padding: 12px 15px;
    border-radius: 8px;
}
