@import 'mixins/mixins';
@import 'mixins/utils';
@import 'common/var';
@import 'input';
@import 'tag';
@import 'option';
@import 'scrollbar';


@include b(select) {
  display: inline-block;
  position: relative;
  line-height: $input-height;

  @include e(popper) {
    @include picker-popper($select-dropdown-bg, $select-dropdown-border, $select-dropdown-shadow);
  }

  @include mf(medium) {
    line-height: $input-medium-height;
  }
  @include mf(small) {
    line-height: $input-small-height;
  }
  @include mf(mini) {
    line-height: $input-mini-height;
  }

  .#{$namespace}-select_tags > span {
    display: inline-block;
  }

  &:hover {
    .#{$namespace}-input_inner {
      border-color: $select-border-color-hover;
    }
  }

  .#{$namespace}-select_tags-text {
    text-overflow: ellipsis;
    display: inline-block;
    overflow-x: hidden;
    vertical-align: bottom;
  }

  .#{$namespace}-input_inner {
    cursor: pointer;
    padding-right: 35px;
    display: block;

    &:focus {
      border-color: $select-input-focus-border-color;
    }
  }

  .#{$namespace}-input {
    display: block;

    & .#{$namespace}-select_caret {
      color: $select-input-color;
      font-size: $select-input-font-size;
      transition: transform 0.3s;
      transform: rotateZ(180deg);
      cursor: pointer;

      @include pf(reverse) {
        transform: rotateZ(0deg);
      }

      @include pf(show-close) {
        font-size: $select-font-size;
        text-align: center;
        transform: rotateZ(180deg);
        border-radius: 100%;
        color: $select-input-color;
        transition: $color-transition;

        &:hover {
          color: $select-close-hover-color;
        }
      }
    }

    &.ro-disabled {
      & .#{$namespace}-input_inner {
        cursor: not-allowed;

        &:hover {
          border-color: $select-disabled-border;
        }
      }
    }

    &.ro-focus .#{$namespace}-input_inner {
      border-color: $select-input-focus-border-color;
    }
  }

  @include e(input) {
    border: none;
    outline: none;
    padding: 0;
    margin-left: 15px;
    color: $select-multiple-input-color;
    font-size: $select-font-size;
    appearance: none;
    height: 28px;
    background-color: transparent;

    @include pf(mini) {
      height: 14px;
    }
  }

  @include e(close) {
    cursor: pointer;
    position: absolute;
    top: 8px;
    z-index: $z-index-top;
    right: 25px;
    color: $select-input-color;
    line-height: 18px;
    font-size: $select-input-font-size;

    &:hover {
      color: $select-close-hover-color;
    }
  }

  @include e(tags) {
    position: absolute;
    line-height: normal;
    white-space: normal;
    z-index: $z-index-normal;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .#{$namespace}-tag_close {
    margin-top: -2px;
  }

  .#{$namespace}-select_tags .#{$namespace}-tag {
    box-sizing: border-box;
    border-color: transparent;
    margin: 2px 0 2px 6px;
    background-color: #f0f2f5;

    .#{$namespace}-icon-close {
      background-color: $input-placeholder-color;
      right: -7px;
      top: 0;
      color: $color-white;

      &:hover {
        background-color: $text-color-gradual-3;
      }

      &::before {
        display: block;
        transform: translate(0, 0.5px);
      }

    }
  }
}

@include b(select-dropdown) {
  z-index: #{$z-index-top + 1};
  border-radius: $border-radius-default;
  box-sizing: border-box;

  @include pf(multiple) {
    & .#{$namespace}-select-dropdown_item.selected {
      color: $select-option-selected-font-color;
      background-color: $select-dropdown-bg;

      &.hover {
        background-color: $select-option-hover-bg;
      }

      &::after {
        position: absolute;
        right: 20px;
        font-family: 'rxui-icons';
        content: "\e6cf";
        font-size: 12px;
        font-weight: bold;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }
    }
  }
  .#{$namespace}-scrollbar.ro-empty .#{$namespace}-select-dropdown_list {
    padding: 0;
  }
}

@include b(select-dropdown_empty) {
  padding: $select-dropdown-empty-padding;
  margin: 0;
  text-align: center;
  color: $select-dropdown-empty-color;
  font-size: $select-font-size;
}

@include b(select-dropdown_wrap) {
  max-height: $select-dropdown-max-height;
}

@include b(select-dropdown_list) {
  list-style: none;
  padding: $select-dropdown-padding;
  margin: 0;
  box-sizing: border-box;
}
