<!-- Path: app/Views/admin/responders_list.view.php -->
<div class="bg-slate-50 min-h-[calc(100vh-64px)] py-8">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="mb-6 flex justify-between items-center">
            <h1 class="text-2xl font-bold text-navy-900">Responder Units Directory</h1>
            <a href="{{APP_URL}}/admin/responders/create" class="bg-brandBlue-600 hover:bg-brandBlue-700 text-white px-4 py-2 rounded shadow-sm font-semibold transition-colors">
                <i class="fas fa-plus"></i> Register Unit
            </a>
        </div>

        <div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
            <div class="overflow-x-auto">
                <table class="w-full text-left border-collapse">
                    <thead>
                        <tr class="bg-slate-50 text-slate-500 text-sm uppercase tracking-wider border-b border-slate-200">
                            <th class="p-4 font-semibold">Org Name</th>
                            <th class="p-4 font-semibold">Category</th>
                            <th class="p-4 font-semibold">User Link</th>
                            <th class="p-4 font-semibold">Status</th>
                            <th class="p-4 font-semibold text-right">Base Location</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-slate-100 text-sm">
                        @if(empty($responders))
                            <tr><td colspan="5" class="p-8 text-center text-slate-500">No responders registered.</td></tr>
                        @else
                            @foreach($responders as $res)
                                <tr class="hover:bg-slate-50">
                                    <td class="p-4 font-bold text-navy-900">{{ $res['organization_name'] }}</td>
                                    <td class="p-4"><span class="bg-slate-200 text-slate-700 px-2 py-1 rounded text-xs font-bold">{{ $res['category_name'] }}</span></td>
                                    <td class="p-4 text-slate-600">{{ $res['full_name'] }} <br><span class="text-xs">{{ $res['email'] }}</span></td>
                                    <td class="p-4">
                                        @if($res['is_available'])
                                            <span class="text-green-500 font-bold"><i class="fas fa-circle text-[10px]"></i> Active</span>
                                        @else
                                            <span class="text-red-500 font-bold"><i class="fas fa-circle text-[10px]"></i> Offline</span>
                                        @endif
                                    </td>
                                    <td class="p-4 text-right font-mono text-xs text-slate-500">{{ $res['base_latitude'] }}, <br>{{ $res['base_longitude'] }}</td>
                                </tr>
                            @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>