<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php
$name = trim((string)$row['first_name'].' '.(string)$row['last_name']);
$title = ($lang==='ar') ? (string)($row['title_ar'] ?? '') : (string)($row['title_en'] ?? '');
$type = (string)($row['cert_type'] ?? 'reviewer');
?>

<div class="card shadow-sm border-0" style="max-width:900px;margin:0 auto;">
  <div class="card-body p-4">
    <div class="text-center mb-3">
      <div style="font-size:26px;font-weight:900;color:#0b2a6f"><?= e($lang==='ar'?'شهادة':'Certificate') ?></div>
      <div class="text-muted"><?= e($title) ?></div>
    </div>

    <div class="border rounded-4 p-4" style="background:linear-gradient(135deg,#f7fbff,#ffffff);border-color:#e6eefc!important">
      <div class="text-center" style="font-size:18px;">
        <?= e($lang==='ar'?'تشهد اللجنة المنظمة بأن':'This is to certify that') ?>
      </div>
      <div class="text-center mt-2" style="font-size:28px;font-weight:900;color:#0b2a6f;">
        <?= e($name) ?>
      </div>
      <div class="text-center mt-2 text-muted">
        <?= e($lang==='ar'?'قد شارك بصفته:':'has served as:') ?> <b><?= e($type) ?></b>
      </div>

      <div class="d-flex justify-content-between mt-4 small text-muted">
        <div><?= e($lang==='ar'?'تاريخ الإصدار:':'Issued:') ?> <?= e((string)$row['issued_at']) ?></div>
        <div><?= e($lang==='ar'?'كود التحقق:':'Verification:') ?> <?= e((string)$row['cert_code']) ?></div>
      </div>
    </div>
  </div>
</div>


    <div class="text-center mt-3">
      <a class="btn btn-outline-dark btn-rounded" href="<?= e(base_path('cert/pdf?code='.(string)$row['cert_code'])) ?>" target="_blank">
        <i class="fa-solid fa-file-pdf me-2"></i><?= e($lang==='ar'?'PDF':'PDF') ?>
      </a>
    </div>

<?php require __DIR__ . '/../../layouts/footer.php'; ?>
