<div class="sa-card mb-8">
    <div class="flex justify-between items-center mb-6">
        <h3 class="text-xl font-bold">Subscription Plans</h3>
        <a href="<?= APP_URL ?>/superadmin/plans/create" class="btn btn-sa-primary">Create New Plan</a>
    </div>

    <div class="table-wrapper">
        <table>
            <thead>
                <tr>
                    <th>Plan Name</th>
                    <th>Price (Monthly)</th>
                    <th>Price (Yearly)</th>
                    <th>Products</th>
                    <th>Users</th>
                    <th>Locations</th>
                    <th>Storage</th>
                    <th class="text-right">Action</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($plans as $p): ?>
                <tr>
                    <td><strong><?= e($p['name']) ?></strong></td>
                    <td class="font-bold text-lg"><?= setting('currency_symbol', 'GH₵') ?><?= number_format($p['price_monthly'], 2) ?></td>
                    <td class="font-bold text-lg text-success"><?= setting('currency_symbol', 'GH₵') ?><?= number_format($p['price_yearly'], 2) ?></td>
                    <td><?= $p['max_products'] == -1 ? 'Unlimited' : number_format($p['max_products']) ?></td>
                    <td><?= $p['max_users'] == -1 ? 'Unlimited' : number_format($p['max_users']) ?></td>
                    <td><?= $p['max_locations'] == -1 ? 'Unlimited' : number_format($p['max_locations']) ?></td>
                    <td><?= number_format($p['storage_mb'] / 1024, 1) ?> GB</td>
                    <td class="text-right">
                        <a href="<?= APP_URL ?>/superadmin/plans/<?= $p['id'] ?>/edit" class="btn btn-ghost btn-sm">Edit</a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
