<?php
defined( 'ABSPATH' ) || exit;

$avi_meta_title = 'Pricing — Avision';
$avi_meta_desc  = 'Protect your Google Business Profile and grow your local visibility. One-time access, no subscription required to get started.';

if ( ! class_exists( 'Avision_Page_Template' ) ) {
	require_once AVISION_PLUGIN_DIR . 'includes/class-avision-page-template.php';
}

$hero = array(
	'badge'       => 'Pricing',
	'title'       => 'Protect your presence.<br>Dominate your territory.',
	'subtitle'    => 'One dashboard to secure your Google Business Profile, track every keyword, and grow your local visibility — automatically.',
	'cta_primary' => array(
		'label' => 'Start Free Audit',
		'url'   => '/local-audit/',
	),
	'align'       => 'center',
	'size'        => 'small',
);

$avi_pricing_shields = array(
	array(
		'emoji' => '🕵️',
		'name'  => 'Spy-Alert',
		'desc'  => 'Your competitors are making moves. Spy-Alert tracks their changes so you\'re never caught off guard.',
	),
	array(
		'emoji' => '💎',
		'name'  => 'Proof Extractor',
		'desc'  => 'Customers don\'t buy services — they buy proof. Proof Extractor surfaces the right trust signals at the right moment.',
	),
	array(
		'emoji' => '🖼️',
		'name'  => 'Image Cleaner',
		'desc'  => 'Your gallery is your first impression online. Image Cleaner keeps it sharp, consistent, and brand-safe.',
	),
	array(
		'emoji' => '📍',
		'name'  => 'NAP Shield',
		'desc'  => 'One wrong phone number. One outdated address. That\'s all it takes to lose a customer. NAP Shield prevents it.',
	),
	array(
		'emoji' => '💬',
		'name'  => 'Hybrid Responses',
		'desc'  => 'Every review answered — in your tone, with the right words. You choose the level of control.',
	),
	array(
		'emoji' => '⚔️',
		'name'  => 'Reputation Armor',
		'desc'  => 'One bad review can haunt you for months. Reputation Armor monitors your perception and builds a long-term shield.',
	),
	array(
		'emoji' => '📸',
		'name'  => 'Galerie Drip-Feed',
		'desc'  => 'Drop all your photos in one go. Guardian publishes them at the perfect pace — one per week.',
	),
	array(
		'emoji' => '📝',
		'name'  => 'Posts Infinis',
		'desc'  => 'An inactive profile is an invisible profile. Posts Infinis keeps a steady stream of content going.',
	),
	array(
		'emoji' => '🎯',
		'name'  => 'Sentinel Top 3',
		'desc'  => 'Sentinel detects any drop from your key positions and alerts you before it becomes a problem.',
	),
);

$avi_pricing_radar = array(
	array(
		'title' => '🗺️ Coming soon — Territory Map',
		'desc'  => 'Visualize your dominance zone on Google Maps — street by street.',
	),
	array(
		'title' => '📈 Keyword Positions — Live',
		'desc'  => 'Track every keyword that matters. See positions move in real time.',
	),
	array(
		'title' => '🏆 Gamified Progression',
		'desc'  => 'Every keyword gained is an achievement. Unlock milestones, climb your score /100.',
	),
	array(
		'title' => '💰 Ad Savings Calculator',
		'desc'  => 'See the exact Google Ads budget you\'re saving by ranking organically.',
	),
);

$avi_pricing_faq = array(
	array(
		'q' => 'Can I cancel anytime?',
		'a' => 'Yes. Monthly plans can be cancelled at any time from your dashboard — no forms, no support ticket. AVI Access is a one-time purchase with zero recurring charge.',
	),
	array(
		'q' => 'What happens right after I purchase?',
		'a' => 'You connect your Google Business Profile via secure authorization. Your dashboard activates immediately.',
	),
	array(
		'q' => 'Do I need a Google Business Profile?',
		'a' => 'Yes — AVI Intelligence works with your existing GBP. If you don\'t have one yet, you can create your Google Business Profile at business.google.com then come back.',
	),
	array(
		'q' => 'I manage multiple locations — is there an agency plan?',
		'a' => 'Yes — see our Agency Pricing page for fleet management tiers starting at $149 one-time for up to 10 locations.',
		'link' => array(
			'label' => 'Agency Pricing',
			'url'   => '/agency-pricing/',
		),
	),
	array(
		'q' => 'Is my data secure?',
		'a' => 'Yes. We use official Google OAuth 2.0 authorization. Your credentials are never stored — only the access token required to sync your profile data.',
	),
);

Avision_Page_Template::render(
	'pricing',
	$hero,
	static function () use ( $avi_pricing_shields, $avi_pricing_radar, $avi_pricing_faq ) {
		?>
		<div class="avi-pricing-section">
			<style>
				.avi-pricing-section { background: #0A1628; color: #ffffff; font-family: inherit; line-height: 1.65; }
				.avi-pricing-section * { box-sizing: border-box; }
				.avi-pricing-section__inner { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }
				.avi-pricing-section__launch {
					margin-top: 0;
					padding: 16px 20px;
					border-radius: 12px;
					background: rgba(59,111,212,0.06);
					border: 1px solid rgba(59,111,212,0.35);
					box-shadow: 0 2px 12px rgba(0,0,0,0.3);
				}
				.avi-pricing-section__launch p { margin: 0; font-size: 0.95rem; color: #cbd5e1; }
				.avi-pricing-section__plan-wrap { display: flex; justify-content: center; margin: 40px 0 48px; }
				.avi-pricing-section__plan {
					width: 100%;
					max-width: 480px;
					padding: 32px 28px 28px;
					border-radius: 16px;
					background: #0f1e35;
					border: 2px solid rgba(108,63,197,0.4);
					box-shadow: 0 2px 12px rgba(0,0,0,0.3), 0 0 40px rgba(108,63,197,0.12);
					text-align: center;
				}
				.avi-pricing-section__plan-badge {
					display: inline-block;
					margin-bottom: 12px;
					padding: 6px 14px;
					border-radius: 999px;
					background: rgba(245,158,11,0.1);
					color: #F59E0B;
					font-size: 0.82rem;
					font-weight: 700;
				}
				.avi-pricing-section__plan h2 { margin: 0 0 8px; font-size: 1.75rem; font-weight: 800; color: #fff; }
				.avi-pricing-section__plan-price { margin: 12px 0 8px; }
				.avi-pricing-section__plan-price s { color: #64748b; font-size: 1.1rem; margin-right: 8px; }
				.avi-pricing-section__plan-price strong { font-size: 2.5rem; font-weight: 800; color: #fff; }
				.avi-pricing-section__plan-note { margin: 0 0 20px; font-size: 13px; color: #94a3b8; }
				.avi-pricing-section__features { list-style: none; margin: 0; padding: 0; text-align: left; }
				.avi-pricing-section__features li { padding: 8px 0; font-size: 0.92rem; color: #e2e8f0; border-bottom: 1px solid rgba(255,255,255,0.06); }
				.avi-pricing-section__features li:last-child { border-bottom: none; }
				.avi-pricing-section__features li.is-muted { color: #64748b; }
				.avi-pricing-section__features li.is-included::before { content: "✓ "; color: #4ade80; font-weight: 700; }
				.avi-pricing-section__features li.is-muted::before { content: "✗ "; color: #64748b; font-weight: 700; }
				.avi-pricing-section .avi-btn--primary {
					background: #6C3FC5;
					border: none;
					color: #fff;
					cursor: pointer;
					font-weight: 700;
					border-radius: 8px;
					padding: 14px 24px;
					font-size: 1rem;
					transition: background 0.2s ease;
				}
				.avi-pricing-section .avi-btn--primary:hover { background: #7c4fd5; }
				.avi-pricing-section .avi-btn--large { padding: 16px 28px; font-size: 1.05rem; }
				.avi-pricing-section__plan-foot { margin: 12px 0 0; font-size: 12px; color: #94a3b8; text-align: center; }
				.avi-pricing-section__upsell {
					max-width: 600px;
					margin: 0 auto 56px;
					padding: 20px 24px;
					border-radius: 8px;
					background: rgba(108,63,197,0.08);
					border-left: 3px solid #6C3FC5;
					box-shadow: 0 2px 12px rgba(0,0,0,0.3);
				}
				.avi-pricing-section__upsell p { margin: 0 0 14px; color: #cbd5e1; font-size: 0.95rem; }
				.avi-pricing-section__upsell p:last-child { margin-bottom: 0; }
				.avi-pricing-section__head { text-align: center; margin: 0 0 32px; }
				.avi-pricing-section__head h2 { margin: 0 0 12px; font-size: 1.85rem; font-weight: 800; color: #fff; }
				.avi-pricing-section__head p { margin: 0 auto; max-width: 720px; color: #94a3b8; font-size: 1rem; line-height: 1.7; }
				.avi-pricing-section__shield-grid {
					display: grid;
					grid-template-columns: repeat(3, 1fr);
					gap: 20px;
					margin-bottom: 28px;
				}
				.avi-pricing-section__card {
					background: #0f1e35;
					border-radius: 12px;
					padding: 22px 20px;
					box-shadow: 0 2px 12px rgba(0,0,0,0.3);
				}
				.avi-pricing-section__shield-card h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 700; color: #fff; }
				.avi-pricing-section__shield-card .avi-pricing-section__shield-emoji { font-size: 1.6rem; margin-bottom: 8px; display: block; }
				.avi-pricing-section__shield-card p { margin: 0 0 12px; font-size: 0.88rem; color: #94a3b8; line-height: 1.55; }
				.avi-pricing-section__active-badge {
					display: inline-block;
					padding: 4px 10px;
					border-radius: 999px;
					background: rgba(74,222,128,0.12);
					color: #4ade80;
					font-size: 0.72rem;
					font-weight: 700;
					letter-spacing: 0.02em;
				}
				.avi-pricing-section__modes {
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					gap: 12px 20px;
					margin: 0 0 24px;
					font-size: 0.9rem;
					color: #cbd5e1;
				}
				.avi-pricing-section__network {
					max-width: 720px;
					margin: 0 auto 64px;
					padding: 18px 22px;
					border-radius: 12px;
					background: rgba(74,222,128,0.08);
					border: 1px solid rgba(74,222,128,0.25);
					text-align: center;
					font-size: 0.92rem;
					color: #cbd5e1;
					box-shadow: 0 2px 12px rgba(0,0,0,0.3);
				}
				.avi-pricing-section__radar-grid {
					display: grid;
					grid-template-columns: repeat(2, 1fr);
					gap: 20px;
					margin-bottom: 64px;
				}
				.avi-pricing-section__radar-card h3 { margin: 0 0 10px; font-size: 1.05rem; color: #fff; font-weight: 700; }
				.avi-pricing-section__radar-card p { margin: 0; font-size: 0.9rem; color: #94a3b8; line-height: 1.55; }
				.avi-pricing-section__faq { max-width: 800px; margin: 0 auto; }
				.avi-pricing-section__faq-item {
					background: #0f1e35;
					border-radius: 12px;
					margin-bottom: 10px;
					box-shadow: 0 2px 12px rgba(0,0,0,0.3);
					border-left: 3px solid #6C3FC5;
					overflow: hidden;
				}
				.avi-pricing-section__faq-item summary {
					padding: 18px 22px;
					cursor: pointer;
					font-weight: 600;
					color: #fff;
					list-style: none;
				}
				.avi-pricing-section__faq-item summary::-webkit-details-marker { display: none; }
				.avi-pricing-section__faq-item[open] summary { color: #F59E0B; }
				.avi-pricing-section__faq-answer { padding: 0 22px 18px; color: #94a3b8; font-size: 0.92rem; line-height: 1.65; }
				.avi-pricing-section__faq-answer a { color: #6C3FC5; }
				@media (max-width: 1024px) {
					.avi-pricing-section__shield-grid { grid-template-columns: repeat(2, 1fr); }
				}
				@media (max-width: 768px) {
					.avi-pricing-section__inner { padding: 0 16px 64px; }
					.avi-pricing-section__shield-grid { grid-template-columns: 1fr; }
					.avi-pricing-section__radar-grid { grid-template-columns: 1fr; }
					.avi-pricing-section__head h2 { font-size: 1.5rem; }
				}
				@media (max-width: 480px) {
					.avi-pricing-section__plan { padding: 24px 18px; }
					.avi-pricing-section__modes { flex-direction: column; align-items: center; }
				}
			</style>

			<div class="avi-pricing-section__inner">

				<!-- Section 1 — Launch offer -->
				<div class="avi-pricing-section__launch">
					<p>🎉 Launch offer — 30% off AVI Access · Use code <strong style="background:#F59E0B;color:#0A1628;padding:2px 8px;border-radius:4px;cursor:pointer;user-select:all;" title="Click to select and copy">LAUNCH_BTOC</strong><span style="font-size:11px;opacity:0.8;margin-left:6px;">← copy this code</span> at checkout · Limited time only</p>
				</div>

				<!-- Section 2 — AVI Access -->
				<div class="avi-pricing-section__plan-wrap">
					<div class="avi-pricing-section__plan">
						<span class="avi-pricing-section__plan-badge">🚀 Launch Offer</span>
						<h2>AVI Access</h2>
						<div class="avi-pricing-section__plan-price">
							<s>$99</s>
							<strong>$69</strong>
						</div>
						<p class="avi-pricing-section__plan-note">✦ One-time payment — never billed again</p>
						<ul class="avi-pricing-section__features">
							<li class="is-included">Full local visibility audit</li>
							<li class="is-included">GBP optimization report</li>
							<li class="is-included">AVI Intelligence chat — full access</li>
							<li class="is-included">Visibility score /100 + priority actions</li>
							<li class="is-included">Growth Radar — 20 keywords, monthly scans</li>
							<li class="is-included">Gamified progression — start your visibility journey</li>
							<li class="is-muted">Guardian Mode (automated protection)</li>
							<li class="is-muted">Weekly / daily scan frequency</li>
							<li class="is-included">AVI Academy — modules unlock with your progression</li>
							<li class="is-included">Google Updates — Latest GBP rule changes</li>
						</ul>
						<a
							href="<?php echo esc_url( home_url( '/local-audit/' ) ); ?>"
							class="avi-btn avi-btn--primary avi-btn--large"
							style="width:100%;margin-top:24px;display:block;text-align:center;text-decoration:none;"
						>Get AVI Access — $69</a>
						<p class="avi-pricing-section__plan-foot">Regular price $99 · One-time, no subscription</p>
					</div>
				</div>

				<!-- Section 3 — Upsell info -->
				<div class="avi-pricing-section__upsell">
					<p>💡 Guardian Mode and Growth Radar plans will be available directly from your dashboard after onboarding — upgrade whenever you&apos;re ready, at your own pace.</p>
					<p>🎓 Every plan includes access to the AVI Academy — step-by-step training on local SEO and your dashboard, unlocking alongside your progression.</p>
				</div>

				<!-- Section 4 — Guardian Mode -->
				<div class="avi-pricing-section__head">
					<h2>🛡️ Guardian Mode — Your 9 active shields</h2>
					<p>Your Google Business Profile is editable by anyone — including strangers. Guardian deploys 9 specialized shields that work in the background, so you never have to worry about your profile again.</p>
				</div>
				<div class="avi-pricing-section__shield-grid">
					<?php foreach ( $avi_pricing_shields as $shield ) : ?>
					<article class="avi-pricing-section__card avi-pricing-section__shield-card">
						<span class="avi-pricing-section__shield-emoji"><?php echo esc_html( $shield['emoji'] ); ?></span>
						<h3><?php echo esc_html( $shield['name'] ); ?></h3>
						<p><?php echo esc_html( $shield['desc'] ); ?></p>
						<span class="avi-pricing-section__active-badge">Active</span>
					</article>
					<?php endforeach; ?>
				</div>
				<div class="avi-pricing-section__modes">
					<span>🤝 Co-pilot — I validate everything</span>
					<span>⚙️ Hybrid — I choose per flow</span>
					<span>🚀 Auto-pilot — Guardian handles it all</span>
				</div>
				<div class="avi-pricing-section__network">
					🟢 Guardian Mode is actively running across our network — detecting and neutralizing unauthorized profile changes, negative patterns, and competitor threats, around the clock.
				</div>

				<!-- Section 5 — Growth Radar -->
				<div class="avi-pricing-section__head">
					<h2>📡 Growth Radar — Own your local territory</h2>
				</div>
				<div class="avi-pricing-section__radar-grid">
					<?php foreach ( $avi_pricing_radar as $radar ) : ?>
					<article class="avi-pricing-section__card avi-pricing-section__radar-card">
						<h3><?php echo esc_html( $radar['title'] ); ?></h3>
						<p><?php echo esc_html( $radar['desc'] ); ?></p>
					</article>
					<?php endforeach; ?>
				</div>

				<!-- Section 6 — FAQ -->
				<div class="avi-pricing-section__head">
					<h2>FAQ</h2>
				</div>
				<div class="avi-pricing-section__faq">
					<?php foreach ( $avi_pricing_faq as $faq ) : ?>
					<details class="avi-pricing-section__faq-item">
						<summary><?php echo esc_html( $faq['q'] ); ?></summary>
						<div class="avi-pricing-section__faq-answer">
							<p style="margin:0"><?php echo esc_html( $faq['a'] ); ?>
							<?php if ( ! empty( $faq['link']['url'] ) ) : ?>
								<a href="<?php echo esc_url( home_url( (string) $faq['link']['url'] ) ); ?>"><?php echo esc_html( (string) $faq['link']['label'] ); ?> →</a>
							<?php endif; ?>
							</p>
						</div>
					</details>
					<?php endforeach; ?>
				</div>

				<?php
				$avi_lang = 'en';
				include __DIR__ . '/../partials/avi-gbp-notice.php';
				?>

			</div>
		</div>
		<?php
	}
);
