<?php

/**
 * Provide a admin area view for the SEO Health Dashboard.
 *
 * This file is used to markup the admin-facing aspects of the plugin.
 *
 * @link       https://yourwebsite.com
 * @since      1.0.2
 *
 * @package    Basic_SEO_Helper
 * @subpackage Basic_SEO_Helper/admin/partials
 */

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables are scoped to this included file, not global scope
?>

<div class="wrap">
	<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
	
	<div class="bsh-dashboard-header">
		<p class="description">
			<?php esc_html_e( 'Get a quick overview of your site\'s SEO health. Each page is scored based on meta titles, descriptions, social tags, and schema markup.', 'cspg-basic-seo-helper' ); ?>
		</p>
	</div>

	<div class="bsh-dashboard-filters">
		<form method="get" action="">
			<input type="hidden" name="page" value="cspg-basic-seo-helper-dashboard">
			
			<label for="filter-score"><?php esc_html_e( 'Filter by Score:', 'cspg-basic-seo-helper' ); ?></label>
			<select name="filter_score" id="filter-score">
				<option value=""><?php esc_html_e( 'All Posts', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="good" <?php selected( isset( $_GET['filter_score'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_score'] ) ) : '', 'good' ); ?>><?php esc_html_e( 'Good (80-100%)', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="needs-improvement" <?php selected( isset( $_GET['filter_score'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_score'] ) ) : '', 'needs-improvement' ); ?>><?php esc_html_e( 'Needs Improvement (50-79%)', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="poor" <?php selected( isset( $_GET['filter_score'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_score'] ) ) : '', 'poor' ); ?>><?php esc_html_e( 'Poor (0-49%)', 'cspg-basic-seo-helper' ); ?></option>
			</select>
			
			<label for="filter-type"><?php esc_html_e( 'Content Type:', 'cspg-basic-seo-helper' ); ?></label>
			<select name="filter_type" id="filter-type">
				<option value=""><?php esc_html_e( 'All Types', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="page" <?php selected( isset( $_GET['filter_type'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_type'] ) ) : '', 'page' ); ?>><?php esc_html_e( 'Pages', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="post" <?php selected( isset( $_GET['filter_type'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_type'] ) ) : '', 'post' ); ?>><?php esc_html_e( 'Posts', 'cspg-basic-seo-helper' ); ?></option>
			</select>
			
			<label for="per-page"><?php esc_html_e( 'Posts per page:', 'cspg-basic-seo-helper' ); ?></label>
			<select name="per_page" id="per-page">
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="5" <?php selected( isset( $_GET['per_page'] ) ? sanitize_text_field( wp_unslash( $_GET['per_page'] ) ) : '20', '5' ); ?>><?php esc_html_e( '5', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="10" <?php selected( isset( $_GET['per_page'] ) ? sanitize_text_field( wp_unslash( $_GET['per_page'] ) ) : '20', '10' ); ?>><?php esc_html_e( '10', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="20" <?php selected( isset( $_GET['per_page'] ) ? sanitize_text_field( wp_unslash( $_GET['per_page'] ) ) : '20', '20' ); ?>><?php esc_html_e( '20', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="50" <?php selected( isset( $_GET['per_page'] ) ? sanitize_text_field( wp_unslash( $_GET['per_page'] ) ) : '20', '50' ); ?>><?php esc_html_e( '50', 'cspg-basic-seo-helper' ); ?></option>
                <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
				<option value="100" <?php selected( isset( $_GET['per_page'] ) ? sanitize_text_field( wp_unslash( $_GET['per_page'] ) ) : '20', '100' ); ?>><?php esc_html_e( '100', 'cspg-basic-seo-helper' ); ?></option>
			</select>
			
			<?php submit_button( __( 'Filter', 'cspg-basic-seo-helper' ), 'secondary', 'submit', false ); ?>
		</form>
	</div>

	<div class="bsh-dashboard-summary">
		<?php
		// Get summary statistics
		$summary_stats = $this->get_seo_summary_stats();

		// Get current filter parameters for maintaining state
        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameters for display filtering, no data modification
		$current_filter_type = isset( $_GET['filter_type'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_type'] ) ) : '';
        // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameters for display filtering, no data modification
		$current_per_page = isset( $_GET['per_page'] ) ? max( 1, intval( wp_unslash( $_GET['per_page'] ) ) ) : 20;

		// Generate filter URLs
		$base_params = array(
			'page'        => 'cspg-basic-seo-helper-dashboard',
			'filter_type' => $current_filter_type,
			'per_page'    => $current_per_page,
		);

		$good_url              = add_query_arg( array_merge( $base_params, array( 'filter_score' => 'good' ) ), admin_url( 'admin.php' ) );
		$needs_improvement_url = add_query_arg( array_merge( $base_params, array( 'filter_score' => 'needs-improvement' ) ), admin_url( 'admin.php' ) );
		$poor_url              = add_query_arg( array_merge( $base_params, array( 'filter_score' => 'poor' ) ), admin_url( 'admin.php' ) );
		$all_url               = add_query_arg( $base_params, admin_url( 'admin.php' ) );
		?>
		<div class="bsh-summary-cards">
            <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
			<a href="<?php echo esc_url( $good_url ); ?>" class="bsh-summary-card bsh-summary-good <?php echo esc_attr( ( isset( $_GET['filter_score'] ) && sanitize_key( wp_unslash( $_GET['filter_score'] ) ) === 'good' ) ? 'bsh-summary-active' : '' ); ?>">
				<h3><?php echo esc_html( $summary_stats['good'] ); ?></h3>
				<p><?php esc_html_e( 'Good SEO', 'cspg-basic-seo-helper' ); ?></p>
			</a>
            <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
			<a href="<?php echo esc_url( $needs_improvement_url ); ?>" class="bsh-summary-card bsh-summary-needs-improvement <?php echo esc_attr( ( isset( $_GET['filter_score'] ) && sanitize_key( wp_unslash( $_GET['filter_score'] ) ) === 'needs-improvement' ) ? 'bsh-summary-active' : '' ); ?>">
				<h3><?php echo esc_html( $summary_stats['needs_improvement'] ); ?></h3>
				<p><?php esc_html_e( 'Needs Improvement', 'cspg-basic-seo-helper' ); ?></p>
			</a>
            <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
			<a href="<?php echo esc_url( $poor_url ); ?>" class="bsh-summary-card bsh-summary-poor <?php echo esc_attr( ( isset( $_GET['filter_score'] ) && sanitize_key( wp_unslash( $_GET['filter_score'] ) ) === 'poor' ) ? 'bsh-summary-active' : '' ); ?>">
				<h3><?php echo esc_html( $summary_stats['poor'] ); ?></h3>
				<p><?php esc_html_e( 'Poor SEO', 'cspg-basic-seo-helper' ); ?></p>
			</a>
            <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only GET parameter for display filtering, no data modification ?>
			<a href="<?php echo esc_url( $all_url ); ?>" class="bsh-summary-card bsh-summary-total <?php echo esc_attr( ( ! isset( $_GET['filter_score'] ) || sanitize_key( wp_unslash( $_GET['filter_score'] ) ) === '' ) ? 'bsh-summary-active' : '' ); ?>">
				<h3><?php echo esc_html( $summary_stats['total'] ); ?></h3>
				<p><?php esc_html_e( 'Total Pages', 'cspg-basic-seo-helper' ); ?></p>
			</a>
		</div>
	</div>

	<div class="bsh-dashboard-table-wrapper">
		<?php
		// Get filtered posts with pagination
        // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only GET parameters for display filtering and pagination, no data modification
		$filter_score = isset( $_GET['filter_score'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_score'] ) ) : '';
		$filter_type  = isset( $_GET['filter_type'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_type'] ) ) : '';
		$paged        = isset( $_GET['paged'] ) ? max( 1, intval( wp_unslash( $_GET['paged'] ) ) ) : 1;
		$per_page     = isset( $_GET['per_page'] ) ? max( 1, intval( wp_unslash( $_GET['per_page'] ) ) ) : 20; // Default to 20 items per page
        // phpcs:enable WordPress.Security.NonceVerification.Recommended

		$results      = $this->get_posts_for_dashboard( $filter_score, $filter_type, $paged, $per_page );
		$posts        = $results['posts'];
		$total_posts  = $results['total_posts'];
		$total_pages  = $results['total_pages'];
		$current_page = $results['current_page'];
		?>

		<?php if ( empty( $posts ) ) : ?>
			<div class="notice notice-info">
				<p><?php esc_html_e( 'No posts found matching your filter criteria.', 'cspg-basic-seo-helper' ); ?></p>
			</div>
		<?php else : ?>
			<table class="wp-list-table widefat fixed striped">
				<thead>
					<tr>
						<th><?php esc_html_e( 'Post/Page', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Type', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Meta Title', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Meta Description', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'OG Tags', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Twitter Tags', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Schema', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'SEO Score', 'cspg-basic-seo-helper' ); ?></th>
						<th><?php esc_html_e( 'Actions', 'cspg-basic-seo-helper' ); ?></th>
					</tr>
				</thead>
				<tbody>
					<?php foreach ( $posts as $post ) : ?>
						<?php
						$seo_data    = $this->get_post_seo_data( $post->ID );
						$score       = $this->calculate_seo_score( $post->ID );
						$score_class = $this->get_score_class( $score );
						?>
						<tr>
							<td>
								<strong>
									<a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" target="_blank">
									<?php echo esc_html( $post->post_title ? $post->post_title : __( '(no title)', 'cspg-basic-seo-helper' ) ); ?>
									</a>
								</strong>
							</td>
							<td><?php echo esc_html( ucfirst( $post->post_type ) ); ?></td>
							<td>
								<?php if ( ! empty( $seo_data['meta_title'] ) ) : ?>
									<span class="bsh-check-good">✅</span>
									<small>(<?php echo esc_html( strlen( $seo_data['meta_title'] ) ); ?> chars)</small>
								<?php else : ?>
									<span class="bsh-check-missing">❌</span>
								<?php endif; ?>
							</td>
							<td>
								<?php if ( ! empty( $seo_data['meta_description'] ) ) : ?>
									<?php
									$desc_length = strlen( $seo_data['meta_description'] );
									if ( $desc_length >= 120 && $desc_length <= 160 ) :
										?>
										<span class="bsh-check-good">✅</span>
									<?php else : ?>
										<span class="bsh-check-warning">⚠️</span>
									<?php endif; ?>
									<small>(<?php echo esc_html( $desc_length ); ?> chars)</small>
								<?php else : ?>
									<span class="bsh-check-missing">❌</span>
								<?php endif; ?>
							</td>
							<td>
								<?php if ( ! empty( $seo_data['og_title'] ) && ! empty( $seo_data['og_description'] ) ) : ?>
									<span class="bsh-check-good">✅</span>
								<?php else : ?>
									<span class="bsh-check-missing">❌</span>
								<?php endif; ?>
							</td>
							<td>
								<?php if ( ! empty( $seo_data['twitter_title'] ) && ! empty( $seo_data['twitter_description'] ) ) : ?>
									<span class="bsh-check-good">✅</span>
								<?php else : ?>
									<span class="bsh-check-missing">❌</span>
								<?php endif; ?>
							</td>
							<td>
								<?php if ( 'enabled' === $seo_data['schema_status'] ) : ?>
									<span class="bsh-check-good">✅</span>
								<?php else : ?>
									<span class="bsh-check-warning">⚠️</span>
								<?php endif; ?>
							</td>
							<td>
								<span class="bsh-score-badge bsh-score-<?php echo esc_attr( $score_class ); ?>">
									<?php echo esc_html( $score ); ?>%
								</span>
							</td>
							<td>
								<a href="<?php echo esc_url( get_edit_post_link( $post->ID ) ); ?>" class="button button-small">
									<?php esc_html_e( 'Edit', 'cspg-basic-seo-helper' ); ?>
								</a>
							</td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			
			<!-- Pagination Controls -->
			<?php if ( $total_pages > 1 ) : ?>
				<div class="bsh-pagination">
					<div class="bsh-pagination-info">
						<?php
						$start_item = ( ( $current_page - 1 ) * $per_page ) + 1;
						$end_item   = min( $current_page * $per_page, $total_posts );
						printf(
							/* translators: %1$d is the starting item number, %2$d is the ending item number, %3$d is the total number of items */
							esc_html__( 'Showing %1$d-%2$d of %3$d items', 'cspg-basic-seo-helper' ),
							esc_html( $start_item ),
							esc_html( $end_item ),
							esc_html( $total_posts )
						);
						?>
					</div>
					
					<div class="bsh-pagination-links">
						<?php
						$base_url = add_query_arg(
							array(
								'page'         => 'cspg-basic-seo-helper-dashboard',
								'filter_score' => $filter_score,
								'filter_type'  => $filter_type,
								'per_page'     => $per_page,
							),
							admin_url( 'admin.php' )
						);

						// Previous button
						if ( $current_page > 1 ) :
							$prev_url = add_query_arg( 'paged', $current_page - 1, $base_url );
							?>
							<a href="<?php echo esc_url( $prev_url ); ?>" class="button">
								<?php esc_html_e( '‹ Previous', 'cspg-basic-seo-helper' ); ?>
							</a>
						<?php else : ?>
							<span class="button button-disabled">
								<?php esc_html_e( '‹ Previous', 'cspg-basic-seo-helper' ); ?>
							</span>
						<?php endif; ?>
						
						<!-- Page numbers -->
						<span class="bsh-page-numbers">
							<?php
							$start_page = max( 1, $current_page - 2 );
							$end_page   = min( $total_pages, $current_page + 2 );

							for ( $i = $start_page; $i <= $end_page; $i++ ) :
								if ( $i === $current_page ) :
									?>
									<span class="bsh-current-page"><?php echo esc_html( $i ); ?></span>
									<?php
								else :
									$page_url = add_query_arg( 'paged', $i, $base_url );
									?>
									<a href="<?php echo esc_url( $page_url ); ?>" class="bsh-page-link"><?php echo esc_html( $i ); ?></a>
									<?php
								endif;
							endfor;
							?>
						</span>
						
						<!-- Next button -->
						<?php
						if ( $current_page < $total_pages ) :
							$next_url = add_query_arg( 'paged', $current_page + 1, $base_url );
							?>
							<a href="<?php echo esc_url( $next_url ); ?>" class="button">
								<?php esc_html_e( 'Next ›', 'cspg-basic-seo-helper' ); ?>
							</a>
						<?php else : ?>
							<span class="button button-disabled">
								<?php esc_html_e( 'Next ›', 'cspg-basic-seo-helper' ); ?>
							</span>
						<?php endif; ?>
					</div>
				</div>
			<?php endif; ?>
		<?php endif; ?>
	</div>

	<div class="bsh-seo-elements-guide">
		<h3><span class="bsh-guide-icon">🧭</span><?php esc_html_e( 'SEO Elements Guide', 'cspg-basic-seo-helper' ); ?></h3>
		<div class="bsh-guide-wrapper">
			<div class="bsh-guide-columns">
				<div class="bsh-guide-column">
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">📝</span><?php esc_html_e( 'Meta Title', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What It Is:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'The meta title (also called the title tag) appears as the clickable headline in search results and in your browser\'s title bar. It\'s one of the strongest on-page SEO signals.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'Best Practices:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'Keep it between 50–60 characters', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Include your primary keyword near the beginning', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Make each title unique across your site', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Add your brand name at the end', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Your SEO Score evaluates the title\'s presence, length, and uniqueness. The plugin can also apply global templates to automate title generation.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
					
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">📄</span><?php esc_html_e( 'Meta Description', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What It Is:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'The meta description is the short summary displayed below the title in search engine results.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'Best Practices:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'Keep between 120–160 characters', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Include the target keyword naturally', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Summarize your content\'s value or benefit', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Use an active voice and call to action', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Descriptions are analyzed for length and completeness. The SEO Health Dashboard flags missing or too-short descriptions.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
					
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">📱</span><?php esc_html_e( 'OG Tags (Open Graph Tags)', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What They Are:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Open Graph meta tags define how your pages appear when shared on platforms like Facebook, LinkedIn, and Slack.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'Best Practices:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'og:title (60–90 characters recommended)', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'og:description (110–200 characters recommended)', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'og:image (minimum 1200×630 pixels)', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Use a consistent featured image for your brand', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'OG tags are auto-generated from your page\'s metadata and featured image but can be customized per post.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
				</div>
				
				<div class="bsh-guide-column">
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">🐦</span><?php esc_html_e( 'Twitter Tags (Twitter Cards)', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What They Are:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Twitter Card tags control how your content looks when shared on X (Twitter) — similar to OG tags, but using the twitter: prefix.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'Best Practices:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'Use a summary_large_image card type', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'twitter:title (50–70 characters recommended)', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'twitter:description (100–200 characters)', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'twitter:image (1200×675 pixels ideal)', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Twitter tags mirror your OG data by default but can be overridden. The plugin checks for missing or mismatched tags.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
					
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">🏗️</span><?php esc_html_e( 'Schema Markup (Structured Data)', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What It Is:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Schema Markup (using JSON-LD) adds structured information that helps search engines understand your content context.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'Best Practices:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'WebSite for your homepage', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Article or BlogPosting for posts', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Organization for your business info', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Include valid JSON-LD syntax', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'Schema is automatically generated for pages and posts. The Dashboard validates syntax and schema presence.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
					
					<div class="bsh-guide-item">
						<h4><span class="bsh-guide-icon">📊</span><?php esc_html_e( 'SEO Score', 'cspg-basic-seo-helper' ); ?></h4>
						<p><strong><?php esc_html_e( 'What It Is:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'The SEO Score is a composite metric (0–100) used by Basic SEO Helper to reflect your page\'s SEO readiness.', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'How It\'s Calculated:', 'cspg-basic-seo-helper' ); ?></strong><br>
						• <?php esc_html_e( 'Meta Title (25 pts) → Presence, length, and keyword clarity', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Meta Description (25 pts) → Length and engagement quality', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Open Graph & Twitter Tags (30 pts) → Completeness', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Schema Markup (10 pts) → Valid JSON-LD detected', 'cspg-basic-seo-helper' ); ?><br>
						• <?php esc_html_e( 'Readability/Structure (10 pts) → Page structure balance', 'cspg-basic-seo-helper' ); ?></p>
						
						<p><strong><?php esc_html_e( 'In Basic SEO Helper:', 'cspg-basic-seo-helper' ); ?></strong><br>
						<?php esc_html_e( 'The Dashboard automatically evaluates and color-codes each post/page, helping users focus on what needs improvement first.', 'cspg-basic-seo-helper' ); ?></p>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="bsh-dashboard-legend">
		<h3><?php esc_html_e( 'Score Legend', 'cspg-basic-seo-helper' ); ?></h3>
		<div class="bsh-legend-items">
			<div class="bsh-legend-item">
				<span class="bsh-score-badge bsh-score-good">95%</span>
				<span><?php esc_html_e( 'Good (80-100%) - Excellent SEO coverage', 'cspg-basic-seo-helper' ); ?></span>
			</div>
			<div class="bsh-legend-item">
				<span class="bsh-score-badge bsh-score-needs-improvement">65%</span>
				<span><?php esc_html_e( 'Needs Improvement (50-79%) - Some fields missing', 'cspg-basic-seo-helper' ); ?></span>
			</div>
			<div class="bsh-legend-item">
				<span class="bsh-score-badge bsh-score-poor">35%</span>
				<span><?php esc_html_e( 'Poor (0-49%) - Major SEO tags missing', 'cspg-basic-seo-helper' ); ?></span>
			</div>
		</div>
	</div>
</div>
