<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
// phpcs:disable WordPress.Security.NonceVerification
// phpcs:disable WordPress.Security.ValidatedSanitizedInput
// phpcs:disable WordPress.WP.EnqueuedResourceParameters
// phpcs:disable WordPress.PHP.DevelopmentFunctions
// phpcs:disable WordPress.DB.PreparedSQL
// phpcs:disable PluginCheck.Security.DirectDB
// phpcs:disable PluginCheck.CodeAnalysis
if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * Email: Loyalty Nudge 2 — Day 14–19 after second purchase
 * Variables: $customer_name, $store_name, $store_url, $order_count, $vip_threshold, $deal_url
 */
$display_name      = ! empty( $customer_name )   ? esc_html( $customer_name )  : 'there';
$display_store     = ! empty( $store_name )      ? esc_html( $store_name )     : 'our store';
$display_count     = ! empty( $order_count )     ? (int) $order_count          : 2;
$display_threshold = ! empty( $vip_threshold )   ? (int) $vip_threshold        : 5;
$display_remaining = max( 1, $display_threshold - $display_count );
$shop_link         = ! empty( $store_url )       ? esc_url( $store_url )       : '#';
$deal_link         = ! empty( $deal_url )        ? esc_url( $deal_url )        : $shop_link;
?><!DOCTYPE html><html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>You are close to VIP status</title></head>
<body style="margin:0;padding:0;background-color:#070C1C;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#070C1C" style="background-color:#070C1C;padding:0;">
<tr><td align="center" style="padding:32px 16px 48px 16px;">
<table width="620" cellpadding="0" cellspacing="0" border="0" style="max-width:620px;width:100%;background-color:#070C1C;">
<tr><td><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="height:5px;background:#E10000;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>
<tr><td style="background-color:#070C1C;padding:40px 48px 32px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;">
  <table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
    <td style="vertical-align:middle;width:80px;"><img src="https://graphictshirts.shop/bogo/icon-128x128.png" width="72" height="72" alt="GT BOGO Engine" style="display:block;border-radius:10px;" /></td>
    <td style="vertical-align:middle;padding-left:20px;">
      <p style="margin:0 0 3px 0;font-family:Georgia,serif;font-size:24px;font-weight:700;color:#ffffff;">GT BOGO ENGINE</p>
      <p style="margin:0 0 5px 0;font-family:Arial,sans-serif;font-size:11px;font-weight:700;color:#E10000;letter-spacing:3px;text-transform:uppercase;">for WooCommerce — PRO</p>
      <p style="margin:0;font-family:Arial,sans-serif;font-size:10px;font-weight:700;color:#2a4a6a;letter-spacing:3px;text-transform:uppercase;">Loyalty Milestone</p>
    </td>
  </tr></table>
</td></tr>
<tr><td style="padding:0 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="height:1px;background:#E10000;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>
<tr><td style="background-color:#070C1C;padding:44px 48px 40px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;">
  <p style="margin:0 0 10px 0;font-family:Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:4px;text-transform:uppercase;color:#E10000;">VIP Is Close</p>
  <h1 style="margin:0 0 20px 0;font-family:Georgia,serif;font-size:38px;font-weight:700;color:#ffffff;line-height:1.15;"><?php echo esc_html( $display_remaining ); ?> Orders Away<br>From VIP Status.</h1>
  <p style="margin:0;font-family:Arial,sans-serif;font-size:17px;color:#8ab0d0;line-height:1.7;">Hi <strong style="color:#ffffff;"><?php echo esc_html( $display_name ); ?></strong> — you have made <strong style="color:#ffffff;"><?php echo esc_html( $display_count ); ?> purchases</strong> at <?php echo esc_html( $display_store ); ?>. VIP status unlocks at <?php echo esc_html( $display_threshold ); ?> orders. You are nearly there.</p>
</td></tr>
<tr><td style="background-color:#050a16;padding:40px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;border-top:1px solid #0f1a30;">
  <div style="background:rgba(225,0,0,0.06);border:1px solid rgba(225,0,0,0.2);border-radius:8px;padding:24px 28px;margin-bottom:28px;">
    <p style="margin:0 0 8px 0;font-family:Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:3px;text-transform:uppercase;color:#E10000;">Your Progress</p>
    <p style="margin:0;font-family:Georgia,serif;font-size:28px;font-weight:700;color:#ffffff;"><?php echo esc_html( $display_count ); ?> / <?php echo esc_html( $display_threshold ); ?> orders</p>
  </div>
  <div style="text-align:center;"><a href="<?php echo esc_url( $deal_link ); ?>" style="display:inline-block;padding:16px 48px;background:#E10000;color:#ffffff;text-decoration:none;font-family:Arial,sans-serif;font-size:12px;font-weight:700;letter-spacing:3px;text-transform:uppercase;">Keep Going — Shop Now</a></div>
</td></tr>
<tr><td style="border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="height:1px;background:#E10000;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>
<tr><td style="background-color:#03060f;padding:18px 48px 36px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;text-align:center;">
  <p style="margin:0 0 8px 0;font-family:Arial,sans-serif;font-size:13px;font-weight:600;color:#8ab0d0;">A product by GRAPHIC T-SHIRTS</p>
  <a href="https://graphictshirts.shop/bogo" style="font-family:Arial,sans-serif;font-size:13px;color:#E10000;text-decoration:none;">graphictshirts.shop/bogo</a>
  <p style="margin:14px 0 0 0;font-family:Arial,sans-serif;font-size:11px;color:#2a4a6a;">&copy; <?php echo esc_html( gmdate('Y') ); ?> GRAPHIC T-SHIRTS. All rights reserved.</p>
</td></tr>
<tr><td><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="height:5px;background:#E10000;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>
</table></td></tr></table>
</body></html>