.multi-select {
  position: relative;
  width: 100%;
}

.multi-select.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.multi-select-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bs-body);
}

.disabled .multi-select-label {
  color: #9ca3af;
}

.multi-select-container {
  position: relative;
  min-height: 32px;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  cursor: pointer;
}

.single-select-container {
  position: relative;
  height: 2.32rem;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  cursor: pointer;
}

.multi-select-container:focus-within:not(.disabled) {
  border-color: #3b82f6;
  outline: none;
}

.disabled .multi-select-container {
  background-color: #f8f9fa;
  border-color: #ced4da;
  cursor: not-allowed;
}

/* Selected tags (for multi-select) */
.multi-select-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: 100%;
  overflow: hidden;
  /* padding: 0.4rem; */
}

.multi-select-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  margin: 0.2rem 0.1rem;
  color: var(--bs-body);
  font-size: 0.875rem;
  border-radius: 0.25rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-tag-icon {
  display: inline-flex;
  align-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
}

.disabled .multi-select-tag {
  background-color: #f8f9fa;
  color: #6c757d;
}

/* Remove tag button */
.multi-select-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0.125rem;
  background: none;
  border: none;
  border-radius: 9999px;
  color: white;
  cursor: pointer;
  background-color: #ffa0a0;
}

.multi-select-tag-remove:hover:not(:disabled) {
  background-color: #bfdbfe;
  color: #3b82f6;
}

.multi-select-tag-remove-icon {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.single-select-display {
  padding: 0.4rem;
  color: #111827;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-select-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 0.875rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
}

.multi-select-clear:hover:not(:disabled) {
  color: #374151;
}

/* The dropdown container */
.multi-select-dropdown {
  position: absolute;
  z-index: 10 !important;
  margin-top: -1rem;
  width: 100%;
  background-color: #fff;
  border-radius: 0.375rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid #d1d5db;
}

/* NEW: the search box inside the dropdown */
.multi-select-dropdown-search {
  padding: 0.5rem;
  border-bottom: 1px solid #d1d5db;
  background-color: #f9fafb;
}

.multi-select-dropdown-search .multi-select-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background-color: #fff;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
}

.multi-select-dropdown-search .multi-select-input:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Options within the dropdown */
.multi-select-option {
  display: flex;
  flex-wrap: unset;
  justify-content: flex-start;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #111827;
  word-break: break-all;
}

.multi-select-option:hover {
  background-color: #f3f4f6;
}

.multi-select-option.highlighted {
  background-color: #3b82f6;
  color: #fff;
}

.multi-select-no-options {
  padding: 0.5rem 0.75rem;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Custom scrollbar styling */
.multi-select-dropdown::-webkit-scrollbar {
  width: 0.5rem;
}
.multi-select-dropdown::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 0.375rem;
}
.multi-select-dropdown::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 0.375rem;
}
.multi-select-dropdown::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
}

/* Focus styles for accessibility */
.multi-select-tag-remove:focus-visible,
.multi-select-clear:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Floating label support */
.multi-select-container.has-floating-label {
  position: relative;
}

.multi-select-container.has-floating-label label {
  position: absolute;
  left: 8px;
  top: -5%;
  transform: translateY(-50%);
  pointer-events: none;
  padding-left: 5px;
  padding-right: 5px;
  background-color: white;
  border-radius: 5px;
  transition: 0.2s ease all;
  color: #6b7280;
}

.multi-select-container.has-floating-label input:focus ~ label,
.has-floating-label input:not(:placeholder-shown) ~ label {
  top: 0;
  transform: translateY(-100%);
  font-size: 0.75rem;
  color: #3b82f6;
  background: white;
  padding: 0 4px;
}

.disabled .has-floating-label label {
  background-color: gray;
}
