<?php
/**
 * pembayaran.php - Halaman Pembayaran dengan Midtrans
 * Digunakan oleh WisatawanController::pembayaran()
 * DIPERBAIKI - Menampilkan jumlah yang sesuai (DP atau Full)
 */
$activeMenu = 'riwayatPesanan';
$pageTitle = 'Pembayaran - Wisatawan';
include __DIR__ . '/../layouts/header.php';

// Data dari controller
$pesanan = $pesanan ?? [];
$snap_token = $snap_token ?? '';
$client_key = $client_key ?? '';

// Jika data tidak lengkap
if (empty($pesanan) || empty($snap_token)) {
    ?>
    <div class="alert alert-danger">
        <i class="fas fa-exclamation-circle"></i>
        Data pembayaran tidak valid. Silakan coba lagi.
    </div>
    <a href="?page=wisatawan&action=pesananSaya" class="btn btn-primary">← Kembali ke Pesanan Saya</a>
    <?php
    include __DIR__ . '/../layouts/footer.php';
    exit;
}

// Cek apakah sudah lunas
if ($pesanan['status_pembayaran'] == 'lunas') {
    ?>
    <div class="alert alert-success">
        <i class="fas fa-check-circle"></i>
        ✅ Pembayaran sudah lunas. Terima kasih!
    </div>
    <a href="?page=wisatawan&action=status&id=<?= $pesanan['id'] ?>" class="btn btn-primary">
        <i class="fas fa-eye"></i> Lihat Detail Pesanan
    </a>
    <?php
    include __DIR__ . '/../layouts/footer.php';
    exit;
}

// ==============================================
// 🔥 HITUNG JUMLAH YANG HARUS DIBAYAR
// ==============================================
$jenisPembayaran = $pesanan['jenis_pembayaran'] ?? 'full';
$totalHarga = (int) $pesanan['total_harga'];
$jumlahDibayar = (int) ($pesanan['jumlah_dibayar'] ?? 0);
$sisaPembayaran = (int) ($pesanan['sisa_pembayaran'] ?? 0);

// Jika jumlah_dibayar belum diisi (data lama), hitung otomatis
if ($jenisPembayaran == 'dp' && $jumlahDibayar == 0) {
    $jumlahDibayar = ceil($totalHarga * 0.5);
    $sisaPembayaran = $totalHarga - $jumlahDibayar;
}

// Jumlah yang harus dibayar sekarang
$jumlahBayarSekarang = ($jenisPembayaran == 'dp') ? $jumlahDibayar : $totalHarga;
?>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">

<!-- Midtrans Snap JS - Sandbox -->
<script src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="<?= htmlspecialchars($client_key) ?>"></script>

<div class="dashboard-wrapper">
    <?php include __DIR__ . '/../layouts/sidebar_wisatawan.php'; ?>

    <main class="main-content">
        <div class="content-header">
            <div>
                <h2><i class="fas fa-credit-card" style="color:#2b6cb0;"></i> Pembayaran</h2>
                <p>Lakukan pembayaran untuk pesanan Anda dengan aman melalui Midtrans.</p>
            </div>
            <a href="?page=wisatawan&action=status&id=<?= $pesanan['id'] ?>" class="btn btn-secondary">
                <i class="fas fa-arrow-left"></i> Kembali
            </a>
        </div>

        <?php if(isset($_SESSION['flash_success'])): ?>
            <div class="alert alert-success">
                <i class="fas fa-check-circle"></i>
                <?= htmlspecialchars($_SESSION['flash_success']) ?>
                <button class="alert-close" onclick="this.parentElement.remove()">&times;</button>
                <?php unset($_SESSION['flash_success']); ?>
            </div>
        <?php endif; ?>

        <?php if(isset($_SESSION['flash_error'])): ?>
            <div class="alert alert-danger">
                <i class="fas fa-exclamation-circle"></i>
                <?= htmlspecialchars($_SESSION['flash_error']) ?>
                <button class="alert-close" onclick="this.parentElement.remove()">&times;</button>
                <?php unset($_SESSION['flash_error']); ?>
            </div>
        <?php endif; ?>

        <!-- ========================================== -->
        <!-- INFORMASI PESANAN -->
        <!-- ========================================== -->
        <div class="info-card">
            <h3><i class="fas fa-file-invoice"></i> Detail Pesanan</h3>
            
            <div class="info-row">
                <span class="info-label">Kode Pesanan</span>
                <span class="info-value">
                    <span class="kode-badge"><?= htmlspecialchars($pesanan['kode_pesanan']) ?></span>
                </span>
            </div>
            
            <div class="info-row">
                <span class="info-label">Kapal</span>
                <span class="info-value"><strong><?= htmlspecialchars($pesanan['nama_kapal'] ?? '-') ?></strong></span>
            </div>
            
            <div class="info-row">
                <span class="info-label">Tanggal Berangkat</span>
                <span class="info-value"><?= date('d/m/Y', strtotime($pesanan['tanggal_berangkat'])) ?></span>
            </div>
            
            <div class="info-row">
                <span class="info-label">Jumlah Penumpang</span>
                <span class="info-value"><?= $pesanan['jumlah_tiket'] ?? 1 ?> orang</span>
            </div>
            
            <div class="info-row">
                <span class="info-label">Total Harga</span>
                <span class="info-value harga">Rp <?= number_format($totalHarga, 0, ',', '.') ?></span>
            </div>
            
            <!-- ========================================== -->
            <!-- 🔥 JENIS PEMBAYARAN - DITAMBAHKAN -->
            <!-- ========================================== -->
            <div class="info-row">
                <span class="info-label">Jenis Pembayaran</span>
                <span class="info-value">
                    <?php if($jenisPembayaran == 'dp'): ?>
                        <span class="badge badge-warning">
                            <i class="fas fa-percent"></i> DP 50%
                        </span>
                    <?php else: ?>
                        <span class="badge badge-success">
                            <i class="fas fa-check-circle"></i> Bayar Full
                        </span>
                    <?php endif; ?>
                </span>
            </div>
            
            <!-- 🔥 JUMLAH YANG HARUS DIBAYAR SEKARANG -->
            <div class="info-row" style="background: <?= ($jenisPembayaran == 'dp') ? '#dbeafe' : '#d1fae5' ?>; padding:0.5rem 0.5rem; border-radius:4px; border-bottom: 2px solid <?= ($jenisPembayaran == 'dp') ? '#3b82f6' : '#22c55e' ?>;">
                <span class="info-label" style="font-weight:700; color:<?= ($jenisPembayaran == 'dp') ? '#1e40af' : '#065f46' ?>;">
                    <i class="fas fa-<?= ($jenisPembayaran == 'dp') ? 'hand-holding-usd' : 'credit-card' ?>"></i>
                    <?= ($jenisPembayaran == 'dp') ? 'Yang Dibayar Sekarang (50%)' : 'Total Dibayar' ?>
                </span>
                <span class="info-value" style="font-weight:700; font-size:1.2rem; color:<?= ($jenisPembayaran == 'dp') ? '#1e40af' : '#065f46' ?>;">
                    Rp <?= number_format($jumlahBayarSekarang, 0, ',', '.') ?>
                </span>
            </div>
            
            <!-- 🔥 SISA PEMBAYARAN (JIKA DP) -->
            <?php if($jenisPembayaran == 'dp' && $sisaPembayaran > 0): ?>
                <div class="info-row" style="background: #fef3c7; padding:0.3rem 0.5rem; border-radius:4px;">
                    <span class="info-label" style="color:#92400e;">
                        <i class="fas fa-clock"></i> Sisa Pembayaran
                    </span>
                    <span class="info-value" style="color:#92400e; font-weight:600;">
                        Rp <?= number_format($sisaPembayaran, 0, ',', '.') ?>
                    </span>
                </div>
                <div class="info-row" style="padding:0.2rem 0.5rem;">
                    <span class="info-label" style="font-size:0.7rem; color:#a0aec0;">
                        <i class="fas fa-info-circle"></i> Sisa pembayaran akan dibayar sebelum keberangkatan
                    </span>
                </div>
            <?php endif; ?>
            
            <div class="info-row">
                <span class="info-label">Status</span>
                <span class="info-value">
                    <span class="badge badge-warning">
                        <i class="fas fa-clock"></i> Menunggu Pembayaran
                    </span>
                </span>
            </div>
            
            <?php if(!empty($pesanan['snap_url'])): ?>
            <div class="info-row">
                <span class="info-label">Link Alternatif</span>
                <span class="info-value">
                    <a href="<?= htmlspecialchars($pesanan['snap_url']) ?>" target="_blank" class="btn btn-sm btn-secondary">
                        <i class="fas fa-external-link-alt"></i> Buka di Browser
                    </a>
                </span>
            </div>
            <?php endif; ?>
        </div>

        <!-- ========================================== -->
        <!-- TOMBOL BAYAR -->
        <!-- ========================================== -->
        <div class="payment-section">
            <div class="payment-info">
                <div class="payment-icon">
                    <i class="fas fa-shield-alt"></i>
                </div>
                <div>
                    <h4>🔒 Pembayaran Aman</h4>
                    <p>Pembayaran diproses oleh <strong>Midtrans</strong> dengan sistem keamanan berstandar tinggi (3D Secure).</p>
                    <p style="font-size:0.85rem; color:#718096; margin-top:0.3rem;">
                        <i class="fas fa-credit-card"></i> Metode: Kartu Kredit, Bank Transfer, QRIS, E-Wallet
                    </p>
                    <p style="font-size:0.75rem; color:#a0aec0; margin-top:0.2rem;">
                        <i class="fas fa-info-circle"></i> 
                        Mode: <strong>Sandbox</strong> (uji coba) - Gunakan kartu uji Midtrans
                    </p>
                    <?php if($jenisPembayaran == 'dp'): ?>
                        <p style="font-size:0.8rem; color:#1e40af; margin-top:0.3rem; background:#dbeafe; padding:0.3rem 0.8rem; border-radius:6px;">
                            <i class="fas fa-info-circle"></i> 
                            Anda membayar <strong>DP 50%</strong> sebesar <strong>Rp <?= number_format($jumlahBayarSekarang, 0, ',', '.') ?></strong>. 
                            Sisa pembayaran <strong>Rp <?= number_format($sisaPembayaran, 0, ',', '.') ?></strong> akan dibayar nanti.
                        </p>
                    <?php endif; ?>
                </div>
            </div>

            <button class="btn btn-success btn-lg btn-pay" id="payButton" style="width:100%; padding:1rem; font-size:1.2rem;">
                <i class="fas fa-credit-card"></i> Bayar Sekarang
            </button>

            <p style="text-align:center; font-size:0.8rem; color:#a0aec0; margin-top:0.5rem;">
                <i class="fas fa-info-circle"></i> 
                Anda akan diarahkan ke halaman pembayaran Midtrans yang aman.
            </p>
        </div>

        <!-- ========================================== -->
        <!-- METODE PEMBAYARAN -->
        <!-- ========================================== -->
        <div class="payment-methods">
            <h4>Metode Pembayaran yang Tersedia</h4>
            <div class="methods-grid">
                <div class="method-item">
                    <i class="fas fa-credit-card" style="color:#2b6cb0;"></i>
                    <span>Kartu Kredit</span>
                </div>
                <div class="method-item">
                    <i class="fas fa-university" style="color:#059669;"></i>
                    <span>Bank Transfer</span>
                </div>
                <div class="method-item">
                    <i class="fas fa-mobile-alt" style="color:#f59e0b;"></i>
                    <span>E-Wallet</span>
                </div>
                <div class="method-item">
                    <i class="fas fa-qrcode" style="color:#8b5cf6;"></i>
                    <span>QRIS</span>
                </div>
            </div>
        </div>

        <!-- ========================================== -->
        <!-- INFORMASI KARTU UJI (SANDBOX) -->
        <!-- ========================================== -->
        <div class="sandbox-info">
            <h4><i class="fas fa-flask" style="color:#f59e0b;"></i> Info Uji Coba (Sandbox)</h4>
            <p>Gunakan kartu uji berikut untuk testing pembayaran:</p>
            <div class="test-card-grid">
                <div class="test-card">
                    <div class="test-card-label">💳 Kartu Kredit</div>
                    <code>4811 1111 1111 1114</code>
                    <div class="test-card-detail">CVV: 123 | Expiry: 12/25</div>
                    <div class="test-card-detail">3DS Password: 112233</div>
                </div>
                <div class="test-card">
                    <div class="test-card-label">🏦 Bank Transfer</div>
                    <code>Pilih BCA / Mandiri / BNI / BRI</code>
                    <div class="test-card-detail">Ikuti instruksi di halaman Midtrans</div>
                </div>
                <div class="test-card">
                    <div class="test-card-label">📱 E-Wallet</div>
                    <code>Gopay / OVO / ShopeePay</code>
                    <div class="test-card-detail">Scan QR Code di halaman Midtrans</div>
                </div>
            </div>
        </div>
    </main>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    const payButton = document.getElementById('payButton');
    const snapToken = '<?= htmlspecialchars($snap_token) ?>';
    const pesananId = <?= $pesanan['id'] ?>;
    const jenisPembayaran = '<?= $jenisPembayaran ?>';
    const jumlahBayar = <?= $jumlahBayarSekarang ?>;
    
    // Cek apakah snapToken tersedia
    if (!snapToken) {
        payButton.disabled = true;
        payButton.innerHTML = '<i class="fas fa-exclamation-triangle"></i> Token Pembayaran Tidak Tersedia';
        payButton.style.background = '#ef4444';
        payButton.style.cursor = 'not-allowed';
        return;
    }
    
    // Update tombol dengan informasi jumlah
    if (jenisPembayaran === 'dp') {
        payButton.innerHTML = '<i class="fas fa-hand-holding-usd"></i> Bayar DP 50% (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
    } else {
        payButton.innerHTML = '<i class="fas fa-credit-card"></i> Bayar Full (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
    }
    
    // Event klik tombol bayar
    payButton.addEventListener('click', function() {
        // Tampilkan loading
        payButton.disabled = true;
        payButton.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Memproses...';
        
        // Panggil Midtrans Snap
        window.snap.pay(snapToken, {
            onSuccess: function(result) {
                console.log('✅ Payment Success:', result);
                
                // Redirect ke halaman sukses
                window.location.href = '?page=wisatawan&action=pembayaranSukses&id=' + pesananId + '&order_id=' + result.order_id;
            },
            onPending: function(result) {
                console.log('⏳ Payment Pending:', result);
                
                // Redirect ke halaman pending
                window.location.href = '?page=wisatawan&action=pembayaranPending&id=' + pesananId + '&order_id=' + result.order_id;
            },
            onError: function(result) {
                console.log('❌ Payment Error:', result);
                
                // Tampilkan pesan error
                alert('❌ Terjadi kesalahan pembayaran. Silakan coba lagi.\n\nError: ' + (result.status_message || 'Unknown error'));
                
                // Reset tombol
                payButton.disabled = false;
                if (jenisPembayaran === 'dp') {
                    payButton.innerHTML = '<i class="fas fa-hand-holding-usd"></i> Bayar DP 50% (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
                } else {
                    payButton.innerHTML = '<i class="fas fa-credit-card"></i> Bayar Full (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
                }
            },
            onClose: function() {
                console.log('⚠️ Payment Popup Closed');
                
                // Reset tombol
                payButton.disabled = false;
                if (jenisPembayaran === 'dp') {
                    payButton.innerHTML = '<i class="fas fa-hand-holding-usd"></i> Bayar DP 50% (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
                } else {
                    payButton.innerHTML = '<i class="fas fa-credit-card"></i> Bayar Full (Rp ' + new Intl.NumberFormat('id-ID').format(jumlahBayar) + ')';
                }
            }
        });
    });
    
    // ==========================================
    // KEYBOARD SHORTCUT: ESC untuk keluar
    // ==========================================
    document.addEventListener('keydown', function(e) {
        if (e.key === 'Escape') {
            // Jika modal snap terbuka, tutup
            const snapModal = document.querySelector('.snap-container');
            if (snapModal) {
                // Snap akan menutup sendiri
            }
        }
    });
});
</script>

<style>
/* ============================================
   STYLE PEMBAYARAN
   ============================================ */
.dashboard-wrapper {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 20px;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 14px;
    padding: 1.8rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
}

.content-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.content-header p {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left-color: #22c55e;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
}

.alert-close:hover {
    opacity: 1;
}

/* ============================================
   INFO CARD
   ============================================ */
.info-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.info-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f7fafc;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #718096;
    font-size: 0.85rem;
    font-weight: 500;
}

.info-value {
    font-size: 0.85rem;
    color: #1a202c;
    text-align: right;
}

.info-value.harga {
    font-weight: 700;
    color: #2b6cb0;
    font-size: 1.1rem;
}

.kode-badge {
    font-weight: 600;
    color: #2b6cb0;
    font-size: 0.8rem;
    background: #ebf8ff;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* ============================================
   BADGE
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================
   BUTTON
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    color: #1a202c;
}

.btn-primary {
    background: #2b6cb0;
    color: #fff;
}

.btn-primary:hover {
    background: #1a4a7a;
    color: #fff;
}

.btn-sm {
    padding: 0.25rem 0.8rem;
    font-size: 0.7rem;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* ============================================
   PAYMENT SECTION
   ============================================ */
.payment-section {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.payment-info {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.payment-icon {
    font-size: 2.5rem;
    color: #22c55e;
    flex-shrink: 0;
}

.payment-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #065f46;
    margin: 0 0 0.2rem;
}

.payment-info p {
    font-size: 0.9rem;
    color: #4a5568;
    margin: 0;
}

/* ============================================
   PAYMENT METHODS
   ============================================ */
.payment-methods {
    background: #f7fafc;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.payment-methods h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.8rem;
}

.methods-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.method-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #4a5568;
}

.method-item i {
    font-size: 1.2rem;
}

/* ============================================
   SANDBOX INFO
   ============================================ */
.sandbox-info {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
}

.sandbox-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sandbox-info p {
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 0.8rem;
}

.test-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.test-card {
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    text-align: center;
}

.test-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.2rem;
}

.test-card code {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1a202c;
    background: #fef3c7;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.test-card-detail {
    font-size: 0.65rem;
    color: #718096;
    margin-top: 0.1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
        padding: 0 12px;
        margin-top: 1rem;
    }
    .main-content {
        padding: 1rem;
    }
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .payment-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .methods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .test-card-grid {
        grid-template-columns: 1fr;
    }
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1rem;
    }
    .info-value {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.8rem;
    }
    .methods-grid {
        grid-template-columns: 1fr;
    }
    .payment-section {
        padding: 1rem;
    }
    .sandbox-info {
        padding: 0.8rem 1rem;
    }
}

/* ============================================
   ANIMASI LOADING
   ============================================ */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}
</style>

<?php include __DIR__ . '/../layouts/footer.php'; ?>