/* ==========================================================================
   Filterable Select — Generic dropdown with search filtering
   Content-agnostic: works with any server-rendered option markup.
   ========================================================================== */

/* Wrapper — relative positioning anchor */
.filterable-select {
  position: relative;
}

/* Trigger — styled like text-input, with chevron */
.filterable-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--parchment-50);
  border: 2px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-primary, var(--grey-700));
}

.filterable-select-trigger:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.filterable-select-trigger::after {
  content: "\25BE"; /* ▾ */
  margin-left: var(--space-xs);
  color: var(--grey-500);
  flex-shrink: 0;
}

.filterable-select-trigger--placeholder {
  color: var(--grey-500);
}

/* Search input — same position as trigger, swaps in when open */
.filterable-select-search {
  display: block;
  width: 100%;
  background: var(--parchment-50);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  outline: none;
  box-sizing: border-box;
}

.filterable-select-search::placeholder {
  color: var(--grey-500);
}

/* Panel — absolute dropdown below trigger */
.filterable-select-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin-top: 2px;
  background: var(--parchment-50);
  border: 1px solid var(--parchment-500);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 20rem;
  overflow-y: auto;
}

/* Group heading */
.filterable-select-group-heading {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--grey-500);
  background: var(--parchment-100);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Option — base style (generic) */
.filterable-select-option {
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
}

.filterable-select-option:hover,
.filterable-select-option.selected {
  background: var(--parchment-200, var(--parchment-100));
}

/* Empty/none option */
.filterable-select-option--none {
  color: var(--grey-500);
  font-style: italic;
}

/* Excluded options (hidden by external controller, e.g. subclass filtered by class) */
.filterable-select-excluded {
  display: none !important;
}
