<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
// phpcs:disable WordPress.Security.NonceVerification
// phpcs:disable WordPress.Security.ValidatedSanitizedInput
// phpcs:disable WordPress.WP.EnqueuedResourceParameters
// phpcs:disable WordPress.DB.PreparedSQL
// phpcs:disable WordPress.DB.PreparedSQLPlaceholders
// phpcs:disable WordPress.DB.DirectDatabaseQuery
// phpcs:disable WordPress.DB.SlowDBQuery
// phpcs:disable PluginCheck.Security.DirectDB
// phpcs:disable PluginCheck.CodeAnalysis
// phpcs:disable WordPressVIPMinimum

/**
 * GT BOGO Engine — Store Owner Documentation
 * Plain-language guide to maximising revenue with GT BOGO Engine PRO.
 *
 * @package GT_BOGO_Engine
 * @since   3.12.0
 * @updated 3.23.3
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$is_pro = function_exists( 'gt_bogo_has_pro' ) ? gt_bogo_has_pro() : false;
$ver    = defined( 'GT_BOGO_VERSION' ) ? GT_BOGO_VERSION : '3.23.3';
$doc    = isset( $_GET['doc'] ) ? sanitize_key( $_GET['doc'] ) : 'overview';

$sections = array(
	'overview'     => array(
		'icon'  => '📖',
		'title' => 'Getting Started',
	),
	'golive'       => array(
		'icon'  => '🚀',
		'title' => 'Go Live Checklist',
	),
	'rules'        => array(
		'icon'  => '⚡',
		'title' => 'Your Deals & Packs',
	),
	'superpowers'  => array(
		'icon'  => '💎',
		'title' => 'Smart Selling Tools',
	),
	'scheduler'    => array(
		'icon'  => '📅',
		'title' => 'Timed Campaigns',
	),
	'loyalty'      => array(
		'icon'  => '👑',
		'title' => 'Loyalty & VIP',
	),
	'referrals'    => array(
		'icon'  => '🔗',
		'title' => 'Referral Program',
	),
	'emails'       => array(
		'icon'  => '📧',
		'title' => 'Automated Emails',
	),
	'analytics'    => array(
		'icon'  => '📈',
		'title' => 'Seeing What Works',
	),
	'ai'           => array(
		'icon'  => '🧠',
		'title' => 'AI Intelligence',
	),
	'abtesting'    => array(
		'icon'  => '🔬',
		'title' => 'Testing Deals',
	),
	'segments'     => array(
		'icon'  => '🎯',
		'title' => 'Customer Groups',
	),
	'conditions'   => array(
		'icon'  => '⚙️',
		'title' => 'Who Gets Your Deals',
	),
	'dealpage'     => array(
		'icon'  => '🏪',
		'title' => 'Your Deals Page',
	),
	'geo'          => array(
		'icon'  => '🌍',
		'title' => 'Country Targeting',
	),
	'currency'     => array(
		'icon'  => '💱',
		'title' => 'Multiple Currencies',
	),
	'whitelabel'   => array(
		'icon'  => '🏷️',
		'title' => 'Agency White Label',
	),
	'integrations' => array(
		'icon'  => '🔌',
		'title' => 'Connecting Other Tools',
	),
	'settings'     => array(
		'icon'  => '⚙️',
		'title' => 'Settings Guide',
	),
	'pricing'      => array(
		'icon'  => '💳',
		'title' => 'Pricing & License',
	),
);

require_once __DIR__ . '/../ui-system/wrapper-start.php';
?>

<div class="gt-page-header gt-animate-in">
	<div>
	<h1 class="gt-page-title">📖 Store Owner Guide</h1>
	<p class="gt-page-subtitle">Everything you need to grow your revenue with GT BOGO Engine PRO v<?php echo esc_html( $ver ); ?> — written for store owners, not developers.</p>
	</div>
	<div class="gt-page-actions">
	<a href="https://graphictshirts.shop/bogo/" target="_blank" class="gt-btn gt-btn-ghost">Get Support →</a>
	</div>
</div>

<div style="display:grid;grid-template-columns:220px 1fr;gap:24px;align-items:start">

<div class="gt-card gt-animate-in" style="padding:0;overflow:hidden;position:sticky;top:32px">
	<div style="padding:14px 18px;border-bottom:1px solid var(--gt-border)">
	<p style="margin:0;font-size:11px;font-weight:800;color:var(--gt-subtle);letter-spacing:.1em;text-transform:uppercase">Guide Contents</p>
	</div>
	<nav style="padding:8px 0">
	<?php
	foreach ( $sections as $key => $s ) :
		$active = $doc === $key;
		?>
	<a href="?page=gt-bogo-engine&tab=documentation&doc=<?php echo esc_attr( $key ); ?>" data-doc="<?php echo esc_attr( $key ); ?>" class="gt-doc-nav-link"
		style="display:flex;align-items:center;gap:10px;padding:9px 18px;text-decoration:none;font-size:13px;font-weight:<?php echo esc_html( $active ) ? '700' : '500'; ?>;color:<?php echo esc_html( $active ) ? '#ffffff' : 'var(--gt-soft)'; ?>;background:<?php echo esc_html( $active ) ? 'rgba(225,0,0,0.12)' : 'transparent'; ?>;border-left:3px solid <?php echo esc_html( $active ) ? '#E10000' : 'transparent'; ?>;transition:all .15s">
		<span style="font-size:15px"><?php echo esc_html( $s['icon'] ); ?></span>
		<?php echo esc_html( $s['title'] ); ?>
	</a>
	<?php endforeach; ?>
	</nav>
</div>

<div class="gt-animate-in" id="gt-doc-content">

<?php if ( $doc === 'overview' ) : ?>
<?php
$doc_free_rule_enabled = (bool) get_option( 'gt_bogo_free_rule_enabled', false );
$doc_rule_name         = get_option( 'gt_bogo_free_rule_name', '' );
$doc_buy_qty           = (int) get_option( 'gt_bogo_free_rule_buy_qty', 1 );
$doc_get_qty           = (int) get_option( 'gt_bogo_free_rule_get_qty', 1 );
$doc_disc_val          = (float) get_option( 'gt_bogo_free_rule_discount_value', 50 );
$doc_disc_type         = get_option( 'gt_bogo_free_rule_discount_type', 'percent' );
$doc_min_cart          = (float) get_option( 'gt_bogo_free_rule_min_cart', 0 );
$doc_disc_label        = $doc_disc_type === 'percent'
	? number_format( $doc_disc_val, 0 ) . '%'
	: get_woocommerce_currency_symbol() . number_format( $doc_disc_val, 2 );
?>
<div class="gt-card gt-animate-in" style="margin-bottom:20px;border-top:3px solid <?php echo $doc_free_rule_enabled ? '#22c55e' : '#f59e0b'; ?>">
	<div class="gt-card-header">
		<h2 class="gt-card-title">Your Active Deal</h2>
		<span style="font-size:12px;font-weight:700;padding:4px 12px;border-radius:50px;background:<?php echo $doc_free_rule_enabled ? 'rgba(34,197,94,0.1)' : 'rgba(245,158,11,0.1)'; ?>;color:<?php echo $doc_free_rule_enabled ? '#22c55e' : '#fcd34d'; ?>"><?php echo $doc_free_rule_enabled ? 'LIVE' : 'PAUSED'; ?></span>
	</div>
	<?php if ( $doc_buy_qty ) : ?>
	<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:12px">
		<div style="padding:14px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
			<p style="margin:0 0 4px;font-size:11px;font-weight:700;color:var(--gt-subtle);text-transform:uppercase;letter-spacing:.08em">Rule Name</p>
			<p style="margin:0;font-size:14px;font-weight:700;color:var(--gt-white)"><?php echo $doc_rule_name ? esc_html( $doc_rule_name ) : 'Free BOGO Rule'; ?></p>
		</div>
		<div style="padding:14px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
			<p style="margin:0 0 4px;font-size:11px;font-weight:700;color:var(--gt-subtle);text-transform:uppercase;letter-spacing:.08em">Structure</p>
			<p style="margin:0;font-size:14px;font-weight:700;color:var(--gt-white)">Buy <?php echo esc_html( $doc_buy_qty ); ?> Get <?php echo esc_html( $doc_get_qty ); ?></p>
		</div>
		<div style="padding:14px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
			<p style="margin:0 0 4px;font-size:11px;font-weight:700;color:var(--gt-subtle);text-transform:uppercase;letter-spacing:.08em">Discount</p>
			<p style="margin:0;font-size:14px;font-weight:700;color:#E10000"><?php echo esc_html( $doc_disc_label ); ?> off</p>
		</div>
		<div style="padding:14px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
			<p style="margin:0 0 4px;font-size:11px;font-weight:700;color:var(--gt-subtle);text-transform:uppercase;letter-spacing:.08em">Min Cart</p>
			<p style="margin:0;font-size:14px;font-weight:700;color:var(--gt-white)"><?php echo $doc_min_cart > 0 ? esc_html( get_woocommerce_currency_symbol() . number_format( $doc_min_cart, 2 ) ) : 'None'; ?></p>
		</div>
	</div>
	<div style="margin-top:12px;display:flex;gap:10px">
		<a href="<?php echo esc_url( admin_url( 'admin.php?page=gt-bogo-engine&tab=free-rule' ) ); ?>" class="gt-btn gt-btn-ghost gt-btn-sm">Edit Rule →</a>
		<a href="<?php echo esc_url( admin_url( 'admin.php?page=gt-bogo-engine&tab=analytics' ) ); ?>" class="gt-btn gt-btn-ghost gt-btn-sm">View Analytics →</a>
	</div>
	<?php else : ?>
	<p style="margin:0;font-size:14px;color:var(--gt-soft)">No free rule configured yet. <a href="<?php echo esc_url( admin_url( 'admin.php?page=gt-bogo-engine&tab=free-rule' ) ); ?>" style="color:#E10000">Set one up →</a></p>
	<?php endif; ?>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">What GT BOGO Engine does for your store</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">GT BOGO Engine automatically applies deals at your customers' checkout — no coupon codes, no manual work, no customer effort. You set up a deal once. From that point on, every customer who qualifies for the deal gets it applied automatically when they add the right items to their cart.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 20px">Most stores lose customers because the checkout process is complicated. A customer sees a deal advertised, can't find the coupon code, gives up and leaves. GT BOGO Engine eliminates that friction entirely. The deal fires on its own. The customer sees their savings applied in real time as they shop.</p>
	<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:20px">
	<?php
	foreach ( array(
		array( '200', 'Ready-to-use deals', 'across 19 industries — import any of them in seconds' ),
		array( '48', 'Smart selling tools', 'that show the right message to the right customer automatically' ),
		array( '19', 'Automated emails', 'that bring customers back without you lifting a finger' ),
		array( '23', 'Customer roles', 'assigned automatically based on purchase history' ),
		array( '150+', 'Currencies supported', 'for stores selling to customers around the world' ),
		array( '$0', 'Coupon codes needed', 'your deals fire automatically at checkout, always' ),
	) as $s ) :
		?>
	<div style="background:var(--gt-card);border:1px solid var(--gt-border);border-radius:10px;padding:20px;text-align:center">
		<div style="font-size:28px;font-weight:900;color:#E10000;line-height:1;margin-bottom:6px"><?php echo esc_html( $s[0] ); ?></div>
		<div style="font-size:13px;font-weight:700;color:var(--gt-white);margin-bottom:4px"><?php echo esc_html( $s[1] ); ?></div>
		<div style="font-size:11px;color:var(--gt-subtle);line-height:1.4"><?php echo esc_html( $s[2] ); ?></div>
	</div>
	<?php endforeach; ?>
	</div>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The five things that make the biggest difference</h2></div>
	<?php
	foreach ( array(
		array(
			'1',
			'Import a pack and enable it today',
			'Go to PRO Rules in the left menu. Browse the 200 pre-built deal packs by industry. Click Import on any pack and all 10 deals inside it load instantly with everything pre-configured. Switch on the ones that suit your store. Your first deal will be live within minutes of installing the plugin — no setup, no configuration, no guesswork.',
		),
		array(
			'2',
			'Turn on at least three smart selling tools',
			'Go to Superpowers Hub and switch on the Cart Progress Bar, the Savings Calculator, and the Nudge Messages. These three tools alone will visibly increase the number of customers who complete their purchase. The progress bar shows customers how close they are to getting their deal. The savings calculator shows them exactly what they are saving. The nudge reminds them the deal is there when they browse your shop.',
		),
		array(
			'3',
			'Let the loyalty system run on autopilot',
			'Once enabled, the plugin automatically tracks every customer\'s purchase history and moves them through four loyalty tiers — Bronze, Silver, Gold, and Platinum. Higher-tier customers get better deals automatically. You do not set any of this up manually. Customers who feel recognised keep coming back. Customers who keep coming back are worth significantly more than one-time buyers.',
		),
		array(
			'4',
			'Switch on the automated emails',
			'Go to Settings and enable the customer email system. From that point on, the plugin sends emails automatically for deal confirmations, loyalty upgrades, birthday deals, referral rewards, and win-back campaigns. Every email uses your store name and logo — your customers never see GT BOGO Engine branding. These emails run permanently in the background and bring customers back without any ongoing work from you.',
		),
		array(
			'5',
			'Check your analytics weekly',
			'Go to Analytics to see which deals are generating the most revenue, which customers are your highest value, and how much your deals are costing versus earning. Use this to make decisions — promote the deals that work, adjust the ones that do not, and identify the customers who deserve a personal thank-you or a special offer.',
		),
	) as $step ) :
		?>
	<div style="display:flex;gap:16px;margin-bottom:22px;align-items:flex-start">
	<div style="width:34px;height:34px;border-radius:50%;background:#E10000;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:800;color:#fff;flex-shrink:0;margin-top:2px"><?php echo esc_html( $step[0] ); ?></div>
	<div>
		<p style="margin:0 0 6px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $step[1] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.7"><?php echo esc_html( $step[2] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Quick Start — Enable Your Top Tools</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.7;margin:0 0 16px">These four tools have the biggest impact on your first BOGO orders. Toggle them on without leaving this page.</p>
	<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px">
	<?php
	$doc_sp_items = array(
		array( 'progress_bar',       'Cart Progress Bar',    'Shows customers how close they are to unlocking the deal.' ),
		array( 'badge_generator',    'Product Badge',        'Adds a BOGO badge to qualifying product images.' ),
		array( 'savings_calculator', 'Savings Calculator',   'Shows customers exactly how much they are saving.' ),
		array( 'nudges',             'Deal Nudges',          'Sends gentle reminders when the deal is within reach.' ),
	);
	$doc_sp_nonce = wp_create_nonce( 'gt_bogo_sp_toggle' );
	foreach ( $doc_sp_items as $sp ) :
		$sp_on = (bool) get_option( 'gtbogo_sp_' . $sp[0] . '_enabled', 0 );
	?>
	<div style="display:flex;align-items:flex-start;gap:14px;padding:14px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
		<label class="gt-toggle" style="margin-top:2px;flex-shrink:0">
			<input type="checkbox" class="gt-doc-sp-toggle"
				data-sp="<?php echo esc_attr( $sp[0] ); ?>"
				data-nonce="<?php echo esc_attr( $doc_sp_nonce ); ?>"
				<?php checked( $sp_on ); ?>>
			<span class="gt-toggle-slider"></span>
		</label>
		<div>
			<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[1] ); ?></p>
			<p style="margin:0;font-size:12px;color:var(--gt-subtle);line-height:1.5"><?php echo esc_html( $sp[2] ); ?></p>
		</div>
	</div>
	<?php endforeach; ?>
	</div>
	<a href="<?php echo esc_url( admin_url( 'admin.php?page=gt-bogo-engine&tab=superpowers' ) ); ?>" class="gt-btn gt-btn-ghost gt-btn-sm">All 48 Tools →</a>
</div>
<script>
(function(){
	document.querySelectorAll('.gt-doc-sp-toggle').forEach(function(cb){
		cb.addEventListener('change',function(){
			var fd=new FormData();
			fd.append('action','gt_bogo_save_superpower_field');
			fd.append('nonce',this.dataset.nonce);
			fd.append('sp_id',this.dataset.sp);
			fd.append('field','enabled');
			fd.append('value',this.checked?'1':'0');
			fetch(ajaxurl,{method:'POST',body:fd}).catch(function(){});
		});
	});
}());
</script>
<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">How the plugin thinks — and why it matters for you</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">GT BOGO Engine does not show the same deal to every customer in the same way. It builds a picture of each customer based on their history with your store, then decides how to present your deals to that specific person.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">A first-time visitor gets a welcoming, educational experience — the deal is presented clearly and calmly. A loyal customer who has bought from you many times sees recognition and reward — nothing pushy, nothing aggressive. A customer who has added items to their cart but seems to be hesitating gets a gentle reminder that their deal is still waiting. A customer with a high-value cart on checkout gets a bolder, more urgent presentation because the moment genuinely warrants it.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">All of this happens automatically, on every customer visit, without any input from you. Your only job is to set the deals and choose the tools you want active. The plugin handles the rest.</p>
</div>

	<?php
elseif ( $doc === 'golive' ) :
	$go_live_status = class_exists( 'GT_BOGO_Go_Live' ) ? GT_BOGO_Go_Live::instance()->get_status() : null;
	?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Go Live Checklist</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.7;margin:0 0 20px">Before your store goes live with GT BOGO Engine, the plugin checks 11 things to make sure everything is set up correctly. All checks must pass before deals start firing. The coloured indicator at the top of every page shows you where you stand — red means setup incomplete, yellow means there is a conflict to fix, green means you are live and everything is running.</p>
	<?php if ( $go_live_status ) : ?>
	<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:12px">
		<?php foreach ( $go_live_status['checks'] as $key => $chk ) : ?>
	<div style="display:flex;gap:12px;align-items:flex-start;padding:14px;border-radius:8px;background:<?php echo esc_html( $chk['pass'] ) ? 'rgba(34,197,94,0.05)' : 'rgba(239,68,68,0.05)'; ?>;border:1px solid <?php echo esc_html( $chk['pass'] ) ? 'rgba(34,197,94,0.3)' : 'rgba(239,68,68,0.2)'; ?>">
		<div style="width:22px;height:22px;border-radius:50%;background:<?php echo esc_html( $chk['pass'] ) ? 'rgba(34,197,94,.2)' : 'rgba(239,68,68,.2)'; ?>;border:1px solid <?php echo esc_html( $chk['pass'] ) ? '#22c55e' : '#ef4444'; ?>;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px">
			<?php
			if ( $chk['pass'] ) :
				?>
				<svg width="10" height="10" viewBox="0 0 10 10"><path d="M2 5L4 7L8 3" stroke="#22c55e" stroke-width="1.5" fill="none" stroke-linecap="round"/></svg>
				<?php
		else :
			?>
			<svg width="10" height="10" viewBox="0 0 10 10"><path d="M3 3L7 7M7 3L3 7" stroke="#ef4444" stroke-width="1.5" stroke-linecap="round"/></svg><?php endif; ?>
		</div>
		<div>
		<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $chk['label'] ); ?></p>
		<p style="margin:0;font-size:12px;color:<?php echo esc_html( $chk['pass'] ) ? 'var(--gt-subtle)' : '#fca5a5'; ?>;line-height:1.5"><?php echo esc_html( $chk['detail'] ); ?></p>
			<?php
			if ( ! $chk['pass'] ) :
				?>
				<a href="<?php echo esc_url( $chk['action'] ); ?>" style="display:inline-block;margin-top:6px;font-size:11px;font-weight:700;color:#E10000;text-decoration:none"><?php echo esc_html( $chk['action_label'] ); ?> →</a><?php endif; ?>
		</div>
	</div>
	<?php endforeach; ?>
	</div>
	<div style="margin-top:20px;padding:16px;background:var(--gt-card);border-radius:8px;border:1px solid var(--gt-border)">
	<p style="margin:0;font-size:14px;color:var(--gt-soft)">
		<strong style="color:var(--gt-white)"><?php echo esc_html( $go_live_status['passed'] ); ?> / <?php echo esc_html( $go_live_status['total'] ); ?></strong> checks passing &nbsp;·&nbsp;
		<strong style="color:<?php echo esc_html( $go_live_status['is_live'] ) ? '#22c55e' : '#f59e0b'; ?>"><?php echo esc_html( $go_live_status['is_live'] ) ? 'Your store is live — deals are firing' : 'Not live yet — complete the checks above'; ?></strong>
	</p>
	</div>
	<?php else : ?>
	<p style="color:var(--gt-soft);font-size:13px">Go Live status loading — make sure the plugin is fully activated with your PRO license.</p>
	<?php endif; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">What the status colours mean</h2></div>
	<?php
	foreach ( array(
		array( '🔴', 'Red — Setup not complete', 'Less than half the checklist is done. Common things to complete: add your store name in Settings, upload your logo, set your email address, and activate your PRO license. Each of these takes under a minute.' ),
		array( '🟡', 'Yellow — A conflict needs fixing', 'Two of your active deals share the same priority number, which means they would both try to fire at the same time. Go to the Conflicts page and change the priority number of one of them by 1. The conflict clears immediately.' ),
		array( '🟢', 'Green — You are live', 'All checks pass. No conflicts. Your deals are firing automatically for every qualifying customer. Nothing more to do — just watch your analytics grow.' ),
	) as $row ) :
		?>
	<div style="display:flex;gap:16px;align-items:flex-start;margin-bottom:18px;padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
	<span style="font-size:28px;flex-shrink:0"><?php echo esc_html( $row[0] ); ?></span>
	<div>
		<p style="margin:0 0 5px;font-size:14px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $row[1] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $row[2] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'rules' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">How deals work in your store</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Every deal you activate has a priority number between 1 and 100. The lower the number, the sooner that deal gets considered. When a customer qualifies for multiple deals at the same time, the one with the lowest priority number is the one that fires. This lets you stack deals logically — entry-level deals for all customers, better deals for returning customers, your best deals reserved for VIP customers.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">You never need to set these priority numbers manually. Every PRO pack comes with priority numbers pre-configured so they stack correctly when you import multiple packs from the same industry.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The 10 deal types in every PRO pack</h2></div>
	<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:12px">
	<?php
	foreach ( array(
		array( 'Welcome Deal', 'For every customer, every visit', 'Your everyday deal. 20–30% off for anyone who adds the right number of items. No restrictions, no requirements. This is the deal that fires most often and drives your baseline revenue lift.' ),
		array( 'Bulk Buy Deal', 'Buy 2, get 1 free', 'When a customer adds enough items, one of them becomes free or heavily discounted. The cheapest qualifying item gets the deal. Works exceptionally well for clothing, supplements, beauty products, and anything customers naturally buy in multiples.' ),
		array( 'Spend More Deal', 'Unlock savings when the cart reaches a target', 'The customer sees a progress bar showing how much more they need to spend to unlock the deal. This deal type is the single most reliable way to increase average order value. Customers who are $12 away from a deal almost always add something.' ),
		array( 'Timed Sale', 'Runs automatically for a set period', 'You pick the start date, the end date, and the discount. The deal activates itself, runs for as long as you specified, then deactivates. A live countdown timer appears automatically. No manual switching on or off required.' ),
		array( 'New Customer Deal', 'First-time buyers only', '35–40% off to convert a browser into a buyer. The plugin detects automatically whether a customer has placed an order before. First-time buyers get this deal. Everyone else gets a different one. You set neither up differently — it just works.' ),
		array( 'Returning Customer Deal', 'For customers who have bought before', 'A loyalty acknowledgement for your repeat buyers. 20–25% off to reward them for coming back. Fires automatically for any customer with at least one previous order.' ),
		array( 'VIP Deal', 'For your best customers', 'Your highest-tier customers — those who have spent the most or bought most frequently — automatically unlock these deals. The plugin assigns VIP status based on spending and order history. You do not need to tag anyone manually.' ),
		array( 'Flash Sale', 'High discount for a short window', '40–50% off for 24 to 48 hours. The countdown timer fires automatically. Creates genuine urgency without permanently cutting your margin. Use for clearance, product launches, or slow periods.' ),
		array( 'Subscriber Deal', 'For loyalty members and subscribers', 'If you run a subscription or membership, the plugin detects those customers automatically and gives them a stacked deal on top of their regular one. Works with WooCommerce Subscriptions and similar plugins.' ),
		array( 'Maximum Event Deal', 'Your biggest deal of the year', 'Buy 2 Get 2 Free or Buy 3 Get 1 Free. Reserved for your most important events — Black Friday, end-of-year clearance, or anniversary sales. The highest-urgency presentation fires automatically.' ),
	) as $rt ) :
		?>
	<div style="padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $rt[0] ); ?></p>
		<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.06em"><?php echo esc_html( $rt[1] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $rt[2] ); ?></p>
	</div>
	<?php endforeach; ?>
	</div>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">200 Ready-to-use packs across 19 industries</h2></div>
	<p style="font-size:13px;color:var(--gt-soft);line-height:1.7;margin:0 0 16px">Every pack contains 10 pre-configured deals for that specific industry. Import a pack and all 10 deals load instantly with the right discount amounts, right customer targeting, and right priority order for your type of store. You can adjust anything after importing.</p>
	<?php
	$industries = array(
		'Software & Digital'        => array( '4 packs', 'Freemium conversion, digital bundles, domain and hosting, digital subscription deals' ),
		'Home & Garden'             => array( '10 packs', 'Room bundles, installation services, smart home, seasonal refresh, renovation, pool and spa, home security' ),
		'Hardware & Print'          => array( '2 packs', 'Online print and signage, hardware project bundles' ),
		'Outdoor & Sports'          => array( '6 packs', 'Outdoor gear, team orders, season openers, equipment service, adventure packages, youth sports' ),
		'Fitness'                   => array( '6 packs', 'Gym membership, personal training, class packs, corporate wellness, studio intro deals' ),
		'Golf'                      => array( '4 packs', 'Tee time bundles, lesson packages, twilight deals, junior programs' ),
		'Cycling & Skiing'          => array( '4 packs', 'Bike and accessories, service packages, lift passes, lesson and equipment rental' ),
		'Martial Arts & Swimming'   => array( '3 packs', 'Intro courses, grading and gear, swim lesson packs' ),
		'B2B'                       => array( '5 packs', 'Contract pricing, trade accounts, reseller volumes, sample orders, minimum order deals' ),
		'Health'                    => array( '5 packs', 'Wellness packages, family health, chronic care loyalty, supplement stacks, subscribe and save' ),
		'Education'                 => array( '6 packs', 'Course bundles, student exclusives, early enrollment, alumni loyalty, study kits, lesson packs' ),
		'Travel & Hospitality'      => array( '6 packs', 'Early booking, stay longer, room and extras, group travel, last minute deals' ),
		'Events'                    => array( '5 packs', 'Early bird tickets, group bookings, season passes, VIP upgrades, merchandise bundles' ),
		'Pets'                      => array( '2 packs', 'Grooming packages, boarding and training bundles' ),
		'Kids & Baby'               => array( '3 packs', 'Art and craft kits, toy bundles, baby and newborn starter packages' ),
		'Gifts & Flowers'           => array( '5 packs', 'Occasion gift bundles, gift card bonuses, mystery boxes, subscription flowers, seasonal bouquets' ),
		'Photography & Accessories' => array( '5 packs', 'Session and prints, album upgrades, leather care, second pair deals, frames and lenses' ),
		'Apparel & Fragrance'       => array( '2 packs', 'Size-up rewards, fragrance discovery sets' ),
		'Hobby, Music & Books'      => array( '6 packs', 'Mystery bundles, collector sets, tabletop games, vinyl collections, instruments, bookstore series' ),
	);
	foreach ( $industries as $name => $info ) :
		?>
	<div style="margin-bottom:10px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px;display:flex;justify-content:space-between;align-items:center;gap:16px">
	<div>
		<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $name ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft)"><?php echo esc_html( $info[1] ); ?></p>
	</div>
	<span style="font-size:11px;font-weight:700;color:#E10000;background:rgba(225,0,0,0.1);padding:3px 10px;border-radius:4px;white-space:nowrap;flex-shrink:0"><?php echo esc_html( $info[0] ); ?></span>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Importing and managing your deals</h2></div>
	<?php
	foreach ( array(
		array( 'Importing a pack in seconds', 'Go to PRO Rules in the left menu and click Browse Packs. Find your industry, click Import on any pack, and all 10 deals load immediately. They arrive switched off so you can review them before anything goes live. Switch on the ones that suit your store — a typical starting setup is one welcome deal, one bulk buy deal, and one spend-more deal.' ),
		array( 'Switching a deal on or off', 'On the PRO Rules page, every deal card has an Active toggle. Flip it on and that deal starts firing within seconds. Flip it off and it stops. No page reload, no cache clearing, no delays.' ),
		array( 'Fixing a conflict', 'If two of your active deals share the same priority number, the Conflicts page highlights them. Click into either deal and change its priority number by 1. The conflict resolves immediately and the yellow indicator on your dashboard clears.' ),
		array( 'Customising a deal', 'After importing a pack, you can override the deal message, badge text, and email copy for any deal on the Pack Config page. This lets you personalise the language to match your brand without losing the original deal setup.' ),
		array( 'The free rule for non-PRO users', 'If you are not yet on PRO, you have access to one global deal that applies across your entire store. You choose the buy quantity, the get quantity, and the discount amount. It is the simplest way to see the plugin working before upgrading.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:14px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'superpowers' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Your 48 smart selling tools</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Smart selling tools are the visual and behavioural elements that appear in your store to guide customers toward completing a purchase. They show the right message at the right moment — progress toward a deal, confirmation that savings have been applied, urgency when stock is limited, recognition for loyal customers.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 20px">Every tool knows who the customer is and adjusts its presentation accordingly. A loyal long-standing customer sees a calm, elegant experience. A new visitor gets a clear, encouraging message. A customer who seems hesitant gets a gentle nudge. You control the maximum intensity — Subtle, Moderate, or Bold. The plugin decides the right level within that range for each customer automatically.</p>
	<div style="display:grid;grid-template-columns:1fr 1fr;gap:12px">
	<div style="padding:14px;background:rgba(225,0,0,0.06);border:1px solid rgba(225,0,0,0.2);border-radius:8px">
		<p style="margin:0 0 6px;font-size:12px;font-weight:800;color:#E10000;letter-spacing:.08em;text-transform:uppercase">28 Visible tools</p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6">Appear in your cart, checkout, shop, and across your storefront. Progress bars, savings displays, countdown timers, social proof, VIP recognition, deal badges, and more. All theme-matched — they look like they belong in your store from day one.</p>
	</div>
	<div style="padding:14px;background:rgba(59,130,246,0.06);border:1px solid rgba(59,130,246,0.2);border-radius:8px">
		<p style="margin:0 0 6px;font-size:12px;font-weight:800;color:#3b82f6;letter-spacing:.08em;text-transform:uppercase">19 Background tools</p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6">Work silently behind the scenes — tracking customer value, detecting VIP status, scoring purchase streaks, monitoring stock levels, calculating referrals. They feed information to the visible tools so every customer interaction is informed by real data about that customer.</p>
	</div>
	</div>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The tools that increase order value most</h2></div>
	<?php
	foreach ( array(
		array(
			'Cart Progress Bar',
			'Shows customers exactly how close they are to unlocking their deal',
			'This is the single most effective tool for increasing average order value. When a customer can see "Add 1 more item to save £24", most of them add it. The bar fills up in real time as they shop. When the deal unlocks, it turns green and shows the deal name. Enable this first. It works from your very first sale.',
		),
		array(
			'Savings Calculator',
			'Shows customers exactly how much money they are saving',
			'Customers who can see their exact savings — "You are saving £24.00 with this deal" — are far more likely to complete their purchase than customers who have to calculate it themselves. The savings calculator appears in the cart totals and updates every time the cart changes. It is one of the lowest-effort, highest-impact tools in the plugin.',
		),
		array(
			'Deal Comparison',
			'Shows the effective price per item when buying in bulk',
			'For stores that sell products people buy in multiples — tyres, supplements, clothing, stationery — this is transformative. A customer considering four tyres who sees "Your price: £89.75 per tyre instead of £119.00" makes a different decision than a customer who has to do that maths themselves. The comparison appears automatically for bulk-buy deals.',
		),
		array(
			'Cart Recommendations',
			'Suggests items that would unlock or enhance the current deal',
			'When a customer is one item away from their deal, this tool shows them exactly what to add. It pulls products from your catalogue that qualify for the current deal and shows them with a direct add-to-cart button. The suggestions change every visit so they feel fresh. Customers who see a relevant recommendation and are close to a deal convert at significantly higher rates.',
		),
		array(
			'Nudge Messages',
			'Reminds customers about their deal while they browse',
			'Two parts working together. In the cart, a message appears above the cart table showing how many more items are needed. In the shop, a deal banner appears above your product listings. Together they keep the deal visible throughout the shopping journey so customers do not forget what they are working toward.',
		),
	) as $sp ) :
		?>
	<div style="margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--gt-border)">
	<p style="margin:0 0 3px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[0] ); ?></p>
	<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.06em"><?php echo esc_html( $sp[1] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.8"><?php echo esc_html( $sp[2] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The tools that reduce cart abandonment</h2></div>
	<?php
	foreach ( array(
		array(
			'Exit Intent',
			'Shows a deal offer the moment a customer is about to leave',
			'When the cursor moves toward closing the tab or navigating away, a deal overlay appears. It is shown once per visit — not on every page, not on every action. Done well, it converts a meaningful percentage of customers who were about to leave into customers who complete their purchase. Set to Subtle for a calm and elegant presentation that suits premium stores.',
		),
		array(
			'Abandon Nudge',
			'Brings back customers who have stopped engaging',
			'Three things happen when a customer with items in their cart goes idle. An overlay reminds them their deal is still active. The browser tab title changes to show the deal message — so if they are on another tab they see it. An optional browser notification can be sent. None of these fire on an empty cart — only when there are items worth recovering.',
		),
		array(
			'Smart Popup',
			'Appears at the right moment with the deal offer',
			'You choose which moment triggers the popup — when the deal first applies to the cart, when the customer has been idle for a set time, when they have scrolled a certain distance, or after they have visited a set number of pages in this session. It fires once per visit. Not intrusive. Not aggressive. Targeted at the moment where a well-timed message makes a real difference.',
		),
		array(
			'Mobile Drawer',
			'A bottom-panel deal reminder built for phones',
			'Slides up from the bottom of the screen on mobile devices only. Shows the active deal and a link back to the shop. Invisible on desktop — it only activates on small screens where the customer cannot see the full cart totals. Particularly effective for stores where most traffic comes from phones.',
		),
		array(
			'Announcement Bar',
			'A banner across the top of your store broadcasting the active deal',
			'Shows every visitor — including first-time visitors who have not yet added anything — that a deal is active and will apply automatically at checkout. Works alongside the countdown timer when you have a timed sale running, showing both the deal and the time remaining in one bar. Customers can dismiss it once and it stays dismissed for their session.',
		),
	) as $sp ) :
		?>
	<div style="margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--gt-border)">
	<p style="margin:0 0 3px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[0] ); ?></p>
	<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.06em"><?php echo esc_html( $sp[1] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.8"><?php echo esc_html( $sp[2] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The tools that build loyalty and social proof</h2></div>
	<?php
	foreach ( array(
		array(
			'Loyalty Widget',
			'Shows each customer their loyalty tier and how close they are to the next one',
			'Logged-in customers see their tier — Bronze, Silver, Gold, or Platinum — their total lifetime spend with your store, and how much more they need to spend to reach the next level. This creates a powerful ongoing motivation to keep buying. A customer who can see they are £43 away from Gold buys differently than a customer who has no idea their loyalty is being tracked.',
		),
		array(
			'Savings History',
			'Shows customers how much they have saved with you over time',
			'A running total of every pound a customer has saved across all their orders. A customer who has saved £340 with your store is not a casual buyer — and seeing that number reinforces how much value your store provides. This tool builds deep loyalty by making the relationship feel reciprocal. Enable it in the Superpowers Hub and it populates automatically from order history.',
		),
		array(
			'Social Proof',
			'Shows how many customers have claimed the current deal recently',
			'Displays a real number — "14 customers have claimed this deal in the last 24 hours" — pulled from your actual order data. For new stores, the plugin uses realistic starting numbers while you build history. This creates gentle urgency without false scarcity. It works because humans naturally trust what other humans have already done.',
		),
		array(
			'VIP Badge',
			'Tells your best customers that their exclusive deal is active',
			'Shown only to customers with VIP status — your highest spenders and most frequent buyers. It communicates: you are recognised, your deal is special, it has been applied automatically. The message is calm and private — never visible to non-VIP customers. For luxury stores, use the Subtle setting which shows "Private Client — your offer is applied automatically."',
		),
		array(
			'Deal Share',
			'Lets customers share your deal with one tap',
			'A share button in the cart totals. On phones it opens the native share menu. On desktop it copies a link. The link takes the recipient directly to your store with the deal pre-applied. Word-of-mouth driven by your own customers is the most trusted form of marketing — this tool activates it automatically.',
		),
		array(
			'Referral Widget',
			'Gives every customer a personal referral link to share',
			'Appears on the order thank-you page and in the customer account. When someone uses a customer\'s referral link and makes a purchase, the referring customer automatically earns a permanent discount coupon. After five successful referrals, the customer becomes a Referral Champion and unlocks your highest-tier deals. This builds a self-sustaining acquisition channel powered by your existing customers.',
		),
	) as $sp ) :
		?>
	<div style="margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--gt-border)">
	<p style="margin:0 0 3px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[0] ); ?></p>
	<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.06em"><?php echo esc_html( $sp[1] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.8"><?php echo esc_html( $sp[2] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">The three tools that run on full autopilot</h2></div>
	<p style="font-size:13px;color:var(--gt-soft);line-height:1.7;margin:0 0 20px">These three tools decide for themselves when to appear. You switch them on once and they handle the rest. No schedules, no triggers, no configuration needed.</p>
	<?php
	foreach ( array(
		array(
			'FOMO Engine',
			'Creates urgency when the moment is right — not all the time',
			'Watches customer behaviour and decides when a moment of urgency will have a genuine impact. A customer browsing casually sees nothing. A customer who has been in the cart for several minutes, has high-value items, and has shown hesitation signals gets a carefully timed message. The engine deliberately avoids firing when the situation does not warrant it — which makes the moments when it does fire far more effective.',
		),
		array(
			'Smart Nudges',
			'Shows deal reminders only when there is something worth reminding',
			'Does not add urgency language unless the situation actually calls for it. When stock is low, it says so accurately. When a deal is about to expire, it says so. When there is nothing genuinely urgent to communicate, it shows a calm informational message. Smart Nudges builds trust by always telling the truth — which means customers believe it when something is genuinely limited.',
		),
		array(
			'Auto Add',
			'Automatically adds a free qualifying item to the cart',
			'When a customer\'s order qualifies them for a free product and you have one configured, this tool adds it to their cart automatically. It only fires when the order is large enough to support the free item without damaging your margin. It will never add an item to a cart that cannot afford it. Customers who discover a bonus item they did not know they were getting are among the most likely to leave a positive review.',
		),
	) as $sp ) :
		?>
	<div style="margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--gt-border)">
	<p style="margin:0 0 3px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[0] ); ?></p>
	<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.06em"><?php echo esc_html( $sp[1] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.8"><?php echo esc_html( $sp[2] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'scheduler' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Set your sales in advance — they run themselves</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">The Campaign Scheduler lets you plan deals weeks or months ahead. You pick the start date, the end date, and the times. On the day and hour you specified, the deal switches on automatically. At the end time you set, it switches off. No manual intervention required.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">When a timed deal is running, a live countdown timer appears in your store automatically, showing customers exactly when the deal ends. When the deal ends, the countdown disappears. Your store always shows accurate information without you needing to update anything.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">How to schedule a campaign</h2></div>
	<?php
	foreach ( array(
		array( '1. Go to Campaign Scheduler in the left menu', 'Select it from the GT BOGO Engine menu. You will see a list of any campaigns you have already scheduled and a form to create a new one.' ),
		array( '2. Choose a deal to schedule', 'Select one of your active deals from the dropdown. Any deal can be scheduled — flash sales, seasonal deals, event-based offers. Deals designed for time-limited use are marked in your pack.' ),
		array( '3. Set your dates and times', 'Enter the start date and time and the end date and time. All times follow your WordPress timezone setting from Settings → General. Double-check your timezone is set correctly before scheduling.' ),
		array( '4. Save and walk away', 'Click Save. The deal will activate itself at the start time and deactivate at the end time. A countdown timer will appear in your store when the deal is live. You do not need to come back and do anything.' ),
		array( '5. Check the scheduler page for confirmation', 'After saving, your campaign appears in the scheduled list with its start and end times. You can edit or delete it from here at any time before it starts.' ),
	) as $step ) :
		?>
	<div style="display:flex;gap:14px;margin-bottom:16px;align-items:flex-start">
	<div style="width:28px;height:28px;border-radius:50%;background:rgba(225,0,0,0.15);border:1px solid rgba(225,0,0,0.3);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;color:#E10000;flex-shrink:0;margin-top:2px"><?php echo esc_html( $step[0][0] ); ?></div>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $step[0] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $step[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Campaign ideas to plan in advance</h2></div>
	<?php
	foreach ( array(
		array( 'Black Friday and Cyber Monday', 'Schedule your biggest flash deal to start at midnight on Black Friday and end Monday evening. Set your maximum event deal (Buy 2 Get 2 or similar). The countdown timer makes the deadline visible and real. When it ends, everything returns to normal automatically.' ),
		array( 'Weekend flash sale', 'Schedule a 20% boost deal to run Friday afternoon through Sunday evening every week. Your regular deals still run — the weekend deal stacks on top for qualifying customers. Remove it anytime if margins need protecting.' ),
		array( 'Seasonal clearance', 'Schedule a clearance deal to run for 10 days at the end of your season. Higher discount than usual, timed to clear stock before new inventory arrives. The countdown creates natural urgency without you needing to write any copy.' ),
		array( 'Product launch window', 'Schedule a new customer deal for the first two weeks after launching a new product range. New visitors during that window get a first-purchase incentive. After two weeks it switches off automatically.' ),
		array( 'Holiday periods', 'Plan your Christmas, Easter, and summer sale dates months in advance. Configure them all in one sitting and they will run exactly when you scheduled them, even if you are away when they start.' ),
	) as $item ) :
		?>
	<div style="padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px;margin-bottom:10px">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'loyalty' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Keeping customers coming back — automatically</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">The most profitable customers are not new ones — they are the ones who keep coming back. GT BOGO Engine tracks every customer\'s purchase history automatically and uses it to give your best customers a better experience without any manual work from you.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">Customers who feel recognised and rewarded do not comparison shop. They come back because the relationship feels personal. The loyalty system creates that feeling at scale — across every customer, on every visit — without you personally tracking anything.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Four loyalty tiers — assigned automatically</h2></div>
	<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:16px">
	<?php
	foreach ( array(
		array( 'Bronze', '#cd7f32', 'Starting tier', 'All customers begin here. Your welcome deals and standard offers apply.' ),
		array( 'Silver', '#9ca3af', '$200+ spent, 3+ orders', '5% extra discount applied automatically on top of their deal. The silver_member status unlocks mid-tier deals from your packs.' ),
		array( 'Gold', '#f59e0b', '$500+ spent, 7+ orders', '10% extra discount. VIP deals start becoming available. Gold customers feel the relationship genuinely improving.' ),
		array( 'Platinum', '#e2e8f0', '$1,000+ spent, 12+ orders', '15% extra discount. All VIP and platinum-targeted deals fire. Your most loyal customers get your best experience.' ),
	) as $tier ) :
		?>
	<div style="padding:16px;border-radius:10px;border:2px solid <?php echo esc_html( $tier[1] ); ?>22;background:<?php echo esc_html( $tier[1] ); ?>08;text-align:center">
		<div style="font-size:22px;margin-bottom:8px">🏆</div>
		<p style="margin:0 0 4px;font-size:15px;font-weight:800;color:<?php echo esc_html( $tier[1] ); ?>"><?php echo esc_html( $tier[0] ); ?></p>
		<p style="margin:0 0 8px;font-size:11px;font-weight:700;color:var(--gt-subtle)"><?php echo esc_html( $tier[2] ); ?></p>
		<p style="margin:0;font-size:11px;color:var(--gt-soft);line-height:1.5"><?php echo esc_html( $tier[3] ); ?></p>
	</div>
	<?php endforeach; ?>
	</div>
	<p style="margin-top:16px;font-size:13px;color:var(--gt-subtle)">Tiers are evaluated and updated automatically on every completed order. Customers move up as they spend and buy more frequently. No manual tagging required from you.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">VIP customers — your highest value buyers</h2></div>
	<p style="font-size:13px;color:var(--gt-soft);line-height:1.7;margin:0 0 16px">VIP status is separate from loyalty tiers. It is earned through spending and order frequency, and it unlocks your highest-discount deals automatically.</p>
	<?php
	foreach ( array(
		array( 'Basic VIP', '3 or more orders and $300 total spent', 'Access to VIP-specific deals from any pack. The plugin assigns this status automatically when thresholds are met.' ),
		array( 'Gold VIP', '5 or more orders and $500 total spent', 'Extended deal access including 40%+ discount deals that standard customers cannot see.' ),
		array( 'Platinum VIP', '$1,000 or more total spent', 'Your highest-tier deals — Buy 2 Get 2 and event-level flash deals. Reserved for customers who have demonstrated serious loyalty.' ),
		array( 'Whale VIP', '$5,000 or more total spent', 'Maximum discount deals. If you have customers at this level, they receive your absolute best experience automatically.' ),
		array( 'Referral Champion', '5 or more successful referrals', 'Earns VIP status through advocacy, not spending. Someone who has sent you 5 paying customers deserves your best deals regardless of their own spend.' ),
	) as $vip ) :
		?>
	<div style="display:flex;gap:14px;align-items:flex-start;margin-bottom:12px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
	<div style="flex-shrink:0;background:rgba(225,0,0,0.1);border:1px solid rgba(225,0,0,0.2);padding:3px 8px;border-radius:4px;font-size:11px;font-weight:700;color:#E10000;white-space:nowrap;margin-top:2px"><?php echo esc_html( $vip[0] ); ?></div>
	<div>
		<p style="margin:0 0 3px;font-size:12px;font-weight:700;color:var(--gt-subtle)"><?php echo esc_html( $vip[1] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft)"><?php echo esc_html( $vip[2] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Purchase streaks — rewarding consistent buyers</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.7;margin:0 0 16px">A purchase streak is a run of consecutive months with at least one order. Customers who maintain streaks are your most valuable — they are buying regularly because they trust and value your store. GT BOGO Engine tracks streaks automatically and rewards them.</p>
	<?php
	foreach ( array(
		array( '4 months in a row', 'A streak bonus email fires celebrating their consistency. Streak deals from your packs activate for this customer.' ),
		array( '8 months in a row', 'Second milestone. Enhanced deal access. The relationship is well established — the plugin treats them accordingly.' ),
		array( '12 months in a row', 'One full year of consistent buying. Maximum streak deal tier. This customer is your most reliable revenue source.' ),
		array( 'Streak at risk', 'If a customer has not ordered in 25 days — which for monthly buyers means they are overdue — an at-risk email fires automatically with a win-back deal. This catches lapsing customers before they are fully gone.' ),
	) as $s ) :
		?>
	<div style="display:flex;gap:12px;align-items:flex-start;margin-bottom:14px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
	<span style="font-size:20px;flex-shrink:0">🔥</span>
	<div>
		<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $s[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft)"><?php echo esc_html( $s[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'referrals' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Turn your customers into your best salespeople</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Word of mouth is the most trusted form of marketing. A recommendation from a friend or family member converts at dramatically higher rates than any paid advertisement. GT BOGO Engine builds a referral system that activates your existing customers as advocates — automatically, without manual setup.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">Every registered customer gets a personal referral link. When they share it and someone uses it to make their first purchase, the referring customer earns a permanent discount coupon. The more they refer, the better their deal access becomes. The system tracks and rewards everything without any input from you.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">How the referral program works step by step</h2></div>
	<?php
	foreach ( array(
		array( 'A customer places an order and visits their account', 'After their first purchase, a referral link appears on their order thank-you page and in the My Rewards tab of their account. They can copy it with one click.' ),
		array( 'They share their link with someone they know', 'They send it by text, share it on social media, include it in a message. The link takes the recipient directly to your store.' ),
		array( 'The referred person visits and makes their first purchase', 'When they land on your site using the referral link, a 30-day tracking window opens. If they buy within 30 days, the referral is attributed automatically.' ),
		array( 'The original customer earns a reward', 'The referring customer receives a discount coupon — default 10% off — with no expiry date. It is theirs permanently. You can configure the reward amount in Settings.' ),
		array( 'Milestones unlock better deals', 'After 1, 3, and 5 successful referrals, the customer\'s deal access automatically improves. After 5 referrals they become a Referral Champion and unlock your highest-tier deals — the same level as your biggest spenders.' ),
		array( 'The referred customer gets a welcome deal', 'The person who was referred receives a first-purchase deal specifically for customers who arrived through a referral. This gives them an immediate reason to buy and improves the chance their referral converts.' ),
	) as $i => $item ) :
		?>
	<div style="display:flex;gap:14px;margin-bottom:16px;align-items:flex-start">
	<div style="width:28px;height:28px;border-radius:50%;background:rgba(225,0,0,0.15);border:1px solid rgba(225,0,0,0.3);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;color:#E10000;flex-shrink:0;margin-top:2px"><?php echo esc_html( $i + 1 ); ?></div>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Making the most of your referral program</h2></div>
	<?php
	foreach ( array(
		array( 'Enable the Referral Widget in Superpowers Hub', 'This makes the referral link visible in the cart and on the thank-you page. Without it, customers receive the link by email only. Making it visible in the cart means every customer who completes a purchase sees it immediately while the experience is fresh.' ),
		array( 'Mention the referral reward in your post-purchase email', 'The deal confirmation email includes the referral link by default. Make sure your email theme is set in Settings so the email looks polished. A well-designed email with a clear referral message converts significantly better than a plain text notification.' ),
		array( 'Set a reward that motivates sharing', 'The default reward is 10% off. You can change this in Settings → Referral Reward Value. A 15% or 20% reward increases the number of customers who actively promote your store. Balance this against the acquisition value of a referred customer — who typically converts at higher rates and spends more than traffic from paid ads.' ),
		array( 'Watch your referral count in Analytics', 'The Customer Intelligence page shows which customers have made referrals and how many. Your top referrers are among your most valuable assets — consider reaching out to them personally or giving them an additional reward. They are doing your marketing for you.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:14px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'emails' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">19 emails that run on autopilot — using your branding</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">GT BOGO Engine sends lifecycle emails automatically based on what each customer does. No scheduling. No manual sending. No writing individual messages. You enable the system once in Settings, choose an email theme, and from that point on the right email goes to the right customer at the right moment.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Every email uses your store name, your logo, and the email address you have configured in WooCommerce. Your customers never see GT BOGO Engine branding — these are your emails, from your store, representing your brand.</p>
	<div style="padding:14px;background:rgba(34,197,94,0.05);border:1px solid rgba(34,197,94,0.3);border-radius:8px">
	<p style="margin:0;font-size:13px;color:var(--gt-soft)"><strong style="color:#22c55e">To enable:</strong> Go to Settings → scroll to Email Settings → switch Customer Emails on. Make sure your store name, logo URL, and WooCommerce email address are configured first. Everything else is automatic.</p>
	</div>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">All 19 automated emails</h2></div>
	<?php
	foreach ( array(
		array( 'Deal Confirmation', 'Sent when a customer completes an order with a deal applied', 'Shows them exactly how much they saved. Reinforces the value of shopping with you. Includes their referral link.' ),
		array( 'Loyalty Tier Upgrade', 'Sent when a customer moves from Bronze to Silver, Silver to Gold, or Gold to Platinum', 'Celebrates their progress. Explains the new deal access they have unlocked. Creates excitement about their evolving relationship with your store.' ),
		array( 'Streak Bonus', 'Sent at 4, 8, and 12 consecutive months of buying', 'Acknowledges their consistency. Explains the streak reward they have earned. One of the most effective retention tools in the plugin.' ),
		array( 'Referral Reward Earned', 'Sent when someone they referred makes their first purchase', 'Shows the referrer their reward coupon and the name of the person they successfully referred. Encourages more referrals.' ),
		array( 'VIP Unlocked', 'Sent when a customer earns any VIP status', 'Informs them of their new VIP tier and the exclusive deals they now have access to. Makes the customer feel genuinely recognised.' ),
		array( 'Free Gift Added', 'Sent when a free product is automatically added to an order', 'Notifies the customer they have received a bonus item. Creates a surprise-and-delight moment that drives reviews and repeat purchases.' ),
		array( 'Deal Expiry Warning', 'Sent 48 hours before a timed deal ends', 'Urgency reminder for customers who have browsed but not yet purchased. The most effective last-chance prompt available.' ),
		array( 'Win-Back', 'Sent to customers who have not ordered in 90 days', 'Contains a personalised re-engagement deal. Subject: "We haven\'t seen you in a while." One of the highest-ROI emails in any store\'s arsenal.' ),
		array( 'Cart Nudge', 'Sent after a customer leaves items in their cart', 'Contains the current active deal and a direct link back to their cart. Fires after the customer has been idle for a configured period.' ),
		array( 'Threshold Nudge', 'Sent when a customer is close to unlocking a spend-more deal', 'Tells them exactly how much more to spend to unlock their saving. Creates a specific, actionable reason to return and complete the order.' ),
		array( 'Referral Progress', 'Sent at 1, 3, and 5 referral milestones', 'Shows the customer their progress toward the next referral milestone and what they will unlock when they get there.' ),
		array( 'Order Milestone', 'Sent at the 3rd, 5th, 10th, and 15th order', 'Acknowledges the relationship. Unlocks the next tier of deal access. Makes long-term customers feel seen.' ),
		array( 'Streak At-Risk', 'Sent when a streak buyer is overdue for their next purchase', 'Gentle urgency to complete a purchase before their streak resets. Highly effective for monthly subscription-style buyers.' ),
		array( 'Subscriber At-Risk', 'Sent when a subscription customer shows signs of churning', 'Retention deal with a direct link to renew. Fires before the subscription lapses, not after.' ),
		array( 'Anniversary', 'Sent on the anniversary of a customer\'s first purchase', 'A celebratory message with a special deal. One of the most personal emails in the system — customers rarely expect a store to remember their anniversary.' ),
		array( 'Post-Purchase Follow-Up', 'Sent 7 days after a qualifying order', 'Suggests related products and shows the next active deal. Keeps your store present in the customer\'s mind at the point when they are most likely to buy again.' ),
		array( 'Lapsed Customer Reactivation', 'Sent to customers who have not bought in 90 days', 'Stronger win-back deal than the standard win-back email. For customers who have been away longer. Subject: "Your deal is waiting."' ),
		array( 'New Customer Welcome', 'Sent after a customer\'s very first order', 'Sets expectations for your loyalty program, referral rewards, and deal system. Establishes the relationship from the very first purchase.' ),
		array( 'Deal Unlocked', 'Sent the moment a customer\'s cart crosses a deal threshold', 'Real-time notification: their deal has just been applied. Creates a moment of delight and encourages immediate checkout.' ),
	) as $i => $em ) :
		?>
	<div style="display:flex;gap:12px;align-items:flex-start;margin-bottom:10px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:6px">
	<span style="font-size:11px;font-weight:800;color:var(--gt-subtle);min-width:20px;text-align:right;margin-top:3px;flex-shrink:0"><?php echo esc_html( $i + 1 ); ?></span>
	<div>
		<p style="margin:0 0 2px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $em[0] ); ?></p>
		<p style="margin:0 0 4px;font-size:11px;font-weight:700;color:#E10000;text-transform:uppercase;letter-spacing:.05em"><?php echo esc_html( $em[1] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.5"><?php echo esc_html( $em[2] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Choosing your email look</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.7;margin:0 0 16px">Choose from 8 dark-background email themes in Settings → Email Theme. Each theme has a different accent colour. All themes render well across Gmail, Outlook, Apple Mail, and mobile email apps.</p>
	<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:10px">
	<?php
	foreach ( array(
		array( 'Midnight', '#E10000', '#070C1C' ),
		array( 'Ocean', '#0ea5e9', '#040d1a' ),
		array( 'Forest', '#16a34a', '#04100a' ),
		array( 'Royal', '#7c3aed', '#0a0714' ),
		array( 'Obsidian', '#d97706', '#0a0a08' ),
		array( 'Ember', '#ea580c', '#110804' ),
		array( 'Slate', '#06b6d4', '#080d14' ),
		array( 'Rose', '#e11d48', '#120608' ),
	) as $theme ) :
		?>
	<div style="border-radius:8px;overflow:hidden;border:1px solid var(--gt-border)">
		<div style="height:32px;background:<?php echo esc_html( $theme[2] ); ?>;border-bottom:3px solid <?php echo esc_html( $theme[1] ); ?>"></div>
		<div style="padding:7px;background:var(--gt-card);text-align:center">
		<p style="margin:0;font-size:11px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $theme[0] ); ?></p>
		</div>
	</div>
	<?php endforeach; ?>
	</div>
	<p style="margin-top:12px;font-size:13px;color:var(--gt-subtle)">The accent colour picker in Settings lets you override the theme accent to match your exact brand colour — for example, using your brand red or brand blue while keeping the dark background style.</p>
</div>

<?php elseif ( $doc === 'analytics' ) : ?>

	<?php
	global $wpdb;
	$total_orders    = (int) $wpdb->get_var( "SELECT COUNT(DISTINCT order_id) FROM {$wpdb->prefix}gtbogo_analytics" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared
	$total_revenue   = (float) $wpdb->get_var( "SELECT COALESCE(SUM(order_total),0) FROM {$wpdb->prefix}gtbogo_analytics" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared
	$total_discounts = (float) $wpdb->get_var( "SELECT COALESCE(SUM(discount_amount),0) FROM {$wpdb->prefix}gtbogo_analytics" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared
	?>
<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">What your deals have achieved so far</h2></div>
	<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:20px">
	<?php
	foreach ( array(
		array( 'Orders with deals applied', number_format( $total_orders ), '#E10000', 'Every one of these orders had a GT BOGO deal fire automatically at checkout' ),
		array( 'Revenue from deal orders', '$' . number_format( $total_revenue, 2 ), '#22c55e', 'Total cart value of all orders where a deal was active' ),
		array( 'Discount given to customers', '$' . number_format( $total_discounts, 2 ), '#f59e0b', 'Total savings your customers have received through GT BOGO deals' ),
	) as $m ) :
		?>
	<div style="background:var(--gt-card);border:1px solid var(--gt-border);border-radius:10px;padding:18px;text-align:center">
		<div style="font-size:24px;font-weight:900;color:<?php echo esc_html( $m[2] ); ?>;line-height:1;margin-bottom:6px"><?php echo esc_html( $m[1] ); ?></div>
		<div style="font-size:12px;font-weight:700;color:var(--gt-white);margin-bottom:4px"><?php echo esc_html( $m[0] ); ?></div>
		<div style="font-size:11px;color:var(--gt-subtle);line-height:1.4"><?php echo esc_html( $m[2] ); ?></div>
	</div>
	<?php endforeach; ?>
	</div>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">What to look at in your analytics — and what it means</h2></div>
	<?php
	foreach ( array(
		array( 'Which deals are firing most', 'Go to Analytics → Rule Leaderboard. The deals at the top are generating the most revenue. These are working. The deals at the bottom — or deals not appearing at all — either are not active, are not qualifying for most carts, or have a priority number that means a higher-ranked deal always fires first.' ),
		array( 'How efficient your deals are', 'Each deal shows an efficiency score. Think of it as: for every £100 of revenue this deal influenced, how much did it cost in discounts? Above 80% is healthy — you are generating significant revenue relative to what you are giving away. Below 60% means the discount is too high for the volume it is generating. Consider reducing the discount percentage.' ),
		array( 'How much revenue deals are influencing', 'The revenue figure next to each deal is the total cart value of every order where that deal fired — not just the discount amount. This is the correct number to look at when deciding whether a deal is worth keeping. A deal that costs £200 in discounts but influences £5.0.0 in revenue is an extremely good deal.' ),
		array( 'Which customers are most valuable', 'Go to Customer Intelligence. Sort by lifetime value to see your top 20 customers by total spend. These are your most important relationships. Consider reaching out to them personally, giving them a surprise reward, or making sure the VIP system is actively giving them your best deals.' ),
		array( 'How many customers you are retaining', 'Look at returning customer orders versus first-time orders. If this ratio is improving over time, the loyalty system is working. If it is static or declining, check that your streak emails and tier upgrade emails are enabled and that your win-back deals are active.' ),
		array( 'Exporting your data', 'Click Export CSV on the Analytics page to download the full dataset. You can open this in Excel or Google Sheets to create your own reports, or import it into your email marketing platform to build segments based on real purchase behaviour.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:14px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">A simple weekly routine that takes 5 minutes</h2></div>
	<?php
	foreach ( array(
		array( 'Monday morning: check which deals fired last week', 'Open Analytics → Rule Leaderboard. Note which deals generated the most orders. If the same deal is always at the top, it is working well — leave it. If a deal has not fired all week, check it is active and that its priority number is not being blocked by a higher-priority deal.' ),
		array( 'Check if any customers need attention', 'Open Customer Intelligence and filter for customers who have not ordered recently. If you have the win-back email active, they are already getting a re-engagement message. If you do not, consider enabling it this week.' ),
		array( 'Review your discount cost', 'Check the total discount given versus total revenue influenced. As long as revenue is at least 5x your discount cost, your deals are generating healthy returns. If this ratio is tightening, consider whether any deals are too aggressive.' ),
		array( 'Plan next week\'s scheduled campaign', 'If you want to run a weekend flash sale or a promotional window, go to Campaign Scheduler and set it up now. It takes 2 minutes and the deal will run and stop on its own without any further attention from you.' ),
	) as $item ) :
		?>
	<div style="display:flex;gap:12px;align-items:flex-start;margin-bottom:14px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
	<span style="font-size:18px;flex-shrink:0">✓</span>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'ai' ) : ?>
<div class="gt-card" style="margin-bottom:20px"><div class="gt-card-header"><h2 class="gt-card-title">Let AI find the right deals for your store</h2></div><p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">The AI Intelligence system analyses your store's actual data — active deals, product categories, average order value, and returning customer rate — and recommends the exact packs that will drive the most revenue. Describe your goal in plain English and the AI scans all 200 PRO packs to find the best match.</p><p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">No technical knowledge required. Type what you want to achieve and the AI does the rest.</p></div>
<div class="gt-card" style="margin-bottom:20px"><div class="gt-card-header"><h2 class="gt-card-title">The six AI superpowers</h2></div>
	<?php
	foreach ( array( array( '📦', 'Pack Recommender', 'AI recommends the best packs for your goal. Analyses your store data and scans all 200 packs to give personalised recommendations with fit scores and specific reasons.', 'Go to AI Intelligence and describe your promotional goal' ), array( '\u270d\ufe0f', 'AI Copywriter', 'Generates deal copy, email subjects, badge text in your brand voice. Define your voice once and batch-generate copy across all superpowers.', 'Go to AI Intelligence and set your brand voice profile' ), array( '🔍', 'Gap Analyzer', 'Scans your active deals against the 200-pack library. Finds seasonal, lifecycle, category, and retention gaps with severity scoring.', 'Go to AI Intelligence and run a gap analysis' ), array( '🛒', 'Cart Intelligence', 'Analyses each customer cart in real time. Predicts optimal discount depth — the minimum needed to convert.', 'Enabled automatically when API key is connected' ), array( '📈', 'Performance Coach', 'Weekly AI report with revenue recommendations. Reviews deal performance, flags underperforming deals, suggests adjustments.', 'Go to AI Intelligence and enable weekly reports' ), array( '🧪', 'A/B Test Optimizer', 'Statistical analysis of A/B tests. Chi-square significance, confidence scoring, tells you not just which deal won but why.', 'Go to A/B Testing and create a test' ) ) as $sp ) :
		?>
		<div style="margin-bottom:22px;padding-bottom:22px;border-bottom:1px solid var(--gt-border)"><p style="margin:0 0 3px;font-size:15px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $sp[0] ); ?> <?php echo esc_html( $sp[1] ); ?></p><p style="margin:0 0 8px;font-size:11px;font-weight:700;color:#E10000"><?php echo esc_html( $sp[2] ); ?></p><p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.8"><?php echo esc_html( $sp[3] ); ?></p></div><?php endforeach; ?></div>
<div class="gt-card"><div class="gt-card-header"><h2 class="gt-card-title">How to get started</h2></div><p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Go to <strong>GT BOGO ENGINE &rarr; INTELLIGENCE &rarr; AI Intelligence</strong>. Add your Anthropic or OpenRouter API key in the API Configuration card, then describe your promotional goal in the Pack Recommendations card and click Get Recommendations.</p></div>
<?php elseif ( $doc === 'abtesting' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Find what sells better — without guessing</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">A/B testing lets you run two different deals at the same time and measure which one generates more revenue. Half your customers see Deal A. The other half see Deal B. After enough orders, you can see clearly which deal is outperforming the other and make it your permanent deal.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">This removes the guesswork from deal design. Instead of choosing between "Buy 2 Get 1 Free" and "30% off when you buy 2" based on instinct, you let your customers tell you which one drives more purchases. The plugin calculates the statistical confidence so you know when you have a definitive answer.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">How to run a test</h2></div>
	<?php
	foreach ( array(
		array( 'Create two deals with the same targeting but different discounts', 'For example: Deal A is "Buy 2 Get 1 Free" and Deal B is "Buy 2, get 35% off the cheapest item." Both should target the same products or categories and have the same priority number. Import them from your pack or set them up manually.' ),
		array( 'Go to A/B Testing and create a new test', 'Select Deal A, select Deal B, name your test ("Free item vs percentage test"), and choose your traffic split. The default is 50/50 which gives you the cleanest data. Click Start Test.' ),
		array( 'Let it run until you have enough orders', 'For a reliable result you need at least 50 orders through each version of the deal. For lower-traffic stores this might take 2–4 weeks. The plugin shows you the confidence percentage — wait until it reaches 95% before declaring a winner.' ),
		array( 'Declare a winner', 'When confidence reaches 95%, the winning deal is highlighted in the results. Click Declare Winner and the losing deal is automatically deactivated. The winning deal continues as your permanent deal at full traffic.' ),
	) as $i => $item ) :
		?>
	<div style="display:flex;gap:14px;margin-bottom:16px;align-items:flex-start">
	<div style="width:28px;height:28px;border-radius:50%;background:rgba(225,0,0,0.15);border:1px solid rgba(225,0,0,0.3);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;color:#E10000;flex-shrink:0;margin-top:2px"><?php echo esc_html( $i + 1 ); ?></div>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Good things to test</h2></div>
	<?php
	foreach ( array(
		array( 'Free item vs percentage discount', 'Customers respond differently to "get one free" versus "save 35%." Even when the monetary value is identical, the framing affects conversion. Test both and let your customers tell you which presentation they prefer.' ),
		array( 'Different threshold amounts', 'If you are running a spend-more deal, test $50 versus $75 versus $100 as the unlock threshold. A lower threshold fires more often but at a smaller discount. A higher threshold drives bigger baskets but fires less. Find the sweet spot for your customers.' ),
		array( 'Different discount percentages', 'Is 20% off enough to change buying behaviour for your customers, or does it need to be 30%? Testing this tells you exactly where your customers\' sensitivity lies without permanently committing to a margin reduction.' ),
		array( 'New customer deal amounts', 'What discount turns a first-time visitor into a buyer? 25%? 35%? The answer varies by industry and product price point. Testing it directly on your store gives you a definitive answer rather than a best guess.' ),
	) as $item ) :
		?>
	<div style="padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px;margin-bottom:10px">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'segments' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Show different deals to different types of customers</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">Customer Segments let you define groups of customers based on their purchase history, spending, loyalty tier, or other criteria — and then target specific deals to those groups exclusively.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">For most stores, the built-in loyalty tiers and VIP system handle segmentation automatically. Segments are useful when you need something more specific — for example, customers who have bought in the last 60 days but spent less than $100, or customers who are in the Gold tier but have not bought in the last 30 days.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">How segments work</h2></div>
	<?php
	foreach ( array(
		array( 'You define the criteria for a group', 'For example: "Customers who have placed 3 or more orders AND spent more than $200 in total AND have not bought in the last 45 days." You can combine as many conditions as you need using AND (all conditions must match) or OR (any one condition is enough).' ),
		array( 'The plugin builds the group automatically', 'Every night, the plugin evaluates your entire customer list against the segment criteria and assigns a custom status to everyone who qualifies. As customers\' purchase history changes, they enter and leave the segment automatically.' ),
		array( 'You see the group size', 'The segment list shows how many customers are currently in each segment. This tells you whether a segment is large enough to be worth a dedicated campaign, or whether it is too small to be meaningful.' ),
		array( 'Create a deal that targets the segment', 'Any deal can be restricted to a specific customer segment. Go to the deal settings and choose your segment from the targeting options. Only customers in that segment will see and receive that deal.' ),
		array( 'Export the list for email campaigns', 'Download the full list of customers in any segment as a CSV. Import it into your email marketing platform to send a targeted message to that exact group.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:14px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Segment ideas worth building</h2></div>
	<?php
	foreach ( array(
		array( 'Lapsed mid-value customers', 'Customers who spent $100–$500 in total but have not bought in 45–90 days. These are customers who were engaged and have gone quiet. A targeted win-back deal with a slightly stronger incentive than your standard win-back often reactivates a meaningful percentage of this group.' ),
		array( 'Frequent buyers approaching a tier upgrade', 'Customers with 6 orders (one away from Gold) or 11 orders (one away from Platinum). A message telling them they are one purchase away from unlocking a better deal tier converts very well — especially when paired with a time-limited incentive.' ),
		array( 'High-spend non-VIPs', 'Customers who have spent over $400 but are not yet VIP. They are very close to VIP status. A deal that explicitly tells them their VIP unlock is within reach can push them over the threshold in a single order.' ),
		array( 'New customers after their second order', 'Customers who have placed exactly 2 orders. They have shown they are not one-time buyers. This is the moment to introduce them to the loyalty system and referral program explicitly — they are more likely to engage with it when they have already demonstrated repeat buying behaviour.' ),
	) as $item ) :
		?>
	<div style="padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px;margin-bottom:10px">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'conditions' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Control exactly who gets your deals</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">The Conditions page lets you set sitewide rules that apply to all deals — not just individual ones. These are your store-level guardrails. For example: "No deals on orders under $20" or "No deals for wholesale accounts."</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">These conditions are evaluated before any deal is considered. If a cart does not meet your sitewide conditions, no deals fire at all. This protects your margins on low-value orders and prevents deals from reaching customer groups they were never intended for.</p>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">The conditions you can set</h2></div>
	<?php
	foreach ( array(
		array( 'Minimum cart value', 'Deals only fire when the cart reaches this amount. Setting a minimum of $30 or $50 prevents your deals from applying to low-value orders where the discount is not commercially viable. Most stores set this to their break-even order value.' ),
		array( 'Maximum cart value', 'Deals only fire below this cart value. Use this to protect margin on very large orders — for example, if a $2,000 order does not need a Buy 2 Get 1 incentive to convert, exclude orders above $500 from certain deals.' ),
		array( 'New customers only or returning customers only', 'Restrict a deal so it only fires for customers placing their first-ever order, or only fires for customers who have ordered before. This lets you run genuinely separate new-customer and returning-customer deals without any overlap.' ),
		array( 'Specific customer groups', 'Restrict deals to customers in specific groups — for example, members, subscribers, or VIP customers. Or exclude certain groups — for example, trade accounts or resellers who should not receive promotional pricing.' ),
		array( 'Specific products or categories', 'Restrict all deals so they only apply to certain categories or specific products. Or exclude certain products from all deals. Useful for protecting margin on cost-price items or new arrivals you do not want to discount.' ),
		array( 'Match ALL conditions or ANY condition', 'When you set multiple conditions, you choose whether all of them must be true for a deal to fire (stricter) or whether any one condition being true is enough (broader). Most stores use "ALL conditions" for their minimum cart value and "ANY condition" for customer group targeting.' ),
	) as $item ) :
		?>
	<div style="display:flex;gap:12px;align-items:flex-start;margin-bottom:12px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:6px">
	<svg style="flex-shrink:0;margin-top:3px" width="16" height="16" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="7" stroke="#E10000" stroke-width="1.5"/><path d="M8 5v3.5L10 10" stroke="#E10000" stroke-width="1.5" stroke-linecap="round"/></svg>
	<div>
		<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Recommended starting conditions for most stores</h2></div>
	<?php
	foreach ( array(
		array( 'Set a minimum cart value of $25–$50', 'This prevents your deals from firing on very small orders where the discount outweighs the value of the sale. The right number depends on your average order value — a minimum of roughly 60–70% of your average order value is a good starting point.' ),
		array( 'Exclude your staff and reseller accounts', 'If you have wholesale customers, staff, or resellers who order frequently at full price, exclude their account type from deals. This protects your pricing integrity and prevents your commercial pricing from being disrupted by promotional deals.' ),
		array( 'Do not exclude new customers by default', 'Your welcome deals and new customer deals are designed to convert first-time buyers. Unless you have a specific reason to exclude new customers from a particular deal, leave them included. First purchases are your most important acquisition metric.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid #E10000;padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0;background:rgba(225,0,0,0.03)">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'dealpage' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">A dedicated page that shows all your active deals</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">The Deal Page creates a browsable page on your store where customers can see every deal that is currently active — what they need to buy, what they get, and how much they save. Customers can add products directly from this page.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">This page is particularly valuable for stores with multiple active deals. Rather than discovering deals by accident, customers can visit the deals page to find the offer that suits them and start shopping from there. Link to it from your homepage, your main navigation, and your promotional emails.</p>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Setting up your deals page</h2></div>
	<?php
	foreach ( array(
		array( 'Go to Deal Page in the left menu', 'This is in the GT BOGO Engine menu. You will see configuration options and a preview of what the page will look like.' ),
		array( 'Choose your page title and web address', 'The page title is what customers see as the heading. The web address (slug) is the URL — for example "yourstoreurl.com/deals". Choose something short and memorable that you can link to easily.' ),
		array( 'Write a short introduction', 'A one or two sentence description that appears at the top of the page explaining what customers can find here. Keep it simple: "Browse our current deals and add qualifying items directly to your cart."' ),
		array( 'Publish the page', 'The plugin creates the page automatically once you save. You do not need to configure anything in WordPress separately.' ),
		array( 'Link to it prominently', 'Add the deals page link to your main navigation menu, your homepage banner, and any promotional emails. Customers who visit this page are actively looking for a deal — they convert at high rates.' ),
	) as $i => $item ) :
		?>
	<div style="display:flex;gap:14px;margin-bottom:14px;align-items:flex-start">
	<div style="width:26px;height:26px;border-radius:50%;background:rgba(225,0,0,0.15);border:1px solid rgba(225,0,0,0.3);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:800;color:#E10000;flex-shrink:0;margin-top:2px"><?php echo esc_html( $i + 1 ); ?></div>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'geo' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Show different messages to customers in different countries</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">If you sell internationally, the Geo Targeting tool lets you show country-specific deal messages. A customer in the United States sees "US orders — deal applied at checkout." A customer in the United Kingdom sees "UK orders — free delivery included." The deal itself is the same — only the message changes to feel locally relevant.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">Geo Targeting also assigns a country-specific status to logged-in customers — which you can then use as a condition in your deals. For example, a deal targeted only at US customers, or a different discount level for EU customers to account for VAT.</p>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">What you can do with Geo Targeting</h2></div>
	<?php
	foreach ( array(
		array( 'Country-specific deal messages', 'Configure different announcement bar and nudge messages for each country. US customers see US-friendly copy. UK customers see UK-friendly copy. All from a single active deal — no duplicate deals needed.' ),
		array( 'Country-targeted deals', 'Restrict any deal to specific countries. For example: a "Free US Shipping on your deal" offer targeted only at American customers, separate from your standard international deal.' ),
		array( 'Works with Multi-Currency', 'When a customer is detected in a country with a different currency, both the geo-specific message and their preferred currency apply at the same time. No additional configuration needed.' ),
		array( 'Location accuracy', 'Country detection is based on the customer\'s IP address and works accurately for the vast majority of visitors. Customers using VPNs may appear to be in a different country — this is normal and does not affect the deal, only the messaging.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'currency' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Sell to customers in their own currency</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">If your store sells to customers in different countries, the Multi-Currency tool lets you display prices and deal thresholds in the customer\'s local currency. A customer in Germany sees euros. A customer in Japan sees yen. Your deal logic always calculates in your base currency behind the scenes — the currency display is converted for each customer automatically.</p>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">How to set up additional currencies</h2></div>
	<?php
	foreach ( array(
		array( 'Go to Multi-Currency in the left menu', 'You will see a search box to find any world currency and a list of currencies you have already configured.' ),
		array( 'Search for the currency you want to add', 'Type the currency name or code — USD, EUR, GBP, JPY, and so on. All major currencies and over 150 total are available.' ),
		array( 'Set the exchange rate', 'Enter the current exchange rate relative to your base currency. Update this periodically to keep prices accurate. A rate that is significantly out of date will affect your margins.' ),
		array( 'Save and it is live', 'The currency is immediately available. Customers browsing from countries using that currency will see prices converted automatically. Deal thresholds — like "spend $50 to unlock this deal" — are converted and displayed in local currency too.' ),
	) as $i => $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'whitelabel' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">For agencies: rebrand the plugin as your own</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">If you manage WooCommerce stores for clients, the White Label feature lets you present GT BOGO Engine as your own branded product. Your clients log in and see "Promotions Manager PRO" — or whatever name you choose. GT BOGO Engine, Graphic T-Shirts, and any reference to the underlying product are completely hidden.</p>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0">With a single $499/year license you can charge clients $299–$499/year for your branded promotions tool. The White Label settings take about 5 minutes to configure. Customer-facing emails are always white-labelled automatically — your clients\' customers never see any GT BOGO Engine branding regardless of these settings.</p>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">What you can customise</h2></div>
	<?php
	foreach ( array(
		array( 'Plugin name', 'Replace "GT BOGO Engine" everywhere in the admin interface with your chosen product name. For example: "Promotions Manager PRO" or "DealFlow" or "Revenue Booster."' ),
		array( 'Menu label', 'The label in the WordPress admin sidebar menu. Change it to match your product name so clients see your branding from the moment they log in.' ),
		array( 'Support link', 'Replace the "Contact Support" link with your own agency support URL. When clients need help they go to your support desk, not ours.' ),
		array( 'Documentation link', 'Replace the Documentation tab link with your own documentation URL. You can build a simplified client-facing guide in your own knowledge base.' ),
		array( 'Agency name', 'Appears in the admin footer. Positions you as the provider and builds your brand with the client.' ),
		array( 'Hide all GT BOGO Engine references', 'One toggle removes all mentions of GT BOGO Engine, Graphic T-Shirts, and any supplier branding from the admin interface.' ),
		array( 'Hide upgrade prompts', 'Removes all pricing information, upgrade CTAs, and pack purchase options from the client\'s admin view. Essential so clients do not see your supplier pricing and margins.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'integrations' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Connect GT BOGO Engine to your other tools</h2></div>
	<p style="font-size:14px;color:var(--gt-soft);line-height:1.8;margin:0 0 16px">GT BOGO Engine connects with the marketing and analytics tools you already use. Every integration only sends data from orders where a deal actually fired — your external tools always receive accurate, deal-specific information rather than all order data mixed together.</p>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Available integrations</h2></div>
	<?php
	foreach ( array(
		array( 'Mailchimp', 'When a customer places an order with a deal, their loyalty tier and deal type are automatically sent to Mailchimp as customer tags. Use these tags to build Mailchimp audiences and trigger Mailchimp email automations based on GT BOGO deal activity. Requires your Mailchimp API key in Settings.' ),
		array( 'Klaviyo', 'BOGO order events are sent to Klaviyo with full details — deal name, discount amount, loyalty tier, and VIP status. Use these to trigger Klaviyo flows based on which deal a customer redeemed and what tier they are in.' ),
		array( 'Google Analytics', 'A purchase event is sent to your GA4 account for every BOGO order. This lets you track deal-influenced revenue separately in your Google Analytics reports and build custom reports showing the impact of your promotion strategy.' ),
		array( 'Facebook and Instagram Ads', 'A purchase event is sent to your Facebook Pixel for every BOGO order. Use this to build Custom Audiences of customers who have redeemed deals — and exclude them from acquisition campaigns so you are not paying to reach people who already buy from you.' ),
		array( 'Zapier and Make.com', 'The GT BOGO Engine deal management tools connect with Zapier and Make.com automations. You can trigger deal activation and deactivation from external events — for example, activating a flash sale automatically when a specific email campaign sends, or deactivating a deal when your CRM shows stock has sold out.' ),
		array( 'WooCommerce Subscriptions', 'If you use WooCommerce Subscriptions, the plugin automatically detects subscription status for each customer. Active subscribers qualify for subscription deals. Subscribers showing at-risk signals trigger retention emails and retention deals automatically.' ),
		array( 'WPML and Polylang', 'If your store is translated into multiple languages using WPML or Polylang, all deal messages, badge text, and nudge copy can be translated through those plugins. Every customer-facing string in GT BOGO Engine is registered for translation.' ),
	) as $item ) :
		?>
	<div style="display:flex;gap:14px;align-items:flex-start;margin-bottom:14px;padding:14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:8px">
	<span style="font-size:20px;flex-shrink:0">🔌</span>
	<div>
		<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'settings' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Settings you should configure on day one</h2></div>
	<?php
	foreach ( array(
		array( 'Store name', 'Used in all automated emails. Your customers need to see your store name, not a technical placeholder. Set this to exactly how you want your store to appear in email subject lines and headings.' ),
		array( 'Store logo URL', 'The URL of your logo image. Used in all automated emails. Your full logo URL — copy it from your media library. Square or landscape logos both work.' ),
		array( 'Email from address', 'The email address your deal emails come from. This should be your store\'s proper email address — for example orders@yourstore.com or hello@yourstore.com. Emails from a recognisable address have significantly higher open rates.' ),
		array( 'Email theme', 'Choose from 8 dark themes. Midnight (red accent) is the default and works for most stores. If your brand has a specific colour, choose the theme whose accent is closest, then override it with the accent colour picker.' ),
		array( 'Customer emails enabled', 'The master switch for all 19 automated customer emails. Toggle this on once your store name, logo, and email address are configured. Everything else is automatic.' ),
		array( 'Referral reward value', 'The percentage discount coupon a customer earns for each successful referral. Default is 10%. Increasing this to 15% or 20% typically increases referral activity meaningfully.' ),
	) as $item ) :
		?>
	<div style="display:flex;gap:12px;margin-bottom:12px;padding:12px 14px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:6px;align-items:flex-start">
	<span style="font-size:16px;flex-shrink:0;margin-top:2px">⚙️</span>
	<div>
		<p style="margin:0 0 3px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.5"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Cart and discount settings</h2></div>
	<?php
	foreach ( array(
		array( 'Auto-remove free items', 'If a customer removes items from their cart and their order no longer qualifies for a deal, any free items that were added automatically are removed at the same time. Keeps the cart accurate and prevents customers from gaming the system by adding and removing qualifying items.' ),
		array( 'Show deal label in cart', 'Displays a small "Deal Applied" label next to discounted items in the cart. Reinforces to the customer that their savings are real and the deal is genuinely working.' ),
		array( 'Cart notice position', 'Controls where the deal announcement appears in the cart — above the cart table, below it, or near the shipping estimate. Test different positions to see which placement generates the most deal completions for your store.' ),
		array( 'Maximum discount cap', 'Set a maximum percentage discount that can apply to any order. This protects you from edge cases where multiple deals might stack unexpectedly. Most stores set this to their maximum acceptable margin reduction — for example 50%.' ),
		array( 'Deals for all customers or excluding some', 'You can exclude specific customer account types from all deals — for example, your wholesale accounts or staff. This prevents promotional pricing from interfering with commercial pricing.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Settings to leave at their defaults</h2></div>
	<p style="font-size:13px;color:var(--gt-soft);line-height:1.7;margin:0 0 12px">These settings work correctly for the vast majority of stores without any adjustment. Only change them if you have a specific reason to.</p>
	<?php
	foreach ( array(
		array( 'Rule caching', 'Keeps your active deals in a short-term memory store so they load faster on each page. Leave this on. It clears automatically whenever you make changes to your deals.' ),
		array( 'Analytics retention', 'How long your deal order history is kept. Default is one year. Only reduce this if you are managing a very large store and need to save database space.' ),
		array( 'Remove all data on uninstall', 'Controls whether the plugin removes all your deal history, customer loyalty data, and analytics when uninstalled. Default is off — your data is preserved if you ever need to reinstall. Only turn this on if you are permanently removing the plugin and want a clean slate.' ),
	) as $item ) :
		?>
	<div style="display:flex;gap:10px;margin-bottom:10px;padding:10px 12px;background:var(--gt-card);border:1px solid var(--gt-border);border-radius:6px;align-items:flex-start">
	<span style="color:#22c55e;font-weight:700;font-size:12px;flex-shrink:0;margin-top:2px">DEFAULT ✓</span>
	<div>
		<p style="margin:0 0 2px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
		<p style="margin:0;font-size:12px;color:var(--gt-soft)"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	</div>
	<?php endforeach; ?>
</div>

<?php elseif ( $doc === 'pricing' ) : ?>

<div class="gt-card" style="margin-bottom:20px">
	<div class="gt-card-header"><h2 class="gt-card-title">Pricing</h2></div>
	<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin-bottom:20px">
	<?php
	foreach ( array(
		array( 'PRO License', '$499', 'per year', 'Annual license for one store. Unlocks all 200 deal packs, all smart selling tools, the customer intelligence system, the email system, and all enterprise features. Renews annually. Rules continue to work after expiry — pack imports and new features lock until renewed.', '#E10000' ),
		array( 'Individual Pack', '$79.99', 'one-time', 'A single industry pack containing 10 ready-to-use deals. Lifetime access — import once and the deals are yours permanently. Choose any pack from the 200 available.', '#3b82f6' ),
		array( 'Starter Bundle', '$299', 'one-time', '5 packs covering the most commonly used deal types: Cart Threshold, Flash Sale, Free Gift, Visual Badge, and Savings Display. Best for stores setting up BOGO for the first time.', '#22c55e' ),
		array( 'Growth Acceleration Bundle', '$299', 'one-time', '9 packs: all 5 Starter packs plus Stack Master, Countdown Urgency, Social Proof, and New Customer. Best for established stores wanting comprehensive deal coverage.', '#f59e0b' ),
		array( 'Complete Bundle', '$799', 'one-time', '15 packs: all Growth packs plus Smart Upsell, Inventory Clearance, VIP Loyalty, Tiered Quantity, Seasonal, and Quick Deal. Best value per pack for stores that want maximum coverage.', '#8b5cf6' ),
	) as $p ) :
		?>
	<div style="padding:20px;border-radius:10px;border:2px solid <?php echo esc_html( $p[4] ); ?>33;background:<?php echo esc_html( $p[4] ); ?>08">
		<p style="margin:0 0 8px;font-size:13px;font-weight:800;color:var(--gt-white)"><?php echo esc_html( $p[0] ); ?></p>
		<div style="display:flex;align-items:baseline;gap:4px;margin-bottom:8px">
		<span style="font-size:28px;font-weight:900;color:<?php echo esc_html( $p[4] ); ?>"><?php echo esc_html( $p[1] ); ?></span>
		<span style="font-size:13px;color:var(--gt-subtle)"><?php echo esc_html( $p[2] ); ?></span>
		</div>
		<p style="margin:0;font-size:12px;color:var(--gt-soft);line-height:1.6"><?php echo esc_html( $p[3] ); ?></p>
	</div>
	<?php endforeach; ?>
	</div>
	<div style="padding:16px;background:rgba(34,197,94,0.05);border:1px solid rgba(34,197,94,0.3);border-radius:8px">
	<p style="margin:0 0 4px;font-size:13px;font-weight:700;color:#22c55e">For agencies managing client stores</p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.6">With a $499/year PRO license you can present GT BOGO Engine to clients as your own branded product using the White Label feature. Enable "Hide Upgrade Prompts" so clients never see the underlying pricing. Many agencies charge $299–$499/year for their branded promotions tool — a straightforward margin on top of the license cost.</p>
	</div>
</div>

<div class="gt-card">
	<div class="gt-card-header"><h2 class="gt-card-title">Your license — answers to common questions</h2></div>
	<?php
	foreach ( array(
		array( 'How do I activate my license?', 'Go to GT BOGO Engine → License in your WordPress admin and enter your license key. Click Activate. It verifies instantly. Once active, all 200 packs become available to import and all PRO features unlock immediately.' ),
		array( 'What happens when my license expires?', 'Your existing active deals keep firing. Your customers\' loyalty history, VIP status, and all data is preserved. The only things that lock are importing new packs and accessing new PRO features. Renew at any time to restore full access.' ),
		array( 'Can I move to a new website?', 'Yes. Use the self-service transfer form at graphictshirts.shop/bogo/#license-transfer. Enter your license key, your purchase email, and your new domain. Transfers are available once every 90 days. After transferring, re-import your packs from the My Packs page inside the plugin.' ),
		array( 'What if I lose my license key?', 'Go to graphictshirts.shop/bogo/retrieve-license.php and enter your purchase email. You will receive a verification code and be able to retrieve your key immediately. No support ticket needed.' ),
		array( 'Can I share my license with a colleague?', 'Your license is for one domain at a time and is not transferable between owners. If a colleague needs to manage the plugin, they can log in to the same WordPress admin. The license itself does not need to be shared.' ),
		array( 'Are the deal packs a one-time purchase?', 'Yes. Individual packs and bundle purchases are lifetime — you pay once and the deals are yours permanently. Only the PRO license (which unlocks the ability to use packs) renews annually.' ),
	) as $item ) :
		?>
	<div style="border-left:3px solid var(--gt-border);padding:12px 16px;margin-bottom:12px;border-radius:0 6px 6px 0">
	<p style="margin:0 0 5px;font-size:13px;font-weight:700;color:var(--gt-white)"><?php echo esc_html( $item[0] ); ?></p>
	<p style="margin:0;font-size:13px;color:var(--gt-soft);line-height:1.65"><?php echo esc_html( $item[1] ); ?></p>
	</div>
	<?php endforeach; ?>
</div>

<?php endif; ?>

</div><!-- end content -->
</div><!-- end grid -->

<script>
(function() {
	function setActiveLink(doc) {
		document.querySelectorAll('.gt-doc-nav-link').forEach(function(a) {
			var isActive = a.getAttribute('data-doc') === doc;
			a.style.fontWeight = isActive ? '700' : '500';
			a.style.color = isActive ? '#ffffff' : 'var(--gt-soft)';
			a.style.background = isActive ? 'rgba(225,0,0,0.12)' : 'transparent';
			a.style.borderLeft = isActive ? '3px solid #E10000' : '3px solid transparent';
		});
	}
	function loadSection(url, doc, pushState) {
		var content = document.getElementById('gt-doc-content');
		if (!content) return;
		content.style.opacity = '0';
		content.style.transition = 'opacity 0.12s ease';
		fetch(url, { credentials: 'same-origin' })
			.then(function(r) { return r.text(); })
			.then(function(html) {
				var parser = new DOMParser();
				var doc2 = parser.parseFromString(html, 'text/html');
				var newContent = doc2.getElementById('gt-doc-content');
				if (newContent) {
					content.innerHTML = newContent.innerHTML;
					content.style.opacity = '1';
					if (pushState) history.pushState({ doc: doc }, '', url);
					setActiveLink(doc);
					window.scrollTo({ top: 0, behavior: 'smooth' });
				} else { window.location.href = url; }
			})
			.catch(function() { window.location.href = url; });
	}
	document.addEventListener('click', function(e) {
		var link = e.target.closest('.gt-doc-nav-link');
		if (!link) return;
		e.preventDefault();
		var doc = link.getAttribute('data-doc');
		var url = link.getAttribute('href');
		if (!url || !doc) return;
		loadSection(url, doc, true);
	});
	window.addEventListener('popstate', function(e) {
		if (e.state && e.state.doc) loadSection(window.location.href, e.state.doc, false);
	});
})();
</script>

<?php require_once __DIR__ . '/../ui-system/wrapper-end.php'; ?>
