<div style="max-width:800px;margin:0 auto;padding:20px;font-family:Arial,sans-serif;">
    <div style="text-align:center;margin-bottom:20px;">
        <h2 style="margin:0;"><?= e($clubName) ?></h2>
        <p style="margin:2px 0;color:#666;"><?= e($clubNameAr) ?></p>
        <p style="margin:2px 0;color:#666;font-size:12px;"><?= e($clubAddress) ?> | <?= e($clubPhone) ?></p>
        <hr>
        <h3><?= lang('finance.receipt') ?></h3>
    </div>

    <table style="width:100%;margin-bottom:15px;">
        <tr>
            <td><strong><?= lang('finance.receipt_no') ?>:</strong> <?= e($receipt['receipt_number']) ?></td>
            <td style="text-align:right;"><strong><?= lang('finance.date') ?>:</strong> <?= format_date($receipt['receipt_date']) ?></td>
        </tr>
        <tr>
            <td><strong><?= lang('finance.member') ?>:</strong> <?= e($receipt['member_name']) ?> (<?= e($receipt['membership_number']) ?>)</td>
            <td style="text-align:right;"><strong><?= lang('finance.method') ?>:</strong> <?= e($receipt['method_name'] ?? '') ?></td>
        </tr>
    </table>

    <table style="width:100%;border-collapse:collapse;margin-bottom:15px;">
        <thead>
            <tr style="background:#f0f0f0;">
                <th style="border:1px solid #ddd;padding:6px;">#</th>
                <th style="border:1px solid #ddd;padding:6px;"><?= lang('finance.description') ?></th>
                <th style="border:1px solid #ddd;padding:6px;text-align:right;"><?= lang('finance.amount') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($items as $i => $item): ?>
            <tr>
                <td style="border:1px solid #ddd;padding:6px;"><?= $i + 1 ?></td>
                <td style="border:1px solid #ddd;padding:6px;"><?= e($item['description_en']) ?></td>
                <td style="border:1px solid #ddd;padding:6px;text-align:right;"><?= format_number($item['amount']) ?></td>
            </tr>
            <?php endforeach; ?>
        </tbody>
        <tfoot>
            <tr style="background:#e8f0fe;">
                <td colspan="2" style="border:1px solid #ddd;padding:8px;text-align:right;"><strong><?= lang('finance.total') ?>:</strong></td>
                <td style="border:1px solid #ddd;padding:8px;text-align:right;"><strong><?= money($receipt['total_amount']) ?></strong></td>
            </tr>
        </tfoot>
    </table>

    <div style="margin-top:40px;">
        <table style="width:100%;">
            <tr>
                <td style="text-align:center;width:50%;">
                    <div style="border-top:1px solid #333;width:150px;margin:40px auto 5px;">&nbsp;</div>
                    <small><?= lang('finance.cashier_signature') ?></small>
                </td>
                <td style="text-align:center;width:50%;">
                    <div style="border-top:1px solid #333;width:150px;margin:40px auto 5px;">&nbsp;</div>
                    <small><?= lang('finance.member_signature') ?></small>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>window.onload = function() { window.print(); };</script>