%row-item {
  display: grid;
  padding: spacer(4);
  align-items: center;
  gap: spacer(4);

  @include breakpoint-up(sm) {
    grid-template-columns: minmax(30%, 1fr) auto;
  }

  .type-icon {
    @include font-size(4);
  }

  .content {
    display: flex;
    align-items: center;
    gap: spacer(2);
  }

  & > :not(.content, .actions) {
    grid-column: 1/-1;
  }

  &:not(:last-child) {
    border-bottom: $border;
  }

  & > .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: spacer(2);
  }

  [aria-grabbed] {
    @extend %icon, .icon-outline-drag;
    @include text-muted;
    margin-left: -(spacer(4));
    order: -1;
  }
}

@mixin rows {
  border: $border;
  border-radius: border-radius(1);
  @include bg-color(filled);
}

.rows {
  @include rows;

  > * {
    @extend %row-item;
  }
}

[role="tree"] {
  @include rows;

  [role="treeitem"] {
    @extend %row-item;

    & > [role="group"],
    & > .group {
      display: grid;
      gap: spacer(4);

      & > [role="treeitem"] {
        border: $border;
        border-radius: border-radius(1);
      }
    }

    &[aria-expanded] {
      & > .content {
        cursor: pointer;

        &::before {
          @extend %icon, .icon-outline-cheveron-down;
        }
      }
    }

    &[aria-expanded="false"] {
      & > .content::before {
        @extend .icon-outline-cheveron-right;
      }

      [role="group"],
      .group {
        display: none;
      }
    }
  }
}
