@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";
@import "select-dropdown";
@import "input";
@import "tag";
@import "option";
@import "option-group";
@import "scrollbar";

@include b(select) {
  display: inline-block;
  position: relative;
  //line-height: $--input-large-height;

  @include e(multiple) {
    overflow: hidden;
    vertical-align: bottom;
    .el-input__suffix, .el-input__suffix-inner{
      height: 100%;
    }
  }

  .el-select__tags
    >span {
      display: contents;
    }
  &:hover {
    .el-input__inner:not([disabled="disabled"]) {
      //border-color: $--select-border-color-hover;
      border-color: $--color-text-placeholder;
      background-color: transparent;

      &::placeholder {
        color: $--color-text-placeholder;
      }
    }
    .el-select-tags-modal:not(.modal-is-active) {
      border-color: $--color-text-placeholder;
    }
    .el-select-tags-modal.selectDisabled{
      border-color: $--color-disabled-border;
    }
  }
  @include e(tags) {
    position: absolute;
    line-height: normal;
    white-space: normal;
    z-index: $--index-normal;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    // padding-left: 4px;
  }

  // .el-tag__close {
  //   margin-top: -2px;
  // }

  .el-tag {
    box-sizing: border-box;
    border-color: transparent;
    margin: 2px 4px 2px 0;
    background-color: $--color-secondary;
    display: inline-flex;
    align-items: center;
    &__close.el-icon-input-close {
      flex: none;
      background-color: $--color-secondary;
      color: $--color-text-secondary;
      font-weight: $--font-weight-700;
      // top: 9px;
      right: 8px;
      margin-right:0;
      &:hover {
        background-color: $--input-icon-bg-color-hover;
      }

      &::before {
        display: block;
        // transform: translate(0, .5px);
      }
    }
    + .el-tag{
      margin-left: 0;
    }
    &:last-child{
      margin-right: 2px;
    }
  }

  .el-tag--info {
    color: $--color-text-regular;
  }
  .is-disabled {
    .el-tag--info {
      color: $--color-text-4
    }
  }
  .el-select__tags{
    .el-select__input{
      color: $--color-text-1;
    }
  }
  .el-input__inner {
    cursor: pointer;
    padding-left: 12px;
    &:focus {
      border-color: $--select-input-focus-border-color;
    }
    &::placeholder {
      color: $--color-text-placeholder;
    }
  }

  .el-select-tags-modal {
    position: absolute;
    border-left: $--border-width-base $--border-style-base $--select-border-color;
    width: 4px;
    top: 4px;
    left: 0;
    z-index: 1;
    height: 80%;
    background: #fff;
    &.modal-is-active {
      border-color: $--color-primary;
    }
    &.modal-is-disabled {
      background-color: $--input-disabled-fill;
    }
    &.selectDisabled {
      background-color: $--color-secondary-disabled-background;
      // left: 1px; // 不加这个会导致树选择器前置标签禁用时遮挡住边线
    }
  }

  .el-input {
    display: flex;
    align-items: center;
    & .el-select__caret {
      color: $--color-text-3;
      font-size: $--select-input-font-size !important;
      transition: transform .3s;
      transform: rotateX(0deg);
      cursor: pointer;

      @include when(reverse) {
        transform: rotateX(180deg);
      }

      @include when(show-close) {
        font-size: $--select-font-size;
        text-align: center;
        transform: rotateX(180deg);
        border-radius: $--border-radius-circle;
        color: $--select-input-color;
        transition: $--color-transition-base;

        &:hover {
          color: $--select-close-hover-color;
        }
      }
    }

    .close-svg {
      width: 20px;
      height: 20px;
      line-height: 20px;
      // border-radius: 50%;
      border-radius: $--border-radius-circle;
      cursor: pointer;
      &:hover {
        background-color: $--color-secondary;
      }
    }

    
    &.is-readable {
      & .el-input__inner {
        cursor: pointer;
        color: $--color-text-regular;
        background: $--color-secondary-disabled-background;
        border-color: $--select-disabled-border;
        &:hover {
          border-color: $--select-disabled-border;
          background: $--color-secondary-disabled-background;
        }
      }
      & .el-input__inner::placeholder {
        color: $--color-info3;
      }
      .el-input__icon{
        cursor: pointer;
        color: $--color-text-3;
      }
    }
    &.is-disabled {
      & .el-input__inner {
        cursor: not-allowed;
        color: $--color-text-4;
        &:hover {
          border-color: $--select-disabled-border;
          background: $--color-secondary-disabled-background;
          // background-color: #F7F8FA;

          &::placeholder {
            color: $--color-info3;
          }
        }
        &+.el-input__suffix{
          i{
            color: $--color-text-4;
          }
        }
      }
    }
    &.is-focus .el-input__inner {
      border-color: $--select-input-focus-border-color;
    }
  }

  > .el-input {
    display: block;
  }

  @include e(input) {
    border: none;
    outline: none;
    padding: 0;
    margin-left: 12px;
    color: $--select-multiple-input-color;
    font-size: $--select-font-size;
    appearance: none;
    height: 28px;
    background-color: transparent;
    @include when(mini) {
      height: 14px;
    }
  }
  @include e(close) {
    cursor: pointer;
    position: absolute;
    top: 8px;
    z-index: $--index-top;
    right: 25px;
    color: $--select-input-color;
    line-height: 18px;
    font-size: $--select-input-font-size;

    &:hover {
      color: $--select-close-hover-color;
    }
  }

  @include m(large) {
    line-height: $--input-large-height;
  }

  @include m(medium) {
    line-height: $--input-medium-height;

    // .el-tag__close.el-icon-input-close {
    //   top: 7px;
    // }
  }

  @include m(small) {
    line-height: $--input-small-height;

    // .el-tag__close.el-icon-input-close {
    //   top: 5px;
    // }
  }
  .no-border {
    .el-input__inner {
      border: none;
      background-color: $--color-white !important;
    }
  }
}
.nofocus{
  display: inline-block!important;
  white-space: nowrap;
  font-size: 0;
}

// .el-select.el-select__multiple {
//   .el-select__tags {
//     left: 0!important;
//   }
// }
