/* ============================================================
   searchable_select.css — turns native <select> dropdowns into
   click-or-type search-and-select widgets. Progressive
   enhancement: the native <select> stays in the DOM as the
   source of truth (kept focusable for validation), with this UI
   layered on top. On touch devices the native picker is used
   instead (see searchable_select.js).
   ============================================================ */

.ss-wrap { position: relative; }

/* Native select is hidden visually but kept in the layout box so the
   browser's required-validation bubble anchors here and can focus it. */
.ss-wrap > select.ss-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

/* Visible control — reuses the original .form-control / .lc-select classes
   so it inherits the same border, padding and font. */
.ss-control {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}
/* Fallback look for selects that don't carry .form-control / .lc-select
   (e.g. the login agency picker, or unclassed selects) so the widget
   still renders like a normal input. */
.ss-control:not(.form-control):not(.lc-select) {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: var(--radius, 6px);
    font-size: 13px;
    color: var(--text, #1e293b);
    background: #fff;
}

.ss-control .ss-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-control .ss-value.ss-placeholder { color: var(--text-muted, #94a3b8); }
.ss-control .ss-arrow {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
    color: var(--text-light, #64748b);
    transition: transform 0.15s;
}
.ss-wrap.ss-open .ss-control .ss-arrow { transform: rotate(180deg); }
.ss-wrap.ss-open .ss-control { border-color: var(--primary, #1B3A6B); box-shadow: 0 0 0 2px var(--primary-light, #e0e8f5); }
.ss-control.ss-disabled { opacity: 0.6; cursor: not-allowed; }

/* Dropdown panel */
.ss-panel {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    max-width: 320px;
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.14);
    display: none;
    overflow: hidden;
}
.ss-wrap.ss-open .ss-panel { display: block; }
.ss-wrap.ss-up .ss-panel { top: auto; bottom: calc(100% + 2px); }

.ss-search-row { padding: 6px; border-bottom: 1px solid var(--border, #e2e8f0); }
.ss-search {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 9px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text, #1e293b);
    outline: none;
}
.ss-search:focus { border-color: var(--primary, #1B3A6B); box-shadow: 0 0 0 2px var(--primary-light, #e0e8f5); }

.ss-list { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; }
.ss-opt {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text, #1e293b);
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-opt:hover, .ss-opt.ss-active { background: var(--primary-light, #e0e8f5); }
.ss-opt.ss-selected { font-weight: 600; color: var(--primary, #1B3A6B); }
.ss-opt.ss-disabled { color: var(--text-muted, #94a3b8); cursor: not-allowed; background: none; }
.ss-opt[hidden] { display: none; }
.ss-group-label {
    padding: 6px 10px 2px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted, #94a3b8);
}
.ss-group-label[hidden] { display: none; }
.ss-empty { padding: 10px; font-size: 12px; color: var(--text-muted, #94a3b8); text-align: center; }
.ss-empty[hidden] { display: none; }
