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

/**
 * Add Theme Info Page
 */
function thryvewp_business_add_theme_info_page() {
    add_theme_page(
        esc_html__( 'Thryvewp Business', 'thryvewp-business' ),
        esc_html__( 'Thryvewp Business', 'thryvewp-business' ),
        'manage_options',
        'thryvewp-business-info',
        'thryvewp_business_render_theme_info_page'
    );
}
add_action( 'admin_menu', 'thryvewp_business_add_theme_info_page' );


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

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

    wp_enqueue_style(
        'thryvewp-business-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_business_admin_assets' );

/**
 * Render Theme Info Page
 */
function thryvewp_business_render_theme_info_page() {
    $pro_url     = 'https://thryvewp.com/themes/thryvewp-business-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 Business', 'thryvewp-business' ); ?></strong></h1>
                <p><?php esc_html_e( 'A modern Full Site Editing WordPress theme built for businesses, agencies, and professionals.', 'thryvewp-business' ); ?></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-business' ); ?>
                </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-business' ); ?></h3>
                    <p><?php esc_html_e( 'Customize your entire website using Gutenberg blocks.', 'thryvewp-business' ); ?></p>
                </div>

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

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

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

            </div>
            
            <!-- Setup Guide -->
            <div class="thryvewp-setup-guide">
                <h2><?php esc_html_e( 'Getting Started Guide', 'thryvewp-business' ); ?></h2>
                <div class="thryvewp-setup-guide-list">
                    <div>
                        <h3>🏠 <?php esc_html_e( 'Setup Front Page and Post Page', 'thryvewp-business' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Settings → Reading.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Select "A static page" under Your homepage displays.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Choose your Homepage and Posts page.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Click Save Changes.', 'thryvewp-business' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>🖼️ <?php esc_html_e( 'Change Favicon and Site Logo', 'thryvewp-business' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Customize or Appearance → Editor.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Open Site Identity.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Upload your Logo and Site Icon.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Click Publish / Save.', 'thryvewp-business' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>✏️ <?php esc_html_e( 'Edit Front Page Template', 'thryvewp-business' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Editor.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Open Templates → Front Page.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Edit blocks and layout as needed.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Click Save.', 'thryvewp-business' ); ?></li>
                        </ol>
                    </div>
                    <div>
                        <h3>🎨 <?php esc_html_e( 'Add Custom CSS', 'thryvewp-business' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Go to Appearance → Editor', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Click Styles → Additional CSS.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Add your CSS code and save.', 'thryvewp-business' ); ?></li>
                        </ol>
                    </div>
                    <div>                    
                        <h3>🚀 <?php esc_html_e( 'What I Will Get on Pro Version', 'thryvewp-business' ); ?></h3>
                        <ol>
                            <li><?php esc_html_e( 'Additional Patterns & Templates.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Regular updates and compatibility checks.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Dedicated support & some customization help.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Theme setup and demo file installation.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Upcoming features and updates.', 'thryvewp-business' ); ?></li>
                        </ol>
                    </div>

                    <div>
                        <h3>🔑 <?php esc_html_e( 'How to Install Pro Version', 'thryvewp-business' ); ?></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-business' ); ?></li>
                            <li><?php esc_html_e( 'Download the Pro version ZIP file from your Freemius account.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Go to your WordPress Dashboard → Appearance → Themes → Add New.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Click on Upload Theme and upload the downloaded ZIP file.', 'thryvewp-business' ); ?></li>
                            <li><?php esc_html_e( 'Activate the theme and enter your license key to enable Pro features.', 'thryvewp-business' ); ?></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-business' ); ?>
                </a>
                
                <a href="<?php echo esc_url( $docs_url ); ?>" target="_blank" class="button button-secondary button-hero">
                    <?php esc_html_e( 'Documentation', 'thryvewp-business' ); ?>
                </a>

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


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