/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ---------------------------------------------------------------------------
 * Tom Select overrides (select-search Stimulus controller).
 * Loaded after tom-select.css so these win the cascade; the widget is restyled
 * to match .lex-input from the Tailwind design system (colors come from the
 * :root variables Tailwind 4 emits for the @theme tokens).
 * ------------------------------------------------------------------------- */

/* Tom Select copies the original select's classes (incl. .lex-input) onto its
   wrapper div — neutralize the box styling there so it only applies once, on
   the inner .ts-control. */
.ts-wrapper.lex-input {
  padding: 0;
  border: none;
  background: transparent;
}

.ts-wrapper .ts-control {
  background: var(--color-field);
  border: 1px solid var(--color-line);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-ink);
  box-shadow: none;
  cursor: pointer;
}
.ts-control input {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-ink);
}
.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control {
  border-color: var(--color-lexindigo);
  box-shadow: none;
}
.ts-wrapper.single.input-active .ts-control {
  background: var(--color-field);
}
/* Honor bg-white on selects that used it (entries-table matter filter) */
.ts-wrapper.bg-white,
.ts-wrapper.bg-white .ts-control,
.ts-wrapper.bg-white.single.input-active .ts-control {
  background: #fff;
}
.ts-wrapper.disabled .ts-control {
  background: var(--color-field);
  opacity: 0.55;
}

/* Chevron for single selects (the default minified theme ships none) */
.ts-wrapper.single {
  --ts-pr-caret: 1.5rem;
}
.ts-wrapper.single .ts-control::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--color-sub);
  border-bottom: 1.5px solid var(--color-sub);
  transform: rotate(45deg);
  pointer-events: none;
}
.ts-wrapper.single.dropdown-active .ts-control::after {
  margin-top: -1px;
  transform: rotate(225deg);
}

.ts-dropdown {
  border: 1px solid var(--color-line);
  border-radius: 8px;
  margin-top: 6px;
  box-shadow: 0 10px 34px rgba(30, 30, 60, 0.16);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-ink);
  z-index: 50;
}
.ts-dropdown-content {
  /* Show as many options as the screen allows; the list scrolls internally
     once it hits the viewport-relative cap. */
  max-height: min(60vh, 560px);
  padding: 4px;
}
.ts-dropdown .option,
.ts-dropdown .no-results {
  padding: 8px 10px;
  border-radius: 6px;
}
.ts-dropdown .active {
  background: var(--color-lexindigo-soft);
  color: var(--color-lexindigo);
}
.ts-dropdown .selected {
  font-weight: 600;
  color: var(--color-lexindigo);
}
.ts-dropdown [data-selectable] .highlight {
  background: rgba(245, 161, 60, 0.28);
  border-radius: 2px;
}
.ts-dropdown .optgroup-header {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-sub);
}
