<div class="max-w-3xl mx-auto">
    <div class="flex items-center justify-between mb-6">
        <div class="flex items-center gap-3">
            <a href="?page=payments" class="text-gray-400 hover:text-gray-600"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/></svg></a>
            <div>
                <h1 class="text-2xl font-bold text-gray-900">Payment #<?= $payment['id'] ?></h1>
                <p class="text-sm text-gray-500"><?= formatDate($payment['payment_date']) ?></p>
            </div>
            <?= statusBadge($payment['status']) ?>
        </div>
        <div class="flex gap-2">
            <a href="?page=payments&action=edit&id=<?= $payment['id'] ?>" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 text-sm font-medium">Edit</a>
            <form method="POST" action="?page=payments&action=delete&id=<?= $payment['id'] ?>" onsubmit="return confirm('Delete this payment?')">
                <?= CSRF::field() ?><button class="px-4 py-2 border border-red-300 text-red-600 rounded-lg hover:bg-red-50 text-sm font-medium">Delete</button>
            </form>
        </div>
    </div>

    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-8 text-center mb-6">
        <p class="text-sm text-gray-500 uppercase font-medium">Amount</p>
        <p class="text-5xl font-bold text-gray-900 mt-2"><?= formatMoney($payment['amount']) ?></p>
        <p class="text-sm text-gray-400 mt-2"><?= ucwords(str_replace('_',' ',$payment['payment_method'] ?? 'manual')) ?></p>
    </div>

    <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
        <dl class="space-y-4 text-sm">
            <div class="flex justify-between"><dt class="text-gray-500">Tenant</dt><dd class="font-medium"><a href="?page=tenants&action=show&id=<?= $payment['tenant_id'] ?>" class="text-indigo-600 hover:underline"><?= htmlspecialchars($payment['first_name'].' '.$payment['last_name']) ?></a></dd></div>
            <div class="flex justify-between"><dt class="text-gray-500">Property</dt><dd class="font-medium"><?= htmlspecialchars(($payment['property_name'] ?? '-') . ($payment['unit_number'] ? ' / '.$payment['unit_number'] : '')) ?></dd></div>
            <div class="flex justify-between"><dt class="text-gray-500">Reference #</dt><dd class="font-medium"><?= htmlspecialchars($payment['reference_number'] ?? '-') ?></dd></div>
            <div class="flex justify-between"><dt class="text-gray-500">Recorded</dt><dd class="font-medium"><?= formatDate($payment['created_at']) ?></dd></div>
            <?php if ($payment['notes']): ?><div class="pt-4 border-t border-gray-100"><dt class="text-gray-500 mb-1">Notes</dt><dd class="text-gray-700"><?= htmlspecialchars($payment['notes']) ?></dd></div><?php endif; ?>
        </dl>
    </div>
</div>
