<?= $this->extend('install/layout') ?>
<?= $this->section('content') ?>
<h2 style="margin-top:0;">Step 1: System Requirements</h2>
<table style="width: 100%; border-collapse: collapse; margin-bottom: 2rem;">
    <tr>
        <td style="padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;">PHP >= 8.1.0</td>
        <td style="text-align: right; padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;font-weight:bold" class="<?= $reqs['php'] ? 'success' : 'error' ?>">
            <?= $reqs['php'] ? 'Pass' : 'Fail' ?>
        </td>
    </tr>
    <tr>
        <td style="padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;">MySQLi Extension</td>
        <td style="text-align: right; padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;font-weight:bold" class="<?= $reqs['mysqli'] ? 'success' : 'error' ?>">
            <?= $reqs['mysqli'] ? 'Pass' : 'Fail' ?>
        </td>
    </tr>
    <tr>
        <td style="padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;">cURL Extension</td>
        <td style="text-align: right; padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;font-weight:bold" class="<?= $reqs['curl'] ? 'success' : 'error' ?>">
            <?= $reqs['curl'] ? 'Pass' : 'Fail' ?>
        </td>
    </tr>
    <tr>
        <td style="padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;">Root is Writable (.env)</td>
        <td style="text-align: right; padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;font-weight:bold" class="<?= $reqs['env_writable'] ? 'success' : 'error' ?>">
            <?= $reqs['env_writable'] ? 'Pass' : 'Fail' ?>
        </td>
    </tr>
    <tr>
        <td style="padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;">Writable Folder Status</td>
        <td style="text-align: right; padding: 0.75rem 0; border-bottom: 1px solid #e5e7eb;font-weight:bold" class="<?= $reqs['writable_dir'] ? 'success' : 'error' ?>">
            <?= $reqs['writable_dir'] ? 'Pass' : 'Fail' ?>
        </td>
    </tr>
</table>

<?php if($canProceed): ?>
    <a href="<?= base_url('install/step2') ?>" class="btn">Proceed to Database Setup -></a>
<?php else: ?>
    <button class="btn" disabled>Resolve Requirements to Continue</button>
<?php endif; ?>
<?= $this->endSection() ?>
