<?php
require '../config/config.php';
require '../config/database.php';
require '../config/auth.php';
include 'layout/header.php';

$planos = $pdo->query("SELECT * FROM planos")->fetchAll();
?>

<h1 class="text-2xl font-bold mb-6">Escolha seu plano</h1>

<div class="grid grid-cols-3 gap-4">
<?php foreach ($planos as $p): ?>
    <div class="bg-white p-4 rounded shadow">
        <h2 class="text-xl font-bold"><?= $p['nome'] ?></h2>
        <p><?= $p['limite_empresas'] ?> empresas</p>
        <p class="text-2xl font-bold">R$ <?= number_format($p['preco'],2,',','.') ?></p>
        <form method="post" action="processa_plano.php">
            <input type="hidden" name="plano_id" value="<?= $p['id'] ?>">
            <button class="bg-blue-600 text-white px-4 py-2 mt-2 rounded">
                Assinar
            </button>
        </form>
    </div>
<?php endforeach ?>
</div>

<?php include 'layout/footer.php'; ?>
