/*
  Tom Select styled to match the Balanced Pro design system.

  This file is served directly (stylesheet_link_tag "tom_select_tailwind"),
  NOT processed by the Tailwind build, so it must be plain CSS — `@apply`
  directives are ignored by the browser. Use the design-token CSS variables
  (defined on :root in tailwind/application.css) so the control matches
  Components::FormControl inputs.
*/
@import "tom-select-rails/css/tom-select.css";

/* The wrapper is just a positioning shell — the visible box lives on .ts-control.
   Reset tom-select's default border/padding/background so they don't double up. */
.ts-wrapper {
  margin-top: 0.25rem;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

/* Match the FormControl text input: same height, border, radius, padding. */
.ts-control {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.375rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: #fff;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.ts-wrapper.focus .ts-control {
  border-color: var(--link);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--link) 20%, transparent);
}

.ts-control input {
  padding-right: 1.25rem !important;
  font-size: 0.875rem;
  margin: 0 !important;
  color: var(--foreground);
}

.ts-wrapper.plugin-remove_button .item {
  border-radius: var(--radius-md);
}

.ts-wrapper.multi .ts-control > div {
  padding: 0 0 0 0.25rem;
  margin: 0;
}

.ts-wrapper.plugin-remove_button .item .remove {
  border: none;
  font-size: 1.125rem;
  line-height: 1;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  border-top-right-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.ts-dropdown {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: #fff;
  color: var(--foreground);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.ts-dropdown [data-selectable].option,
.ts-dropdown .no-results {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.ts-dropdown [data-selectable].option:first-child {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.ts-dropdown [data-selectable].option:last-child {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.ts-dropdown .create:hover,
.ts-dropdown .option:hover,
.ts-dropdown .active {
  background-color: var(--bgColor-accent-muted);
  color: var(--fgColor-accent);
}

.ts-dropdown .spinner {
  height: auto;
  width: auto;
}

.ts-dropdown .spinner:after {
  height: 1.25rem;
  width: 1.25rem;
  border-width: 2px;
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
  display: inline-block;
}

.ts-wrapper:not(.form-control):not(.form-select).single .ts-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  print-color-adjust: exact;
}
