@use 'sass:map';

@use 'mixins/mixins' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@include b(tree-select) {
  width: 100%;
  display: inline-block;
  line-height: map.get($input-height, 'default');
  min-height: map.get($input-height, 'default');
  position: relative;
  color: var(--el-text-color-regular);
  vertical-align: middle;

  @each $size in (large, small) {
    @include m($size) {
      font-size: map.get($input-font-size, $size);
      line-height: map.get($input-height, $size);
      min-height: map.get($input-height, $size);
    }
  }

  @include e(input) {
    padding: 0 10px;
    display: flex;
    line-height: inherit;
    min-height: inherit;
    width: 100%;
    outline: none;
    background-color: var(--el-fill-color-blank);
    box-shadow: 0 0 1px 1px inset var(--el-border-color);
    border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
    &:focus {
      border: 1px solid var(--el-color-primary);
    }
    @include when(disabled) {
      cursor: not-allowed;
      background-color: map.get($input-disabled, 'fill');

      @include e(text) {
        cursor: not-allowed;
        color: map.get($input-disabled, 'text-color');
        &::placeholder {
          color: map.get($input-disabled, 'text-color');
        }
      }

      @include e(tag) {
        cursor: not-allowed;
      }
      @include e(item) {
        cursor: not-allowed;
      }
      @include e(query) {
        cursor: not-allowed;
        color: map.get($input-disabled, 'text-color');
        &::placeholder {
          color: map.get($input-disabled, 'text-color');
        }
      }

      @include e(content) {
        cursor: not-allowed;
      }
    }

    @include when(tree-visible) {
      .#{$namespace}-icon {
        transform: rotate(180deg);
      }
    }

    @include e(prefix) {
      display: inline-block;
      color: var(--el-input-icon-color, var(--el-text-color-placeholder));
    }
  }

  @include e(text) {
    width: 100%;
    outline: none;
    border: none;
    padding: 0;
    color: inherit;
    background-color: transparent;

    &::placeholder {
      color: var(
        --el-input-placeholder-color,
        map.get($input, 'placeholder-color')
      );
      font-size: 14px;
    }
  }

  @include e(content) {
    flex: 10;
    min-height: 100%;
    position: relative;

    @include e(tag) {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: left;
      width: 100%;
      min-height: 100%;
      @include e(item) {
        margin: 2px 4px 2px 0;
        user-select: none;
      }
    }
  }

  @include e(tools) {
    position: relative;
    z-index: 2;
    padding: 2px 4px;
    background-color: getCssVar('fill-color', 'blank');
    margin-bottom: 6px;
  }

  @include e(query) {

  }

  @include e(icon) {
    min-height: inherit;
    height: inherit;
    transition: transform 0.15s;
    color: var(--el-input-icon-color, var(--el-text-color-placeholder));
    justify-content: right;
    @include e(close) {
      cursor: pointer;
    }
  }

  @include e(placeholder) {
    position: absolute;
    top: 50%;
    left: 0;
    font-size: 14px;
    transform: translateY(-50%);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;

    @include when('transparent') {
      color: var(--el-text-color-placeholder);
    }
  }
}
