@use "common/var" as *;
@use "mixins/mixins" as *;
@use "mixins/function.scss" as *;

@include b(select) {
  position: relative;
  vertical-align: middle;
  line-height: 1;
  white-space: nowrap;
  display: flex;
  padding: 10px;
  justify-content: center;
  align-items: center;
  line-height: 1;
  width: calc(100% - 71px);
  margin: auto;
  @include e(text) {
    width: auto;
    margin-right: 20px;
    font-size: getCssVar("font-size", "base");
    color: getCssVar("text-color", "regular");
    height: 30px;
    line-height: 30px;
  }
  @include e(content) {
    flex: 1;
    position: relative;
  }
  @include e(input) {
    width: calc(100% - 17px);
    height: 30px;
    line-height: 30px;
    color: getCssVar("text-color", "regular");
    font-size: getCssVar("font-size", "base");
    border: 1px solid getCssVar("border-color", "light");
    outline: none;
    border-radius: getCssVar("border-radius", "base");
    text-indent: 0.8em;
    padding-right: 15px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    background: transparent;
    &::-webkit-input-placeholder {
      color: #a8abb2;
    }
    &:focus {
      border: 1px solid getCssVar("color-primary");
    }
  }
  @include e(required) {
    color: red;
  }

  @include e(icon) {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    line-height: 30px;
    cursor: pointer;
    width: 25px;
    text-align: center;
  }
  @include when(disabled) {
    &,
    &:hover,
    &:focus {
      cursor: not-allowed;
    }
    @include e(input) {
      cursor: not-allowed;
      color: getCssVar("text-color", "placeholder");
    }
    @include e(icon) {
      cursor: not-allowed;
    }
    @include e(content) {
      background-color: var(--el-disabled-bg-color);
      box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
    }
  }
  @include e(option) {
    width: 100%;
    height: auto;
    max-height: 500px;
    min-height: 35px;
    background: #ffffff;
    box-sizing: border-box;
    overflow: auto;
    border: 1px solid getCssVar("border-color", "light");
    position: absolute;
    z-index: 999;
    list-style: none;
    top: 2em;
    padding: 0;
    margin: 0;
    padding-left: 0.8em;
  }
  @include e(option-item) {
    cursor: pointer;
    background: #ffffff !important;
    color: getCssVar("text-color", "regular");
    height: 2.1em;
    line-height: 2.1em;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: getCssVar("font-size", "base");
    text-align: left;
    @include when(active) {
      &,
      &:hover,
      &:focus {
        color: getCssVar("color-primary");
        background: #ffffff;
      }
    }
  }
  @include e(option-check) {
    display: flex;
    flex-direction: column;
  }
}
