<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Pembayaran Berhasil</title>
    <!--[if mso]>
    <style type="text/css">
        body, table, td {font-family: Arial, sans-serif !important;}
    </style>
    <![endif]-->
</head>
<body style="margin: 0; padding: 0; background-color: #f3f4f6; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;">
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color: #f3f4f6;">
        <tr>
            <td align="center" style="padding: 40px 20px;">
                <!-- Main Container -->
                <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="600" style="max-width: 600px; background-color: #ffffff; border-radius: 16px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); overflow: hidden;">
                    <!-- Header with Gradient -->
                    <tr>
                        <td style="background: linear-gradient(135deg, #10b981 0%, #059669 100%); padding: 40px 30px; text-align: center;">
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
                                <tr>
                                    <td align="center">
                                        <div style="width: 80px; height: 80px; background-color: rgba(255, 255, 255, 0.2); border-radius: 50%; display: inline-block; margin-bottom: 20px;">
                                            <svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-top: 20px;">
                                                <path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
                                            </svg>
                                        </div>
                                        <h1 style="margin: 0; color: #ffffff; font-size: 32px; font-weight: 700; letter-spacing: -0.5px;">
                                            Pembayaran Berhasil!
                                        </h1>
                                        <p style="margin: 12px 0 0 0; color: rgba(255, 255, 255, 0.95); font-size: 18px;">
                                            Coin Anda telah ditambahkan ke akun
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    
                    <!-- Content -->
                    <tr>
                        <td style="padding: 40px 30px;">
                            <p style="margin: 0 0 24px 0; color: #374151; font-size: 16px; line-height: 1.6;">
                                Terima kasih! Pembayaran Anda telah berhasil diproses. Coin telah ditambahkan ke saldo akun Anda.
                            </p>
                            
                            <!-- Success Details Box -->
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
                                <tr>
                                    <td style="background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 2px solid #d4af37; border-radius: 12px; padding: 30px; text-align: center; box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);">
                                        <p style="margin: 0 0 12px 0; color: #92400e; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;">
                                            Coin Ditambahkan
                                        </p>
                                        <p style="margin: 0; font-size: 48px; font-weight: 700; color: #d4af37; line-height: 1.2;">
                                            +{{ number_format($transaction->coins, 0, ',', '.') }}
                                        </p>
                                        <p style="margin: 8px 0 0 0; color: #92400e; font-size: 18px; font-weight: 600;">
                                            {{ \App\Models\User::getCoinAbbreviation() }}
                                        </p>
                                    </td>
                                </tr>
                            </table>
                            
                            <!-- Transaction Details -->
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-top: 24px;">
                                <tr>
                                    <td style="background-color: #f9fafb; border-radius: 12px; padding: 24px; border: 1px solid #e5e7eb;">
                                        <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
                                            <tr>
                                                <td style="padding-bottom: 16px; border-bottom: 2px solid #10b981;">
                                                    <p style="margin: 0; color: #059669; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;">
                                                        Detail Transaksi
                                                    </p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="padding-top: 16px;">
                                                    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
                                                        <tr>
                                                            <td style="padding: 8px 0;">
                                                                <p style="margin: 0; color: #6b7280; font-size: 14px;">Kode Referensi</p>
                                                                <p style="margin: 4px 0 0 0; color: #111827; font-size: 16px; font-weight: 600;">{{ $transaction->reference_code }}</p>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="padding: 8px 0;">
                                                                <p style="margin: 0; color: #6b7280; font-size: 14px;">Metode Pembayaran</p>
                                                                <p style="margin: 4px 0 0 0; color: #111827; font-size: 16px; font-weight: 600;">{{ $transaction->payment_channel }}</p>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="padding: 8px 0;">
                                                                <p style="margin: 0; color: #6b7280; font-size: 14px;">Jumlah Pembayaran</p>
                                                                <p style="margin: 4px 0 0 0; color: #111827; font-size: 18px; font-weight: 600;">Rp {{ number_format($transaction->amount, 0, ',', '.') }}</p>
                                                            </td>
                                                        </tr>
                                                        @if($transaction->fee > 0)
                                                        <tr>
                                                            <td style="padding: 8px 0;">
                                                                <p style="margin: 0; color: #6b7280; font-size: 14px;">Biaya Admin</p>
                                                                <p style="margin: 4px 0 0 0; color: #111827; font-size: 16px; font-weight: 600;">Rp {{ number_format($transaction->fee, 0, ',', '.') }}</p>
                                                            </td>
                                                        </tr>
                                                        @endif
                                                        <tr>
                                                            <td style="padding: 8px 0;">
                                                                <p style="margin: 0; color: #6b7280; font-size: 14px;">Waktu Pembayaran</p>
                                                                <p style="margin: 4px 0 0 0; color: #111827; font-size: 16px; font-weight: 600;">{{ $transaction->paid_at->format('d F Y, H:i') }} WIB</p>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="padding: 8px 0; border-top: 1px solid #e5e7eb; margin-top: 8px;">
                                                                <p style="margin: 8px 0 0 0; color: #6b7280; font-size: 14px;">Saldo Coin Saat Ini</p>
                                                                <p style="margin: 4px 0 0 0; color: #10b981; font-size: 22px; font-weight: 700;">{{ number_format($transaction->user->coin_balance ?? 0, 0, ',', '.') }} {{ \App\Models\User::getCoinAbbreviation() }}</p>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            
                            <!-- Action Button -->
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-top: 24px;">
                                <tr>
                                    <td style="text-align: center;">
                                        <a href="{{ route('dashboard') }}" style="display: inline-block; padding: 14px 32px; background-color: #d4af37; color: #ffffff; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 16px;">
                                            Kembali ke Dashboard
                                        </a>
                                    </td>
                                </tr>
                            </table>
                            
                            <!-- Success Message -->
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-top: 24px;">
                                <tr>
                                    <td style="padding: 16px; background-color: #d1fae5; border-radius: 8px; border: 1px solid #10b981;">
                                        <p style="margin: 0; color: #065f46; font-size: 14px; line-height: 1.6; text-align: center;">
                                            <strong>🎉 Selamat!</strong> Coin Anda telah berhasil ditambahkan. Anda sekarang dapat menggunakan coin untuk membeli show favorit Anda.
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    
                    <!-- Footer -->
                    <tr>
                        <td style="background-color: #f9fafb; padding: 30px; border-top: 1px solid #e5e7eb;">
                            <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
                                <tr>
                                    <td style="text-align: center;">
                                        <p style="margin: 0 0 8px 0; color: #6b7280; font-size: 12px;">
                                            Terima kasih telah menggunakan layanan kami.
                                        </p>
                                        <p style="margin: 20px 0 0 0; color: #9ca3af; font-size: 11px;">
                                            © {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>

