@use 'sass:map';

@use './index.scss' as *;
@use '../mixins/mixins' as *;
@use '../common/var' as *;

@include b(dsh-select-dropdown) {
  @include e(control) {
    display: flex;
    @include e(reverse-span) {
      font-size: 12px;
    }
  }
  @include e(item) {
    font-size: map.get($select, 'font-size');
    // 20 as the padding of option item, 12 as the size of ✓ icon size
    padding: 0 12px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    color: map.get($select-option, 'text-color');
    height: map.get($select-option, 'height');
    line-height: map.get($select-option, 'height');
    box-sizing: border-box;
    cursor: pointer;

    @include when(disabled) {
      color: map.get($select-option, 'disabled-color');
      cursor: not-allowed;
    }

    .select-tag {
      display: none;
    }

    &.hover,
    &:hover {
      background-color: map.get($select-option, 'hover-background');

      .select-tag {
        display: inline-block;
        background: #005bf5;
        color: #fff;
        border-top: 0;
        padding-right: 8px;
        padding-left: 8px;
        width: -webkit-fit-content;
        width: -moz-fit-content;
        width: fit-content;
        margin-left: 10px;
        position: absolute;
        right: 8px;

        &::before {
          content: '';
          width: 0;
          height: 0;
          position: absolute;
          right: 84%;
          top: 0;
          border-left: solid 12px transparent;
          border-top: solid 16px #005bf5;
          border-right: solid 12px transparent;
          border-bottom: solid 16px #005bf5;
        }
      }
    }

    &.selected {
      color: map.get($select-option, 'selected-text-color');
    }
  }

  .el-select-pop-search-container {
    padding: 4px 8px;
    i {
      &.search-icon {
        position: absolute;
        top: 10px;
        left: 10px;
        color: #a6abb4;
        width: 14px;
        line-height: initial;
      }
    }
  }
}
