<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Payment Failed</title>
</head>
<body style="margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f3f4f6;">
    <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="max-width: 600px; margin: 0 auto; background-color: #ffffff;">
        <!-- Header -->
        <tr>
            <td style="background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%); padding: 40px 30px; text-align: center;">
                <div style="width: 60px; height: 60px; background-color: rgba(255,255,255,0.2); border-radius: 50%; margin: 0 auto 15px; display: flex; align-items: center; justify-content: center;">
                    <span style="font-size: 30px;">❌</span>
                </div>
                <h1 style="margin: 0; color: #ffffff; font-size: 28px; font-weight: 600;">
                    Payment Failed
                </h1>
            </td>
        </tr>

        <!-- Body -->
        <tr>
            <td style="padding: 40px 30px;">
                <p style="margin: 0 0 20px; font-size: 16px; color: #374151; line-height: 1.6;">
                    Dear {{ $userName }},
                </p>

                <p style="margin: 0 0 20px; font-size: 16px; color: #374151; line-height: 1.6;">
                    Unfortunately, your payment for <strong>{{ $trainingName }}</strong> could not be processed.
                    Your registration is still pending and will be confirmed once payment is completed.
                </p>

                <!-- Payment Details Card -->
                <table role="presentation" width="100%" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; margin: 30px 0;">
                    <tr>
                        <td style="padding: 25px;">
                            <h3 style="margin: 0 0 20px; color: #991b1b; font-size: 18px; border-bottom: 2px solid #fecaca; padding-bottom: 10px;">
                                Payment Details
                            </h3>
                            <table role="presentation" width="100%" cellspacing="0" cellpadding="8">
                                <tr>
                                    <td style="color: #6b7280; font-size: 14px; width: 40%;">Training Program:</td>
                                    <td style="color: #111827; font-size: 14px; font-weight: 500;">{{ $trainingName }}</td>
                                </tr>
                                <tr>
                                    <td style="color: #6b7280; font-size: 14px;">Amount:</td>
                                    <td style="color: #111827; font-size: 16px; font-weight: 600;">{{ $amount }}</td>
                                </tr>
                                @if(!empty($reference))
                                <tr>
                                    <td style="color: #6b7280; font-size: 14px;">Reference:</td>
                                    <td style="color: #111827; font-size: 14px; font-weight: 500; font-family: monospace;">{{ $reference }}</td>
                                </tr>
                                @endif
                                @if(!empty($reason))
                                <tr>
                                    <td style="color: #6b7280; font-size: 14px;">Reason:</td>
                                    <td style="color: #dc2626; font-size: 14px; font-weight: 500;">{{ $reason }}</td>
                                </tr>
                                @endif
                            </table>
                        </td>
                    </tr>
                </table>

                <p style="margin: 0 0 20px; font-size: 14px; color: #374151; line-height: 1.6;">
                    Please try again or contact our support team at
                    <a href="mailto:{{ $supportEmail ?? config('mail.from.address') }}" style="color: #0891b2;">
                        {{ $supportEmail ?? config('mail.from.address') }}
                    </a>
                    if the problem persists.
                </p>

                <!-- Call to Action -->
                <table role="presentation" width="100%" style="margin: 30px 0;">
                    <tr>
                        <td align="center">
                            <a href="{{ route('training.registrations.my') }}" style="display: inline-block; background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%); color: #ffffff; padding: 14px 32px; text-decoration: none; border-radius: 6px; font-size: 15px; font-weight: 500;">
                                View My Registrations
                            </a>
                        </td>
                    </tr>
                </table>

                <p style="margin: 0; font-size: 14px; color: #6b7280; line-height: 1.6;">
                    Best regards,<br>
                    <strong>{{ config('app.name') }}</strong> Training Team
                </p>
            </td>
        </tr>

        <!-- Footer -->
        <tr>
            <td style="background-color: #f3f4f6; padding: 30px; text-align: center; border-top: 1px solid #e5e7eb;">
                <p style="margin: 0 0 10px; font-size: 13px; color: #6b7280;">
                    &copy; {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
                </p>
                <p style="margin: 0; font-size: 12px; color: #9ca3af;">
                    If you did not initiate this payment, please contact support immediately.
                </p>
            </td>
        </tr>
    </table>
</body>
</html>
