<x-app-layout>
    <x-slot name="header">
        <h2 class="h4 mb-0">Visitor Log</h2>
    </x-slot>

    <div class="card">
        <div class="table-responsive">
            <table class="table table-sm mb-0">
                <thead>
                    <tr>
                        <th>Waktu</th>
                        <th>Desa</th>
                        <th>User Agent</th>
                        <th>Referrer</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse ($logs as $log)
                        <tr>
                            <td>{{ $log->visited_at->format('Y-m-d H:i') }}</td>
                            <td>{{ $log->desa?->nama }}</td>
                            <td class="text-truncate" style="max-width: 300px;">{{ $log->user_agent }}</td>
                            <td>{{ $log->referrer ?? '-' }}</td>
                        </tr>
                    @empty
                        <tr><td colspan="4" class="text-center text-muted py-4">Belum ada data kunjungan.</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>

    <div class="mt-3">{{ $logs->links() }}</div>
</x-app-layout>
