<?php
use Livewire\Component;
use App\Models\LegalPage;
?>

<div class="max-content">
    <header class="mb-10">
        <h1 class="text-2xl font-semibold tracking-tight">Legal Pages</h1>
        <p class="text-sm text-gray-500 mt-1">Update foundation policies and legal agreements.</p>
    </header>

    <div class="card">
        <div class="overflow-x-auto">
            <table>
                <thead>
                    <tr>
                        <th>Page Name</th>
                        <th>Last Updated</th>
                        <th class="text-right">Actions</th>
                    </tr>
                </thead>
                <tbody class="bg-white divide-y divide-gray-200">
                    @foreach($pages as $page)
                        <tr>
                            <td class="px-6 py-4 font-medium text-sm text-gray-900">{{ $page->title }}</td>
                            <td class="px-6 py-4 text-gray-500 text-xs">{{ $page->updated_at->format('M d, Y') }}</td>
                            <td class="px-6 py-4 text-right">
                                <a href="{{ route('admin.legal.edit', $page->slug) }}" wire:navigate class="text-sage font-semibold text-xs px-2" style="color: #99BC85;">Edit Content</a>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>