.trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default);
  outline: none;
  text-align: left;
  gap: var(--spacing-2);

  &:hover:not(:disabled) {
    border-color: var(--color-border-hover);
  }

  &:focus-visible {
    border-color: var(--color-border-focus);
  }

  &.disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  svg {
    flex-shrink: 0;
    color: var(--color-text-tertiary);
    transition: transform var(--duration-fast) var(--ease-default);
  }

  &.open svg {
    transform: rotate(180deg);
  }
}

.dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: var(--spacing-1) 0;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 16px var(--color-shadow);

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
  }
}

.option {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);

  &:hover,
  &.focused {
    background: var(--color-bg-hover);
  }

  &.selected {
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
  }
}

.optionLabel {
  flex: 1;
  padding: 7px var(--spacing-3);
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.previewBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  background: transparent;
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease,
    color 150ms ease,
    border-color 150ms ease,
    background 150ms ease;

  svg {
    margin-left: 1px;
  }

  .option:hover &,
  .option.focused & {
    opacity: 0.6;
  }

  &:hover {
    opacity: 1 !important;
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  }
}

.suffix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-1-5) 12px;
  margin: var(--spacing-1) 0;

  &::before,
  &::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
  }
}

.dividerLabel {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.dividerPlain {
  height: 1px;
  background: var(--color-border);
  margin: var(--spacing-1) 12px;
}

.multiTrigger {
  flex-wrap: wrap;
  gap: var(--spacing-1);
  min-height: 36px;
  height: auto;
  cursor: pointer;

  > svg {
    margin-left: auto;
    align-self: center;
  }
}

.multiChips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-1);
  flex: 1;
  min-width: 0;
  align-items: center;
}

.multiChip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-half);
  padding: var(--spacing-half) var(--spacing-2);
  background: var(--color-bg-hover);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.multiChip[draggable="true"] {
  cursor: grab;

  &:active {
    cursor: grabbing;
  }
}

.multiChipDragging {
  opacity: 0.4;
}

.multiChipRemove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  line-height: 1;
  transition: color var(--duration-fast) var(--ease-default),
    background var(--duration-fast) var(--ease-default);

  &:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-input);
  }
}

.multiPlaceholder {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.searchBox {
  padding: var(--spacing-1) var(--spacing-2);
  border-bottom: 1px solid var(--color-border);
}

.searchInput {
  width: 100%;
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;

  &::placeholder {
    color: var(--color-text-tertiary);
  }

  &:focus {
    border-color: var(--color-border-focus);
  }
}
