<?php
function cv_h($v){ return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8'); }
$title = ($certificate['conference_title_ar'] ?? '') ?: ($certificate['conference_title_en'] ?? '');
?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<title>Certificate Verification</title>
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
<style>
body{font-family:Cairo,sans-serif;background:#f8fafc}
.box{max-width:850px;margin:50px auto;background:white;border-radius:24px;padding:35px;box-shadow:0 18px 45px rgba(15,23,42,.1)}
.ok{font-size:56px;color:#16a34a}
</style>
</head>
<body>
<div class="box text-center">
    <div class="ok">✓</div>
    <h2 class="fw-bold">شهادة موثقة / Verified Certificate</h2>
    <p class="text-muted"><?= cv_h($title) ?></p>
    <hr>
    <h3><?= cv_h($certificate['recipient_name']) ?></h3>
    <div class="badge bg-primary p-2"><?= cv_h($certificate['certificate_type']) ?></div>
    <p class="mt-3"><?= nl2br(cv_h($certificate['body_ar'] ?: $certificate['body_en'])) ?></p>
    <table class="table table-bordered mt-4">
        <tr><th>Certificate No</th><td><?= cv_h($certificate['certificate_no']) ?></td></tr>
        <tr><th>Status</th><td><?= cv_h($certificate['status']) ?></td></tr>
        <tr><th>Issued At</th><td><?= cv_h($certificate['issued_at']) ?></td></tr>
    </table>
    <a class="btn btn-success" target="_blank" href="/easychair/certificates/print?token=<?= cv_h($certificate['verify_token']) ?>">Print Certificate</a>
</div>
</body>
</html>
