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

.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 {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    background-color: white;

    .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 {
        content: '';
        display: inline-block;
        position: absolute;
        height: 10px;
        width: 4px;
        background: white;
        animation: 2s linear zent-ani-spin infinite;
        transform-origin: 10px 4px;
        left: -1px;
        top: 6px;
      }
    }
  }
}

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

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

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

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

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

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

.zent-tree-bar {
  position: relative;

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

  &.off {
    .switcher {
      &:after {
        transform: rotate(0deg);
      }
    }
  }

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

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

    .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);
      }
    }

    .operation {
      display: inline-block;
      margin-left: 10px;
      opacity: 0;
      font-size: 0.8em;
      color: black;
      transition: opacity 0.3s ease-in;

      & > span.opt: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;
      }
    }
  }

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

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