<?php $title = 'Content Management'; ?>
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-white font-weight-bold"><i class="fas fa-edit mr-2"></i>Content Management</h1>
</div>

<div class="glass-card">
    <div class="mb-3" style="border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 0.8rem;">
        <h5 class="font-weight-bold mb-0" style="color: #4e73df;">Public Pages</h5>
    </div>
    <div class="glass-table">
        <table class="table">
            <thead><tr><th>Page</th><th>Title</th><th>Status</th><th>Last Updated</th><th>Actions</th></tr></thead>
            <tbody>
                <?php foreach ($pages as $p): ?>
                <tr>
                    <td><code><?= htmlspecialchars($p->slug) ?></code></td>
                    <td><?= htmlspecialchars($p->title) ?></td>
                    <td>
                        <span class="glass-badge" style="background: <?= $p->status === 'published' ? 'rgba(28,200,138,0.2)' : 'rgba(255,255,255,0.1)' ?>; color: <?= $p->status === 'published' ? '#1cc88a' : 'rgba(255,255,255,0.5)' ?>;">
                            <?= ucfirst($p->status) ?>
                        </span>
                    </td>
                    <td style="color: rgba(255,255,255,0.5);"><?= $p->updated_at ? date('M d, Y H:i', strtotime($p->updated_at)) : '-' ?></td>
                    <td>
                        <a href="<?= $baseUrl ?>/cms/<?= $p->slug ?>/edit" class="glass-btn btn-sm"><i class="fas fa-edit mr-1"></i>Edit</a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <div class="mt-3" style="color: rgba(255,255,255,0.5); font-size: 0.85rem;">
        <i class="fas fa-info-circle mr-1"></i>
        CMS pages control the public-facing content of the membership portal. Use WYSIWYG-style HTML for formatting.
    </div>
</div>
