<?php $__env->startSection('header'); ?>
    <?php echo $__env->make('emails.partials.regiticket-email-logo', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-bottom:35px;">
        <tr>
            <td align="center" style="padding:0;">
                <p style="margin:0 0 8px 0;font-family:monospace;color:#8e8e93;font-size:14px;">ORDEN #<?php echo e(str_pad($order->id, 6, '0', STR_PAD_LEFT)); ?></p>
                <table cellpadding="0" cellspacing="0" border="0" align="center" style="border-collapse:collapse;">
                    <tr>
                        <td bgcolor="#f0fdf4" align="center" style="background-color:#f0fdf4;border:1px solid #bbf7d0;padding:6px 15px;">
                            <span style="font-size:12px;font-weight:bold;color:#166534;text-transform:uppercase;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Pago Exitoso')); ?></span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

    <p style="margin:16px 0;line-height:1.65;color:#48484a;font-size:15px;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Hola,')); ?></p>
    <p style="margin:16px 0;line-height:1.65;color:#48484a;font-size:15px;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Tu pago ha sido procesado correctamente. A continuación encontrarás tus entradas digitales. Presenta el código QR al llegar al evento.')); ?></p>

    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-bottom:30px;">
        <tr>
            <td bgcolor="#f9f9f9" style="background-color:#f9f9f9;border:1px solid #f0f0f0;padding:25px;font-family:Helvetica,Arial,sans-serif;">
                <div style="font-weight:bold;font-size:20px;margin-bottom:8px;color:#1c1c1e;line-height:1.3;"><?php echo e($event->title); ?></div>
                <div style="font-size:15px;color:#636366;line-height:1.5;">
                    <div style="margin-bottom:5px;">📅 <?php echo e(\Carbon\Carbon::parse($event->start_date)->setTimezone($event->timezone ?? 'America/Puerto_Rico')->translatedFormat('D, d M Y · g:i A')); ?></div>
                    <?php if($event->venue): ?>
                        <div>📍 <?php echo e($event->venue->name); ?></div>
                    <?php endif; ?>
                </div>
            </td>
        </tr>
    </table>

    <?php $__currentLoopData = $order->attendees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attendee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-bottom:25px;">
            <tr>
                <td bgcolor="#ffffff" style="background-color:#ffffff;border:1px solid #eeeeee;padding:30px;text-align:center;font-family:Helvetica,Arial,sans-serif;">
                    <div style="font-weight:bold;font-size:18px;color:#1c1c1e;"><?php echo e($attendee->holder_name ?: __('Asistente')); ?></div>
                    <div style="color:#b91830;font-size:12px;font-weight:bold;text-transform:uppercase;margin-top:6px;"><?php echo e($attendee->ticketType?->name); ?></div>

                    <table align="center" cellpadding="0" cellspacing="0" border="0" style="margin:20px auto;border-collapse:collapse;">
                        <tr>
                            <td align="center">
                                <img src="<?php echo e($qrUrls[$attendee->id]); ?>" alt="QR" width="180" height="180" border="0" style="display:block;border:0;">
                            </td>
                        </tr>
                    </table>

                    <div style="font-family:monospace;font-size:11px;color:#aeaeb2;"><?php echo e($attendee->security_code); ?></div>

                    <?php
                        $bib = $attendee->registration_data['bib'] ?? null;
                    ?>
                    <?php if($bib): ?>
                        <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-top:25px;">
                            <tr>
                                <td style="padding-top:20px;border-top:1px solid #f0f0f0;">
                                    <div style="font-size:10px;text-transform:uppercase;color:#8e8e93;font-weight:bold;margin-bottom:5px;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Número de Corredor (BIB)')); ?></div>
                                    <div style="font-size:32px;font-weight:bold;color:#1c1c1e;font-family:Helvetica,Arial,sans-serif;"><?php echo e($bib); ?></div>
                                </td>
                            </tr>
                        </table>
                    <?php endif; ?>
                </td>
            </tr>
        </table>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

    <h3 style="margin:40px 0 0 0;font-size:14px;border-bottom:2px solid #1c1c1e;padding-bottom:10px;text-transform:uppercase;color:#1c1c1e;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Resumen de la Compra')); ?></h3>
    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;margin-top:25px;font-family:Helvetica,Arial,sans-serif;">
        <?php $__currentLoopData = $order->attendees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attendee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $base = (float) ($attendee->ticketType?->sale_price ?? $attendee->ticketType?->price);
                $ticketTotal = \App\Services\FeeCalculator::calculateTotalForAttendee($base);
            ?>
            <tr>
                <td style="padding:15px 0;border-bottom:1px solid #f0f0f0;">
                    <strong style="font-size:15px;color:#1c1c1e;"><?php echo e($attendee->holder_name ?: __('Asistente')); ?></strong><br>
                    <span style="font-size:13px;color:#8e8e93;"><?php echo e($attendee->ticketType?->name); ?></span>
                </td>
                <td style="padding:15px 0;border-bottom:1px solid #f0f0f0;text-align:right;font-size:15px;font-weight:600;color:#1c1c1e;">$<?php echo e(number_format($ticketTotal, 2)); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <td style="padding:20px 0 0 0;color:#1c1c1e;font-weight:bold;font-size:20px;border-bottom:none;"><?php echo e(__('Total Pagado')); ?></td>
            <td style="padding:20px 0 0 0;text-align:right;color:#b91830;font-weight:bold;font-size:20px;border-bottom:none;">$<?php echo e(number_format((float) $order->total_amount, 2)); ?></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:right;font-size:11px;color:#aeaeb2;padding-top:8px;font-weight:600;border-bottom:none;">
                <?php echo e($order->currency); ?> (IVA Incl.)
            </td>
        </tr>
    </table>

    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-top:50px;">
        <tr>
            <td align="center" style="padding:0;">
                <p style="font-size:14px;color:#8e8e93;margin:0 0 25px 0;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('También puedes acceder a tu orden y gestionar tus tickets online:')); ?></p>
                <?php echo $__env->make('emails.partials.button-primary', [
                    'url' => route('landing.event.checkout.confirmation', ['event' => $event->slug, 'checkoutOrder' => $order->uuid]),
                    'label' => __('Ver mi Orden Online'),
                ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
            </td>
        </tr>
    </table>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footer'); ?>
    <p style="color:#ffffff;margin:0 0 12px 0;font-weight:bold;font-size:14px;font-family:Helvetica,Arial,sans-serif;"><?php echo e(config('app.name')); ?></p>
    <p style="margin:0 0 15px 0;color:#8e8e93;font-family:Helvetica,Arial,sans-serif;">&copy; <?php echo e(date('Y')); ?> <?php echo e(__('Todos los derechos reservados.')); ?></p>
    <?php echo $__env->make('emails.partials.footer-rule', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <p style="color:#555555;font-size:11px;margin:0;font-family:Helvetica,Arial,sans-serif;"><?php echo e(__('Este correo confirma tu transacción segura en la red de Regiticket.')); ?></p>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('emails.layouts.regiticket-branded', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/resources/views/emails/order-confirmation.blade.php ENDPATH**/ ?>