<?php $bp = defined('BASE_PATH') ? BASE_PATH : '/gmind'; $card = $card ?? []; ?>
<style>@media print{.no-print{display:none}}</style>
<div class="admin-section">
    <div class="no-print" style="display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;">
        <a href="<?= $bp ?>/branch/id-cards" style="color:#16a085;text-decoration:none;font-size:0.85rem;">← Back</a>
        <button onclick="window.print()" style="background:#16a085;color:#fff;border:none;padding:8px 18px;border-radius:8px;font-size:0.85rem;cursor:pointer;font-weight:600;">🖨 Print</button>
    </div>
    <div style="max-width:420px;margin:0 auto;background:#fff;border:2px solid #16a085;border-radius:12px;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,0.1);">
        <div style="background:linear-gradient(135deg,#16a085,#117a65);color:#fff;padding:14px;text-align:center;">
            <h1 style="margin:0;font-family:'Poppins',sans-serif;font-size:1.2rem;">GMIND INSTITUTE</h1>
            <p style="margin:2px 0 0;font-size:0.72rem;opacity:0.85;"><?= htmlspecialchars($card['branch_name']??'', ENT_QUOTES, 'UTF-8') ?> (<?= htmlspecialchars($card['branch_code']??'', ENT_QUOTES, 'UTF-8') ?>)</p>
        </div>
        <div style="padding:20px;display:flex;gap:16px;">
            <div style="flex-shrink:0;">
                <?php $photo = $card['photo'] ?? ''; if ($photo): ?><img src="<?= $bp ?>/<?= htmlspecialchars($photo, ENT_QUOTES, 'UTF-8') ?>" alt="" style="width:80px;height:100px;border-radius:6px;object-fit:cover;border:1px solid #ddd;"><?php else: ?><div style="width:80px;height:100px;background:#f0f0f0;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:2rem;color:#ccc;">👤</div><?php endif; ?>
            </div>
            <div style="flex:1;font-size:0.82rem;">
                <div style="font-weight:700;font-size:1rem;color:#0d3b3b;margin-bottom:6px;"><?= htmlspecialchars($card['student_name']??'', ENT_QUOTES, 'UTF-8') ?></div>
                <table style="width:100%;font-size:0.76rem;">
                    <tr><td style="color:#999;padding:2px 0;">ID No</td><td style="font-weight:600;padding:2px 0;"><?= htmlspecialchars($card['card_number']??'', ENT_QUOTES, 'UTF-8') ?></td></tr>
                    <tr><td style="color:#999;padding:2px 0;">Enrollment</td><td style="font-weight:600;padding:2px 0;"><?= htmlspecialchars($card['enrollment_no']??'', ENT_QUOTES, 'UTF-8') ?></td></tr>
                    <tr><td style="color:#999;padding:2px 0;">Course</td><td style="font-weight:600;padding:2px 0;"><?= htmlspecialchars($card['course_name']??'—', ENT_QUOTES, 'UTF-8') ?></td></tr>
                    <tr><td style="color:#999;padding:2px 0;">Father</td><td style="font-weight:600;padding:2px 0;"><?= htmlspecialchars($card['father_name']??'—', ENT_QUOTES, 'UTF-8') ?></td></tr>
                    <tr><td style="color:#999;padding:2px 0;">DOB</td><td style="font-weight:600;padding:2px 0;"><?= !empty($card['dob'])?date('d/m/Y',strtotime($card['dob'])):'—' ?></td></tr>
                    <tr><td style="color:#999;padding:2px 0;">Valid Till</td><td style="font-weight:600;padding:2px 0;"><?= !empty($card['expiry_date'])?date('d/m/Y',strtotime($card['expiry_date'])):'—' ?></td></tr>
                </table>
            </div>
        </div>
        <div style="padding:0 20px 14px;font-size:0.7rem;color:#999;">
            <div>📍 <?= htmlspecialchars($card['branch_address']??'', ENT_QUOTES, 'UTF-8') ?></div>
            <div>📞 <?= htmlspecialchars($card['branch_phone']??'', ENT_QUOTES, 'UTF-8') ?></div>
        </div>
        <div style="background:#f9f9f9;padding:10px 20px;text-align:center;font-size:0.68rem;color:#bbb;border-top:1px solid #eee;">If found, please return to <?= htmlspecialchars($card['branch_name']??'Gmind Institute', ENT_QUOTES, 'UTF-8') ?> · <?= htmlspecialchars($card['branch_phone']??'', ENT_QUOTES, 'UTF-8') ?></div>
    </div>
</div>
