@import '../../styles/basis.less';

.yk-select__wrapper {
  position: relative;
  display: inline-block;
  min-width: 200px;
  max-width: 100%;
  font-size: @size-s;
  color: @font-color-l;
  vertical-align: middle;
}

.yk-select__trigger {
  display: flex;
  align-items: center;
  gap: @space-s;
  box-sizing: border-box;
  padding: 0 @space-m;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: @radius-m;
  background-color: @bg-color-s;
  cursor: pointer;
  transition:
    border-color @animatb,
    background-color @animatb;

  &:hover {
    background-color: @bg-color-m;
  }

  &:focus-visible {
    outline: 2px solid @pcolor-3;
    outline-offset: 1px;
  }

  &--open,
  &--open:hover {
    border-color: @pcolor;
    background-color: @bg-color-l;
  }

  &--disabled,
  &--disabled:hover {
    color: @font-color-ss;
    background-color: @bg-color-s;
    cursor: not-allowed;
    opacity: 0.6;
  }

  &--is-error,
  &--is-error:hover {
    border-color: @ecolor;
  }

  &--s {
    padding: 0 @space-s;
    min-height: 22px;
    font-size: @size-ss;
    border-radius: @radius-s;
  }

  &--m {
    padding: 0 @space-m;
    min-height: 30px;
    font-size: @size-s;
    border-radius: @radius-s;
  }

  &--l {
    padding: 0 @space-m;
    min-height: 34px;
    font-size: @size-s;
    border-radius: @radius-m;
  }

  &--xl {
    padding: 0 @space-l;
    min-height: 46px;
    font-size: @size-m;
    border-radius: @radius-m;
  }

  &--multiple {
    padding-top: @space-ss;
    padding-bottom: @space-ss;
  }
}

.yk-select__selected {
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yk-select__placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: @font-color-ss;
  flex: 1;
}

.yk-select__tags {
  display: flex;
  align-items: center;
  overflow: hidden;
  flex: 1;
  flex-wrap: wrap;
  gap: @space-ss;
}

.yk-select__tag {
  display: inline-flex;
  align-items: center;
  gap: @space-ss;
  padding: 0 @space-s;
  max-width: 100%;
  height: 24px;
  border-radius: @radius-s;
  color: @font-color-m;
  background-color: @bg-color-l;
  line-height: 24px;
}

.yk-select__tag-close {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: @font-color-ss;
  transition:
    color @animatf,
    background-color @animatf;
  cursor: pointer;

  &:hover {
    color: @font-color-l;
    background-color: @gray-2;
  }
}

.yk-select__suffix {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  color: @font-color-ss;
  flex-shrink: 0;
}

.yk-select__clear {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: @font-color-ss;
  transition:
    color @animatf,
    background-color @animatf;
  cursor: pointer;

  &:hover {
    color: @font-color-l;
    background-color: @gray-2;
  }
}

.yk-select__arrow {
  transition: transform @animatb;

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

.yk-select__dropdown {
  box-sizing: border-box;
  padding: @space-ss;
  max-height: 280px;
  border: 1px solid @line-color-s;
  border-radius: @radius-m;
  background-color: @bg-color-l;
  box-shadow: @shadow-m;
  animation: yk-select-dropdown-in @animatf ease-out;
}

@keyframes yk-select-dropdown-in {
  from {
    opacity: 0;
    transform: scaleY(0.96);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.yk-select__filter {
  padding: @space-ss;
}

.yk-select__filter-input {
  padding: 0 @space-s;
  width: 100%;
  height: 28px;
  font-size: @size-s;
  border: 1px solid @line-color-m;
  border-radius: @radius-s;
  color: @font-color-l;
  background-color: @bg-color-l;
  outline: none;
  box-sizing: border-box;

  &:focus {
    border-color: @pcolor;
  }
}

.yk-select__options {
  overflow-y: auto;
  margin: 0;
  padding: 0;
  max-height: 240px;
  list-style: none;
}

.yk-select__option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 @space-m;
  height: 32px;
  border-radius: @radius-s;
  color: @font-color-l;
  gap: @space-s;
  line-height: 32px;
  cursor: pointer;

  &--active {
    background-color: @bg-color-m;
  }

  &--selected {
    font-weight: 500;
    color: @pcolor;
  }

  &--disabled,
  &--disabled:hover {
    color: @font-color-ss;
    background-color: transparent;
    cursor: not-allowed;
  }
}

.yk-select__option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yk-select__option-check {
  flex-shrink: 0;
  color: @pcolor;
}

.yk-select__empty {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: @space-l;
  text-align: center;
  color: @font-color-ss;
  gap: @space-s;
}
