@mixin buildingDisciplinesNode() {
  $base: "esri-building-disciplines-tree-node";
  $root: "#{$base}--root";
  $leaf: "#{$base}--leaf";
  $label: "#{$base}__label";
  $checkbox: "#{$base}__checkbox";
  $checkbox--checked: "#{$base}__checkbox--checked";
  $checkbox--indeterminate: "#{$base}__checkbox--indeterminate";
  $collapse-toggle: "#{$base}__collapse-toggle";
  $collapse-toggle--collapsed: "#{$base}__collapse-toggle--collapsed";
  $children: "#{$base}__children";

  $collapse-toggle-size: 18px;
  $collapse-toggle-icon-size: 10px;

  $checkbox-size: 14px;
  $checkbox-border-size: 1px;
  $checkbox-icon-size: 10px;

  $max-levels: 5;
  $indent-size: $side-spacing--three-quarters;

  @for $level from 1 through $max-levels {
    .#{$base}--level-#{$level} {
      $padding: $indent-size * ($level - 1);

      padding-left: $padding;

      &.#{$leaf} {
        padding-left: $padding + $collapse-toggle-size;
      }
    }
  }

  .#{$label} {
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    padding-top: $side-spacing--quarter;
    padding-bottom: $side-spacing--quarter;
    font-size: $font-size;
    font-weight: $font-weight--light;

    span {
      min-width: 0;
      word-break: break-word;
      text-wrap: pretty;
    }
  }

  .#{$collapse-toggle} {
    appearance: none;
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.1s ease-in-out;
    margin: 0;
    border: none;
    background: none;
    padding: ($collapse-toggle-size - $collapse-toggle-icon-size) * 0.5;
    width: $collapse-toggle-size;
    height: $collapse-toggle-size;
    line-height: $collapse-toggle-icon-size;
    font-size: $collapse-toggle-icon-size;

    &:not(.#{$collapse-toggle--collapsed}) {
      transform: rotate(90deg);
    }
  }

  .#{$checkbox} {
    appearance: none;
    display: inline-block;
    flex-shrink: 0;
    transition: all 0.1s ease-in-out;
    margin: 0;
    margin-right: $side-spacing--half;
    border: solid 1px $border-color;
    background: none;
    padding: ($checkbox-size - $checkbox-icon-size - $checkbox-border-size * 2) * 0.5;
    width: $checkbox-size;
    height: $checkbox-size;
    line-height: $checkbox-icon-size;
    font-size: $checkbox-icon-size;

    &::before {
      color: $interactive-font-color--inverse;
    }
  }

  .#{$checkbox--indeterminate} {
    &::before {
      color: $interactive-font-color;
    }
  }

  .#{$checkbox--checked} {
    border-color: $border-color--active;
    background: $border-color--active;

    &::before {
      color: $interactive-font-color--inverse;
    }
  }

  [dir="rtl"] {
    .#{$checkbox} {
      margin-right: 0;
      margin-left: $side-spacing--half;
    }

    .#{$collapse-toggle} {
      transform: rotate(180deg);

      &:not(.#{$collapse-toggle--collapsed}) {
        transform: rotate(90deg);
      }
    }

    @for $level from 1 through $max-levels {
      .#{$base}--level-#{$level} {
        $padding: $indent-size * ($level - 1);

        padding-right: $padding;
        padding-left: 0;

        &.#{$leaf} {
          padding-right: $padding + $collapse-toggle-size;
          padding-left: 0;
        }
      }
    }
  }
}

/**
 * Adds all the styles for the "Categories & Disciplines" tree used in the building explorer.
 */
@mixin buildingDisciplinesTree() {
  $base: "esri-building-disciplines-tree";

  @include buildingDisciplinesNode();
}
