<?php
require_once 'includes/config.php';
$code = $_GET['code'] ?? '';
$stmt = $pdo->prepare("SELECT * FROM certificates WHERE verification_code = ?");
$stmt->execute([$code]);
$cert = $stmt->fetch();
?>
<!DOCTYPE html>
<html lang="bn">
<head>
    <meta charset="UTF-8">
    <title>সার্টিফিকেট ভেরিফিকেশন</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body { background:#f0f2f8; display:flex; align-items:center; justify-content:center; min-height:100vh; font-family:Arial; }
        .verify-card { background:white; border-radius:20px; padding:40px; text-align:center; max-width:500px; box-shadow:0 10px 40px rgba(0,0,0,0.15); }
        .valid { color:#11998e; }
        .invalid { color:#e74c3c; }
    </style>
</head>
<body>
<div class="verify-card">
    <?php if($cert): ?>
        <i class="fas fa-check-circle fa-4x valid mb-3"></i>
        <h3 class="valid">✅ বৈধ সার্টিফিকেট</h3>
        <p><strong>নাম:</strong> <?= htmlspecialchars($cert['student_name']) ?></p>
        <p><strong>কোর্স:</strong> <?= htmlspecialchars($cert['course_name']) ?></p>
        <p><strong>ইস্যু তারিখ:</strong> <?= date('d M Y', strtotime($cert['completion_date'])) ?></p>
        <p><strong>সার্টিফিকেট নং:</strong> <?= $cert['certificate_number'] ?></p>
    <?php else: ?>
        <i class="fas fa-times-circle fa-4x invalid mb-3"></i>
        <h3 class="invalid">❌ অবৈধ সার্টিফিকেট</h3>
        <p>সার্টিফিকেট পাওয়া যায়নি</p>
    <?php endif; ?>
</div>
</body>
</html>