/* Tom Select Base Styles */
.ts-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.ts-control {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: #f3f4f6;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.ts-dropdown {
  position: absolute !important;
  left: 0;
  top: 100%;
  width: 100% !important;
  z-index: 50;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: white;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  max-width: 100vw;
}

.ts-dropdown .active {
  background-color: #eff6ff;
  color: #1e40af;
}

.ts-dropdown .option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  background: #fff;
  color: #222;
}

.ts-dropdown .option:hover {
  background-color: #f9fafb;
}

.ts-dropdown .option.selected {
  background-color: #eff6ff;
  color: #1e40af;
}

/* Tom Select Core Styles */
.ts-wrapper.single .ts-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ts-wrapper.single .ts-control::after {
  content: '';
  border: 4px solid transparent;
  border-top-color: #9ca3af;
  border-right-color: #9ca3af;
  transform: rotate(135deg);
  margin-top: -4px;
  margin-left: 0.5rem;
}

.ts-dropdown {
  margin-top: 0.25rem;
}

.ts-dropdown .option {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-dropdown .option.active {
  background: #e0e7ef;
  color: #111;
}

.ts-dropdown .option.selected {
  background-color: #eff6ff;
  color: #1e40af;
}

.ts-dropdown .option:hover {
  background-color: #f9fafb;
}

.ts-dropdown .optgroup-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
}

.ts-dropdown .optgroup {
  border-top: 1px solid #f3f4f6;
}

.ts-dropdown .optgroup:first-child {
  border-top: none;
}

/* Input styles */
.ts-control input {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: #374151;
  flex: 1 1 auto;
  min-width: 0;
}

.ts-control input:focus {
  outline: none;
  box-shadow: none;
}

/* Selected item styles */
.ts-control>div {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #374151;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
}

/* Clear button styles */
.ts-control .clear-button {
  color: #9ca3af;
  padding: 0.25rem;
  margin-left: 0;
  margin-right: 10px;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.ts-control .clear-button:hover {
  color: #6b7280;
}

/* Style the search input inside the dropdown */
.ts-dropdown input[type="text"] {
  background: #fff !important;
  color: #222;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  margin: 8px;
  padding: 6px 10px;
  width: 95% !important;
  min-width: 200px;
  box-sizing: border-box;
  display: block;
}

.ts-hidden-accessible {
  display: none !important;
}

.ts-control {
  display: flex;
  align-items: center;
  position: relative;
}

.ts-control input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

.ts-control .clear-button {
  /* order: 2; */
  margin-left: 0;
  margin-right: 10px;
  position: relative;
  z-index: 2;
}

.ts-dropdown .ts-dropdown-content {
  max-height: 22.5rem;
  /* 2.25rem * 10 options */
  overflow-y: auto;
}

.ts-control.has-items input[placeholder] {
  display: none !important;
}