/* Minimal Tom Select styles (dark theme to match the app)
   Based on the default Tom Select CSS, simplified and tuned for Tailwind-like visuals.
   If you later install the official CSS via npm/build tooling, you can remove this file
   and include `tom-select.css` from the package instead. */

.ts-wrapper {
  position: relative;
  display: block;
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #e5e7eb; /* gray-200 */
}

.ts-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  box-sizing: border-box;
  min-height: 2.5rem; /* ~40px */
  width: 100%;
  background-color: rgba(17, 24, 39, 0.8); /* gray-900/80 */
  color: #e5e7eb;
  border: 1px solid #1e40af; /* blue-800 */
  border-radius: 0.375rem; /* rounded md */
  padding: 0.375rem 0.5rem; /* px-2 py-1.5 */
  cursor: text;
}

.ts-wrapper.single .ts-control {
  cursor: pointer;
}

.ts-wrapper.disabled .ts-control,
.ts-control.is-disabled {
  background: #1f2937; /* gray-800 */
  color: #9ca3af; /* gray-400 */
  cursor: not-allowed;
  opacity: 0.7;
}

.ts-control input {
  color: inherit;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0 0.25rem;
  margin: 0.125rem 0;
  line-height: 1.4;
  min-width: 2ch;
}

.ts-control .item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  margin: 0.125rem;
  border-radius: 0.25rem;
  background-color: rgba(37, 99, 235, 0.35); /* blue-600/35 */
  color: #dbeafe; /* blue-100 */
}

.ts-control .item .remove {
  opacity: 0.85;
  cursor: pointer;
  font-weight: 700;
}

.ts-dropdown,
.ts-dropdown.form-control {
  position: absolute;
  box-sizing: border-box;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background: #0b1220; /* near slate-950 */
  color: #e5e7eb; /* gray-200 */
  border: 1px solid rgba(30, 64, 175, 0.6); /* blue-800/60 */
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 60; /* above most UI; panel should already be above overlay */
  overflow: hidden;
}

.ts-dropdown [data-selectable] {
  cursor: pointer;
}

.ts-dropdown .create {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(30, 64, 175, 0.35);
  color: #93c5fd; /* blue-300 */
  font-style: italic;
}

.ts-dropdown-content {
  max-height: 16rem; /* 256px */
  overflow-y: auto;
}

.ts-dropdown .option,
.ts-dropdown .optgroup-header {
  padding: 0.5rem 0.75rem;
  line-height: 1.25rem;
}

.ts-dropdown .option {
  color: #e5e7eb; /* gray-200 */
}

.ts-dropdown .option.active,
.ts-dropdown .option.selected,
.ts-dropdown .option:hover {
  background: rgba(37, 99, 235, 0.25); /* blue-600/25 */
  color: #ffffff;
}

.ts-dropdown .optgroup-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: #93c5fd; /* blue-300 */
  background: rgba(30, 58, 138, 0.35); /* blue-900/35 */
}

.ts-wrapper.focus .ts-control,
.ts-control.focus {
  border-color: #60a5fa; /* blue-400 */
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35); /* ring */
}

.ts-wrapper .ts-loading-spinner {
  margin-left: 0.5rem;
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-top-color: #60a5fa;
  border-radius: 50%;
  width: 1rem;
  height: 1rem;
  animation: ts-spin 0.7s linear infinite;
}

@keyframes ts-spin {
  to { transform: rotate(360deg); }
}

/* Clear button plugin */
.ts-control .clear-button {
  margin-left: 0.25rem;
  opacity: 0.85;
  cursor: pointer;
  color: #93c5fd;
}
.ts-control .clear-button:hover {
  opacity: 1;
  color: #bfdbfe;
}

/* Dropdown caret for single select */
.ts-wrapper.single .ts-control::after {
  content: "";
  border-style: solid;
  border-width: 0.35rem 0.35rem 0 0.35rem;
  border-color: #93c5fd transparent transparent transparent;
  display: block;
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.8;
}

/* Ensure the control fills the container width */
.ts-control,
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  width: 100%;
}

/* Hide the original select element */
.ts-hidden-accessible {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
