/* Select (ui/select.rs): the app's drop-down, a combobox button and its
   listbox popup. Light and dark come from the tokens. */

.mc-select { position: relative; display: inline-block; max-width: 100%; min-width: 0; vertical-align: middle; }
.mc-field .mc-select { display: block; }
.mc-select__trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  width: 100%; min-width: 0; max-width: 100%; min-height: 36px; padding: 6px 10px; text-align: left;
  font: 400 14px/20px var(--font-sans); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); cursor: pointer;
}
.mc-select__trigger:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mc-select__trigger:disabled { cursor: not-allowed; opacity: 0.6; }
.mc-select__value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-select__value.is-placeholder { color: var(--ink-muted); }
.mc-select__chev { flex: none; font-size: 12px; color: var(--ink-muted); transition: transform 120ms ease; }
.mc-select.is-open .mc-select__chev { transform: rotate(180deg); }

.mc-select__list {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  min-width: 100%; width: max-content; max-width: min(calc(100vw - 32px), 420px);
  max-height: min(320px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
}
.mc-select__list[hidden] { display: none; }
.mc-select__option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
  font: 400 14px/20px var(--font-sans); color: var(--ink); overflow-wrap: anywhere;
}
.mc-select__option.is-active { background: var(--grape-wash); outline: 1px solid var(--grape); outline-offset: -1px; }
.mc-select__option[aria-selected="true"] { font-weight: 600; }
.mc-select__option[aria-disabled="true"] { color: var(--ink-muted); cursor: not-allowed; opacity: 0.6; }
.mc-select__check { flex: none; color: var(--grape); font-size: 12px; }
.mc-select__group + .mc-select__group, .mc-select__option + .mc-select__group { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 4px; }
.mc-select__group-label { padding: 6px 10px 2px; font: 600 12px/16px var(--font-sans); color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.04em; }
.mc-select__group .mc-select__option { padding-left: 16px; }

@media (forced-colors: active) {
  .mc-select__option.is-active { outline: 2px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) { .mc-select__chev { transition: none; } }
