<div class="user-profile">
    <div class="row">
        <div class="col-12 col-md-9">

            {{-- USER INFO --}}
            <div class="card mb-3">
                <div class="card-body">
                    <p><strong>Username:</strong> {{ $user->username }}</p>
                    <p><strong>Email:</strong> {{ $user->email_address }}</p>
                    <p><strong>Created:</strong> {{ $user->created_at->format('d M Y') }}</p>
                </div>
            </div>

            {{-- ROLES --}}
            <div class="card mb-3">
                <div class="card-body">
                    <h4 class="card-title mb-3">Roles</h4>

                    @foreach($roles as $role)
                        <div class="mb-2">
                            <strong>{{ $role->name }}</strong>
                            <span class="text-muted small">
                                ({{ $role->permissions->count() }} permissions)
                            </span>
                        </div>
                    @endforeach
                </div>
            </div>

            {{-- EFFECTIVE PERMISSIONS --}}
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title mb-3">Effective Permissions</h4>

                    @foreach($permissions as $group => $perms)
                        <h5>{{ $group }}</h5>
                        <ul class="mb-3">
                            @foreach($perms as $perm)
                                <li>
                                    <strong>{{ $perm->label }}</strong>
                                    <div class="text-muted small">
                                        {{ $perm->description }}
                                    </div>
                                </li>
                            @endforeach
                        </ul>
                    @endforeach
                </div>
            </div>

        </div>

        {{-- SIDEBAR --}}
        <div class="col-12 col-md-3">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">Inspection</h4>
                    <hr>

                    <p class="text-muted small mb-0">
                        This page shows all permissions granted to the user
                        via assigned roles.
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>
