@import (reference) "../theme/variables/antdVariables.less";
@select-prefix-cls: ~"@{ant-prefix}-select";

.ued-select-wrap {
  // empty block
}

.ued-select-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  // padding: 4px 0;
  border-radius: 2px;

  &-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
  }

  &-primary {
    color: @primary-color !important;
  }

  &-primary-remark-color {
    color: fade(@primary-color, 50%) !important;
  }

  &-label {
    max-width: 100%;
    color: @text-color;
    line-height: 24px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &-lightBackground,
  &-otherLightBackground {
    padding: 0 4px;
    background-color: fade(@primary-color, 10%);
    border-radius: 2px;
  }

  &-darkBackground,
  &-otherDarkBackground {
    padding: 0 4px;
    background-color: @primary-color;
    border-radius: 2px;
    color: #fff;
  }

  &-remark {
    width: 100%;
    margin-top: 2px;
    color: @text-color-secondary;
    line-height: 18px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

// 通用样式
.@{select-prefix-cls} {
  &-selection {
    &-item {
      color: @text-color;
    }
    &-item-content {
      white-space: normal !important;
    }

    &__rendered {
      margin-left: @control-padding-horizontal;
    }

    &.@{select-prefix-cls}-selection--single {
      .@{select-prefix-cls}-selection__rendered {
        margin-right: @input-affix-padding;
      }
    }

    &.@{select-prefix-cls}-selection--multiple {
      .@{select-prefix-cls}-selection__placeholder {
        margin-left: 0;
      }
    }
  }

  &-multiple {
    .@{select-prefix-cls}-selection-overflow {
      padding: 2px 0;
      &-item {
        line-height: 0;
      }
    }
    .@{select-prefix-cls}-selector {
      padding: 1px 8px;
    }

    .ued-select-item {
      &-lightBackground,
      &-otherLightBackground {
        padding: 0 15px 0 4px;
      }

      &-darkBackground,
      &-otherDarkBackground {
        padding: 0 15px 0 4px;
      }
    }
    .ued-multiple-select-tag {
      position: relative;
      max-width: 100%;
      margin-right: 4px;
      padding: 0 22px 0 4px;
      color: @text-color;
      font-size: 14px;
      line-height: 24px;
      background-color: fade(@text-color, 6%);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      border: 0;
      border-radius: 2px;

      .anticon-close {
        position: absolute;
        top: 50%;
        right: 4px;
        transform: translateY(-50%);
        color: @text-color-secondary;
        svg {
          width: 14px;
          height: 14px
        }
      }
    }
    .lightBackground {
      .ued-multiple-select-tag;

      padding: 0;
      padding-right: 4px;
      background-color: fade(@primary-color, 10%);
      .ued-select-item-lightBackground {
        background-color: transparent !important;
      }
    }
    .darkBackground {
      .ued-multiple-select-tag;

      padding: 0;
      padding-right: 4px;
      background-color: @primary-color;
      color: #fff;
    }

    .jsx {
      .ued-multiple-select-tag;
      padding: 0;
      background-color: transparent;
    }

    .ued-select-checked-tag {
      position: relative;
      display: flex;
      flex: none;
      box-sizing: border-box;
      max-width: 100%;
      height: 24px;
      margin-top: 2px;
      margin-bottom: 2px;
      line-height: 22px;
      background: #f5f5f5;
      border: 1px solid #d8e0ec;
      border-radius: @border-radius-sm;
      cursor: default;
      transition: font-size 0.3s, line-height 0.3s, height 0.3s;
      user-select: none;
      margin-inline-end: 4px;
      padding-inline-start: 8px;
      padding-inline-end: 4px;
      font-size: @font-size-base;

      .anticon-close {
        display: flex;
        align-items: center;
        color: rgba(0, 0, 0, 0.45);
        font-weight: bold;
        font-size: 14px;
        cursor: pointer;
      }
    }
  }

  &-arrow {
    right: @control-padding-horizontal;
  }

  &-item {
    // &:not(:first-child) {
    //   margin-top: 2px;
    // }
    &.ued-check-all.@{select-prefix-cls}-item-option-disabled {
      cursor: pointer;
      color: @text-color !important;

      &:hover {
        background-color: fade(@primary-color, 6);
      }

      &.ued-check-all-checked {
        font-weight: 500;
        background-color: fade(@primary-color, 6);

        .@{select-prefix-cls}-item-option-content {
          display: flex;

          .ued-check-all-content {
            flex: 1;
            display: flex;
            justify-content: space-between;
            align-items: center;
          }

          .ued-check-all-option {
            color: @primary-color;
          }
        }
      }
    }
  }
}

// 下拉选择：悬浮框独立div渲染的样式
.@{select-prefix-cls}-dropdown {
  border-radius: 2px;

  .@{select-prefix-cls}-item-option-active {
    &:not(.@{select-prefix-cls}-item-option-disabled) {
      background-color: @dropdown-hover-bg;
    }
  }

  .@{select-prefix-cls}-item.@{select-prefix-cls}-item-option-selected {
    &:not(.@{select-prefix-cls}-item-option-disabled) {
      color: @text-color;
      background-color: @dropdown-selected-bg;
      font-weight: normal;
      .@{select-prefix-cls}-item-option-state {
        margin-left: 8px;
        align-content: center;
      }
    }
  }

  &-menu {
    max-height: 240px;

    &-item {
      height: 36px;
      padding: 6px 16px;
      line-height: 24px;

      &-selected {
        color: @primary-color;
      }
    }

    &::-webkit-scrollbar {
      width: 3px;
    }
  }
}

.@{select-prefix-cls}-dropdown--empty {
  .@{select-prefix-cls}-dropdown-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;

    .@{select-prefix-cls}-dropdown-menu-item {
      height: auto;
    }
  }
}
