@import 'theme/default';
@import 'theme/font';
@import './animation';

.zent-tree {
  @include theme-color(color, stroke, 1);
  font-size: $font-size-normal;

  ul,
  li {
    list-style: none;
  }

  ul {
    padding-left: 20px;
  }

  .tree-node-loading-wrapper {
    @include theme-color(background-color, stroke, 9);
    display: inline-block;
    position: relative;
    vertical-align: middle;

    .tree-node-loading {
      @include theme-color(border-color, primary, 4);
      display: inline-block;
      height: 10px;
      width: 10px;
      border-radius: 50%;
      margin-right: 5px;
      border-width: 1px;
      border-style: solid;

      &:after {
        @include theme-color(background, stroke, 9);
        content: '';
        display: inline-block;
        position: absolute;
        height: 10px;
        width: 4px;
        animation: 2s linear zent-cp-ani-spin infinite;
        transform-origin: 10px 4px;
        left: -1px;
        top: 6px;
      }
    }
  }
}

.zent-tree.zent-tree-large {
  font-size: $font-size-large;

  .zent-tree-bar {
    .zent-tree-switcher {
      line-height: 20px;

      &:after {
        border: 6px solid transparent;
        border-left-width: 9px;
        @include theme-color(border-left-color, stroke, 6);
      }
    }
  }
}

.zent-tree.zent-tree-small {
  font-size: $font-size-small;

  .zent-tree-bar {
    .zent-tree-switcher {
      line-height: 12px;

      &:after {
        border: 4px solid transparent;
        border-left-width: 6px;
        @include theme-color(border-left-color, stroke, 6);
      }
    }
  }
}

.zent-tree-bar {
  position: relative;

  .zent-tree-switcher {
    position: absolute;
    top: 2px;
    left: -18px;
    width: 16px;
    height: 16px;
    line-height: 18px;
    display: inline-block;
    vertical-align: middle;
    border: 0 none;
    cursor: pointer;
    outline: none;

    &:after {
      @include theme-color(color, stroke, 2);
      content: '';
      display: inline-block;
      border: 5px solid transparent;
      border-left-width: 7px;
      @include theme-color(border-left-color, stroke, 6);
      transform: rotate(90deg);
      transform-origin: 23.09% 50%;
      transition: transform 0.3s ease;
    }
  }

  &.zent-tree-bar--off {
    .zent-tree-switcher {
      &:after {
        transform: rotate(0deg);
      }
    }
  }

  .zent-tree-node {
    display: inline-block;
    line-height: 1.42857143;
    cursor: pointer;

    .zent-tree-content {
      margin-left: -4px;
      padding: 0 4px;
      display: inline-block;
      border: 1px solid transparent;
      border-radius: 4px;
      background-color: transparent;
      transition: all 0.3s ease-in-out;

      &:hover {
        @include theme-color(background-color, primary, 8);
      }
    }

    .zent-tree-operation-container {
      @include theme-color(color, stroke, 1);
      display: inline-block;
      margin-left: 10px;
      opacity: 0;
      font-size: 0.8em;
      transition: opacity 0.3s ease-in;

      & > span.zent-tree-operation:not(:last-of-type) {
        @include theme-color(border-left-color, stroke, 6);
        margin-right: 8px;
        padding-right: 8px;
        border-left-width: 2px;
        border-left-style: solid;
      }
    }
  }

  &:hover {
    .zent-tree-node .zent-tree-operation-container {
      opacity: 1;
    }
  }

  .zent-checkbox-wrap {
    margin-top: -5px;
  }
}

.zent-tree-child {
  overflow: hidden;
}
