<?php
/**
 * Pro Features admin page
 *
 * @package WebEquipe\PDFSearch
 * @since 1.2.2
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$webequipe_pdf_admin_pricing_url = \WebEquipe\PDFSearch\Pro_Launch_Banner::get_admin_pricing_url();
$webequipe_pdf_dashboard_url     = admin_url( 'admin.php?page=webequipe-pdf-search' );
$webequipe_pdf_plugin_website_url = \WebEquipe\PDFSearch\Pro_Launch_Banner::get_plugin_website_url();

$webequipe_pdf_pro_features = array(
	array(
		'icon'        => 'dashicons-visibility',
		'title'       => __( 'OCR for Scanned PDFs', 'webequipe-pdf-search' ),
		'description' => __( 'Google Vision reads scanned and image-based PDFs on upload. No pre-processing or extra tools.', 'webequipe-pdf-search' ),
		'plans'       => __( 'Starter, Pro & Agency', 'webequipe-pdf-search' ),
	),
	array(
		'icon'        => 'dashicons-lock',
		'title'       => __( 'Private PDF Search', 'webequipe-pdf-search' ),
		'description' => __( 'Keep PDFs indexed but hidden from logged-out visitors. Ideal for member-only resources.', 'webequipe-pdf-search' ),
		'plans'       => __( 'Pro & Agency', 'webequipe-pdf-search' ),
	),
	array(
		'icon'        => 'dashicons-chart-bar',
		'title'       => __( 'Analytics Dashboard', 'webequipe-pdf-search' ),
		'description' => __( 'Top queries, zero-result searches, and most-clicked PDFs so you know what content to add.', 'webequipe-pdf-search' ),
		'plans'       => __( 'Pro & Agency', 'webequipe-pdf-search' ),
	),
);

$webequipe_pdf_comparison_rows = \WebEquipe\PDFSearch\Pro_Launch_Banner::get_feature_comparison_rows();
$webequipe_pdf_plan_columns    = array(
	'free'    => __( 'Free', 'webequipe-pdf-search' ),
	'starter' => __( 'Starter', 'webequipe-pdf-search' ),
	'pro'     => __( 'Pro', 'webequipe-pdf-search' ),
	'agency'  => __( 'Agency', 'webequipe-pdf-search' ),
);

?>
<div class="wrap webequipe-pdf-upgrade-wrap">
	<div class="webequipe-pdf-upgrade-hero">
		<div class="webequipe-pdf-upgrade-hero-content">
			<span class="webequipe-pdf-upgrade-hero-badge"><?php esc_html_e( 'Pro', 'webequipe-pdf-search' ); ?></span>
			<h1><?php esc_html_e( 'PDF Search Pro Features', 'webequipe-pdf-search' ); ?></h1>
			<p class="webequipe-pdf-upgrade-hero-lead">
				<?php esc_html_e( 'Search inside every PDF—including scanned documents. Add private member search and analytics without leaving WordPress.', 'webequipe-pdf-search' ); ?>
			</p>
			<div class="webequipe-pdf-upgrade-hero-actions">
				<a href="<?php echo esc_url( $webequipe_pdf_admin_pricing_url ); ?>" class="webequipe-pdf-upgrade-cta-primary">
					<?php esc_html_e( 'Upgrade now', 'webequipe-pdf-search' ); ?>
				</a>
				<a href="<?php echo esc_url( $webequipe_pdf_plugin_website_url ); ?>" class="webequipe-pdf-upgrade-cta-secondary" target="_blank" rel="noopener noreferrer">
					<?php esc_html_e( 'Explore Plugin', 'webequipe-pdf-search' ); ?>
				</a>
				<a href="<?php echo esc_url( $webequipe_pdf_dashboard_url ); ?>" class="webequipe-pdf-upgrade-cta-secondary">
					<?php esc_html_e( 'Back to Dashboard', 'webequipe-pdf-search' ); ?>
				</a>
			</div>
		</div>
	</div>

	<section class="webequipe-pdf-upgrade-section">
		<h2 class="webequipe-pdf-upgrade-section-title"><?php esc_html_e( 'What you get with Pro', 'webequipe-pdf-search' ); ?></h2>
		<div class="webequipe-pdf-upgrade-features">
			<?php foreach ( $webequipe_pdf_pro_features as $webequipe_pdf_pro_feature ) : ?>
				<div class="webequipe-pdf-upgrade-feature-card">
					<span class="dashicons <?php echo esc_attr( $webequipe_pdf_pro_feature['icon'] ); ?> webequipe-pdf-upgrade-feature-icon" aria-hidden="true"></span>
					<h3><?php echo esc_html( $webequipe_pdf_pro_feature['title'] ); ?></h3>
					<p><?php echo esc_html( $webequipe_pdf_pro_feature['description'] ); ?></p>
					<span class="webequipe-pdf-upgrade-feature-plan"><?php echo esc_html( $webequipe_pdf_pro_feature['plans'] ); ?></span>
				</div>
			<?php endforeach; ?>
		</div>
	</section>

	<section class="webequipe-pdf-upgrade-section webequipe-pdf-upgrade-ocr-flow">
		<h2 class="webequipe-pdf-upgrade-section-title"><?php esc_html_e( 'How OCR works', 'webequipe-pdf-search' ); ?></h2>
		<p class="webequipe-pdf-upgrade-ocr-flow-intro">
			<?php esc_html_e( 'With PDF Search Pro, scanned and image-based PDFs are indexed automatically—no desktop OCR software required.', 'webequipe-pdf-search' ); ?>
		</p>
		<ol class="webequipe-pdf-upgrade-ocr-flow-steps">
			<li class="webequipe-pdf-upgrade-ocr-flow-step">
				<span class="webequipe-pdf-upgrade-ocr-flow-step-num" aria-hidden="true">1</span>
				<div class="webequipe-pdf-upgrade-ocr-flow-step-body">
					<strong><?php esc_html_e( 'Upload a PDF', 'webequipe-pdf-search' ); ?></strong>
					<span><?php esc_html_e( 'Add a PDF to the Media Library. Pro indexing runs on upload, or you can index manually from Manage PDFs.', 'webequipe-pdf-search' ); ?></span>
				</div>
			</li>
			<li class="webequipe-pdf-upgrade-ocr-flow-step">
				<span class="webequipe-pdf-upgrade-ocr-flow-step-num" aria-hidden="true">2</span>
				<div class="webequipe-pdf-upgrade-ocr-flow-step-body">
					<strong><?php esc_html_e( 'Detect scanned pages', 'webequipe-pdf-search' ); ?></strong>
					<span><?php esc_html_e( 'Pro checks each page. Image-only or scanned pages are flagged for OCR instead of native text extraction.', 'webequipe-pdf-search' ); ?></span>
				</div>
			</li>
			<li class="webequipe-pdf-upgrade-ocr-flow-step">
				<span class="webequipe-pdf-upgrade-ocr-flow-step-num" aria-hidden="true">3</span>
				<div class="webequipe-pdf-upgrade-ocr-flow-step-body">
					<strong><?php esc_html_e( 'Secure server processing', 'webequipe-pdf-search' ); ?></strong>
					<span><?php esc_html_e( 'Page images are sent to WebEquipe’s OCR service for processing—they are not read only in the browser.', 'webequipe-pdf-search' ); ?></span>
				</div>
			</li>
			<li class="webequipe-pdf-upgrade-ocr-flow-step">
				<span class="webequipe-pdf-upgrade-ocr-flow-step-num" aria-hidden="true">4</span>
				<div class="webequipe-pdf-upgrade-ocr-flow-step-body">
					<strong><?php esc_html_e( 'Google Cloud Vision API', 'webequipe-pdf-search' ); ?></strong>
					<span><?php esc_html_e( 'Text is extracted from scanned and image-based content using Google Vision OCR.', 'webequipe-pdf-search' ); ?></span>
				</div>
			</li>
			<li class="webequipe-pdf-upgrade-ocr-flow-step">
				<span class="webequipe-pdf-upgrade-ocr-flow-step-num" aria-hidden="true">5</span>
				<div class="webequipe-pdf-upgrade-ocr-flow-step-body">
					<strong><?php esc_html_e( 'Index & search', 'webequipe-pdf-search' ); ?></strong>
					<span><?php esc_html_e( 'Extracted text is stored in your WordPress index. The PDF appears in search results like any text-based document.', 'webequipe-pdf-search' ); ?></span>
				</div>
			</li>
		</ol>
		<p class="webequipe-pdf-upgrade-ocr-flow-note">
			<?php esc_html_e( 'Only the page content required for OCR is transmitted to the service. Your PDF files remain in your Media Library on your site.', 'webequipe-pdf-search' ); ?>
		</p>
	</section>

	<section class="webequipe-pdf-upgrade-section webequipe-pdf-upgrade-compare">
		<h2 class="webequipe-pdf-upgrade-section-title"><?php esc_html_e( 'Compare all features', 'webequipe-pdf-search' ); ?></h2>
		<p class="webequipe-pdf-upgrade-compare-intro">
			<?php esc_html_e( 'See what each plan includes. Live pricing and checkout are on the next screen.', 'webequipe-pdf-search' ); ?>
		</p>
		<div class="webequipe-pdf-upgrade-compare-table-wrap">
			<table class="webequipe-pdf-upgrade-compare-table">
				<thead>
					<tr>
						<th scope="col" class="webequipe-pdf-compare-feature-col"><?php esc_html_e( 'Feature', 'webequipe-pdf-search' ); ?></th>
						<?php foreach ( $webequipe_pdf_plan_columns as $webequipe_pdf_col_key => $webequipe_pdf_col_label ) : ?>
							<th scope="col" class="webequipe-pdf-compare-plan-col webequipe-pdf-compare-plan-col--<?php echo esc_attr( $webequipe_pdf_col_key ); ?>">
								<?php echo esc_html( $webequipe_pdf_col_label ); ?>
							</th>
						<?php endforeach; ?>
					</tr>
				</thead>
				<tbody>
					<?php foreach ( $webequipe_pdf_comparison_rows as $webequipe_pdf_row ) : ?>
						<tr>
							<th scope="row" class="webequipe-pdf-compare-feature-col"><?php echo esc_html( $webequipe_pdf_row['label'] ); ?></th>
							<?php foreach ( array_keys( $webequipe_pdf_plan_columns ) as $webequipe_pdf_col_key ) : ?>
								<td class="webequipe-pdf-compare-plan-col webequipe-pdf-compare-plan-col--<?php echo esc_attr( $webequipe_pdf_col_key ); ?>">
									<?php
									\WebEquipe\PDFSearch\Pro_Launch_Banner::render_comparison_cell(
										isset( $webequipe_pdf_row[ $webequipe_pdf_col_key ] ) ? $webequipe_pdf_row[ $webequipe_pdf_col_key ] : 'no'
									);
									?>
								</td>
							<?php endforeach; ?>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>
	</section>

	<section class="webequipe-pdf-upgrade-section webequipe-pdf-upgrade-steps">
		<h2 class="webequipe-pdf-upgrade-section-title"><?php esc_html_e( 'How to upgrade', 'webequipe-pdf-search' ); ?></h2>
		<ol class="webequipe-pdf-upgrade-steps-list">
			<li>
				<strong><?php esc_html_e( 'Choose a plan', 'webequipe-pdf-search' ); ?></strong>
				<span><?php esc_html_e( 'Open the pricing page, compare plans, and complete checkout in your WordPress dashboard.', 'webequipe-pdf-search' ); ?></span>
			</li>
			<li>
				<strong><?php esc_html_e( 'Install the Pro plugin', 'webequipe-pdf-search' ); ?></strong>
				<span><?php esc_html_e( 'Download the zip from your account and upload it under Plugins → Add New.', 'webequipe-pdf-search' ); ?></span>
			</li>
			<li>
				<strong><?php esc_html_e( 'Activate & license', 'webequipe-pdf-search' ); ?></strong>
				<span><?php esc_html_e( 'Activate Pro and enter your license key. You can deactivate this free plugin afterward.', 'webequipe-pdf-search' ); ?></span>
			</li>
		</ol>
		<div class="webequipe-pdf-upgrade-footer-cta">
			<a href="<?php echo esc_url( $webequipe_pdf_admin_pricing_url ); ?>" class="webequipe-pdf-upgrade-cta-primary">
				<?php esc_html_e( 'View plans & upgrade', 'webequipe-pdf-search' ); ?>
			</a>
			<p class="webequipe-pdf-upgrade-footer-note">
				<?php esc_html_e( 'Your existing PDF index is kept when you switch to Pro—no need to re-index unless you change OCR or indexing settings.', 'webequipe-pdf-search' ); ?>
			</p>
		</div>
	</section>
</div>
