<?php
/**
 * Theme Upsell Page
 * 
 * @package Pet Ecommerce Store
 */

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

/**
 * Add theme upsell page to admin menu
 */
add_action( 'admin_menu', 'pet_ecommerce_store_add_theme_page' );
function pet_ecommerce_store_add_theme_page() {
    add_theme_page(
        __('Pet Ecommerce Store Pro', 'pet-ecommerce-store'),
        'Pet Ecommerce Store 🚀',
        'manage_options',
        'pet-ecommerce-store-pro',
        'pet_ecommerce_store_pro_page_callback'
    );
}
/**
 * Render theme upsell page
 */
function pet_ecommerce_store_pro_page_callback() {
    ?>
    <div class="wrap ot-pro-wrap">
        <h1><?php esc_html_e('Upgrade to Pet Ecommerce Store Pro 🚀', 'pet-ecommerce-store'); ?></h1>
        
        <div class="ot-pro-hero">
            <div class="hero-content">
                <div class="hero-left">
                    <h2><?php esc_html_e('Take Your Pet Ecommerce Store Business to the Next Level', 'pet-ecommerce-store'); ?></h2>
                    <p class="subtitle"><?php esc_html_e('Get access to premium features, advanced layouts, and priority support', 'pet-ecommerce-store'); ?></p>
                    <div class="button-group">
                        <?php
                        // Check if theme is FSE (block theme) or customizer based
                        if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) {
                            // Block theme - link to Site Editor
                            $editor_url = admin_url( 'site-editor.php' );
                            $editor_text = __('Site Editor', 'pet-ecommerce-store');
                            $editor_icon = 'dashicons-layout';
                        } else {
                            // Classic theme - link to Customizer
                            $editor_url = admin_url( 'customize.php' );
                            $editor_text = __('Customize', 'pet-ecommerce-store');
                            $editor_icon = 'dashicons-admin-customizer';
                        }
                        // Check if the Ovation Elements plugin is active
                        $is_plugin_active = is_plugin_active('ovation-elements/ovation-elements.php');
                        ?>
                        <a class="button button-hero button-primary theme-install" id="install-activate-button" href="#" style="display:<?php echo $is_plugin_active ? 'none' : 'inline-flex'; ?> !important;">
                            <span class="dashicons dashicons-download"></span>
                            <?php _e('Begin Installation', 'pet-ecommerce-store'); ?>
                        </a>
                        <a class="button button-hero button-success" id="view-site-button" href="<?php echo esc_url( home_url('/') ); ?>" target="_blank" style="display:<?php echo $is_plugin_active ? 'inline-flex' : 'none'; ?> !important;">
                            <span class="dashicons dashicons-admin-site"></span>
                            <?php _e('View Site', 'pet-ecommerce-store'); ?>
                        </a>
                        <a target="_blank" href="<?php echo esc_url( $editor_url ); ?>" class="button button-hero button-customize" style="display:<?php echo $is_plugin_active ? 'inline-flex' : 'none'; ?> !important;">
                            <span class="dashicons <?php echo esc_attr( $editor_icon ); ?>"></span>
                            <?php echo esc_html( $editor_text ); ?>
                        </a>
                        <a href="<?php echo esc_url( PET_ECOMMERCE_STORE_LIVE_DEMO ); ?>" target="_blank" class="button button-hero button-demo">
                            <span class="dashicons dashicons-visibility"></span>
                            <?php esc_html_e('Live Demo', 'pet-ecommerce-store'); ?>
                        </a>
                        <a href="<?php echo esc_url( PET_ECOMMERCE_STORE_BUY_PRO ); ?>" target="_blank" class="button button-primary button-hero button-pro">
                            <span class="dashicons dashicons-star-filled"></span>
                            <?php esc_html_e('Get Pro Theme', 'pet-ecommerce-store'); ?>
                        </a>
                        <a href="<?php echo esc_url( PET_ECOMMERCE_STORE_FREE_DOC ); ?>" target="_blank" class="button button-hero button-docs">
                            <span class="dashicons dashicons-book"></span>
                            <?php esc_html_e('Documentation', 'pet-ecommerce-store'); ?>
                        </a>
                        <a href="<?php echo esc_url( PET_ECOMMERCE_STORE_BUNDLE_LINK ); ?>" target="_blank" class="button button-hero button-bundle">
                            <span class="dashicons dashicons-cart"></span>
                            <?php esc_html_e('WordPress Theme Bundle', 'pet-ecommerce-store'); ?>
                        </a>
                    </div>
                </div>
                <div class="hero-right">
                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/screenshot.png" alt="<?php esc_attr_e('Pet Ecommerce Store Theme Screenshot', 'pet-ecommerce-store'); ?>" class="theme-screenshot">
                </div>
            </div>
        </div>

        <div class="ot-pro-features">
            <h2><?php esc_html_e('Why Upgrade to Pro?', 'pet-ecommerce-store'); ?></h2>
            
            <div class="feature-grid">
                <div class="feature-box">
                    <span class="dashicons dashicons-layout"></span>
                    <h3><?php esc_html_e('Different styling Options', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('This content will change based on different styling options.', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-admin-customizer"></span>
                    <h3><?php esc_html_e('Section Reordering Option', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Sections can be reordered or rearranged as per your preference.', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-editor-table"></span>
                    <h3><?php esc_html_e('Footer Builder', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Create custom footers with advanced widgets', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-art"></span>
                    <h3><?php esc_html_e('Typography Controls', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Full control over fonts, sizes, and text styling', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-cart"></span>
                    <h3><?php esc_html_e('WooCommerce Styling', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Advanced WooCommerce integration with custom product layouts', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-admin-tools"></span>
                    <h3><?php esc_html_e('Advanced Options', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Advanced theme options available for themes', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-performance"></span>
                    <h3><?php esc_html_e('Performance Optimized', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('3X faster loading with optimized code and assets', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-sos"></span>
                    <h3><?php esc_html_e('Priority Support', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Get expert help within 24 hours through our priority support system', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-admin-appearance"></span>
                    <h3><?php esc_html_e('Unlimited Color Schemes', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Customize every color to match your brand identity with unlimited color options', 'pet-ecommerce-store'); ?></p>
                </div>
                
                <div class="feature-box">
                    <span class="dashicons dashicons-download"></span>
                    <h3><?php esc_html_e('One-Click Demo Import', 'pet-ecommerce-store'); ?></h3>
                    <p><?php esc_html_e('Import complete demo content with just one click and get started instantly', 'pet-ecommerce-store'); ?></p>
                </div>
            </div>
        </div>

        <div class="ot-pro-comparison">
            <h2><?php esc_html_e('Free vs Pro Comparison', 'pet-ecommerce-store'); ?></h2>
            
            <table class="comparison-table">
                <thead>
                    <tr>
                        <th><?php esc_html_e('Feature', 'pet-ecommerce-store'); ?></th>
                        <th><?php esc_html_e('Free', 'pet-ecommerce-store'); ?></th>
                        <th class="pro-col"><?php esc_html_e('Pro', 'pet-ecommerce-store'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><?php esc_html_e('Typography Controls', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('Limited', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Full Control', 'pet-ecommerce-store'); ?></td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('WooCommerce Styling', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Custom Widgets', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('Basic', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Advanced', 'pet-ecommerce-store'); ?></td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Color Schemes', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('Limited', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Unlimited', 'pet-ecommerce-store'); ?></td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Demo Import', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Priority Support', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Custom Post Types', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Page Builder Integration', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('Gutenberg', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Gutenberg/Customizer', 'pet-ecommerce-store'); ?></td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Speed Optimization', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('Standard', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Advanced (3X Faster)', 'pet-ecommerce-store'); ?></td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Sticky Header', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Preloader Options', 'pet-ecommerce-store'); ?></td>
                        <td>❌</td>
                        <td class="pro-col">✅</td>
                    </tr>
                    <tr>
                        <td><?php esc_html_e('Blog Layouts', 'pet-ecommerce-store'); ?></td>
                        <td><?php esc_html_e('1', 'pet-ecommerce-store'); ?></td>
                        <td class="pro-col"><?php esc_html_e('Advanced', 'pet-ecommerce-store'); ?></td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="ot-pro-testimonials">
            <h2><?php esc_html_e('What Our Users Say', 'pet-ecommerce-store'); ?></h2>
            
        <div class="testimonial-grid">
            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"I was looking for a clean and professional theme for my pet ecommerce store website and this theme delivered exactly that. Setup was quick and the layout looks very modern."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- John D.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"The theme design is professional and easy to customize. The documentation helped me set up my accounting website without any issues."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Sarah M.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"Very flexible and beginner-friendly. I was able to adjust colors, sections, and layouts directly from the Customizer. Highly recommended."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Michael R.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"The mobile responsive design works perfectly. Most of my clients visit from their phones, and the site looks clean and professional."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Emily T.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"Great theme for tax professionals. The service sections and homepage layout helped me present my services clearly to potential clients."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- David L.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"Customer support is very helpful and responsive. They guided me during setup and solved my issue quickly."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Jennifer K.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"Fast loading and SEO friendly. After launching my website with this theme, I started receiving more inquiries from clients."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Robert H.', 'pet-ecommerce-store'); ?></span>
            </div>

            <div class="testimonial-box">
                <div class="stars">⭐⭐⭐⭐</div>
                <p><?php esc_html_e('"A very good theme with useful features for financial and consulting businesses. Easy to install and configure."', 'pet-ecommerce-store'); ?></p>
                <span class="author"><?php esc_html_e('- Lisa P.', 'pet-ecommerce-store'); ?></span>
            </div>
        </div>
        </div>

        <div class="ot-pro-cta">
            <h2><?php esc_html_e('Ready to Upgrade?', 'pet-ecommerce-store'); ?></h2>
            <p><?php esc_html_e('Join hundreds of satisfied customers who upgraded to Pro', 'pet-ecommerce-store'); ?></p>
            <a href="<?php echo esc_url( PET_ECOMMERCE_STORE_BUY_PRO ); ?>" target="_blank" class="button button-primary button-hero">
                <?php esc_html_e('Get Pet Ecommerce Store Pro Now', 'pet-ecommerce-store'); ?> →
            </a>
        </div>

        <div class="ot-pro-footer">
            <p><?php printf( __('Need help? Contact our <a href="%s" target="_blank">support</a> team anytime.', 'pet-ecommerce-store'), esc_url( PET_ECOMMERCE_STORE_SUPPORT ) ); ?></p>
        </div>
    </div>
    <?php
}
