<?php
declare(strict_types=1);
// ==================================================
// Nuclear Fancy Pants Edition™ -- NUCLEAR+++
// File: /templates/woocommerce-settings.php
// Description: WooCommerce Tools settings page - NUCLEAR+++
// Last Edited: 2026-05-09
// ==================================================

namespace AutoMarketerAI;

defined('ABSPATH') || exit;
?>
<div class="wrap" id="amai-settings-page">

    <div class="amai-settings-header">
        <h1 class="amai-settings-header__title">WooCommerce Settings</h1>
        <p class="amai-settings-header__sub">Configure your WooCommerce automation tools.</p>
    </div>

    <?php // ── Abandoned Cart Timing ────────────────────────────── ?>
    <?php if (class_exists('\\AutoMarketerAI\\AbandonedCart')): ?>
    <div class="amai-settings-section">
        <div class="amai-settings-section__head">
            <h2 class="amai-settings-section__title">Abandoned Cart Reminders</h2>
            <p class="amai-settings-section__desc">The defaults are research-backed. Send the first reminder within an hour while the purchase is still top of mind -- studies show this window gets the best conversion rates. Wait 24 hours for the second, giving shoppers time to reconsider without feeling pressured. The third at 72 hours catches anyone still on the fence before they move on for good. Adjust these to match your store's rhythm.</p>
        </div>
        <div class="amai-settings-section__body">
            <div class="amai-nudge-thresholds">
                <div class="amai-nudge-threshold-row">
                    <label class="amai-nudge-threshold-row__label" for="amai-nudge-1-hours">First reminder</label>
                    <div class="amai-nudge-threshold-row__input-wrap">
                        <input type="number" id="amai-nudge-1-hours" class="amai-nudge-hours-input" min="1" max="720" step="1"
                            value="<?php echo esc_attr((string) (int) get_option('amai_cart_nudge_1_hours', '1')); ?>" />
                        <span class="amai-nudge-threshold-row__unit">hours after abandonment</span>
                    </div>
                </div>
                <div class="amai-nudge-threshold-row">
                    <label class="amai-nudge-threshold-row__label" for="amai-nudge-2-hours">Second reminder</label>
                    <div class="amai-nudge-threshold-row__input-wrap">
                        <input type="number" id="amai-nudge-2-hours" class="amai-nudge-hours-input" min="1" max="720" step="1"
                            value="<?php echo esc_attr((string) (int) get_option('amai_cart_nudge_2_hours', '24')); ?>" />
                        <span class="amai-nudge-threshold-row__unit">hours after abandonment</span>
                    </div>
                </div>
                <div class="amai-nudge-threshold-row">
                    <label class="amai-nudge-threshold-row__label" for="amai-nudge-3-hours">Third reminder</label>
                    <div class="amai-nudge-threshold-row__input-wrap">
                        <input type="number" id="amai-nudge-3-hours" class="amai-nudge-hours-input" min="1" max="720" step="1"
                            value="<?php echo esc_attr((string) (int) get_option('amai_cart_nudge_3_hours', '72')); ?>" />
                        <span class="amai-nudge-threshold-row__unit">hours after abandonment</span>
                    </div>
                </div>
                <div class="amai-nudge-thresholds__footer">
                    <button id="amai-save-nudge-thresholds-btn" class="amai-btn amai-btn--primary">Save</button>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>

</div>
<div id="amai-settings-toast" class="amai-toast" style="display:none;"></div>