<?php $title = $success ? 'Payment Successful' : 'Payment Failed'; ?>
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-white font-weight-bold"><i class="fas fa-<?= $success ? 'check-circle' : 'times-circle' ?> mr-2"></i><?= $title ?></h1>
</div>

<div class="row justify-content-center">
    <div class="col-lg-6">
        <div class="glass-card text-center">
            <?php if ($success): ?>
            <div style="font-size: 4rem; color: #1cc88a; margin-bottom: 20px;">
                <i class="fas fa-check-circle"></i>
            </div>
            <h4 class="font-weight-bold mb-3" style="color: #1cc88a;">Payment Successful!</h4>
            <p style="color: rgba(255,255,255,0.7); margin-bottom: 20px;">Your payment has been processed successfully.</p>
            <div style="background: rgba(255,255,255,0.05); border-radius: 8px; padding: 20px; margin-bottom: 20px; text-align: left;">
                <div class="d-flex justify-content-between mb-2">
                    <span style="color: rgba(255,255,255,0.5);">Amount Paid</span>
                    <span style="font-weight: 700; color: #1cc88a;">GHS <?= number_format($amount ?? 0, 2) ?></span>
                </div>
                <div class="d-flex justify-content-between mb-2">
                    <span style="color: rgba(255,255,255,0.5);">Reference</span>
                    <span style="font-weight: 600;"><?= htmlspecialchars($reference ?? '') ?></span>
                </div>
                <div class="d-flex justify-content-between mb-2">
                    <span style="color: rgba(255,255,255,0.5);">Gateway</span>
                    <span style="font-weight: 600;"><?= htmlspecialchars(ucfirst($gateway ?? '')) ?></span>
                </div>
                <div class="d-flex justify-content-between">
                    <span style="color: rgba(255,255,255,0.5);">Status</span>
                    <span class="glass-badge" style="background: rgba(28,200,138,0.2); color: #1cc88a;"><?= htmlspecialchars(ucfirst($status ?? 'completed')) ?></span>
                </div>
            </div>
            <div>
                <?php if (!empty($receiptId)): ?>
                <a href="<?= $baseUrl ?>/contributions/receipt/<?= $receiptId ?>/download" class="glass-btn" target="_blank"><i class="fas fa-receipt mr-1"></i>Download Receipt</a>
                <?php endif; ?>
                <a href="<?= $baseUrl ?>/contributions/member" class="glass-btn"><i class="fas fa-history mr-1"></i>View Contributions</a>
                <a href="<?= $baseUrl ?>/member/dashboard" class="glass-btn glass-btn-primary"><i class="fas fa-tachometer-alt mr-1"></i>Dashboard</a>
            </div>
            <?php else: ?>
            <div style="font-size: 4rem; color: #e74a3b; margin-bottom: 20px;">
                <i class="fas fa-times-circle"></i>
            </div>
            <h4 class="font-weight-bold mb-3" style="color: #e74a3b;">Payment Failed</h4>
            <p style="color: rgba(255,255,255,0.7); margin-bottom: 20px;"><?= htmlspecialchars($message ?? 'An error occurred during payment processing.') ?></p>
            <?php if (!empty($reference)): ?>
            <p style="color: rgba(255,255,255,0.4); font-size: 0.85rem;">Reference: <?= htmlspecialchars($reference) ?></p>
            <?php endif; ?>
            <div class="mt-3">
                <a href="<?= $baseUrl ?>/payment/make" class="glass-btn glass-btn-primary"><i class="fas fa-redo mr-1"></i>Try Again</a>
                <a href="<?= $baseUrl ?>/member/dashboard" class="glass-btn"><i class="fas fa-tachometer-alt mr-1"></i>Dashboard</a>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>
