@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../checkbox/style/mixin";
@import "../../button/style/mixin.less";

@transfer-prefix-cls: ~"@{dt-prefix}-transfer";
@checkbox-prefix-cls: ~"@{dt-prefix}-checkbox";

.@{transfer-prefix-cls} {
  .reset-component;
  position: relative;
  font-size: @transfer-font-size-base;
  color: @transfer-text-color;
  line-height: 1;

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

    .@{checkbox-prefix-cls} {
      top: -0.05em;
    }

    .@{checkbox-prefix-cls}-wrapper {
      font-size: @transfer-font-size-base;
    }

    .@{checkbox-prefix-cls}-wrapper + span,
    .@{checkbox-prefix-cls} + span {
      padding-left: @transfer-list-checkbox-text-padding;
      line-height: 22px;
    }

    &-with-footer {
      padding-bottom: @transfer-list-footer-height;
    }

    &-search {
      padding: 0 @control-padding-horizontal-sm;
      height: @transfer-list-search-height;
      font-size: @transfer-font-size-base;

      &:hover {
        border: @transfer-border-width-base @transfer-border-style-base @transfer-border-color-hover;
      }

      &-action {
        color: @transfer-list-search-action-color;
        position: absolute;
        top: 2px;
        right: 8px;
        bottom: 2px;
        line-height: @transfer-list-search-height;
        text-align: center;

        .@{iconfont-css-prefix} {
          transition: all .3s;
          color: @disabled-color;
          &:hover {
            color: @text-color-secondary;
          }
        }

        span& {
          pointer-events: none;
        }
      }
    }

    &-header {
      padding: @transfer-list-header-padding-vertical @transfer-list-padding-horizontal;
      border-radius: @transfer-border-radius-base @transfer-border-radius-base 0 0;
      background: @title-content-background;
      border-bottom: @transfer-border-width-base @transfer-border-style-base @transfer-border-color-base;
      overflow: hidden;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;

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

    &-body {
      position: relative;
      height: 100%;

      &-search-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        padding: @transfer-list-search-margin;
        width: 100%;
      }
    }

    &-body-with-search {
      padding-top: @transfer-list-search-height + 4px;
    }

    &-content {
      height: 100%;
      overflow: auto;
      list-style: none;
      padding: 0;
      margin: 0;

      > .LazyLoad {
        animation: transferHighlightIn 1s;
      }

      &-item {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: @transfer-list-item-padding-vertical @transfer-list-padding-horizontal;
        min-height: @transfer-list-item-height;
        transition: all .3s;

        > span {
          padding-right: 0;
        }
      }

      &-item + &-item {
        margin-top: 1px;
      }

      &-item-checked {
        background-color: #fff;
        > span {
          color: @transfer-list-item-color-checked;
        }
      }

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

      &-item-disabled {
        cursor: not-allowed;
        color: @transfer-list-item-color-disabled;
      }
    }

    &-body-not-found {
      padding-top: 0;
      color: @transfer-list-not-found-color;
      text-align: center;
      display: none;
      position: absolute;
      top: 50%;
      width: 100%;
      margin-top: -@transfer-font-size-base / 2;
    }

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

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

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

    .@{dt-prefix}-btn {
      display: block;
      font-size: 12px;

      .button-disabled(#696969;#f3f3f3);

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

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

@keyframes transferHighlightIn {
  0% {
    background: @transfer-list-item-background-hover;
  }
  100% {
    background: transparent;
  }
}
