@import "mixins/mixins";
@import "mixins/utils";
@import "common/var";
@import "input";
@import "button";
@import "checkbox";
@import "checkbox-group";

@include b(transfer) {
  font-size: $--font-size-base;

  @include e(buttons) {
    display: inline-block;
    vertical-align: middle;
    padding: 0 16px;
  }

  .el-transfer__button {
    display: block;
    margin: 0 auto;
    padding: 8px 8px;
    color: $--color-white;
    background-color: $--color-primary;
    font-size: 0;

    @include when(with-texts) {
      border-radius: $--border-radius-base;
    }

    @include when(disabled) {
      border: $--border-base;
      background-color: $--background-color-base;
      color: $--color-text-placeholder;

      &:hover {
        border: $--border-base;
        background-color: $--background-color-base;
        color: $--color-text-placeholder;
      }
    }

    &:first-child {
      margin-bottom: 16px;
    }

    &:nth-child(2) {
      margin: 0;
    }

    i,
    span {
      font-size: 14px;
    }

    & [class*="bi-iconfont-"] {
      margin-left: 0;
    }

    &>.el-button__content {
      .el-button__slot span+.bi-iconfont-chevron-right {
        margin-left: 8px;
      }
    }
  }
}

@include b(transfer-panel) {
  border: 1px solid $--transfer-border-color;
  border-radius: $--transfer-border-radius;
  overflow: hidden;
  background: $--color-white;
  display: inline-block;
  vertical-align: middle;
  width: $--transfer-panel-width;
  max-height: 100%;
  box-sizing: border-box;
  position: relative;

  @include e(body) {
    height: $--transfer-panel-body-height;

    @include when(with-footer) {
      padding-bottom: $--transfer-panel-footer-height;
    }
  }

  @include e(list) {
    margin: 0;
    list-style: none;
    height: $--transfer-panel-body-height;
    overflow: auto;
    box-sizing: border-box;

    @include when(filterable) {
      height: #{$--transfer-panel-body-height - $--transfer-filter-height};
      padding-top: 0;
    }
  }

  @include e(item) {
    height: $--transfer-item-height;
    line-height: $--transfer-item-height;
    padding-left: 12px;
    display: block !important;

    &+.el-transfer-panel__item {
      margin-left: 0;
    }

    &.el-checkbox {
      margin-right: 24px;
      color: $--color-text-regular;
      &:last-of-type {
        margin-right: 24px;
      }
    }

    &:hover {
      color: $--color-primary;
    }

    &.el-checkbox .el-checkbox__label {
      width: 100%;
      @include utils-ellipsis;
      display: block;
      box-sizing: border-box;
      padding-left: 22px;
      line-height: $--transfer-item-height;
      .el-text-tooltip {
        white-space: pre-wrap;
      }
    }

    .el-checkbox__input {
      position: absolute;
      top: 13px;
    }
  }

  @include e(filter) {
    text-align: center;
    margin: 12px;
    margin-bottom: 8px;
    box-sizing: border-box;
    display: block;
    width: auto;

    .el-input__inner {
      height: $--transfer-filter-height;
      width: 100%;
      font-size: 14px;
      display: inline-block;
      box-sizing: border-box;
      border-radius: 4px;
      padding-right: 10px;
      padding-left: 30px;
    }

    .el-input__icon {
      font-size: 14px;
    }

    .bi-iconfont-close-circle-fill {
      cursor: pointer;
    }
  }

  .el-transfer-panel__header {
    display: flex;
    align-items: center;
    width: 100%;
    height: $--transfer-panel-header-height;
    line-height: $--transfer-panel-header-height;
    background: $--transfer-panel-header-background-color;
    margin: 0;
    padding-left: 12px;
    border-bottom: 1px solid $--transfer-border-color;
    box-sizing: border-box;
    color: $--color-black;

    .el-checkbox {
      display: flex;
      align-items: center;
      width: 100%;

      .el-checkbox__label {
        display: flex;
        width: 100%;
        .el-text-tooltip {
          width: calc(100% - 74px);
          white-space: pre-wrap;
          span {
            font-size: 14px;
            color: $--color-text-regular;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
          }
        }

        &>span {
          position: absolute;
          right: 12px;
          color: $--color-text-secondary;
          font-size: 12px;
          font-weight: normal;
        }
      }
    }
  }

  .el-transfer-panel__footer {
    height: $--transfer-panel-footer-height;
    background: $--color-white;
    margin: 0;
    padding: 0;
    border-top: 1px solid $--transfer-border-color;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: $--index-normal;
    @include utils-vertical-center;

    .el-checkbox {
      padding-left: 22px;
      color: $--color-text-regular;
    }
  }

  .el-transfer-panel__empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: $--color-text-secondary;
  }

  .el-checkbox__label {
    padding-left: 8px;
  }

  .el-checkbox__inner {
    height: 14px;
    width: 14px;
    border-radius: 4px;

    &::after {
      height: 6px;
      width: 3px;
      left: 4px;
    }
  }
}