@import './token.less';

@import './selections.less';
@import './result-list.less';

.@{ns}-Transfer2 {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  min-height: 400px;
  position: relative;
  overflow: hidden;

  &-searchbox {
    width: 100%;
  }

  &--inline {
    display: inline-flex;
    flex-wrap: nowrap;
  }

  &-title {
    display: flex;
    align-items: center;
    background: @Transfer2-title-bg;
    height: 30px;
    line-height: @Form-input-lineHeight;
    font-size: @Form-input-fontSize;
    padding: calc(
        (
          30px - @Form-input-lineHeight * @Form-input-fontSize)
           / 2
    )
    @size-1;
    flex-direction: row;
    border-radius: @border-radius @border-radius 0 0;

    &--light {
      background: transparent;
    }

    > span {
      flex-grow: 1;
    }
  }

  &-select {
    overflow: hidden;
  }

  &-select,
  &-result {
    width: 0;
    min-width: 200px;
    max-height: 400px;
    flex-grow: 1;
    border: @Form-input-borderWidth solid @Form-input-borderColor;
    display: flex;
    flex-direction: column;
    border-radius: @border-radius;
    .@{ns}-Tabs-pane,.@{ns}-Tabs-content{
      padding: 0 !important;
    }
    .@{ns}-Tabs-linksContainer-wrapper{
      height: 40px;
      border: 0 !important;
    }
  }

  &-select > &-selection,
  &-result > &-value {
    flex-grow: 1;
    max-height: 100%;
    overflow: auto;
    position: relative; // 貌似不加 relative 会有 bug。
    padding: 0;
  }

  &-select > .@{ns}-ChainedSelection {
    min-height: unset;
    overflow: hidden;

    .@{ns}-ChainedSelection-col {
      height: 100%;
      overflow: auto;
      min-width: unset;
      flex: 1 1 0;
    }
  }

  .@{ns}--ResultTreeList {
    border-top: 1px solid var(--color-border);
  }

  .@{ns}-AssociatedSelection {
    overflow: hidden;

    &-left,
    &-right {
      min-height: unset;
    }
  }

  &-select {
    overflow: hidden;
  }

  &-selection {
    .@{ns}-ListSelection-placeholder {
      height: 100%;
      display: flex;
      align-items: center;
      text-align: center;
      justify-content: center;
    }

    &.@{ns}-Tree,
    &.@{ns}-AssociatedSelection {
      .@{ns}-Tree-itemLabel.is-checked:hover,
      .@{ns}-Tree-itemLabel:hover {
        .@{ns}-Tree-itemLabel-item > .@{ns}-Tree-itemText {
          background-color: unset;
          &:active {
            background-color: unset;
          }
        }
      }

      .@{ns}-Tree-itemLabel-item {
        display: flex;
        align-items: center;

        > .@{ns}-Tree-itemText {
          max-width: unset;
          line-height: unset;
          top: unset;
        }
      }
    }
  }

  &-search {
    padding: @size-2;
  }

  &-mid {
    min-width: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  &-arrow {
    width: 40px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--color-border);
    margin: 0 10px;
    color: @icon-color;

    > svg {
      top: 0;
      width: 14px;
      height: 14px;
    }
  }

  &-checkAll,
  &-clearAll {
    user-select: none;
    cursor: pointer;

    &.is-disabled {
      pointer-events: none;
      color: var(--color-text-4);
    }
  }

  .@{ns}-Tree {
    padding: 2px 10px;

    &-itemLabel:hover::after {
      left: 0;
    }
  }
}


.@{ns}-TransferControl {
  position: relative;
  overflow: hidden;

  &.is-inline {
    display: inline-block;
  }
}

.@{ns}-TransferPicker {
  &-icon {
    transition: transform @animation-duration ease-out;
    margin: 5px 5px 5px auto;
    display: flex;
    color: inherit;
    &:hover {
      color: var(--primary);
    }

    > svg {
      width: 12px;
      height: 12px;
      top: 0;
    }
  }
}

.@{ns}-TransferDropDown {
  &:hover {
    border: 1px solid ver(--menu-active-color);
  }
  &-icon {
    transform: rotate(90deg);
    transition: transform @animation-duration ease-out;
    margin: 5px 0 5px auto;
    display: flex;
    color: inherit;
    &:hover {
      color: var(--primary);
    }

    > svg {
      width: 10px;
      height: 10px;
      top: 0;
    }
  }

  &.is-active &-icon {
    transform: rotate(-90deg);
  }
}
.@{ns}-TransferDropDown-content {
  min-width: 400px;
  display: flex;
  flex-direction: column;
  padding: @spacing-2 0;
  // height: 350px;

  &.is-mobile {
    width: 100%;
  }
  & > .@{ns}-Transfer2-selection {
    flex-grow: 1;
    // max-height: @Transfer2-selection-maxHeight;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative; // 貌似不加 relative 会有 bug。
  }
}
