/* Tom Select Custom Styling */

/* Control (input area) */
.ts-control {
  background-color: white;
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  min-height: 42px;
  padding: 0.5rem;
}

.dark .ts-control {
  background-color: rgb(23, 23, 23);
  border-color: rgb(64, 64, 64);
}

.ts-control:focus-within {
  border-color: rgb(59, 130, 246);
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .ts-control:focus-within {
  border-color: rgb(107, 114, 128);
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
}

/* Selected items */
.ts-control .item {
  background-color: rgb(219, 234, 254);
  color: rgb(30, 64, 175);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
}

.dark .ts-control .item {
  background-color: rgb(38, 38, 38);
  color: rgb(229, 231, 235);
  border: 1px solid rgb(64, 64, 64);
}

.ts-control .item .remove {
  margin-left: 0.5rem;
  color: rgb(37, 99, 235);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dark .ts-control .item .remove {
  color: rgb(156, 163, 175);
}

.ts-control .item .remove:hover {
  color: rgb(220, 38, 38);
}

.dark .ts-control .item .remove:hover {
  color: rgb(248, 113, 113);
}

/* Dropdown */
.ts-dropdown {
  background-color: white;
  border: 1px solid rgb(229, 231, 235);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  margin-top: 0.25rem;
  max-height: 20rem;
  overflow-y: auto;
}

.dark .ts-dropdown {
  background-color: rgb(23, 23, 23);
  border-color: rgb(64, 64, 64);
}

/* Options */
.ts-dropdown .option {
  color: rgb(17, 24, 39);
  cursor: pointer;
  transition: background-color 0.15s;
}

.dark .ts-dropdown .option {
  color: rgb(243, 244, 246);
}

.ts-dropdown .option:hover {
  background-color: rgb(249, 250, 251);
}

.dark .ts-dropdown .option:hover {
  background-color: rgb(38, 38, 38);
}

.ts-dropdown .option.active {
  background-color: rgb(239, 246, 255);
  color: rgb(37, 99, 235);
}

.dark .ts-dropdown .option.active {
  background-color: rgb(38, 38, 38);
  color: rgb(229, 231, 235);
}

.ts-dropdown .option.selected {
  background-color: rgb(243, 244, 246);
  font-weight: 500;
}

.dark .ts-dropdown .option.selected {
  background-color: rgb(51, 51, 51);
}

/* Optgroup headers */
.ts-dropdown .optgroup-header {
  border-bottom: 1px solid rgb(229, 231, 235);
  background-color: rgb(249, 250, 251);
  position: sticky;
  top: 0;
  z-index: 10;
}

.dark .ts-dropdown .optgroup-header {
  border-bottom-color: rgb(64, 64, 64);
  background-color: rgb(15, 15, 15);
  color: rgb(209, 213, 219);
}

.ts-dropdown .optgroup:not(:first-child) {
  border-top: 1px solid rgb(229, 231, 235);
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.dark .ts-dropdown .optgroup:not(:first-child) {
  border-top-color: rgb(64, 64, 64);
}

/* No results */
.ts-dropdown .no-results {
  color: rgb(107, 114, 128);
  text-align: center;
  padding: 1rem;
}

.dark .ts-dropdown .no-results {
  color: rgb(156, 163, 175);
}

/* Loading */
.ts-dropdown .spinner {
  color: rgb(107, 114, 128);
  text-align: center;
  padding: 1rem;
}

.dark .ts-dropdown .spinner {
  color: rgb(156, 163, 175);
}

/* Placeholder */
.ts-control input::placeholder {
  color: rgb(156, 163, 175);
}

.dark .ts-control input::placeholder {
  color: rgb(156, 163, 175);
}

/* Hide default select */
select[data-controller="tom-select"] {
  display: none !important;
}
