/**
 *
 * This file may have been modified by Bytedance Inc. (“Bytedance Inc.'s Modifications”). 
 * All Bytedance Inc.'s Modifications are Copyright (year) Bytedance Inc..  
 * 
 * This source code is licensed under the Apache license.
 * See LICENSE file in the project root for license information.
 *
 */
@select-prefix-cls: ~'@{ant-prefix}-select';

// 搜索组件输入框隐藏
.@{ant-prefix}-select.sp-search-select {
  .@{ant-prefix}-select-selection-search-input {
    visibility: hidden !important;
  }
}

.@{ant-prefix}-select:not(.@{ant-prefix}-select-disabled):hover {
  &.@{ant-prefix}-select-allow-clear {
    .@{ant-prefix}-select-arrow:not(:last-child) {
      opacity: 0;
    }
  }
  &.@{ant-prefix}-select-customize-input {
    .@{ant-prefix}-select-selector {
      background: none;
    }
  }
}

// 输入框颜色调整
.@{ant-prefix}-select:not(.sp-null) {
  color: @color-text-icon-0;
  &.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selection-item {
    color: @color-text-icon-1;
  }
  &.@{ant-prefix}-select-sm {
    font-size: @font-size-sm;
  }
}

// 下拉时内容禁止透明
.@{ant-prefix}-select-single:not(.sp-null).@{ant-prefix}-select-open {
  .@{ant-prefix}-select-selection-item {
    color: @color-text-icon-3;
    opacity: 1;
  }
  &:not(.@{ant-prefix}-select-show-search) {
    .@{ant-prefix}-select-selection-item {
      color: @color-text-icon-0;
    }
  }
}

// 箭头旋转
.@{ant-prefix}-select-show-arrow.@{ant-prefix}-select-open {
  .@{ant-prefix}-select-arrow .@{iconfont-css-prefix}-down {
    transform: rotate(180deg);
  }
}

// placeholder 颜色
.@{ant-prefix}-select-selection-placeholder:not(.sp-null) {
  color: @color-text-icon-3;
  opacity: 1;
}

// 小箭头样式
.@{ant-prefix}-select-arrow:not(.sp-null) {
  color: @color-text-icon-2;
  transition: transform .3s;
}
// icon 大小
.@{ant-prefix}-select-arrow:not(.sp-null),
.@{ant-prefix}-select-clear:not(.sp-null) {
  width: @select-icon-size;
  height: @select-icon-size;
  font-size: @select-icon-size;
  top: calc(50% - 2px);
  right: 8px;
}

// 多选状态下
.@{ant-prefix}-select-multiple:not(.sp-null) {
  .@{ant-prefix}-select-selection-overflow {
    padding: 1px 0;
  }
  .@{ant-prefix}-select-selector {
    padding-left: @select-multiple-selector-padding-left;

    input {
      transition: none;
    }
  }
  // 已选内容样式
  .@{ant-prefix}-select-selection-item {
    font-size: @font-size-sm;
    color: @color-text-icon-0;
    background-color: @select-selection-item-bg;
    border-color: @select-selection-item-border-color;
    padding: @select-selection-item-padding;
    border-radius: @select-selection-item-border-radius;
    margin-right: @select-multiple-item-spacing-right;
    .sp-select-all-closeicon,
    .@{ant-prefix}-select-selection-item-remove {
      font-size: @select-icon-size - 2px;

      > .anticon {
        vertical-align: middle;
      }
    }
  }

  &.@{select-prefix-cls}-focused:not(.@{select-prefix-cls}-disabled) {
    .@{ant-prefix}-select-selection-item {
      background-color: @select-selection-active-item-bg;
    }
  }

  &.sp-select-all-tag {
    .@{ant-prefix}-select-selection-item-content {
      margin-right: 0;
    }

    .sp-select-all-closeicon {
      color: @color-text-icon-2;
      line-height: 1;
      vertical-align: middle;
    }

    .sp-select-all-tag-text {
      margin-right: 4px;
    }
  }

  &.@{ant-prefix}-select-lg {
    .@{select-prefix-cls}-selection-search {
      height: @select-multiple-item-height-lg;
      line-height: @select-multiple-item-height-lg;
    }
  }
  &.@{ant-prefix}-select-sm {
    .@{ant-prefix}-select-selector::after {
      line-height: @select-multiple-selection-height;
    }

    .@{ant-prefix}-select-selection-item {
      height: @select-multiple-selection-height;
      line-height: @select-multiple-selection-height - 2px;
    }

    .@{ant-prefix}-select-selection-search {
      height: @select-multiple-selection-height;
      line-height: @select-multiple-selection-height;

      &-input,
      &-mirror {
        height: @select-multiple-selection-height - 2px;
        line-height: @select-multiple-selection-height - 4px;
      }
    }

    .@{select-prefix-cls}-selection-search:first-child .@{select-prefix-cls}-selection-search-input {
      margin-left: 5px;
    }
  }
}

.@{ant-prefix}-select {

  &-item {

    &-option {

      &-selected:not(&-disabled) {
        .@{select-prefix-cls}-item-option-content {
          color: @select-item-selected-color;
        }
      }
    }
  }
}

// dropdown container
.@{ant-prefix}-select-dropdown {
  border: 1px solid @color-line-1;

  // 字体颜色
  .@{ant-prefix}-select-item:not(.@{ant-prefix}-select-item-option-disabled) {
    color: @color-text-icon-0;
  }
  .@{ant-prefix}-select-item:not(.@{ant-prefix}-select-item-option-disabled).@{ant-prefix}-select-item-group {
    color: @select-item-group-color;
  }

  // 多选状态

  &.sp-multiple-dropdown {
    // 单条数据样式
    .@{ant-prefix}-select-item {
      &:not(.@{ant-prefix}-select-item-option-disabled) {
        font-weight: normal;
      }
      &:not(.@{ant-prefix}-select-item-group) {
        padding-left: 36px;
        position: relative;
        &.@{ant-prefix}-select-item-option-disabled {

          &::before {
            background-color: @color-fill-deepen-4;
          }
        }
        &.@{ant-prefix}-select-item-option-selected {
          background-color: transparent;

          &::before {
            display: none;
          }
          &.@{ant-prefix}-select-item-option-active {
            background-color: @select-item-active-bg;
          }
          &.@{ant-prefix}-select-item-option-disabled {
            .@{ant-prefix}-select-item-option-content {
              color: @color-text-icon-1;
            }
            .@{ant-prefix}-select-item-option-state {
              opacity: .4;
            }
          }
          .@{ant-prefix}-select-item-option-state {
            position: absolute;
            top: 50%;
            transform: translate(0, -50%);
            left: 12px;
            width: @select-icon-size;
            height: @select-icon-size;
            font-size: @select-icon-size;
            border: none;
            border-radius: 2px;
            color: #fff;
            background-color: @color-primary-brand;
            .@{iconfont-css-prefix}-check {
              display: block;
            }
          }
        }
      }
    }

    // 未选中时的框
    .sp-select-all .select-all-checkbox,
    .@{ant-prefix}-select-item:not(.@{ant-prefix}-select-item-group)::before {
      content: '';
      position: absolute;
      display: block;
      width: @select-icon-size;
      height: @select-icon-size;
      top: 50%;
      left: 12px;
      transform: translate(0, -50%);
      border: 1px solid @color-line-0;
      border-radius: 2px;
      background-color: #fff;
      box-sizing: border-box;
    }

    // 选中时添加svg内容
    .sp-select-all .select-all-checkbox.select-all,
    .@{ant-prefix}-select-item:not(.@{ant-prefix}-select-item-group).@{ant-prefix}-select-item-option-selected
    .@{iconfont-css-prefix}-check {

      > svg > path {
        d: path(
          'M248.375 462.793C226.505 484.663 226.505 520.12 248.375 541.989L406.767 700.38C428.636 722.25 464.093 722.25 485.963 700.38L802.746 383.598C824.616 361.728 824.616 326.271 802.746 304.402C780.877 282.533 745.42 282.533 723.55 304.402L446.365 581.587L327.571 462.793C305.701 440.924 270.244 440.924 248.375 462.793Z'
        );
      }
    }

    // SPMultiple 组件

    .sp-multiple-select-divider {
      width: calc(100% - 16px);
      min-width: calc(100% - 16px);
      margin: 8px;
    }

    .sp-select-all {
      color: @color-text-icon-1;
      height: 32px;
      line-height: 32px;
      margin: 0;
      padding: 0 0 0 36px;
      position: relative;
      cursor: pointer;

      .select-all-checkbox {

        > svg {
          display: none;
        }

        &.select-all {
          border: none;
          color: #fff;
          line-height: @select-icon-size;
          background-color: @color-primary-brand;

          > svg {
            width: @select-icon-size;
            height: @select-icon-size;
            display: inline;
          }
        }
      }
    }
  }
  // SPSearch 组件

  &.sp-search-select-dropdown {

    .sp-select-search {
      margin: 0 12px 8px;
    }
  }

  .sp-select-more-loading {
    display: inline-flex;
    font-size: 16px;
    width: 32px;
    height: 32px;
    align-self: center;
    align-items: center;
    justify-content: center;
    color: @color-text-icon-3;
    overflow: hidden;

    > span {
      display: inline-flex;
      animation: loadingCircle 1s infinite linear;

      > svg.icon {
        width: 1em;
        height: 1em;
        vertical-align: -.15em;
        fill: currentColor;
        overflow: hidden;
      }
    }
  }
}

.@{ant-prefix}-select-single.@{ant-prefix}-select-customize-input:not(.sp-null)
.@{ant-prefix}-select-selector
.@{ant-prefix}-select-selection-placeholder {
  top: 1px;
  left: 1px;
  z-index: 1;
}
