<?php
/**
 * Upgrade to Pro page
 *
 * @package AfriRegions
 */

defined( 'ABSPATH' ) or die( 'Forbidden' );

class SCPWOO_Page_Upgrade {

    private const PRICING_URL = 'https://afriregions.com/pricing/';

    /** @return void */
    public function render(): void {
        $pricing_url = self::PRICING_URL;
        ?>
        <div class="scpwoo-upgrade-page">

            <!-- Hero banner -->
            <div class="scpwoo-upgrade-hero">
                <div class="scpwoo-upgrade-body">
<div class="scpwoo-upgrade-title"><?php esc_html_e( 'Everything you need to manage your deliveries with precision, whether within your own country or in another African country.', 'afriregions-city-neighborhood-for-woocommerce' ); ?></div>
                    <div class="scpwoo-upgrade-desc"><?php esc_html_e( 'Advanced shipping features built for African e-commerce. Pickup points, travel agencies, and unified smart search.', 'afriregions-city-neighborhood-for-woocommerce' ); ?></div>
                    <a href="<?php echo esc_url( $pricing_url ); ?>" target="_blank" rel="noopener" class="scpwoo-upgrade-cta">
                        <?php esc_html_e( 'Get AfriRegions Pro', 'afriregions-city-neighborhood-for-woocommerce' ); ?> &rarr;
                    </a>
                </div>
                <div class="scpwoo-upgrade-globe"><img src="<?php echo esc_url( plugin_dir_url( dirname( __FILE__ ) ) . 'img/livreur.png' ); ?>" alt="" class="scpwoo-upgrade-illustration"></div>
            </div>

            <!-- Feature grid -->
            <div class="scpwoo-section-title"><?php esc_html_e( "What's included in Pro", 'afriregions-city-neighborhood-for-woocommerce' ); ?></div>
            <div class="scpwoo-feat-grid">

                <?php
                $features = array(
                    array( 'dashicons-search',       __( 'Unified Address Search', 'afriregions-city-neighborhood-for-woocommerce' ),        __( 'Customers type once — Region, City and Neighborhood fill automatically. Faster checkout, fewer errors.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                    array( 'dashicons-location',     __( 'Pickup Points', 'afriregions-city-neighborhood-for-woocommerce' ),                  __( 'Define pickup spots with address and hours. Customers select one at checkout, reducing failed home deliveries.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                    array( 'dashicons-car',          __( 'Travel Agency Shipping', 'afriregions-city-neighborhood-for-woocommerce' ),         __( 'Set different prices for each intercity route via local travel agencies — the delivery model that works across Africa.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                    array( 'dashicons-performance',  __( 'Express & Same Day Options', 'afriregions-city-neighborhood-for-woocommerce' ),     __( 'Offer Standard, Express and Same Day delivery with custom surcharges and estimated delivery times.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                    array( 'dashicons-chart-line',   __( 'Free Shipping Progress Bar', 'afriregions-city-neighborhood-for-woocommerce' ),     __( 'Show customers how much more they need to unlock free shipping. Proven to increase average order value.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                    array( 'dashicons-upload',       __( 'Bulk Shipping Rule Editor', 'afriregions-city-neighborhood-for-woocommerce' ),      __( 'Export all your shipping rules to Excel, edit in bulk, and re-import. Saves hours when managing large zone lists.', 'afriregions-city-neighborhood-for-woocommerce' ) ),
                );
                foreach ( $features as $feat ) :
                ?>
                <div class="scpwoo-feat-card">
                    <div class="scpwoo-feat-name"><?php echo esc_html( $feat[1] ); ?></div>
                    <div class="scpwoo-feat-desc"><?php echo esc_html( $feat[2] ); ?></div>
                </div>
                <?php endforeach; ?>

            </div>

            <!-- Comparison table -->
            <div class="scpwoo-dash-card">
                <div class="scpwoo-dash-card-header"><?php esc_html_e( 'Free vs Pro', 'afriregions-city-neighborhood-for-woocommerce' ); ?></div>
                <table class="wp-list-table widefat fixed striped scpwoo-activity-table">
                    <thead>
                        <tr>
                            <th><?php esc_html_e( 'Feature', 'afriregions-city-neighborhood-for-woocommerce' ); ?></th>
                            <th style="width:80px;text-align:center;"><?php esc_html_e( 'Free', 'afriregions-city-neighborhood-for-woocommerce' ); ?></th>
                            <th style="width:80px;text-align:center;color:var(--scpwoo-accent);"><?php esc_html_e( 'Pro', 'afriregions-city-neighborhood-for-woocommerce' ); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $rows = array(
                            array( __( 'Structured checkout fields — Region, City & Neighborhood with typo-tolerant search', 'afriregions-city-neighborhood-for-woocommerce' ), true, true ),
                            array( __( 'Zone-based shipping rates — most specific zone always wins', 'afriregions-city-neighborhood-for-woocommerce' ),                         true, true ),
                            array( __( 'Block orders from restricted delivery zones', 'afriregions-city-neighborhood-for-woocommerce' ),                                         true, true ),
                            array( __( 'Live shipping estimate in cart with landmark field', 'afriregions-city-neighborhood-for-woocommerce' ),                                  true, true ),
                            array( __( 'REST API for mobile app integration', 'afriregions-city-neighborhood-for-woocommerce' ),                                                 true, true ),
                            array( __( 'One search bar fills all address fields automatically', 'afriregions-city-neighborhood-for-woocommerce' ),                               false, true ),
                            array( __( 'Pickup points — customers choose a collection spot at checkout', 'afriregions-city-neighborhood-for-woocommerce' ),                      false, true ),
                            array( __( 'Travel agency routes — intercity delivery pricing by route', 'afriregions-city-neighborhood-for-woocommerce' ),                          false, true ),
                            array( __( 'Express & Same Day delivery tiers with custom surcharges', 'afriregions-city-neighborhood-for-woocommerce' ),                            false, true ),
                            array( __( 'Free shipping progress bar — nudge customers to spend more', 'afriregions-city-neighborhood-for-woocommerce' ),                          false, true ),
                            array( __( 'Bulk edit shipping rules in Excel and re-import', 'afriregions-city-neighborhood-for-woocommerce' ),                                     false, true ),
                        );
                        foreach ( $rows as $row ) :
                        ?>
                        <tr>
                            <td><?php echo esc_html( $row[0] ); ?></td>
                            <td style="text-align:center;">
                                <?php if ( $row[1] ) : ?>
                                    <span class="scpwoo-cmp-yes">&#10003;</span>
                                <?php else : ?>
                                    <span class="scpwoo-cmp-no">&#10005;</span>
                                <?php endif; ?>
                            </td>
                            <td style="text-align:center;"><span class="scpwoo-cmp-yes">&#10003;</span></td>
                        </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>

            <!-- CTA footer -->
            <div style="text-align:center;padding:24px 0 8px;">
                <a href="<?php echo esc_url( $pricing_url ); ?>" target="_blank" rel="noopener" class="scpwoo-upgrade-cta">
                    <?php esc_html_e( 'Get AfriRegions Pro', 'afriregions-city-neighborhood-for-woocommerce' ); ?> &rarr;
                </a>
            </div>

        </div>
        <?php
    }
}
