<?php $pageTitle = 'My Certificates'; ?>
<div class="mb-4"><p class="text-secondary">Your earned certificates</p></div>
<?php if (empty($certs)): ?>
    <div class="empty-state"><i class="fas fa-award"></i><h5>No Certificates Yet</h5><p>Complete your courses and pass assessments to earn certificates.</p></div>
<?php else: ?>
    <?php foreach ($certs as $cert): ?>
    <div class="certificate-card mb-4">
        <div class="cert-header">
            <h2 style="color:var(--secondary)">CIX Orbit Academy</h2>
            <p>Certificate of Completion</p>
        </div>
        <div class="cert-body">
            <p>This is to certify that</p>
            <div class="cert-name"><?= e($cert['student_name']) ?></div>
            <p>has successfully completed the course</p>
            <div class="cert-course"><?= e($cert['course_name']) ?></div>
        </div>
        <div class="cert-footer">
            <div><strong>Certificate No:</strong><br><?= e($cert['certificate_number']) ?></div>
            <div><strong>Issue Date:</strong><br><?= e($cert['issue_date']) ?></div>
            <div><strong>Status:</strong><br><span class="badge-cix badge-active">Verified</span></div>
        </div>
        <?php if ($cert['qr_code_path']): ?><img src="<?= storage_url($cert['qr_code_path']) ?>" alt="QR" width="100" style="margin:1rem auto;display:block;"><?php endif; ?>
        <?php if ($cert['pdf_path']): ?><a href="<?= storage_url($cert['pdf_path']) ?>" class="btn-cix btn-cix-primary btn-cix-sm mt-2" download><i class="fas fa-download"></i> Download PDF</a><?php endif; ?>
    </div>
    <?php endforeach; ?>
<?php endif; ?>
