<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Thank You</title>
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Poppins:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>
        body, table, td, a { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
        table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; }
        img { -ms-interpolation-mode: bicubic; border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; }
        body {
            margin: 0;
            padding: 0;
            width: 100% !important;
            background-color: #f4f7fb;
            font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        }
        a { color: #0284c7; }

        @media screen and (max-width: 600px) {
            .mobile-stack {
                display: block !important;
                width: 100% !important;
                box-sizing: border-box !important;
                padding-right: 0 !important;
                text-align: center !important;
            }
            .mobile-center-img {
                margin: 0 auto 20px auto !important;
            }
            .mobile-text-center {
                text-align: center !important;
            }
            .mobile-text-center h1 {
                text-align: center !important;
                font-size: 20px !important;
            }
            .mobile-text-center p {
                text-align: center !important;
            }
            .card-col-stack {
                display: block !important;
                width: 100% !important;
                box-sizing: border-box !important;
                padding-right: 0 !important;
                padding-bottom: 16px !important;
            }
            .card-col-stack:last-child {
                padding-bottom: 0 !important;
            }
        }
    </style>
</head>
<body style="margin:0;padding:0;background-color:#f4f7fb;">

    <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background:linear-gradient(180deg,#f4f7fb 0%,#ffffff 280px);">
        <tr>
            <td align="center" style="padding:32px 16px 48px 16px;">

                <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:640px;background-color:#ffffff;border-radius:16px;overflow:hidden;box-shadow:0 24px 60px -28px rgba(15,23,42,0.18),0 4px 12px -4px rgba(15,23,42,0.06);">

                    {{-- Logo bar (top-left) --}}
                    <tr>
                        <td style="padding:24px 36px 0 36px;background:#ffffff;">
                            <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td align="left" style="vertical-align:middle;">
                                        <img src="https://yefranchisees.b-cdn.net/media/super_admin/1765876542596_h5zysjyuz2_1763553376085_6ko0s4sekh8_qualiti_logo.png"
                                             alt="{{ $franchisee->name ?? 'Young Engineers' }}"
                                             style="max-width:140px;height:auto;display:block;border:0;">
                                    </td>
                                    <td align="right" style="vertical-align:middle;font-family:'Poppins',Arial,sans-serif;font-size:11px;font-weight:600;color:#94a3b8;letter-spacing:0.18em;text-transform:uppercase;">
                                        {{ !empty($isPaymentEmail) ? 'Payment' : 'Confirmation' }}
                                    </td>
                                </tr>
                            </table>
                            <div style="height:1px;background:linear-gradient(90deg,rgba(14,165,233,0) 0%,#e2e8f0 50%,rgba(14,165,233,0) 100%);margin-top:22px;line-height:1px;font-size:0;">&nbsp;</div>
                        </td>
                    </tr>

                    {{-- Hero Section: Circular Image + Headline side-by-side --}}
                    <tr>
                        <td style="padding:32px 36px 20px 36px;background:#ffffff;">
                            <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <!-- Left Column: Circular Image with Rainbow Border -->
                                    <td class="mobile-stack mobile-center-img" width="170" valign="middle" style="width:170px;padding-right:24px;text-align:center;">
                                        <div style="display:inline-block;width:142px;height:142px;border-radius:50%;padding:4px;background:linear-gradient(135deg,#FF007F,#FF7F00,#7FFF00,#00FF7F,#007FFF,#7F00FF);box-shadow:0 8px 16px rgba(15,23,42,0.08);">
                                            <img src="https://yefranchisees.b-cdn.net/frontend/congratulations.png"
                                                 alt="Thank You"
                                                 width="134"
                                                 height="134"
                                                 style="display:block;width:134px;height:134px;border-radius:50%;object-fit:cover;border:4px solid #ffffff;background-color:#ffffff;">
                                        </div>
                                    </td>
                                    <!-- Right Column: Heading and Subtext -->
                                    <td class="mobile-stack mobile-text-center" valign="middle" style="font-family:'Poppins','Inter',Arial,sans-serif;text-align:left;">
                                        <h1 style="margin:0 0 10px 0;font-size:22px;line-height:1.25;font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:-0.5px;">
                                            @if(!empty($isPaymentEmail))
                                                Payment Confirmed{{ !empty($parentName) ? ', ' . htmlspecialchars($parentName) : '' }}!
                                            @else
                                                Thank You for Your Submission{{ !empty($parentName) ? ', ' . htmlspecialchars($parentName) : '' }}!
                                            @endif
                                        </h1>
                                        <p style="margin:0 0 10px 0;font-size:14px;line-height:1.5;color:#475569;font-weight:400;">
                                            @if(!empty($isPaymentEmail))
                                                Your payment has been confirmed. Below is a summary of your registration and payment details.
                                            @else
                                                Your enrollment details have been successfully received. We are excited to guide your child on their engineering journey!
                                            @endif
                                        </p>
                                        @if(empty($isPaymentEmail))
                                        <p style="margin:0;font-size:13px;line-height:1.5;color:#64748b;font-weight:400;">
                                            A member of our team will be in touch with you very soon with final confirmation.
                                        </p>
                                        @endif
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>

                    {{-- Accent divider --}}
                    <tr>
                        <td align="center" style="padding:10px 36px 16px 36px;">
                            <div style="height:1px;background:linear-gradient(90deg,rgba(14,165,233,0) 0%,#e2e8f0 50%,rgba(14,165,233,0) 100%);line-height:1px;font-size:0;">&nbsp;</div>
                        </td>
                    </tr>

                    {{-- Submission Details Section --}}
                    @if(!empty($bodyHtml))
                    <tr>
                        <td align="center" style="padding:16px 36px 4px 36px;font-family:'Poppins','Inter',Arial,sans-serif;">
                            <div style="font-size:20px;font-weight:700;color:#0f172a;text-align:center;margin-bottom:6px;letter-spacing:-0.2px;text-transform:uppercase;">
                                @if(!empty($isPaymentEmail))
                                    Payment <span style="color:#0ea5e9;">Confirmation</span>
                                @else
                                    Your Booking <span style="color:#0ea5e9;">Summary</span>
                                @endif
                            </div>
                            <p style="margin:0 0 4px 0;text-align:center;font-size:13px;color:#64748b;font-weight:400;">
                                @if(!empty($isPaymentEmail))
                                    Your registration and payment details are below for your records.
                                @else
                                    Below is a copy of your submitted information for your records.
                                @endif
                            </p>
                            @if(empty($isPaymentEmail))
                            <p style="margin:0;text-align:center;font-size:11px;color:#94a3b8;font-weight:500;letter-spacing:0.02em;">
                                Submitted on {{ $submittedOn ?? now()->format('F j, Y · g:i A') }}
                            </p>
                            @endif
                        </td>
                    </tr>
                    <tr>
                        <td align="left" style="padding:0 28px 8px 28px;font-family:'Poppins','Inter',Arial,sans-serif;color:#334155;font-size:14px;line-height:1.7;">
                            {!! $bodyHtml !!}
                        </td>
                    </tr>
                    @endif

                    {{-- Closing note --}}
                    <tr>
                        <td align="center" style="padding:30px 40px 8px 40px;font-family:'Poppins','Inter',Arial,sans-serif;">
                            <p style="margin:0;font-size:14px;line-height:1.75;color:#64748b;">
                                If you have any questions, simply reply to this email —<br>we'd love to hear from you.
                            </p>
                            <p style="margin:22px 0 0 0;font-size:15px;font-weight:500;color:#0f172a;line-height:1.6;">
                                Warm regards,<br>
                                <span style="font-family:'Playfair Display',Georgia,serif;font-size:18px;font-weight:700;color:#0284c7;">
                                    {{ $franchisee->name ?? 'The Young Engineers Team' }}
                                </span>
                            </p>
                        </td>
                    </tr>

                    {{-- Footer --}}
                    <tr>
                        <td style="padding:36px 36px 28px 36px;background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%);border-top:1px solid #eef2f7;">
                            <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td align="center" style="font-family:'Poppins',Arial,sans-serif;">
                                        <p style="margin:0 0 8px 0;font-size:13px;font-weight:700;color:#334155;letter-spacing:0.4px;text-transform:uppercase;">
                                            {{ $franchisee->name ?? 'Young Engineers' }}
                                        </p>
                                        <p style="margin:0;font-size:12px;color:#94a3b8;font-weight:500;">
                                            @if($franchisee && $franchisee->franchise_domain)
                                                <a href="https://{{ rtrim($franchisee->franchise_domain, '/') }}" target="_blank" style="color:#0284c7;text-decoration:none;font-weight:600;">
                                                    {{ $franchisee->franchise_domain }}
                                                </a>
                                                @if($franchisee->phone)
                                                    <span style="padding:0 10px;color:#cbd5e1;">•</span>
                                                @endif
                                            @endif
                                            @if($franchisee && $franchisee->phone)
                                                <a href="tel:{{ $franchisee->phone }}" style="color:#0284c7;text-decoration:none;font-weight:600;">{{ $franchisee->phone }}</a>
                                            @endif
                                        </p>
                                        <p style="margin:18px 0 0 0;font-size:11px;color:#cbd5e1;font-weight:500;letter-spacing:0.05em;">
                                            © {{ date('Y') }} {{ $franchisee->name ?? 'Young Engineers' }}. All rights reserved.
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>

                </table>

            </td>
        </tr>
    </table>

</body>
</html>
