@foreach($nodes as $node)
<li>
    <span class="cat-name">{{ $node->name }}</span>
    @if(!$node->is_active)<span class="badge bg-secondary ms-1">inactive</span>@endif
    <span class="cat-actions">
        <a href="{{ route('admin.categories.edit', $node) }}">Edit</a>
        <form action="{{ route('admin.categories.destroy', $node) }}" method="POST" class="d-inline" onsubmit="return confirm('Delete this category and ALL its children?')">
            @csrf @method('DELETE')
            <button type="submit" class="btn btn-link btn-sm p-0 text-danger" style="font-size:0.85rem;">Delete</button>
        </form>
    </span>
    @if($node->relationLoaded('childrenRecursive') && $node->childrenRecursive->isNotEmpty())
        <ul>@include('admin.categories._node', ['nodes' => $node->childrenRecursive])</ul>
    @endif
</li>
@endforeach
