@extends('admin.layouts.app')
@section('title', 'SEO Pages')
@section('content')
<div class="action-bar">
    <span>{{ $seoPages->total() }} SEO pages</span>
    <a href="{{ route('admin.seo-pages.create') }}" class="btn btn-primary">+ New SEO Page</a>
</div>
<div class="card">
    <table>
        <tr><th>Page URL</th><th>Title</th><th>Meta Title</th><th>Active</th><th>Actions</th></tr>
        @foreach($seoPages as $seo)
        <tr>
            <td><code style="color:#f0c040;font-size:0.85rem">/{{ $seo->page_url }}</code></td>
            <td><strong>{{ Str::limit($seo->title, 40) ?? '—' }}</strong></td>
            <td class="text-muted">{{ Str::limit($seo->meta_title, 50) ?? '—' }}</td>
            <td>{!! $seo->is_active ? '<span style="color:#6fcf97">Yes</span>' : '<span style="color:#e74c3c">No</span>' !!}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.seo-pages.edit', $seo) }}" class="btn btn-primary btn-sm">Edit</a>
                <form action="{{ route('admin.seo-pages.destroy', $seo) }}" method="POST" onsubmit="return confirm('Delete this SEO page?')">
                    @csrf @method('DELETE')
                    <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                </form>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $seoPages->links() }}</div>
</div>
@endsection
