/* ════════════════════════════════════════════════════
   controls/select.css — the styles for js/controls/select.js
   ════════════════════════════════════════════════════
   Globally linked from index.html, unlike the sheet these rules came out of
   (chaos-controls.css, which the Chaos app loads on mount). They moved when
   the second app needed the control: Settings' add-an-Azure-DevOps-account
   form uses it for the project picker (AB#13020 T10.4), and a control under
   js/controls/ that only renders correctly inside one app is a trap for the
   next caller — it looks available and arrives unstyled.

   Two sheets override these with higher specificity and are unaffected by the
   move: apps/chaos.css (.ch-create-kind) and controls/gallery.css
   (.ch-group-dir-select).
*/

.ch-select {
    position: relative;
    display: inline-block;
    min-width: 160px;
}

/* Trigger chrome matches the other embedded pickers (priority-picker.js's
   .ch-priority-trigger, status-picker's badge) — same border/background/
   padding/height/text color, so a select() dropdown reads as the same
   family of control instead of a visually distinct one. */
.ch-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    padding: 4px 10px;
    font-size: var(--fs-body);
    cursor: pointer;
    text-align: left;
    outline: none;
    min-height: 32px;
}

.ch-select-chevron {
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0.5;
    flex-shrink: 0;
    margin-left: auto;
}

.ch-select-trigger:hover {
    border-color: var(--accent);
}

/* A picker whose options are not available yet (select()'s `disabled`) still
   shows its reason as the trigger label, so keep it readable — dimmed, not
   hidden — and drop the affordances that would promise it opens. */
.ch-select-trigger:disabled {
    cursor: default;
    opacity: 0.6;
}

.ch-select-trigger:disabled:hover {
    border-color: var(--border);
}

.ch-select-placeholder {
    color: var(--text-muted);
}

.ch-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-height: 240px;
    overflow-y: auto;
}

/* The search box stands IN the trigger's place while a searchable control is
   open (select.js replaces one with the other), so it wears the trigger's own
   chrome: same border, radius, height and padding, plus the focus ring the
   button never needed. Anything narrower or flatter would make the field
   appear to jump on click. */
.ch-select-search {
    width: 100%;
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 4px 10px;
    font-size: var(--fs-body);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    min-height: 32px;
}

.ch-select-search::placeholder {
    color: var(--text-muted);
}

.ch-select-list {
    padding: 4px 0;
}

.ch-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: var(--fs-body);
    color: var(--text-primary);
    transition: background 0.1s;
}

.ch-select-item:hover {
    background: var(--bg-hover);
}

.ch-select-active {
    background: var(--bg-hover);
    font-weight: 500;
}

/* Where the keyboard is, which is a different fact from which row is chosen —
   hence a tint rather than the checkmark .ch-select-active carries. The two
   coincide on the row you are standing on and must still be tellable apart. */
.ch-select-item.ch-select-highlight {
    background: var(--bg-hover);
    box-shadow: inset 2px 0 0 var(--accent);
}

.ch-select-icon {
    flex-shrink: 0;
}

.ch-select-active::after {
    content: '✓';
    margin-left: auto;
    font-size: var(--fs-meta);
    opacity: 0.6;
}
