@color-disable: #d4d4d4;
@bgcolor-disable: #f5f5f5;
@greyborder: #d9d9d9;
@bluebg: #1890ff;

.treejs {
  box-sizing: border-box;
  font-size: 14px;

  *:after,
  *:before {
    box-sizing: border-box;
  }

  & > .treejs-node {
    padding-left: 0;
  }

  .treejs-nodes {
    list-style: none;
    padding-left: 20px;
    overflow: hidden;
    transition: height 150ms ease-out, opacity 150ms ease-out;
  }

  .treejs-node {
    cursor: pointer;
    overflow: hidden;

    &.treejs-placeholder {
      padding-left: 20px;
    }
  }

  .treejs-switcher {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    transition: transform 150ms ease-out;

    &:before {
      position: absolute;
      top: 8px;
      left: 6px;
      display: block;
      content: ' ';
      border: 4px solid transparent;
      border-top: 4px solid rgba(0, 0, 0, 0.4);
      transition: border-color 150ms;
    }
    &:hover:before {
      border-top: 4px solid rgba(0, 0, 0, 0.65);
    }
  }
  .treejs-node__close > .treejs-switcher {
    transform: rotate(-90deg);
  }
  .treejs-node__close > .treejs-nodes {
    height: 0;
  }

  .treejs-checkbox {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;

    &:before {
      transition: all 0.3s;
      cursor: pointer;
      position: absolute;
      top: 2px;
      content: ' ';
      display: block;
      width: 16px;
      height: 16px;
      border: 1px solid @greyborder;
      border-radius: 2px;
    }
    &:hover:before {
      box-shadow: 0 0 2px 1px @bluebg;
    }
  }
  .treejs-node__checked {
    & > .treejs-checkbox {
      &:before {
        background-color: @bluebg;
        border-color: @bluebg;
      }
      &:after {
        position: absolute;
        content: ' ';
        display: block;
        top: 4px;
        left: 5px;
        width: 5px;
        height: 9px;
        border: 2px solid #fff;
        border-top: none;
        border-left: none;
        transform: rotate(45deg);
      }
    }
  }
  .treejs-node__halfchecked {
    & > .treejs-checkbox {
      &:before {
        background-color: @bluebg;
        border-color: @bluebg;
      }
      &:after {
        position: absolute;
        content: ' ';
        display: block;
        top: 9px;
        left: 3px;
        width: 10px;
        height: 2px;
        background-color: #fff;
      }
    }
  }

  .treejs-node__disabled {
    cursor: not-allowed;
    color: rgba(0, 0, 0, 0.25);
    .treejs-checkbox {
      cursor: not-allowed;
      &:before {
        cursor: not-allowed;
        border-color: @greyborder !important;
        background-color: @bgcolor-disable !important;
      }
      &:hover:before {
        box-shadow: none !important;
      }
    }
    .treejs-node__checked {
      & > .treejs-checkbox {
        &:after {
          border-color: @greyborder;
        }
      }
    }
    .treejs-node__halfchecked {
      & > .treejs-checkbox {
        &:after {
          background-color: @greyborder;
        }
      }
    }
  }
  .treejs-node__disabled.treejs-node__checked {
    & > .treejs-checkbox {
      &:after {
        border-color: @greyborder;
      }
    }
  }
  .treejs-node__disabled.treejs-node__halfchecked {
    & > .treejs-checkbox {
      &:after {
        background-color: @greyborder;
      }
    }
  }

  .treejs-label {
    vertical-align: middle;
  }
}
