<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Add Theme Info Page
 */
function thryvewp_fse_add_theme_info_page() {
    add_theme_page(
        esc_html__( 'Thryvewp FSE', 'thryvewp-fse' ),
        esc_html__( 'Thryvewp FSE', 'thryvewp-fse' ),
        'manage_options',
        'thryvewp-fse-info',
        'thryvewp_fse_render_theme_info_page'
    );
}
add_action( 'admin_menu', 'thryvewp_fse_add_theme_info_page' );


/**
 * Enqueue CSS for Theme Info Page
 */
function thryvewp_fse_admin_assets( $hook ) {

    // Correct hook slug for your page
    if ( 'appearance_page_thryvewp-fse-info' !== $hook ) {
        return;
    }

    wp_enqueue_style(
        'thryvewp-fse-admin',
        get_template_directory_uri() . '/inc/theme-info/theme-info.css',
        array(),
        wp_get_theme()->get('Version') // better than hardcoded version
    );
}
add_action( 'admin_enqueue_scripts', 'thryvewp_fse_admin_assets' );



/**
 * Render Theme Info Page
 */
function thryvewp_fse_render_theme_info_page() {
    $pro_url     = 'https://thryvewp.com/themes/thryvewp-fse-pro/';
    $contact_url = 'https://thryvewp.com/contact';
    $docs_url    = 'https://thryvewp.com/documentation/';
    ?>

    <div class="thryvewp-wrap">
        <div class="thryvewp-info-wrap">

            <!-- Header -->
            <div class="thryvewp-info-header">
                <h1><strong><?php esc_html_e( 'Thryvewp FSE', 'thryvewp-fse' ); ?></strong></h1>
                <p><?php esc_html_e( 'A modern Full Site Editing WordPress theme built for businesses, agencies, and professionals.', 'thryvewp-fse' ); ?></p></br>
                <a href="<?php echo esc_url( $pro_url ); ?>" target="_blank" class="button button-primary button-hero">
                    <?php esc_html_e( 'Buy Pro', 'thryvewp-fse' ); ?>
                </a>                
            </div>

            <!-- Features -->
            <div class="thryvewp-info-features">

                <div class="thryvewp-feature-box">
                    <span class="dashicons dashicons-editor-expand"></span>
                    <h3><?php esc_html_e( 'Full Site Editing', 'thryvewp-fse' ); ?></h3>
                    <p><?php esc_html_e( 'Customize your entire website using Gutenberg blocks.', 'thryvewp-fse' ); ?></p>
                </div>

                <div class="thryvewp-feature-box">
                    <span class="dashicons dashicons-airplane"></span>
                    <h3><?php esc_html_e( 'Fast & Lightweight', 'thryvewp-fse' ); ?></h3>
                    <p><?php esc_html_e( 'Optimized for speed and performance.', 'thryvewp-fse' ); ?></p>
                </div>

                <div class="thryvewp-feature-box">
                    <span class="dashicons dashicons-cart"></span>
                    <h3><?php esc_html_e( 'WooCommerce Ready', 'thryvewp-fse' ); ?></h3>
                    <p><?php esc_html_e( 'Fully compatible with WooCommerce.', 'thryvewp-fse' ); ?></p>
                </div>

                <div class="thryvewp-feature-box">
                    <span class="dashicons dashicons-laptop"></span>
                    <h3><?php esc_html_e( 'Responsive Design', 'thryvewp-fse' ); ?></h3>
                    <p><?php esc_html_e( 'Looks perfect on all devices.', 'thryvewp-fse' ); ?></p>
                </div>

            </div>
            
            <!-- Setup Guide -->
            <div class="thryvewp-setup-guide">
                <h2><?php esc_html_e( 'Getting Started Guide', 'thryvewp-fse' ); ?></h2>
                <div class="thryvewp-setup-guide-list">
                    <div>
                        <h3>🏠 <?php esc_html_e( 'Setup Front Page and Post Page', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Settings → Reading.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Select "A static page" under Your homepage displays.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Choose your Homepage and Posts page.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Click Save Changes.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>🖼️ <?php esc_html_e( 'Change Favicon and Site Logo', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Customize or Appearance → Editor.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Open Site Identity.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Upload your Logo and Site Icon.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Click Publish / Save.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>✏️ <?php esc_html_e( 'Edit Front Page Template', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Editor.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Open Templates → Front Page.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Edit blocks and layout as needed.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Click Save.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>🎨 <?php esc_html_e( 'Add Custom CSS', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Editor', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Click Styles → Additional CSS.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Add your CSS code and save.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>

                    <div>
                        <h3>🚀 <?php esc_html_e( 'What I Will Get on Pro Version', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Additional Patterns & Templates.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Regular updates and compatibility checks.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Dedicated support & some customization help.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Theme setup and demo file installation.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Upcoming features and updates.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>

                    <div>
                        <h3>🔑 <?php esc_html_e( 'How to Install Pro Version', 'thryvewp-fse' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'After purchasing the Pro version, log in to Freemius using the username and password you received at the time of purchase.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Download the Pro version ZIP file from your Freemius account.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Go to your WordPress Dashboard → Appearance → Themes → Add New.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Click on Upload Theme and upload the downloaded ZIP file.', 'thryvewp-fse' ); ?></li>
                            <li><?php esc_html_e( 'Activate the theme and enter your license key to enable Pro features.', 'thryvewp-fse' ); ?></li>
                        </ol>
                    </div>

                </div>          
            </div>
            <!-- Action Buttons -->
            <div class="thryvewp-info-actions">
                 <a href="<?php echo esc_url( $pro_url ); ?>" target="_blank" class="button button-primary button-hero">
                    <?php esc_html_e( 'Buy Pro', 'thryvewp-fse' ); ?>
                </a>
                
                <a href="<?php echo esc_url( $docs_url ); ?>" target="_blank" class="button button-secondary button-hero">
                    <?php esc_html_e( 'Documentation', 'thryvewp-fse' ); ?>
                </a>

                <a href="<?php echo esc_url( $contact_url ); ?>" target="_blank" class="button button-primary button-hero">
                    <?php esc_html_e( 'Contact Us', 'thryvewp-fse' ); ?>
                </a>
            </div>


        </div>
    </div>
<?php
}
