@import 'functions/rem';
@import 'mixins/list';
@import 'variables/colors';
@import 'variables/gutters';

.expanded-tree-node {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-height: 300px;
  overflow: auto;

  &__filter {
    padding: 0 0.9375rem;
    margin-bottom: 1.25rem;
  }

  &__heading {
    font-size: 1rem;
    padding: 0 0.9375rem;
    display: block;
    font-weight: 600;

    ::ng-deep {
      h1,
      h2,
      h3,
      h4,
      h5,
      h6 {
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }

  &__nodes {
    overflow: auto;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    @include msfa__reset-list;
    padding: 0.3125rem 0;
  }

  &__info {
    padding: 0.9375rem;
  }

  &__node {
    &--leaf {
      margin-top: $digi--layout--gutter--s;
      padding-left: $digi--layout--gutter;

      &:first-child {
        margin-top: 0;
      }
    }
  }

  &__node-checkbox-presentation {
    font-size: var(--digi--typography--font-size--s);
    font-weight: 400;
    display: block;
    position: relative;
    padding-left: 1.875rem;
    cursor: pointer;
    line-height: normal;

    &__box {
      position: absolute;
      top: 0;
      left: 0;
      height: 1.25rem;
      width: 1.25rem;
      border-radius: 0.1875rem;
      background-color: var(--digi--ui--color--background);
      border: 1px solid var(--digi--ui--color--background--dark);
    }

    &--toggle-all {
      margin: 1.25rem $digi--layout--gutter;
    }

    &--checked &__box {
      background-color: var(--digi--ui--color--success);
      border-color: var(--digi--ui--color--success);

      &::after {
        position: absolute;
        left: 0.375rem;
        top: 0.0625rem;
        width: 0.375rem;
        height: 0.6875rem;
        border: solid #fff;
        border-width: 0 0.125rem 0.125rem 0;
        transform: rotate(35deg);
        content: '';
      }
    }

    &--focus &__box {
      box-shadow: var(--digi--ui--outline--focus--m);
    }
  }

  &__node-expansion-presentation {
    display: inline-flex;
    padding: 0.3125rem 0.9375rem;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    position: relative;
    border-width: 0;
    background-color: transparent;
    align-items: center;
    white-space: nowrap;
    font-size: var(--digi--typography--font-size--s);
    text-align: center;
    position: relative;

    &:hover,
    &--focus {
      background-color: var(--digi--ui--color--background--secondary);
    }

    &--active {
      background-color: var(--digi--ui--color--primary);
      color: var(--digi--ui--color--background);

      &:hover,
      &--focus {
        background-color: lighten($digi--ui--color--primary, 10%);
      }
    }

    &__text {
      text-align: left;
      flex-grow: 1;
      max-width: rem(450);
      margin-right: $digi--layout--gutter--s;
      display: block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    &__has-selection-dot {
      width: 1rem;
      height: 1rem;
      border-radius: 50%;
      background-color: var(--digi--ui--color--success);
      margin-right: $digi--layout--gutter--s;
    }

    &__icon {
      display: inline-flex;
      justify-content: center;
      align-items: center;
      width: 1em;
      max-height: 1em;
    }
  }
}
