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

.zent-tree {
  color: $theme-stroke-1;
  font-size: 18px;

  ul,
  li {
    list-style: none;
  }

  ul {
    padding-left: 26px;
  }

  .tree-node-loading-wrapper {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    background-color: white;

    .tree-node-loading {
      display: inline-block;
      height: 16px;
      width: 16px;
      border-radius: 50%;
      border: 1px solid $theme-primary-2;

      &:after {
        content: '';
        display: inline-block;
        position: absolute;
        height: 10px;
        width: 4px;
        background: white;
        animation: 2s linear rotate infinite;
        transform-origin: 10px 4px;
        left: -1px;
        top: 6px;
      }
    }
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.zent-tree.zent-tree-large {
  font-size: 20px;

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

      &:after {
        border: 6px solid transparent;
        border-left: 9px solid $theme-stroke-7;
      }
    }
  }
}

.zent-tree.zent-tree-small {
  font-size: 14px;

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

      &:after {
        border: 4px solid transparent;
        border-left: 6px solid $theme-stroke-7;
      }
    }
  }
}

.zent-tree-bar {
  position: relative;

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

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

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

  &:hover {
    .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 {
        background-color: $theme-primary-6;
      }
    }

    .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) {
        margin-right: 8px;
        padding-right: 8px;
        border-right: 2px solid $theme-stroke-7;
      }
    }
  }

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

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