<?php $pageTitle = 'Packages'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Course packages and pricing</p>
    <a href="<?= base_url('admin/package-create') ?>" class="btn-cix btn-cix-accent btn-cix-sm"><i class="fas fa-plus"></i> New Package</a>
</div>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix"><thead><tr><th>Package</th><th>Price</th><th>Duration</th><th>Courses</th><th>Status</th></tr></thead>
        <tbody><?php if (empty($packages)): ?><tr><td colspan="5" class="text-center text-secondary p-4">No packages</td></tr>
        <?php else: foreach ($packages as $p): ?>
        <tr><td><strong><?= e($p['name']) ?></strong><br><small class="text-secondary"><?= e($p['description'] ?? '') ?></small></td>
        <td style="color:var(--secondary);font-weight:700;">R<?= number_format($p['price'], 2) ?></td>
        <td><?= (int)$p['duration_days'] ?> days</td><td><?= (int)$p['course_count'] ?></td>
        <td><span class="badge-cix <?= $p['is_active'] ? 'badge-active' : 'badge-rejected' ?>"><?= $p['is_active'] ? 'Active' : 'Inactive' ?></span></td></tr>
        <?php endforeach; endif; ?></tbody></table>
    </div>
</div>
