/* === Combo (custom select) ===
   Shared by the admin forms and the map's region picker. A native <select>
   draws its option list with the OS, so that list ignores the app's theme and
   scrollbar entirely — the combo replaces it with our own menu while the
   <select> underneath keeps the value and the change events (combo.js). */

.combo {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}
.combo > select {
    /* Keep the native select in the DOM (form value, change events) but
       fully out of layout — never visible, never tabbable. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}
.combo-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 11px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    text-align: left;
    min-height: 46px;
}
.combo-trigger:hover:not(:disabled) { border-color: var(--border-strong); }
.combo-trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.combo.is-open > .combo-trigger {
    border-color: var(--accent);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.combo.is-disabled .combo-trigger {
    opacity: 0.6;
    cursor: not-allowed;
}
.combo-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.combo-caret {
    flex-shrink: 0;
    color: var(--text-muted);
    display: inline-flex;
    transition: transform .18s ease, color .15s ease;
}
.combo.is-open .combo-caret { transform: rotate(180deg); color: var(--text); }

.combo-menu {
    z-index: 200;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-dropdown);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: comboIn 0.12s ease-out;
}
.combo-menu[hidden] { display: none; }
.combo-menu--up { animation-name: comboInUp; }
@keyframes comboIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes comboInUp {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.combo-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.4;
    user-select: none;
}
.combo-option.is-active { background: var(--bg-subtle); }
.combo-option.is-selected {
    color: var(--accent);
    font-weight: 600;
    background: var(--bg-subtle);
}
html[data-theme="dark"] .combo-option.is-selected {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.combo-option.is-selected::after {
    content: '';
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}
