@import url(../var.less);
@import url(common/transition.less);
@import url(./checkbox.less);

@tree-prefix: ~"@{prefix}tree";
@tree-node-prefix: ~"@{prefix}tree-node";

.@{tree-prefix}{
  position: relative;
  cursor: default;
  background: @color-white;
  color: @tree-font-color;

  &__empty-block {
    position: relative;
    min-height: 60px;
    text-align: center;
    width: 100%;
    height: 100%;
  }

  &__empty-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: @secondary-text-color;
    font-size: @font-size-base;
  }

  &__drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background-color: @primary-color;
  }

}

.@{tree-node-prefix} {
  white-space: nowrap;
  outline: none;
  &:focus { /* focus */
    > .w-tree-node__content {
      background-color: @tree-node-hover-background-color;
    }
  }

  &.is-drop-inner {
    > .w-tree-node__content .w-tree-node__label {
      background-color: @primary-color;
      color: #fff;
    }
  }

  &__content {
    display: flex;
    align-items: center;
    height: 26px;
    cursor: pointer;

    & > .w-tree-node__expand-icon {
      padding: 6px;
    }
    & > label.w-checkbox {
      margin-right: 8px;
    }
    &:hover {
      background-color: @tree-node-hover-background-color;
    }

    .w-tree.is-dragging & {
      cursor: move;

      & * {
        pointer-events: none;
      }
    }

    .w-tree.is-dragging.is-drop-not-allow & {
      cursor: not-allowed;
    }
  }

  &__expand-icon {
    cursor: pointer;
    color: @tree-expand-icon-color;
    font-size: 12px;

    transform: rotate(0deg);
    transition: transform 0.3s ease-in-out;

    &.expanded {
      transform: rotate(90deg);
    }

    &.is-leaf {
      color: transparent;
      cursor: default;
    }
  }

  &__label {
    font-size: @font-size-base;
  }

  &__loading-icon {
    margin-right: 8px;
    font-size: @font-size-base;
    color: @tree-expand-icon-color;
  }

  & > .w-tree-node__children {
    overflow: hidden;
    background-color: transparent;
  }

  &.is-expanded > .w-tree-node__children {
    display: block;
  }
}

.w-tree--highlight-current .w-tree-node.is-current > .w-tree-node__content {
  background-color: mix(@color-white, @primary-color, 92%);
}