@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../checkbox/style/mixin';
@import './customize.less';

@yee-transfer-prefix-cls: ~'@{yee-prefix}-transfer';

@yee-transfer-header-vertical-padding: (@yee-transfer-header-height - 1px - @yee-font-size-base * @yee-line-height-base) /
  2;

.@{yee-transfer-prefix-cls} {
  .yee-reset-component;

  position: relative;

  &-disabled {
    .@{yee-transfer-prefix-cls}-list {
      background: @yee-transfer-disabled-bg;
    }
  }

  &-list {
    position: relative;
    display: inline-block;
    width: 180px;
    height: @yee-transfer-list-height;
    padding-top: @yee-transfer-header-height;
    vertical-align: middle;
    border: @yee-border-width-base @yee-border-style-base @yee-border-color-base;
    border-radius: @yee-border-radius-base;

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

    &-search {
      padding: 0 24px 0 @yee-control-padding-horizontal-sm;
      &-action {
        position: absolute;
        top: 12px;
        right: 12px;
        bottom: 12px;
        width: 28px;
        color: @yee-disabled-color;
        line-height: @yee-input-height-base;
        text-align: center;
        .@{yee-iconfont-css-prefix} {
          color: @yee-disabled-color;
          transition: all 0.3s;
          &:hover {
            color: @yee-text-color-secondary;
          }
        }
        span& {
          pointer-events: none;
        }
      }
    }

    &-header {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      // border-top is on the transfer dom. We should minus 1px for this
      padding: (@yee-transfer-header-vertical-padding - 1px) @yee-control-padding-horizontal
        @yee-transfer-header-vertical-padding;
      overflow: hidden;
      color: @yee-text-color;
      background: @yee-component-background;
      border-bottom: @yee-border-width-base @yee-border-style-base @yee-border-color-split;
      border-radius: @yee-border-radius-base @yee-border-radius-base 0 0;

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

      .@{yee-prefix}-checkbox-wrapper + span {
        padding-left: 8px;
      }
    }

    &-body {
      position: relative;
      height: 100%;
      font-size: @yee-font-size-base;

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

    &-body-with-search {
      padding-top: @yee-input-height-base + 24px;
    }

    &-content {
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: auto;
      list-style: none;
      > .LazyLoad {
        animation: transferHighlightIn 1s;
      }

      &-item {
        min-height: 32px;
        padding: 6px @yee-control-padding-horizontal;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        transition: all 0.3s;
        > span {
          padding-right: 0;
        }
        &-text {
          padding-left: 8px;
        }
      }

      &-item:not(&-item-disabled):hover {
        background-color: @yee-item-hover-bg;
        cursor: pointer;
      }

      &-item-disabled {
        color: @yee-btn-disable-color;
        cursor: not-allowed;
      }
    }

    &-body-not-found {
      position: absolute;
      top: 50%;
      width: 100%;
      padding-top: 0;
      color: @yee-disabled-color;
      text-align: center;
      transform: translateY(-50%);

      // with filter should offset the search box height
      .@{yee-transfer-prefix-cls}-list-body-with-search & {
        margin-top: @yee-input-height-base / 2;
      }
    }

    &-footer {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      border-top: @yee-border-width-base @yee-border-style-base @yee-border-color-split;
      border-radius: 0 0 @yee-border-radius-base @yee-border-radius-base;
    }
  }

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

    .@{yee-prefix}-btn {
      display: block;

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

      .@{yee-iconfont-css-prefix} {
        font-size: 12px;
      }
    }
  }
}

@keyframes transferHighlightIn {
  0% {
    background: @yee-primary-2;
  }
  100% {
    background: transparent;
  }
}
