/* ─────────────────────────────────────────────
   CUSTOM DROPDOWN  (.ds-select)
   Theme-aware option list — the open menu follows
   the active color theme (.theme-*) because every
   color is a token. Built by select-enhance.js,
   which progressively enhances <select class="select">.
───────────────────────────────────────────── */
.ds-select { position: relative; width: 100%; }

.ds-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.4;
  text-align: left;
  color: var(--fg-primary);
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ds-select__trigger:hover { border-color: var(--border-strong); }
.ds-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-select__trigger .ds-select__chevron {
  flex-shrink: 0;
  width: 12px; height: 12px;
  color: var(--fg-muted);
  transition: transform .15s ease, color .12s ease;
}
.ds-select[data-open] .ds-select__trigger {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}
.ds-select[data-open] .ds-select__chevron {
  transform: rotate(180deg);
  color: var(--brand-primary);
}
.ds-select__value.is-placeholder { color: var(--fg-muted); }

/* size + error modifiers mirror the native helpers */
.ds-select-sm .ds-select__trigger { padding: 5px 9px; font-size: var(--text-xs); }
.ds-select-lg .ds-select__trigger { padding: 10px 13px; font-size: var(--text-base); }
.ds-select-error .ds-select__trigger { border-color: var(--color-red-600); }
.ds-select-error[data-open] .ds-select__trigger { box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.ds-select[aria-disabled="true"] .ds-select__trigger {
  background: var(--bg-muted);
  color: var(--fg-muted);
  cursor: not-allowed;
  border-color: var(--border-default);
}
.ds-select[aria-disabled="true"] .ds-select__chevron { color: var(--border-strong); }

/* The themed panel — high z-index to render above modals */
.ds-select__panel {
  position: absolute;
  z-index: 2200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.ds-select:not([data-open]) .ds-select__panel { display: none; }

.ds-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--fg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}
.ds-select__option > span:first-child {
  white-space: nowrap;
}
/* hover / keyboard-highlighted use the active theme's tint */
.ds-select__option:hover,
.ds-select__option[data-active] {
  background: var(--brand-primary-light);
  color: var(--brand-primary-text);
}
/* the chosen value */
.ds-select__option[aria-selected="true"] {
  background: var(--brand-primary-light);
  color: var(--brand-primary-text);
  font-weight: var(--fw-medium);
}
.ds-select__option .ds-select__check {
  flex-shrink: 0;
  width: 14px; height: 14px;
  color: var(--brand-primary);
  opacity: 0;
}
.ds-select__option[aria-selected="true"] .ds-select__check { opacity: 1; }
/* disabled option */
.ds-select__option[aria-disabled="true"] {
  color: var(--fg-muted);
  cursor: not-allowed;
  background: transparent;
}
/* group label inside panel */
.ds-select__group {
  padding: 8px 9px 4px;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-muted);
}
