// Removes bullet points automatically.
[role='tree'],
[role='tree'] [role='group'] {
  list-style: none;
  margin: 0;
  padding: 0;
}

[role='tree'] [role='group'] {
  transition: transform 100ms ease-out;
  transform: translateY(0);
}

[role='tree'] .transition {
  overflow: hidden;
  height: 100%;
  transition: height 100ms ease-out;
}

[role='treeitem'] {
  padding: 0;

  > .label {
    height: 1.5rem;
    display: flex;
    align-items: center;
    padding-left: calc(var(--level) * var(--treeitem-identation) + var(--treeitem-offset));

    &:hover {
      background-color: var(--hover-color);
      color: var(--text-color-strong);
      transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    &:hover [class*='custom-icon'] {
      color: var(--text-color-strong);
      transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .spacer {
      flex: 1 0 auto;
      height: 1rem;
      width: 1rem;
      margin-right: 0.25rem;
    }
  }

  &[aria-expanded='false'] > .transition {
    height: 0;

    > [role='group'] {
      transform: translateY(-100%);
    }
  }

  &[aria-selected='true'] > .label {
    background-color: var(--background-color-selected);
    color: var(--text-color-strong);

    &:hover {
      // TODO: proper background color change for hover
      // This also changes text color
      filter: brightness(0.95);
    }
  }

  > .label {
    // to prevent content layout shifting when border is added on focus
    border: 2px solid transparent;
  }
  &:focus  > .label {
    // If focused, show an outline
    // If selected as well: do nothing special: keep the selected background color
    // hacky solution so outline shows both horizontal and vertical, and layout doesn't shift. I don't know what I"m doing
    border: 2px solid var(--accent-color);

    // TODO: proper background color change for hover
  }
}

.default_caret {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  background-color: var(--text-color);
  mask-image: url(~resources/icons/small-arrow-down.svg);
  -webkit-mask-image: url(~resources/icons/small-arrow-down.svg);
  transition: transform 100ms ease-out;
  margin-right: 0.25rem;

  &[aria-pressed='false'] {
    transform: rotateZ(-90deg);
  }
}
