.#{$ns}TreeControl {
  position: relative;
  border: 1px solid var(--Form-input-borderColor);
  border-radius: 2px;
  max-height: 300px;
  overflow: auto;
  overflow: hidden;

  .tree-spinner{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    z-index: 5;
  }

  &.h-full {
    max-height: none;
    overflow: visible;
  }

  &.no-border {
    border: 0;
  }
}

.#{$ns}Tree {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  &-list-wrap{
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
  }

  &-placeholder{
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &-list,
  &-sublist {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  &-list{
    padding: 0 6px 50px;
  }

  &-sublist {
    margin-left: var(--Tree-indent);
  }

  &-sublist.is-folded {
    display: none;
  }

  &-item {
    line-height: var(--Tree-itemHeight);
    position: relative;

    > div {
      &:hover {
        text-decoration: none;

        > .#{$ns}Tree-item-icons {
          visibility: visible;
        }
      }

      > span > svg {
        display: inline-block;
        cursor: pointer;
        position: relative;
        top: 2px;
        width: px2rem(16px);
        height: px2rem(16px);
        margin-left: var(--Tree-icon-gap);
      }
    }
  }

  &.is-disabled {
    pointer-events: none;
  }

  &.is-draggable {
    position: relative;
  }

  &--outline &-sublist &-item--isLeaf {
    &:before {
      position: absolute;
      top: -8px;
      left: calc((var(--Tree-indent) - 5px) * -1);
      bottom: 0px;
      border-left: 1px solid var(--borderColor);
      content: '';
    }
  }

  &-rootItem {
    line-height: var(--Tree-itemHeight);
  }

  &-item > div:hover > .#{$ns}Tree-item-icons,
  &-rootItem > div:hover > .#{$ns}Tree-item-icons {
    visibility: visible;
  }

  &-itemLabel {
    display: flex;
    align-items: center;
    position: relative;
    user-select: none;
    margin-bottom: px2rem(4px);
    padding-left: var(--Tree-icon-gap);
    & > * {
      position: relative;
      z-index: 2;
    }
    > .#{$ns}Checkbox {
      display: inline-flex;
      align-self: center;
    }
  
    &:hover {
      background: var(--Tree-item-onHover-bg-pure);
    }
  }

  &-item {
    .is-checked {
      background: var(--Tree-item-onChekced-bg);
      border-radius: var(--Tree-item-onChekced-bg-borderRadius);
      color: white;
      .#{$ns}Tree-itemText{
        color: white;
      }
      
      .#{$ns}Tree-itemIcon{
        color: white;
      }
      .#{$ns}Tree-item-icons > span{
        color: white;
      }
      .#{$ns}Tree-itemArrow polygon{
        fill: white
      }
    }
    .is-disabled {
      color: var(--text--muted-color);
      background: none;
      &:hover {
        background: none;
      }
    }
  }

  &.is-draggable &-itemLabel:hover::after {
    display: none;
  }

  &-item-icons {
    visibility: hidden;
    transition: visibility var(--animation-duration) ease;
    display: inline-block;
    vertical-align: top;
    height: var(--Tree-itemHeight);
    line-height: var(--Tree-itemHeight);
    padding-right: var(--Tree-icon-gap);

    > span {
      display: inline-block;
      vertical-align: middle;
      margin-left: var(--Tree-icon-gap);
      color: var(--primary);
      cursor: pointer;

      > svg {
        $svgSize: px2rem(12px);
        width: $svgSize;
        height: $svgSize;
        top: 0;
      }
    }
  }

  &-itemInput {
    padding-left: var(--Tree-itemArrowWidth);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;

    > a {
      display: inline-block;
      cursor: pointer;
      margin-left: var(--Tree-icon-gap);
      color: var(--icon-color);

      &:hover {
        color: var(--icon-onHover-color);
        text-decoration: none;
      }
    }

    > input {
      flex-grow: 1;
      width: 100%;
      outline: none;
      background: var(--Form-input-bg);
      border: var(--Form-input-borderWidth) solid var(--Form-input-borderColor);
      border-radius: var(--Form-input-borderRadius);
      line-height: var(--Form-input-lineHeight);
      padding: calc(
          (
              var(--Tree-inputHeight) - var(--Form-input-lineHeight) *
                var(--Form-input-fontSize) - #{px2rem(2px)}
            ) / 2
        )
        var(--Form-input-paddingX);
      font-size: var(--Form-input-fontSize);

      &::placeholder {
        color: var(--Form-input-placeholderColor);
        user-select: none;
      }

      &:focus {
        border-color: var(--Form-input-onFocused-borderColor);
        box-shadow: var(--Form-input-boxShadow);
        background: var(--Form-input-onFocused-bg);
      }
    }
  }

  &-addTopBtn {
    cursor: pointer;
    color: var(--primary);
    height: var(--Tree-itemHeight);
    line-height: var(--Tree-itemHeight);
    display: block;

    &:hover {
      text-decoration: none;
    }

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

    > svg {
      $svgSize: px2rem(14px);
      width: $svgSize;
      height: $svgSize;
      top: $svgSize * 0.125;
      margin-right: var(--Tree-icon-gap);
    }
  }

  &-itemArrow {
    cursor: pointer;
    width: var(--Tree-itemArrowWidth);
    display: inline-flex;
    margin-right: var(--Tree-icon-margin-right);

    // &:before {
    //   font-style: normal;
    //   font-family: $Tree-arrowVendor;
    //   content: $Tree-unfoldedArrowContent;
    // }
    > svg {
      width: var(--Tree-itemArrowWidth);
      height: var(--Tree-itemArrowWidth);
      display: block;
      transition: transform var(--animation-duration);
      top: 0;
    }

    &.is-folded > svg {
      transform: rotate(-90deg);
    }
  }

  &-itemArrowPlaceholder {
    display: inline-block;
    width: calc(var(--Tree-itemArrowWidth) + var(--Tree-icon-gap));
  }

  &-itemDrager {
    cursor: move;
    color: var(--icon-color);
  }

  &-spinner {
    margin-right: var(--Tree-icon-gap);
  }

  &-itemIcon {
    display: inline-flex;
    color: var(--primary);
    margin-right: var(--Tree-icon-gap);
  }

  &-rootIcon,
  &-folderIcon,
  &-leafIcon {
    > svg {
      top: 0;
      width: px2rem(14px);
      height: px2rem(14px);
    }
  }
    

  &-itemText {
    cursor: pointer;
    flex: 1 auto;
    color: var(--Form-input-color);
    line-height: var(--lineHeightBase);
  }
  .is-disabled &-itemText {
    color: var(--text--muted-color);
  }

  &-placeholder {
    color: var(--text--muted-color);
  }

  &-dropIndicator {
    position: absolute;
    height: px2rem(2px);
    background-color: var(--Tree-itemLabel--onChecked-color);
    border-radius: px2rem(1px);
    z-index: 1;

    &::after {
      position: absolute;
      top: px2rem(-3px);
      left: px2rem(-6px);
      width: px2rem(8px);
      height: px2rem(8px);
      background-color: transparent;
      border: px2rem(2px) solid var(--Tree-itemLabel--onChecked-color);
      border-radius: 50%;
      content: '';
    }

    &--hover {
      border-radius: 0;
      background-color: var(--Tree-item-onHover-bg-pure);

      &::after {
        display: none;
      }
    }
  }

  .#{$ns}Transfer-search{
    flex: 1;
  }
}
