<?php
// phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals
 defined( 'ABSPATH' ) || exit;

$posts = get_posts( [
    'post_type'      => [ 'post', 'page' ],
    'post_status'    => 'publish',
    'posts_per_page' => 100,
    'orderby'        => 'title',
    'order'          => 'ASC',
] );
?>

<div class="wrap zs-seo-wrap">
    <div class="zs-seo-header">
        <h1>🔍 <?php esc_html_e('SEO Audit', 'zs-seo-audit-optimization'); ?></h1>
        <p><?php esc_html_e('Select a page/post to analyze, or run a full site scan.', 'zs-seo-audit-optimization'); ?></p>
    </div>

    <div class="zs-seo-box">
        <div class="zs-seo-row">
            <select id="zs-seo-post-select" class="zs-seo-select">
                <option value=""><?php esc_html_e('— Select a page or post —', 'zs-seo-audit-optimization'); ?></option>
                <?php foreach ( $posts as $p ) : ?>
                    <option value="<?php echo esc_attr( $p->ID ); ?>">
                        [<?php echo esc_html( $p->post_type ); ?>] <?php echo esc_html( $p->post_title ); ?>
                    </option>
                <?php endforeach; ?>
            </select>
            <button type="button" id="zs-seo-run-single" class="button button-primary">
                🔍 <?php esc_html_e('Analyze', 'zs-seo-audit-optimization'); ?>
            </button>
        </div>

        <div id="zs-seo-single-results" style="margin-top:20px;"></div>
    </div>
</div>
