<!doctype html>
<html>
<body style="margin:0;padding:0;background:#f3f6fb;font-family:Segoe UI,Arial,sans-serif;color:#111827;">
  <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f3f6fb;padding:28px 12px;">
    <tr><td align="center">
      <table role="presentation" width="640" cellspacing="0" cellpadding="0" style="max-width:640px;width:100%;background:#ffffff;border:1px solid #dfe7f1;border-radius:18px;overflow:hidden;box-shadow:0 18px 48px rgba(15,23,42,.10);">
        <tr>
          <td style="padding:30px;background:linear-gradient(135deg,#0f766e,#111827);color:#ffffff;">
            <div style="font-size:12px;font-weight:800;letter-spacing:2px;text-transform:uppercase;color:#8ff0d2;">PAID - CONFIRMED</div>
            <h1 style="margin:10px 0 0;font-size:28px;line-height:1.2;color:#ffffff;">Your Nexora Ticket Is Confirmed</h1>
            <div style="margin-top:14px;display:inline-block;padding:8px 14px;border-radius:999px;background:rgba(255,255,255,.14);font-size:13px;font-weight:700;">{{ details.ticket_number }}</div>
            <div style="margin-top:10px;padding:8px 14px;border-radius:999px;background:rgba(255,255,255,.10);font-size:12px;font-weight:600;color:rgba(255,255,255,.85);">
              CNIC: {{ details.cnic }}
            </div>
          </td>
        </tr>
        <tr><td style="padding:28px 30px;">
          <div style="padding:16px 18px;background:#e8f8ef;border:1px solid #bfe9d0;border-left:5px solid #17996b;border-radius:12px;margin-bottom:20px;">
            <strong style="display:block;color:#12724f;font-size:15px;">Dear {{ recipient.name if recipient is defined else details.name }},</strong>
            {% if is_team is defined and is_team %}
            <span style="display:block;color:#215e47;font-size:13.5px;line-height:1.6;margin-top:5px;">Your team payment has been received and approved. Every team member's individual PDF ticket is attached with this email. Please bring your <strong>original CNIC</strong> and your ticket to the event for verification.</span>
            {% else %}
            <span style="display:block;color:#215e47;font-size:13.5px;line-height:1.6;margin-top:5px;">Your payment has been received and approved. Your PDF ticket is attached with this email. Please bring your <strong>original CNIC</strong> and this ticket to the event for verification.</span>
            {% endif %}
          </div>
          {% if is_team is defined and is_team and roster is defined and roster %}
          <div style="padding:14px 18px;background:#f0f7ff;border:1px solid #bfdbfe;border-left:5px solid #2563eb;border-radius:12px;margin-bottom:20px;">
            <strong style="display:block;color:#1e40af;font-size:14px;margin-bottom:6px;">Team Roster</strong>
            {% for line in roster %}
            <span style="display:block;color:#1e3a5f;font-size:13px;line-height:1.8;">{{ line }}</span>
            {% endfor %}
          </div>
          {% endif %}
          <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border:1px solid #dfe7f1;border-radius:12px;overflow:hidden;">
            {% for label, value in [
              ('Ticket Number', details.ticket_number),
              ('Name', details.name),
              ('Email', details.email),
              ('Contact Number', details.phone),
              ('CNIC', details.cnic),
              ('Game Applied', details.game),
              ('Platform', details.platform),
              ('Entry Type', details.entry_type),
              ('Member Count', details.member_count),
              ('Team Name', details.team_name),
              ('Leader Name', details.leader_name),
              ('Amount Received', payment_received if payment_received is defined else 'Rs. 0'),
              ('Amount Due', payment_due if payment_due is defined else 'Rs. 0'),
              ('Applied Date & Time', details.created_at),
              ('Payment Status', 'Paid & Approved')
            ] %}
            <tr>
              <td style="padding:12px 16px;border-bottom:1px solid #e8eef6;background:#f8fafc;color:#64748b;font-size:13px;font-weight:700;width:42%;">{{ label }}</td>
              <td style="padding:12px 16px;border-bottom:1px solid #e8eef6;color:#111827;font-size:14px;font-weight:700;text-align:right;">{{ value }}</td>
            </tr>
            {% endfor %}
          </table>
          <p style="margin:22px 0 0;font-size:13.5px;line-height:1.7;color:#64748b;">
            Event: <strong style="color:#111827;">{{ settings.event_date | pretty_dt }}</strong><br>
            Venue: {{ settings.event_venue }}{% if settings.event_city %}, {{ settings.event_city }}{% endif %}
          </p>
          <p style="margin:16px 0 0;font-size:12px;color:#94a3b8;text-align:center;">
            If you did not expect this email, please contact <a href="mailto:nexora.esport.support@gmail.com" style="color:#2563eb;">nexora.esport.support@gmail.com</a> or WhatsApp <a href="https://wa.me/923310314962" style="color:#2563eb;">+92 331 0314962</a>
          </p>
        </td></tr>
        <tr><td style="padding:18px 30px;background:#111827;color:#cbd5e1;font-size:12.5px;text-align:center;">
          {{ settings.event_title }}{% if settings.contact_email %} กค {{ settings.contact_email }}{% endif %} กค WhatsApp: +92 331 0314962
          <br><span style="font-size:11px;color:#64748b;">This is a transactional email regarding your registration. You are receiving this because you registered for {{ settings.event_title }}.</span>
        </td></tr>
      </table>
    </td></tr>
  </table>
</body>
</html>
