@select-prefix-cls: ~"@{css-prefix}select";
@select-item-prefix-cls: ~"@{css-prefix}select-item";
@select-group-prefix-cls: ~"@{css-prefix}select-group";
// TODO 应定义在form.less
@form-prefix-cls: ~"@{css-prefix}form";
@form-item-prefix-cls: ~"@{form-prefix-cls}-item";

.@{select-prefix-cls} {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    vertical-align: middle;
    color: @text-color;
    font-size: @font-size-base;
    //position: relative;
    line-height: normal;

    &-timepicker{
        .haloe-select-dropdown{
            margin:8px 0;
        }
        .haloe-select-item{
            height:36px
        }
        .haloe-select-selected-value{
            font-size: 14px !important;
        }

    }
    &-selection {
        .haloe-select-suffix {
            color: @steps-wait-title-color;
        }
        display: block;
        box-sizing: border-box;
        outline: none;
        user-select: none;
        cursor: pointer;
        position: relative;

        background-color: @background-color-selection;
        border-radius: @btn-border-radius;
        border: 1px solid @color-scrollbar;
        transition: all @transition-time @ease-in-out;

        &:hover, &-focused {
            .hover();
            .@{select-prefix-cls}-arrow {
                display: inline-block;
            }
        }
    }

    &-arrow {
        .inner-arrow();
    }

    &-visible{
        .@{select-prefix-cls}-selection{
            .active();
        }

        .@{select-prefix-cls}-arrow {
            transform: translateY(-50%) rotate(180deg);
            display: inline-block;
        }
        .@{select-prefix-cls}-search {
            transform: translateY(-50%);
            display: inline-block;
        }
    }

    &-disabled {
        .@{select-prefix-cls}-selection {
            .disabled();

            .@{select-prefix-cls}-arrow {
                color: @slider-disabled-color;
            }

            &:hover {
                border-color: @border-color-base;
                box-shadow: none;

                .@{select-prefix-cls}-arrow {
                    display: inline-block;
                }
            }
        }
    }

    // 简约选择器：只有下边框，无圆角
    &-variant-simple {
        .@{select-prefix-cls}-selection {
            border: none;
            border-bottom: 1px solid @color-scrollbar;
            border-radius: 0;

            &:hover, &-focused {
                border: none;
                border-bottom: 1px solid @color-brand-primary;
            }
        }

        &.@{select-prefix-cls}-visible .@{select-prefix-cls}-selection {
            border: none;
            border-bottom: 1px solid @color-brand-primary;
            box-shadow: none;
        }

        &.@{select-prefix-cls}-disabled .@{select-prefix-cls}-selection {
            border: none;
            border-bottom: 1px solid @border-color-base;
        }

        // 覆盖各尺寸的圆角
        &.@{select-prefix-cls}-small .@{select-prefix-cls}-selection,
        &.@{select-prefix-cls}-middle .@{select-prefix-cls}-selection,
        &.@{select-prefix-cls}-large .@{select-prefix-cls}-selection {
            border-radius: 0;
        }
    }

    &-single &-selection{
        height: @input-height-base;
        position: relative;

        .@{select-prefix-cls}-placeholder{
            color: @input-placeholder-color;
        }

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            display: block;
            height: @input-height-base - 2px;
            line-height: @input-height-base - 2px;
            font-size: @font-size-base;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-left: 12px;
            padding-right: 24px;
        }
    }

    &-multiple &-selection{
        padding: 0 24px 0 4px;
        //min-height: @input-height-base;

        .@{select-prefix-cls}-placeholder{
            display: block;
            height: @input-height-base - 2px;
            line-height: @input-height-base - 2px;
            color: @input-placeholder-color;
            font-size: @font-size-base;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-left: 4px;
            padding-right: 22px;
        }
        .@{select-prefix-cls}-head-sum {
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
        .e-tag-no-border{
          border: none;
          margin: 6px 4px 6px 8px;
        //   color: @color-complementary-1 !important;
          background-color: @color-brand-primary-sec;
          .e-tag-text {
            color: @color-complementary-1;
          }
          .haloe-icon-close:before {
            color: @color-scrollbar;
          }
        }
    }
    &-default&-multiple &-selection{
        min-height: @input-height-base;
    }

    &-large&-single &-selection{
        height: @input-height-large;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-large ;
            line-height: @input-height-large ;
            font-size: @font-size-middle;
        }
    }

    &-large&-multiple &-selection{
        min-height: @input-height-large;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            min-height: @input-height-large ;
            line-height: @input-height-large ;
            font-size: @font-size-middle;
        }
    }

    &-small&-single &-selection{
        height: @input-height-small;
        border-radius: @btn-border-radius-small;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-small ;
            line-height: @input-height-small ;
        }
    }

    &-small&-multiple &-selection{
        min-height: @input-height-small;
        border-radius: @btn-border-radius-small;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: auto;
            min-height: @input-height-small ;
            line-height: @input-height-small ;
        }
    }

    // 新增的middle尺寸
    &-middle&-single &-selection{
        height: @input-height-middle;
        border-radius: @btn-border-radius-middle;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-middle ;
            line-height: @input-height-middle ;
            font-size: @font-size-middle;
        }
    }

    &-middle&-multiple &-selection{
        min-height: @input-height-middle;
        border-radius: @btn-border-radius-middle;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: auto;
            min-height: @input-height-middle ;
            line-height: @input-height-middle ;
            font-size: @font-size-middle;
        }
    }

    &-dropdown-list {
        //display: inline-block;
        min-width: 100%;
        list-style: none;
        margin-bottom: 5px;
        .@{select-group-prefix-cls}-wrap {
          .@{select-group-prefix-cls}-line {
            padding-bottom: 7px;
            margin-top: 9px;
          }
          &:first-child {
            .@{select-group-prefix-cls}-line {
              padding-bottom: 7px;
              margin-top: 0px;
              div {
                display: none;
              }
            }
          }
          .@{select-group-prefix-cls} {
            // padding-left: 20px;
            .@{select-item-prefix-cls} {
              padding-left: 30px;
            }
          }
        }
    }

    &-dropdown-list-footer {
      border-top: 1px solid #E9EBEF; // ★待定
      height: 36px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    &-dropdown-list-footer-create-item-content {
      padding-left: 10px;
      padding-right: 10px;
      width: 100%;
      display: flex;
    }

    &-dropdown-list-footer-create-item-title {
      // font-size: 12px;
      // color: @primary-color;
      // cursor: pointer;
      // button {
        display: flex;
        align-items: center;
        margin-left: -10px;
        i {
          transform: scale(0.8);
          margin-right: 3px;
        }
        span {
        //   margin-left: 0px;
        }
      // }
    }

    &-dropdown-list-footer-create-item-input {
      // width: 110px;
      flex: 1;
      margin-right: 17px;
    }

    & &-dropdown{
        width: auto;
        text-align: left;
        padding-top: 5px;
        .haloe-input {
            border:none;
            border-radius: 0px;
            border-bottom: 1px solid #dcdfe6; // ★待定
        }
    }
    &-dropdown-has-footer {
      overflow-y: hidden;
    }
    &-dropdown-has-footer &-dropdown-list{
      overflow: auto;
      max-height: 150px;
    }

    // input
    &-input{
        display: inline-block;
        height: @input-height-base;
        line-height: @input-height-base;
        padding: 0 24px 0 8px;
        font-size: @font-size-base;
        outline: none;
        border: none;
        box-sizing: border-box;
        color: @input-color;
        background-color: transparent;
        position: relative;
        cursor: pointer;
        .placeholder();

        &[disabled]{
            cursor: @cursor-disabled;
            color: @color-brand-disabled2;
            -webkit-text-fill-color: @color-brand-disabled2;  // #5249
        }
    }

    &-single &-input{
        width: 100%;
    }

    &-large &-input, &-large&-multiple &-input{
        // font-size: @font-size-large;
        height: @input-height-large - 6px;
        line-height: @input-height-large - 6px;
        top: 2px;
    }

    &-small &-input, &-small&-multiple &-input{
        height: @input-height-small - 6px;
        line-height: @input-height-small - 6px;
        top: 2px;
    }

    // 新增middle样式
    &-middle &-input, &-middle&-multiple &-input{
      height: @input-height-middle - 6px;
      line-height: @input-height-middle - 6px;
      top: 2px;
    }

    &-multiple &-input{
        height: @input-height-base - 6px;
        line-height: @input-height-base - 6px;
        padding: 0 0 0 4px;
        top: 2px;
    }

    &-not-found{
        margin: 17px 0;
        text-align: center;
        color: @btn-disable-color;
        li:not([class^=haloe-]){
            margin-bottom: 0;
        }
    }
    &-loading{
        text-align: center;
        color: @btn-disable-color;
    }

    &-multiple .@{css-prefix}tag{
        height: 24px;
        line-height: 22px;
        margin: 3px 4px 3px 0;
        max-width: 99%;
        position: relative;
        span:not(.haloe-select-max-tag){
            display: block;
            margin-right: 14px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        i{
            display: block;
            position: absolute;
            right: 4px;
            top: 6px;
        }
    }
    &-multiple-tag-hidden{
        margin-right: 0 !important;
    }

    &-large&-multiple .@{css-prefix}tag{
        height: 32px;
        line-height: 30px;
        font-size: @font-size-large;
        i{
            top: 9px;
        }
    }

    &-small&-multiple .@{css-prefix}tag{
        height: 17px;
        line-height: 15px;
        font-size: @font-size-small;
        padding: 0 6px;
        margin: 3px 4px 2px 0;
        span{
            margin-right: 14px;
        }
        i{
            top: 2px;
            right: 2px;
        }
    }

    // TODO 新增middle样式，根据实际效果修改
    &-middle&-multiple .@{css-prefix}tag{
      height: 32px;
      line-height: 30px;
      font-size: @font-size-large;
      i{
          top: 9px;
      }
    }

    &-dropdown-list {
        //display: inline-block;
        min-width: 100%;
        list-style: none;
    }

    &-dropdown-list-footer-create-item-content {
        padding-left: 10px;
        padding-right: 10px;
        width: 100%;
        display: flex;
      }

      &-dropdown-list-footer-create-item-title {
        // font-size: 12px;
        // color: @primary-color;
        // cursor: pointer;
        // button {
          display: flex;
          align-items: center;
          margin-left: -10px;
          i {
            transform: scale(0.8);
            margin-right: 3px;
          }
          span {
          //   margin-left: 0px;
          }
        // }
      }

      &-dropdown-list-footer-create-item-input {
        // width: 110px;
        flex: 1;
        margin-right: 17px;
      }

    & &-dropdown{
        width: inherit;
    }

    &-prefix{
        display: inline-block;
        vertical-align: middle;
        i{
            vertical-align: top;
        }
    }
    &-head-with-prefix{
        display: inline-block !important;
        vertical-align: middle;
    }
    &-single &-prefix{
        padding-left: 4px;
    }
    &-single &-head-with-prefix, &-multiple &-head-with-prefix{
        padding-left: 0 !important;
    }

    &-head-flex{
        display: flex;
        align-items: center;
    }

    &-multiple &-head-flex &-prefix{
        margin-right: 4px;
    }
}

.select-item(@select-prefix-cls, @select-item-prefix-cls);

.@{select-prefix-cls}-multiple .@{select-item-prefix-cls} {
    position: relative;
    &-selected{
        color: @selected-color;
        // background: #fff;
        background: @color-complementary-10;
    }
    &-focus,&-selected:hover{
        background: @background-color-select-hover;
    }

    &-selected&-focus {
        color: shade(@selected-color, 10%);
        background: @color-functional-white;
    }

    &-selected:after{
        .haloe-icon();
        float: right;
        font-size: @font-size-base;
        content: "\e698";
        color: @selected-color;
        position: absolute;
        top: 8px;
        right: 8px;
    }
    &-checkbox-label{
        margin-left: 5px;
    }
    &-selected.haloe-select-item-disabled{
        color: @btn-disable-color;
        &:after{
            color: @btn-disable-color;
        }
        &:hover{
            // background-color: #fff;
            background-color: @color-complementary-10;
        }
    }
}

.@{select-item-prefix-cls}-delete-icon{
    float: right!important;
    margin-right: 10px;
    &:hover{
      color: @primary-color;
    }
    margin-top: 2.5px;
}

.@{select-group-prefix-cls} {
    list-style: none;
    margin: 0;
    padding: 0;

    &-title {
        padding-left: 8px;
        font-size: 12px;
        color: @legend-color;
        height: 30px;
        line-height: 30px;
    }
}

.@{form-item-prefix-cls}-error{
    .@{select-prefix-cls}{
        &-selection{
            border: 1px solid @error-color;
        }
        &-arrow{
            color: @error-color;
        }
        &-visible .@{select-prefix-cls}-selection{
            .active-error;
        }
        // 简约选择器错误态：只有下边框
        &-variant-simple &-selection{
            border: none;
            border-bottom: 1px solid @error-color;
        }
        &-variant-simple&-visible .@{select-prefix-cls}-selection{
            border: none;
            border-bottom: 1px solid @error-color;
        }
    }
}

.@{select-prefix-cls}{
  ::-webkit-scrollbar {
    width: 6px;
    cursor: pointer;
  }
  ::-webkit-scrollbar-track {
    background-color: @color-scrollbar-track !important;
  }
  ::-webkit-scrollbar-thumb {
    background-color: @color-scrollbar !important;
    border-radius: 6px;
  }
}

// 定义lazy样式
.haloe-select-lazy{
  .haloe-select-dropdown{
    overflow: hidden;
    height: 200px;
  }
}

// 定义footer
.haloe-select-footer .haloe-select-dropdown{
  margin-bottom: 0px;
  padding-bottom:0px;
}
.haloe-select-slot-footer{
  position: sticky;
  bottom: 0px;
  // top:100px;
  // bottom: 10px;
  border-top: 1px solid @font-50;
  padding: 5px 12px;
  text-align: right;
  background: @color-functional-white;
  button+button {
    margin-left: 8px;
    margin-bottom: 0;
  }
}
.haloe-select-slot-cutome-nodata {
    color: @btn-disable-color;
    display: flex;
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    margin: 17px 0;
}
.haloe-select-option-no-data {
    &-icon {
        padding-top: 5px;
    }
    &-span {
        margin-left: 5px;
        vertical-align: middle;
        color: @color-complementary-5;
    }
}

.@{select-item-prefix-cls} {
    &-disabled {
        color: @color-icon-disable;
        &:hover {
            color: @color-icon-disable;
        }
    }
}
