@import './../theme/vars.scss';
@import './../mixins/icon.scss';
@import './../mixins/scrollbar.scss';

$transfer-prefix-cls: #{$vender-prefix}-transfer;
$transfer2PrefixCls: #{$vender-prefix}-transfer2;
$venderCls: $vender-prefix;

.#{$transfer-prefix-cls} {
  width: 100%;

  &-item {
    position: relative;
    display: block;
    padding: 5px 10px;
    margin-bottom: -1px;
    color: $transfer-color;
    text-decoration: none;
    cursor: pointer;
    background-color: white;
    border: 0;
    user-select: none;

    &:hover {
      color: $transfer-color;
      text-decoration: none;
      background-color: whitesmoke;
    }

    &.selected {
      color: $transfer-color;
      text-decoration: none;
      background-color: whitesmoke;
    }

    &.amos-transfer-item-nowrap {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  &-panel {
    padding: 0;
    margin-right: auto;
    margin-left: auto;
    text-align: center;
    word-wrap: break-word;
    white-space: nowrap;
    vertical-align: middle;

    &-inner-ctl {
      display: flex;
      align-items: center;
      flex-direction: column;
      justify-content: center;
    }

    .amos-btn {
      display: block;

      & + .amos-btn {
        margin-top: 1em;
        margin-left: 0;
      }
    }
  }

  &-search {
    position: absolute;
    top: 0;
    z-index: 2;
    display: block;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    pointer-events: none;
  }

  &-input {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    padding-left: 28px;
    font-size: 14px;
    line-height: 1.42857143;
    color: $transfer-input-color;
    background-color: white;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  &-table {
    margin-top: 10px;
    border: 1px solid #ececec;
    border-radius: 2px;

    &-content {
      // 设置 relative 是为了很方便的控制 其内容 item 的选中时自动滚动
      position: relative;
      height: 100%;
      overflow: auto;
    }
  }

  &-list-group {
    padding-left: 0;
    margin-bottom: 20px;
  }
}

// transfer2
.#{$transfer2PrefixCls} {
  position: relative;
  line-height: 1.5;

  &-list {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 200px;
    padding-top: 33px;
    font-size: 12px;
    vertical-align: middle;
    border: 1px solid #d9d9d9;
    border-radius: 4px;

    &-with-footer {
      padding-bottom: 33px;
    }

    &-search {
      &-action {
        position: absolute;
        top: 4px;
        right: 4px;
        bottom: 4px;
        width: 28px;
        font-size: 14px;
        line-height: 34px;
        color: rgba(0, 0, 0, 0.25);
        text-align: center;

        i[class*='icon'] {
          font-size: 16px;
          color: rgba(0, 0, 0, 0.25);
          transition: all 0.3s;

          &:hover {
            color: rgba(0, 0, 0, 0.43);
          }
        }

        span.#{$transfer2PrefixCls}-list-search-action {
          pointer-events: none;
        }
      }
    }

    &-header {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      padding: 7px 15px;
      overflow: hidden;
      color: rgba(0, 0, 0, 0.65);
      background: white;
      border-bottom: 1px solid #e9e9e9;
      border-radius: 4px 4px 0 0;

      .crisp-checkbox {
        margin-right: 6px;
      }

      &-title {
        position: absolute;
        right: 15px;
      }
    }

    &-body {
      position: relative;
      height: 100%;
      font-size: 12px;

      &-search-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 4px;
      }
    }

    &-body-with-search {
      padding-top: 34px;
    }

    &-content {
      @include pretty-scrollbar(6px, 6px, $scrollOutColor, $scrollInnerColor, 5px);

      height: 100%;
      overflow: auto;

      > .crisp-lazy {
        animation: transferHighlightIn 1s;
      }

      &-item {
        min-height: 32px;
        padding: 7px 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition: all 0.3s;

        .crisp-checkbox {
          margin-right: 6px;
        }
      }

      &-item:not(&-item-disabled):hover {
        cursor: pointer;
        background-color: rgba($primary-color, 0.1);
      }

      &-item-disabled {
        color: rgba(0, 0, 0, 0.25);
        cursor: not-allowed;
      }
    }

    &-body-not-found {
      position: absolute;
      top: 50%;
      display: none;
      width: 100%;
      padding-top: 0;
      margin-top: -10px;
      color: rgba(0, 0, 0, 0.25);
      text-align: center;
    }

    &-content:empty + &-body-not-found {
      display: block;
    }

    &-footer {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      border-top: 1px solid #e9e9e9;
      border-radius: 0 0 4px 4px;
    }
  }

  &-operation {
    display: inline-block;
    margin: 0 8px;
    overflow: hidden;
    vertical-align: middle;

    .#{$venderCls}-btn {
      display: block;
      padding: 0 6px;

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

      i[class*='icon'] {
        @include iconfont-size-under-12px(10px);

        margin-right: 0;
      }
    }
  }
}

@keyframes transferHighlightIn {
  0% {
    background: rgba($primary-color, 0.1);
  }

  100% {
    background: transparent;
  }
}

