<?php
/**
 * Email: License Expiring Soon
 * Variables:
 *   $customer_name  string
 *   $customer_email string
 *   $license_key    string
 *   $expires        string  e.g. 'March 8, 2027'
 *   $days_remaining int
 *   $renewal_url    string
 *   $license_type   string  'subscription'
 *   $notice_period  string  '30 days' | '14 days'
 */
if ( ! defined( 'ABSPATH' ) ) exit;
$display_name    = ! empty( $customer_name )   ? esc_html( $customer_name )   : 'there';
$display_email   = ! empty( $customer_email )  ? esc_html( $customer_email )  : '';
$display_key     = ! empty( $license_key )     ? esc_html( $license_key )     : '';
$display_expires = ! empty( $expires )         ? esc_html( $expires )         : 'your renewal date';
$days_left       = ! empty( $days_remaining )  ? (int) $days_remaining        : 30;
$renewal_link    = ! empty( $renewal_url )     ? esc_url( $renewal_url )      : 'https://graphictshirts.shop/bogo/';
$is_urgent       = $days_left <= 14;
?><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>GT BOGO Engine PRO — License Expiring <?php echo $is_urgent ? 'Soon' : 'in 30 Days'; ?></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;">

<!-- TOP BAR -->
<tr><td><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
  <td style="height:5px;background:<?php echo $is_urgent ? '#f59e0b' : '#E10000'; ?>;font-size:0;line-height:0;">&nbsp;</td>
</tr></table></td></tr>

<!-- LOGO -->
<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,'Times New Roman',serif;font-size:24px;font-weight:700;color:#ffffff;letter-spacing:0.5px;line-height:1;">GT BOGO ENGINE</p>
      <p style="margin:0 0 5px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;color:#E10000;letter-spacing:3px;text-transform:uppercase;line-height:1;">for WooCommerce — PRO</p>
      <p style="margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:10px;font-weight:700;color:#2a4a6a;letter-spacing:3px;text-transform:uppercase;line-height:1;">Annual License Notice</p>
    </td>
  </tr></table>
</td></tr>

<!-- RED RULE -->
<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:<?php echo $is_urgent ? '#f59e0b' : '#E10000'; ?>;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>

<!-- HERO -->
<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:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:4px;text-transform:uppercase;color:<?php echo $is_urgent ? '#f59e0b' : '#E10000'; ?>;">
    <?php echo $is_urgent ? 'Urgent — 14 Days Remaining' : '30-Day Renewal Notice'; ?>
  </p>
  <h1 style="margin:0 0 20px 0;font-family:Georgia,'Times New Roman',serif;font-size:42px;font-weight:700;color:#ffffff;letter-spacing:-0.5px;line-height:1.15;">
    <?php echo $is_urgent ? 'Renew Now to<br>Stay Protected.' : 'Your License<br>Expires Soon.'; ?>
  </h1>
  <p style="margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:17px;font-weight:600;color:#8ab0d0;line-height:1.7;">
    Hi <strong style="color:#ffffff;"><?php echo $display_name; ?></strong> — your GT BOGO Engine PRO license expires in
    <strong style="color:<?php echo $is_urgent ? '#fbbf24' : '#ffffff'; ?>;"><?php echo $days_left; ?> days</strong>
    on <strong style="color:#ffffff;"><?php echo $display_expires; ?></strong>.
    Renew now to keep all PRO features running without interruption.
  </p>
</td></tr>

<!-- EXPIRY WARNING BOX -->
<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:<?php echo $is_urgent ? 'rgba(245,158,11,0.08)' : 'rgba(225,0,0,0.06)'; ?>;border:1px solid <?php echo $is_urgent ? 'rgba(245,158,11,0.3)' : 'rgba(225,0,0,0.25)'; ?>;border-radius:8px;padding:24px 28px;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#4a6a8a;border-bottom:1px solid #0f1a30;width:40%;">License Key</td>
        <td style="padding:10px 0;font-family:'Courier New',Courier,monospace;font-size:13px;font-weight:700;color:#ffffff;text-align:right;border-bottom:1px solid #0f1a30;word-break:break-all;"><?php echo $display_key; ?></td>
      </tr>
      <tr>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#4a6a8a;border-bottom:1px solid #0f1a30;">Type</td>
        <td style="padding:10px 0;text-align:right;border-bottom:1px solid #0f1a30;">
          <span style="background:rgba(59,130,246,0.1);border:1px solid rgba(59,130,246,0.3);color:#93c5fd;padding:2px 10px;border-radius:50px;font-size:12px;font-weight:700;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;">Annual — 1 Year</span>
        </td>
      </tr>
      <tr>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#4a6a8a;border-bottom:1px solid #0f1a30;">Registered Email</td>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#ffffff;text-align:right;border-bottom:1px solid #0f1a30;"><?php echo $display_email; ?></td>
      </tr>
      <tr>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:#4a6a8a;">Expiration Date</td>
        <td style="padding:10px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;color:<?php echo $is_urgent ? '#fbbf24' : '#ffffff'; ?>;text-align:right;"><?php echo $display_expires; ?></td>
      </tr>
    </table>
  </div>
</td></tr>

<!-- WHAT HAPPENS -->
<tr><td style="background-color:#070C1C;padding:40px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;border-top:1px solid #0f1a30;">
  <p style="margin:0 0 22px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:4px;text-transform:uppercase;color:#E10000;">What Happens If You Do Not Renew</p>
  <?php foreach ([
    'All PRO rules pause — your store reverts to Free plan (1 active rule only)',
    'Superpowers deactivate — Exit Intent, Countdown Timers, Announcement Bars, and all 15 Superpowers go offline',
    'Enterprise features lock — Analytics, A/B Testing, Scheduler, Segments, and Geo Targeting become inaccessible',
    'Your configuration is preserved — rules and settings are saved and restore instantly on renewal',
  ] as $item): ?>
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom:16px;"><tr>
    <td style="width:24px;vertical-align:top;padding-top:3px;"><p style="margin:0;font-family:Georgia,'Times New Roman',serif;font-size:18px;font-weight:700;color:#E10000;line-height:1;">—</p></td>
    <td style="vertical-align:top;padding-left:16px;"><p style="margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;font-weight:600;color:#c8d8e8;line-height:1.65;"><?php echo esc_html($item); ?></p></td>
  </tr></table>
  <?php endforeach; ?>
</td></tr>

<!-- STACKING NOTE -->
<tr><td style="background-color:#050a16;padding:32px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;border-top:1px solid #0f1a30;">
  <div style="background:rgba(34,197,94,0.05);border:1px solid rgba(34,197,94,0.15);border-radius:8px;padding:20px 24px;">
    <p style="margin:0 0 8px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:3px;text-transform:uppercase;color:#86efac;">License Stacking</p>
    <p style="margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:600;color:#8ab0d0;line-height:1.65;">Purchase additional years now and they stack on your current license — extending your expiry date automatically. Each license is tied to your email address and valid for one website at a time, transferable at any moment.</p>
  </div>
</td></tr>

<!-- CTA -->
<tr><td style="background-color:#070C1C;padding:44px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;border-top:1px solid #0f1a30;text-align:center;">
  <p style="margin:0 0 28px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:32px;font-weight:900;color:#ffffff;letter-spacing:-0.5px;">$19.99 <span style="font-size:16px;font-weight:400;color:#4a6a8a;">/ year</span></p>
  <a href="<?php echo $renewal_link; ?>" style="display:inline-block;padding:18px 56px;background:#E10000;color:#ffffff;text-decoration:none;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:12px;font-weight:700;letter-spacing:3px;text-transform:uppercase;">RENEW LICENSE NOW</a>
  <p style="margin:20px 0 0 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#4a6a8a;">Pro Packs are lifetime — only the annual license requires renewal.</p>
</td></tr>

<!-- RED RULE -->
<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>

<!-- GRAPHIC T-SHIRTS -->
<tr><td style="background-color:#03060f;padding:44px 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;">
      <p style="margin:0 0 5px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:4px;text-transform:uppercase;color:#E10000;">GRAPHIC T-SHIRTS</p>
      <p style="margin:0 0 10px 0;font-family:Georgia,'Times New Roman',serif;font-size:22px;font-weight:700;color:#ffffff;line-height:1.25;">Luxury Urban Couture<br>for the Bold.</p>
      <p style="margin:0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:600;color:#4a6a8a;line-height:1.6;">1,300+ unique pieces. Free worldwide shipping.</p>
    </td>
    <td style="text-align:right;vertical-align:middle;padding-left:24px;white-space:nowrap;">
      <a href="https://graphictshirts.shop" style="display:inline-block;padding:14px 28px;border:1px solid #1e3a5f;color:#7a9bc0;text-decoration:none;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:2px;text-transform:uppercase;">EXPLORE</a>
    </td>
  </tr></table>
</td></tr>

<!-- FOOTER -->
<tr><td style="background-color:#03060f;padding:18px 48px 36px 48px;border-left:1px solid #0f1a30;border-right:1px solid #0f1a30;border-top:1px solid #0a1628;text-align:center;">
  <p style="margin:0 0 5px 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:#ffffff;">GT BOGO ENGINE FOR WOOCOMMERCE</p>
  <p style="margin:0 0 8px 0;font-family:'Helvetica Neue',Helvetica,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:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#E10000;text-decoration:none;letter-spacing:1px;">graphictshirts.shop/bogo</a>
  <p style="margin:14px 0 0 0;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:11px;color:#2a4a6a;">&copy; <?php echo date('Y'); ?> GRAPHIC T-SHIRTS. All rights reserved.</p>
</td></tr>

<!-- BOTTOM BAR -->
<tr><td><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="height:5px;background:<?php echo $is_urgent ? '#f59e0b' : '#E10000'; ?>;font-size:0;line-height:0;">&nbsp;</td></tr></table></td></tr>

</table></td></tr></table>
</body></html>
