/* ══════════════════════════════════════════════════════════════════
   GFS CHOICES — a from-scratch skin over Choices.js's own stylesheet,
   replacing its default teal/grey look with the app's own gfs- design
   tokens so every js-choice / multi-choice dropdown (search fields,
   multi-selects, tag pickers — the whole "New Lesson Plan" topic and
   template pickers included) matches the rest of the admin UI instead
   of looking like an unstyled third-party widget.

   Loaded once, right after choices.min.css, on every page that pulls
   Choices.js in — the same handful of --gfs-* custom properties gfs-
   core.css already exposes for everything else, so this adapts to
   light/dark automatically without its own dark-mode block. Falls back
   to sane hardcoded values via var(--gfs-x, fallback) on the couple of
   older templates that load Choices.js without gfs-core.css.
   ══════════════════════════════════════════════════════════════════ */

.choices {
  margin-bottom: 0;
  font-size: 13.5px;
  font-family: inherit;
}

/* ── The visible box (replaces the native <select>) ── */
.choices__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  min-height: 42px;
  background: var(--gfs-card, #fff);
  border: 1.5px solid var(--gfs-border2, rgba(0, 0, 0, 0.1));
  border-radius: var(--gfs-r-sm, 10px);
  padding: 5px 34px 5px 12px;
  font-size: 13.5px;
  color: var(--gfs-ink2, #2d3240);
  transition: border-color 0.18s var(--gfs-ease, ease), box-shadow 0.18s var(--gfs-ease, ease);
}
.choices[data-type*="select-one"] .choices__inner {
  padding-bottom: 5px;
  cursor: pointer;
}
.choices[data-type*="select-multiple"] .choices__inner,
.choices[data-type*="text"] .choices__inner {
  cursor: text;
}

.is-focused .choices__inner,
.is-open .choices__inner {
  border-color: var(--gfs-blue, #1a56e8);
  box-shadow: 0 0 0 3px var(--gfs-blue-bg, rgba(26, 86, 232, 0.12));
}
.is-open .choices__inner,
.is-flipped.is-open .choices__inner {
  border-radius: var(--gfs-r-sm, 10px);
}

.choices.is-disabled .choices__inner,
.choices.is-disabled .choices__input {
  background: var(--gfs-surface2, #ecedf2);
  color: var(--gfs-ink4, #9ba3b5);
  border-color: var(--gfs-border, rgba(0, 0, 0, 0.06));
  cursor: not-allowed;
}
.choices.is-disabled .choices__item {
  cursor: not-allowed;
}

/* ── Dropdown caret — a plain CSS chevron instead of the default filled triangle ── */
.choices[data-type*="select-one"]::after {
  content: "";
  height: 7px;
  width: 7px;
  border-style: solid;
  border-color: transparent;
  border-right-color: var(--gfs-ink3, #6b7385);
  border-bottom-color: var(--gfs-ink3, #6b7385);
  border-width: 0 1.5px 1.5px 0;
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: -5px;
  transform: rotate(45deg);
  transition: transform 0.15s var(--gfs-ease, ease);
  pointer-events: none;
}
.choices[data-type*="select-one"].is-open::after {
  margin-top: -2px;
  transform: rotate(-135deg);
  border-color: transparent;
}

/* Single-value clear (×) button that sits before the caret */
.choices[data-type*="select-one"] .choices__button {
  right: 26px;
  margin-right: 0;
  opacity: 0.4;
}
.choices[data-type*="select-one"] .choices__button:hover,
.choices[data-type*="select-one"] .choices__button:focus {
  opacity: 1;
  box-shadow: none;
}

/* ── Lists ── */
.choices__list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.choices__list--single {
  display: flex;
  align-items: center;
  padding: 0;
  width: 100%;
  min-height: 30px;
}
.choices__list--single .choices__item {
  width: 100%;
  color: var(--gfs-ink2, #2d3240);
}
.choices__placeholder {
  color: var(--gfs-ink4, #9ba3b5);
  opacity: 1;
}

/* ── Multi-select tags — recolored to a gfs-badge-blue pill, teal removed ── */
.choices__list--multiple {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.choices__list--multiple .choices__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px 3px 12px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  background: var(--gfs-blue-bg, #eff4ff);
  border: 1px solid var(--gfs-blue-bg2, #dde8ff);
  color: var(--gfs-blue, #1a56e8);
  word-break: break-word;
  box-sizing: border-box;
}
.choices__list--multiple .choices__item.is-highlighted {
  background: var(--gfs-blue-bg2, #dde8ff);
  border-color: var(--gfs-blue, #1a56e8);
}
.is-disabled .choices__list--multiple .choices__item {
  background: var(--gfs-surface2, #ecedf2);
  border-color: var(--gfs-border2, rgba(0, 0, 0, 0.1));
  color: var(--gfs-ink4, #9ba3b5);
}

/* Remove (×) button on a tag — drawn with CSS instead of the default SVG icon */
.choices[data-type*="select-multiple"] .choices__button,
.choices[data-type*="text"] .choices__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border-left: 0;
  background-image: none !important;
  border-radius: 50%;
  opacity: 0.7;
}
.choices[data-type*="select-multiple"] .choices__button::before,
.choices[data-type*="text"] .choices__button::before {
  content: "\2715";
  text-indent: 0;
  font-size: 9px;
  line-height: 1;
  color: currentColor;
}
.choices[data-type*="select-multiple"] .choices__button:hover,
.choices[data-type*="select-multiple"] .choices__button:focus,
.choices[data-type*="text"] .choices__button:hover,
.choices[data-type*="text"] .choices__button:focus {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* ── Search / free-text input (both the inline one and the cloned dropdown one) ── */
.choices__input {
  display: inline-block;
  vertical-align: baseline;
  background: transparent;
  font-size: 13.5px;
  color: var(--gfs-ink2, #2d3240);
  margin: 0;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  max-width: 100%;
}
.choices[data-type*="select-one"] .choices__input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin: 0;
  border-bottom: 1px solid var(--gfs-border, rgba(0, 0, 0, 0.06));
  background: var(--gfs-surface, #f4f5f8);
  border-radius: var(--gfs-r-sm, 10px) var(--gfs-r-sm, 10px) 0 0;
  color: var(--gfs-ink2, #2d3240);
}
.choices__input::placeholder {
  color: var(--gfs-ink4, #9ba3b5);
}

/* ── Dropdown panel ── */
.choices__list--dropdown,
.choices__list[aria-expanded] {
  z-index: 60;
  background: var(--gfs-card, #fff);
  border: 1px solid var(--gfs-border2, rgba(0, 0, 0, 0.1));
  border-radius: var(--gfs-r-sm, 10px);
  margin-top: 4px;
  box-shadow: var(--gfs-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.12));
  overflow: hidden;
}
.is-open .choices__list--dropdown,
.is-open .choices__list[aria-expanded] {
  border-color: var(--gfs-border2, rgba(0, 0, 0, 0.1));
}
.is-flipped .choices__list--dropdown,
.is-flipped .choices__list[aria-expanded] {
  margin-top: 0;
  margin-bottom: 4px;
  border-radius: var(--gfs-r-sm, 10px);
}
.choices__list--dropdown .choices__list,
.choices__list[aria-expanded] .choices__list {
  max-height: 260px;
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--gfs-ink2, #2d3240);
}
.choices__list--dropdown .choices__item--selectable::after,
.choices__list[aria-expanded] .choices__item--selectable::after {
  display: none; /* drop the library's "Press to select" hint text */
}
.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: var(--gfs-blue-bg, #eff4ff);
  color: var(--gfs-blue, #1a56e8);
}
.choices__item--disabled {
  color: var(--gfs-ink4, #9ba3b5);
}
.choices__item.has-no-results,
.choices__item.has-no-choices {
  text-align: center;
  font-style: italic;
  color: var(--gfs-ink3, #6b7385);
  cursor: default;
}

.choices__heading {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 12px 6px;
  border-bottom: none;
  color: var(--gfs-ink3, #6b7385);
}
