                <section class="eep-settings-panel" id="eep-tab-monetization" data-tab="monetization" data-subtab="boost-packages">
                    <h2><?php esc_html_e('Boost Packages', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Configure package pricing, duration rules, renewals, and featured listing visuals.', 'nexdirectory'); ?></p>
                    <?php
                    $boost_pricing_rows = [];
                    $boost_pricing_json = (string) get_option('eep_boost_duration_pricing', '');
                    $boost_pricing_decoded = json_decode($boost_pricing_json, true);
                    if (is_array($boost_pricing_decoded)) {
                        foreach ($boost_pricing_decoded as $boost_row) {
                            if (!is_array($boost_row)) {
                                continue;
                            }
                            $boost_days = absint((int) ($boost_row['days'] ?? 0));
                            $boost_price = isset($boost_row['price']) && is_numeric($boost_row['price']) ? round((float) $boost_row['price'], 2) : 0.0;
                            if ($boost_days > 0 && $boost_price > 0) {
                                $boost_pricing_rows[$boost_days] = [
                                    'days' => $boost_days,
                                    'price' => $boost_price,
                                ];
                            }
                        }
                    }
                    if (empty($boost_pricing_rows)) {
                        $boost_pricing_rows = [
                            7 => ['days' => 7, 'price' => 9.99],
                            30 => ['days' => 30, 'price' => 29.99],
                            90 => ['days' => 90, 'price' => 79.99],
                        ];
                    }
                    ksort($boost_pricing_rows);
                    $boost_pricing_rows = array_values($boost_pricing_rows);
                    $boost_pricing_storage = wp_json_encode($boost_pricing_rows);
                    if (!is_string($boost_pricing_storage) || $boost_pricing_storage === '') {
                        $boost_pricing_storage = '[]';
                    }

                    $boost_type_pricing_raw = (string) get_option('eep_boost_type_pricing', '');
                    $boost_type_rows = [];
                    $boost_type_lines = preg_split('/\r\n|\r|\n/', $boost_type_pricing_raw);
                    if (is_array($boost_type_lines)) {
                        foreach ($boost_type_lines as $boost_type_line) {
                            $boost_type_line = trim((string) $boost_type_line);
                            if ($boost_type_line === '') {
                                continue;
                            }
                            $boost_type_parts = explode('|', $boost_type_line, 2);
                            if (count($boost_type_parts) !== 2) {
                                continue;
                            }
                            $boost_type_slug = eep_sanitize_title((string) $boost_type_parts[0]);
                            if ($boost_type_slug === '') {
                                continue;
                            }
                            $boost_pairs = explode(',', (string) $boost_type_parts[1]);
                            foreach ($boost_pairs as $boost_pair) {
                                $boost_pair = trim((string) $boost_pair);
                                if ($boost_pair === '' || !preg_match('/^(\d{1,4})\s*[:=]\s*([0-9]+(?:\.[0-9]{1,2})?)$/', $boost_pair, $boost_matches)) {
                                    continue;
                                }
                                $boost_days = absint((int) ($boost_matches[1] ?? 0));
                                $boost_price = isset($boost_matches[2]) ? round((float) $boost_matches[2], 2) : 0.0;
                                if ($boost_days > 0 && $boost_price > 0) {
                                    $boost_type_rows[] = [
                                        'type' => $boost_type_slug,
                                        'days' => $boost_days,
                                        'price' => $boost_price,
                                    ];
                                }
                            }
                        }
                    }

                    $boost_type_options = [];
                    $boost_type_terms = get_terms([
                        'taxonomy' => self::TAX_TYPE,
                        'hide_empty' => false,
                    ]);
                    if (!is_wp_error($boost_type_terms) && is_array($boost_type_terms)) {
                        foreach ($boost_type_terms as $boost_type_term) {
                            if (!$boost_type_term instanceof WP_Term) {
                                continue;
                            }
                            $boost_type_options[(string) $boost_type_term->slug] = (string) $boost_type_term->name;
                        }
                    }
                    foreach ($boost_type_rows as $boost_type_row) {
                        $boost_type_slug = eep_sanitize_title((string) ($boost_type_row['type'] ?? ''));
                        if ($boost_type_slug !== '' && !isset($boost_type_options[$boost_type_slug])) {
                            $boost_type_options[$boost_type_slug] = ucwords(str_replace('-', ' ', $boost_type_slug));
                        }
                    }
                    asort($boost_type_options);
                    $boost_type_overrides_enabled = !empty($boost_type_rows);

                    $boost_currency_selected = strtoupper(sanitize_text_field((string) get_option('eep_boost_currency', 'USD')));
                    $boost_currency_options = [
                        'USD' => 'USD - US Dollar',
                        'EUR' => 'EUR - Euro',
                        'GBP' => 'GBP - British Pound',
                        'CAD' => 'CAD - Canadian Dollar',
                        'AUD' => 'AUD - Australian Dollar',
                        'NZD' => 'NZD - New Zealand Dollar',
                        'CHF' => 'CHF - Swiss Franc',
                        'SEK' => 'SEK - Swedish Krona',
                        'NOK' => 'NOK - Norwegian Krone',
                        'DKK' => 'DKK - Danish Krone',
                        'JPY' => 'JPY - Japanese Yen',
                        'CNY' => 'CNY - Chinese Yuan',
                        'HKD' => 'HKD - Hong Kong Dollar',
                        'SGD' => 'SGD - Singapore Dollar',
                        'INR' => 'INR - Indian Rupee',
                        'AED' => 'AED - UAE Dirham',
                        'SAR' => 'SAR - Saudi Riyal',
                        'QAR' => 'QAR - Qatari Riyal',
                        'ZAR' => 'ZAR - South African Rand',
                        'NGN' => 'NGN - Nigerian Naira',
                        'KES' => 'KES - Kenyan Shilling',
                        'EGP' => 'EGP - Egyptian Pound',
                        'BRL' => 'BRL - Brazilian Real',
                        'MXN' => 'MXN - Mexican Peso',
                        'CLP' => 'CLP - Chilean Peso',
                        'ARS' => 'ARS - Argentine Peso',
                        'TRY' => 'TRY - Turkish Lira',
                        'PLN' => 'PLN - Polish Zloty',
                        'CZK' => 'CZK - Czech Koruna',
                        'HUF' => 'HUF - Hungarian Forint',
                        'RON' => 'RON - Romanian Leu',
                    ];
                    if ($boost_currency_selected !== '' && !isset($boost_currency_options[$boost_currency_selected])) {
                        $boost_currency_options[$boost_currency_selected] = sprintf(__('%s - Custom', 'nexdirectory'), $boost_currency_selected);
                    }
                    $secret_mask_display = '****************';
                    $get_masked_secret_value = static function ($option_key) use ($secret_mask_display) {
                        return trim((string) get_option((string) $option_key, '')) !== '' ? $secret_mask_display : '';
                    };
                    $boost_stripe_test_secret_masked = $get_masked_secret_value('eep_boost_stripe_test_secret_key');
                    $boost_stripe_live_secret_masked = $get_masked_secret_value('eep_boost_stripe_live_secret_key');
                    $boost_paypal_test_secret_masked = $get_masked_secret_value('eep_boost_paypal_test_secret');
                    $boost_paypal_live_secret_masked = $get_masked_secret_value('eep_boost_paypal_live_secret');
                    $ticket_stripe_test_secret_masked = $get_masked_secret_value('eep_ticket_stripe_test_secret_key');
                    $ticket_stripe_live_secret_masked = $get_masked_secret_value('eep_ticket_stripe_live_secret_key');
                    $ticket_paypal_test_secret_masked = $get_masked_secret_value('eep_ticket_paypal_test_secret');
                    $ticket_paypal_live_secret_masked = $get_masked_secret_value('eep_ticket_paypal_live_secret');
                    ?>
                    <div class="eep-settings-grid eep-monetization-grid">
                        <div class="eep-settings-field eep-full eep-monetization-card">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-megaphone" aria-hidden="true"></span><?php esc_html_e('Boost Packages', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('Set package pricing, stacking, tax, and listing-type overrides.', 'nexdirectory'); ?></p>

                            <div class="eep-settings-grid">
                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_enabled" value="0">
                                    <label><input type="checkbox" id="eep_boost_enabled" name="eep_boost_enabled" value="1" <?php checked((string) get_option('eep_boost_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable paid boosts globally', 'nexdirectory'); ?></label>
                                    <p class="description"><?php esc_html_e('Allows creators to pay to feature their listings.', 'nexdirectory'); ?></p>
                                </div>

                                <div class="eep-settings-field eep-full" data-eep-conditional-field="boost-settings">
                                    <div class="eep-settings-grid">
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_ranking_mode"><?php esc_html_e('Ranking mode', 'nexdirectory'); ?></label>
                                            <select id="eep_boost_ranking_mode" name="eep_boost_ranking_mode">
                                                <option value="simple" <?php selected((string) get_option('eep_boost_ranking_mode', 'simple'), 'simple'); ?>><?php esc_html_e('Simple (boosted first)', 'nexdirectory'); ?></option>
                                                <option value="time_weighted" <?php selected((string) get_option('eep_boost_ranking_mode', 'simple'), 'time_weighted'); ?>><?php esc_html_e('Time-weighted (longest remaining first)', 'nexdirectory'); ?></option>
                                            </select>
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_currency"><?php esc_html_e('Currency (ISO)', 'nexdirectory'); ?></label>
                                            <select id="eep_boost_currency" name="eep_boost_currency">
                                                <?php foreach ($boost_currency_options as $currency_code => $currency_label) : ?>
                                                    <option value="<?php echo esc_attr((string) $currency_code); ?>" <?php selected($boost_currency_selected, (string) $currency_code); ?>>
                                                        <?php echo esc_html((string) $currency_label); ?>
                                                    </option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>

                                        <div class="eep-settings-field">
                                            <input type="hidden" name="eep_boost_allow_stacking" value="0">
                                            <label><input type="checkbox" id="eep_boost_allow_stacking" name="eep_boost_allow_stacking" value="1" <?php checked((string) get_option('eep_boost_allow_stacking', '0'), '1'); ?>> <?php esc_html_e('Allow stacking boosts', 'nexdirectory'); ?></label>
                                            <p class="description"><?php esc_html_e('When enabled, new boosts extend from the current expiry date.', 'nexdirectory'); ?></p>
                                        </div>

                                        <div class="eep-settings-field">
                                            <input type="hidden" name="eep_boost_vat_enabled" value="0">
                                            <label><input type="checkbox" id="eep_boost_vat_enabled" name="eep_boost_vat_enabled" value="1" <?php checked((string) get_option('eep_boost_vat_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable VAT', 'nexdirectory'); ?></label>
                                        </div>

                                        <div class="eep-settings-field" data-eep-conditional-field="boost-vat">
                                            <label for="eep_boost_vat_percent"><?php esc_html_e('VAT Percentage', 'nexdirectory'); ?></label>
                                            <input type="number" step="0.01" min="0" id="eep_boost_vat_percent" name="eep_boost_vat_percent" value="<?php echo esc_attr((string) get_option('eep_boost_vat_percent', '0')); ?>">
                                        </div>

                                        <div class="eep-settings-field eep-full">
                                            <label for="eep_boost_duration_pricing"><?php esc_html_e('Boost package durations and prices', 'nexdirectory'); ?></label>
                                            <input type="hidden" id="eep_boost_duration_pricing" name="eep_boost_duration_pricing" value="<?php echo esc_attr($boost_pricing_storage); ?>">
                                            <div class="eep-monetization-repeater" id="eep-boost-package-rows" data-eep-package-rows>
                                                <?php foreach ($boost_pricing_rows as $boost_package_row) : ?>
                                                    <div class="eep-monetization-row" data-eep-package-row>
                                                        <div class="eep-monetization-col">
                                                            <label><?php esc_html_e('Duration (days)', 'nexdirectory'); ?></label>
                                                            <input type="number" min="1" max="3650" step="1" value="<?php echo esc_attr((string) absint((int) ($boost_package_row['days'] ?? 0))); ?>" data-eep-package-days>
                                                        </div>
                                                        <div class="eep-monetization-col">
                                                            <label><?php esc_html_e('Price', 'nexdirectory'); ?></label>
                                                            <input type="number" min="0" step="0.01" value="<?php echo esc_attr(number_format((float) ($boost_package_row['price'] ?? 0.0), 2, '.', '')); ?>" data-eep-package-price>
                                                        </div>
                                                        <div class="eep-monetization-col eep-monetization-col-actions">
                                                            <button type="button" class="button-link-delete" data-eep-remove-package><?php esc_html_e('Remove', 'nexdirectory'); ?></button>
                                                        </div>
                                                    </div>
                                                <?php endforeach; ?>
                                            </div>
                                            <div class="eep-settings-actions">
                                                <button type="button" class="button button-secondary" data-eep-add-boost-package><?php esc_html_e('Add package', 'nexdirectory'); ?></button>
                                            </div>
                                        </div>

                                        <div class="eep-settings-field eep-full">
                                            <label><input type="checkbox" id="eep_boost_type_pricing_enabled" value="1" <?php checked($boost_type_overrides_enabled); ?>> <?php esc_html_e('Enable per-type price overrides', 'nexdirectory'); ?></label>
                                            <p class="description"><?php esc_html_e('Optional. Leave disabled to use the same package prices for all listing types.', 'nexdirectory'); ?></p>
                                        </div>

                                        <div class="eep-settings-field eep-full" data-eep-conditional-field="boost-type-pricing">
                                            <label for="eep_boost_type_pricing"><?php esc_html_e('Per-type pricing overrides', 'nexdirectory'); ?></label>
                                            <input type="hidden" id="eep_boost_type_pricing" name="eep_boost_type_pricing" value="<?php echo esc_attr($boost_type_pricing_raw); ?>">
                                            <div class="eep-monetization-repeater" id="eep-boost-type-rows" data-eep-type-rows data-eep-type-options="<?php echo esc_attr(wp_json_encode($boost_type_options)); ?>">
                                                <?php
                                                if (empty($boost_type_rows)) {
                                                    $boost_type_rows = [
                                                        ['type' => '', 'days' => (int) ($boost_pricing_rows[0]['days'] ?? 30), 'price' => 0],
                                                    ];
                                                }
                                                foreach ($boost_type_rows as $boost_type_row) :
                                                ?>
                                                    <div class="eep-monetization-row eep-monetization-row-type" data-eep-type-row>
                                                        <div class="eep-monetization-col">
                                                            <label><?php esc_html_e('Listing type', 'nexdirectory'); ?></label>
                                                            <select data-eep-type-slug>
                                                                <option value=""><?php esc_html_e('Select type', 'nexdirectory'); ?></option>
                                                                <?php foreach ($boost_type_options as $boost_type_slug => $boost_type_name) : ?>
                                                                    <option value="<?php echo esc_attr((string) $boost_type_slug); ?>" <?php selected((string) $boost_type_slug, (string) ($boost_type_row['type'] ?? '')); ?>><?php echo esc_html((string) $boost_type_name); ?></option>
                                                                <?php endforeach; ?>
                                                            </select>
                                                        </div>
                                                        <div class="eep-monetization-col">
                                                            <label><?php esc_html_e('Duration', 'nexdirectory'); ?></label>
                                                            <select data-eep-type-days>
                                                                <?php foreach ($boost_pricing_rows as $boost_package_row) : ?>
                                                                    <option value="<?php echo esc_attr((string) absint((int) ($boost_package_row['days'] ?? 0))); ?>" <?php selected((int) ($boost_type_row['days'] ?? 0), (int) ($boost_package_row['days'] ?? 0)); ?>>
                                                                        <?php echo esc_html(sprintf(_n('%d day', '%d days', absint((int) ($boost_package_row['days'] ?? 0)), 'nexdirectory'), absint((int) ($boost_package_row['days'] ?? 0)))); ?>
                                                                    </option>
                                                                <?php endforeach; ?>
                                                            </select>
                                                        </div>
                                                        <div class="eep-monetization-col">
                                                            <label><?php esc_html_e('Override price', 'nexdirectory'); ?></label>
                                                            <input type="number" min="0" step="0.01" value="<?php echo esc_attr(number_format((float) ($boost_type_row['price'] ?? 0.0), 2, '.', '')); ?>" data-eep-type-price>
                                                        </div>
                                                        <div class="eep-monetization-col eep-monetization-col-actions">
                                                            <button type="button" class="button-link-delete" data-eep-remove-type-row><?php esc_html_e('Remove', 'nexdirectory'); ?></button>
                                                        </div>
                                                    </div>
                                                <?php endforeach; ?>
                                            </div>
                                            <div class="eep-settings-actions">
                                                <button type="button" class="button button-secondary" data-eep-add-type-row><?php esc_html_e('Add type override', 'nexdirectory'); ?></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full eep-monetization-card">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-update" aria-hidden="true"></span><?php esc_html_e('Auto-Renew', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_auto_renew_enabled" value="0">
                                    <label><input type="checkbox" id="eep_boost_auto_renew_enabled" name="eep_boost_auto_renew_enabled" value="1" <?php checked((string) get_option('eep_boost_auto_renew_enabled', '1'), '1'); ?>> <?php esc_html_e('Allow auto-renew subscriptions', 'nexdirectory'); ?></label>
                                </div>
                                <div class="eep-settings-field" data-eep-conditional-field="boost-autorenew-settings">
                                    <label for="eep_boost_reminder_days"><?php esc_html_e('Reminder lead time (days)', 'nexdirectory'); ?></label>
                                    <input type="number" min="1" max="30" id="eep_boost_reminder_days" name="eep_boost_reminder_days" value="<?php echo esc_attr((string) get_option('eep_boost_reminder_days', 3)); ?>">
                                </div>
                                <div class="eep-settings-field" data-eep-conditional-field="boost-autorenew-settings">
                                    <label for="eep_boost_retry_limit"><?php esc_html_e('Failed renewal retries', 'nexdirectory'); ?></label>
                                    <input type="number" min="1" max="10" id="eep_boost_retry_limit" name="eep_boost_retry_limit" value="<?php echo esc_attr((string) get_option('eep_boost_retry_limit', 3)); ?>">
                                </div>
                            </div>
                        </div>

                        <div class="eep-settings-field eep-full eep-monetization-card">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-format-image" aria-hidden="true"></span><?php esc_html_e('Visual Controls', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_show_featured_badge" value="0">
                                    <label><input type="checkbox" id="eep_boost_show_featured_badge" name="eep_boost_show_featured_badge" value="1" <?php checked((string) get_option('eep_boost_show_featured_badge', '1'), '1'); ?>> <?php esc_html_e('Show featured badge', 'nexdirectory'); ?></label>
                                </div>
                                <div class="eep-settings-field eep-full" data-eep-conditional-field="boost-featured-settings">
                                    <div class="eep-settings-grid">
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_featured_badge_text"><?php esc_html_e('Featured badge label', 'nexdirectory'); ?></label>
                                            <input type="text" id="eep_boost_featured_badge_text" name="eep_boost_featured_badge_text" value="<?php echo esc_attr((string) get_option('eep_boost_featured_badge_text', __('Featured', 'nexdirectory'))); ?>">
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_featured_badge_image_url"><?php esc_html_e('Custom badge image URL', 'nexdirectory'); ?></label>
                                            <input type="url" id="eep_boost_featured_badge_image_url" name="eep_boost_featured_badge_image_url" value="<?php echo esc_attr((string) get_option('eep_boost_featured_badge_image_url', '')); ?>" placeholder="https://">
                                        </div>
                                    </div>
                                </div>
                                <div class="eep-settings-field">
                                    <input type="hidden" name="eep_boost_highlight_style" value="0">
                                    <label><input type="checkbox" name="eep_boost_highlight_style" value="1" <?php checked((string) get_option('eep_boost_highlight_style', '1'), '1'); ?>> <?php esc_html_e('Highlight boosted listing cards', 'nexdirectory'); ?></label>
                                </div>
                                <div class="eep-settings-field">
                                    <input type="hidden" name="eep_boost_verified_badge_enabled" value="0">
                                    <label><input type="checkbox" name="eep_boost_verified_badge_enabled" value="1" <?php checked((string) get_option('eep_boost_verified_badge_enabled', '0'), '1'); ?>> <?php esc_html_e('Show optional verified badge', 'nexdirectory'); ?></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel" id="eep-tab-monetization-payment" data-tab="monetization" data-subtab="boost-payment">
                    <h2><?php esc_html_e('Boost Payment', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Configure boost checkout mode, gateway providers, and secure credentials.', 'nexdirectory'); ?></p>
                    <div class="eep-settings-grid eep-monetization-grid">
                        <div class="eep-settings-field eep-full eep-monetization-card">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-money-alt" aria-hidden="true"></span><?php esc_html_e('Payment Gateways', 'nexdirectory'); ?></h3>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field">
                                    <label for="eep_boost_gateway_mode"><?php esc_html_e('Mode', 'nexdirectory'); ?></label>
                                    <select id="eep_boost_gateway_mode" name="eep_boost_gateway_mode">
                                        <option value="test" <?php selected((string) get_option('eep_boost_gateway_mode', 'test'), 'test'); ?>><?php esc_html_e('Test / Sandbox', 'nexdirectory'); ?></option>
                                        <option value="live" <?php selected((string) get_option('eep_boost_gateway_mode', 'test'), 'live'); ?>><?php esc_html_e('Live', 'nexdirectory'); ?></option>
                                    </select>
                                </div>

                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_test_free_mode" value="0">
                                    <label><input type="checkbox" id="eep_boost_test_free_mode" name="eep_boost_test_free_mode" value="1" <?php checked((string) get_option('eep_boost_test_free_mode', '0'), '1'); ?>> <?php esc_html_e('Enable free test mode (no payment gateway)', 'nexdirectory'); ?></label>
                                    <p class="description"><?php esc_html_e('Use this for testing boost UX without Stripe or PayPal. Boosts activate instantly and create zero-value orders.', 'nexdirectory'); ?></p>
                                </div>

                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_stripe_enabled" value="0">
                                    <label><input type="checkbox" id="eep_boost_stripe_enabled" name="eep_boost_stripe_enabled" value="1" <?php checked((string) get_option('eep_boost_stripe_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable Stripe', 'nexdirectory'); ?></label>
                                </div>
                                <div class="eep-settings-field eep-full" data-eep-conditional-field="boost-stripe">
                                    <div class="eep-settings-grid">
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_stripe_test_secret_key"><?php esc_html_e('Stripe test secret key', 'nexdirectory'); ?></label>
                                            <input type="password" id="eep_boost_stripe_test_secret_key" name="eep_boost_stripe_test_secret_key" value="<?php echo esc_attr($boost_stripe_test_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing key', 'nexdirectory'); ?>">
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_stripe_live_secret_key"><?php esc_html_e('Stripe live secret key', 'nexdirectory'); ?></label>
                                            <input type="password" id="eep_boost_stripe_live_secret_key" name="eep_boost_stripe_live_secret_key" value="<?php echo esc_attr($boost_stripe_live_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing key', 'nexdirectory'); ?>">
                                        </div>
                                    </div>
                                </div>

                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_boost_paypal_enabled" value="0">
                                    <label><input type="checkbox" id="eep_boost_paypal_enabled" name="eep_boost_paypal_enabled" value="1" <?php checked((string) get_option('eep_boost_paypal_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable PayPal', 'nexdirectory'); ?></label>
                                </div>
                                <div class="eep-settings-field eep-full" data-eep-conditional-field="boost-paypal">
                                    <div class="eep-settings-grid">
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_paypal_test_client_id"><?php esc_html_e('PayPal test client ID', 'nexdirectory'); ?></label>
                                            <input type="text" id="eep_boost_paypal_test_client_id" name="eep_boost_paypal_test_client_id" value="<?php echo esc_attr((string) get_option('eep_boost_paypal_test_client_id', '')); ?>">
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_paypal_test_secret"><?php esc_html_e('PayPal test secret', 'nexdirectory'); ?></label>
                                            <input type="password" id="eep_boost_paypal_test_secret" name="eep_boost_paypal_test_secret" value="<?php echo esc_attr($boost_paypal_test_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing secret', 'nexdirectory'); ?>">
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_paypal_live_client_id"><?php esc_html_e('PayPal live client ID', 'nexdirectory'); ?></label>
                                            <input type="text" id="eep_boost_paypal_live_client_id" name="eep_boost_paypal_live_client_id" value="<?php echo esc_attr((string) get_option('eep_boost_paypal_live_client_id', '')); ?>">
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_boost_paypal_live_secret"><?php esc_html_e('PayPal live secret', 'nexdirectory'); ?></label>
                                            <input type="password" id="eep_boost_paypal_live_secret" name="eep_boost_paypal_live_secret" value="<?php echo esc_attr($boost_paypal_live_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing secret', 'nexdirectory'); ?>">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel" id="eep-tab-monetization-tickets" data-tab="monetization" data-subtab="tickets">
                    <h2><?php esc_html_e('Tickets', 'nexdirectory'); ?></h2>
                    <p class="eep-settings-subheading"><?php esc_html_e('Set up ticket checkout behavior, attendee confirmations, and ticket gateways.', 'nexdirectory'); ?></p>
                    <?php
                    $ticket_currency_selected = strtoupper(sanitize_text_field((string) get_option('eep_ticket_currency', 'USD')));
                    if ($ticket_currency_selected !== '' && !isset($boost_currency_options[$ticket_currency_selected])) {
                        $boost_currency_options[$ticket_currency_selected] = sprintf(__('%s - Custom', 'nexdirectory'), $ticket_currency_selected);
                    }
                    ?>
                    <div class="eep-settings-grid eep-monetization-grid">
                        <div class="eep-settings-field eep-full eep-monetization-card">
                            <h3 class="eep-settings-core-title"><span class="dashicons dashicons-tickets-alt" aria-hidden="true"></span><?php esc_html_e('Ticket Checkout', 'nexdirectory'); ?></h3>
                            <p class="description"><?php esc_html_e('Used for Single-Organisation mode event pages. Supports paid checkout and free reservation tickets.', 'nexdirectory'); ?></p>
                            <div class="eep-settings-grid">
                                <div class="eep-settings-field eep-full">
                                    <input type="hidden" name="eep_ticketing_enabled" value="0">
                                    <label><input type="checkbox" id="eep_ticketing_enabled" name="eep_ticketing_enabled" value="1" <?php checked((string) get_option('eep_ticketing_enabled', '1'), '1'); ?>> <?php esc_html_e('Enable ticket checkout globally', 'nexdirectory'); ?></label>
                                </div>

                                <div class="eep-settings-field eep-full" data-eep-conditional-field="ticket-settings">
                                    <div class="eep-settings-grid">
                                        <div class="eep-settings-field">
                                            <label for="eep_ticket_currency"><?php esc_html_e('Currency (ISO)', 'nexdirectory'); ?></label>
                                            <select id="eep_ticket_currency" name="eep_ticket_currency">
                                                <?php foreach ($boost_currency_options as $currency_code => $currency_label) : ?>
                                                    <option value="<?php echo esc_attr((string) $currency_code); ?>" <?php selected($ticket_currency_selected, (string) $currency_code); ?>>
                                                        <?php echo esc_html((string) $currency_label); ?>
                                                    </option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                        <div class="eep-settings-field">
                                            <label for="eep_ticket_gateway_mode"><?php esc_html_e('Gateway Mode', 'nexdirectory'); ?></label>
                                            <select id="eep_ticket_gateway_mode" name="eep_ticket_gateway_mode">
                                                <option value="test" <?php selected((string) get_option('eep_ticket_gateway_mode', 'test'), 'test'); ?>><?php esc_html_e('Test / Sandbox', 'nexdirectory'); ?></option>
                                                <option value="live" <?php selected((string) get_option('eep_ticket_gateway_mode', 'test'), 'live'); ?>><?php esc_html_e('Live', 'nexdirectory'); ?></option>
                                            </select>
                                        </div>
                                        <div class="eep-settings-field eep-full">
                                            <input type="hidden" name="eep_ticket_send_confirmation_email" value="0">
                                            <label><input type="checkbox" id="eep_ticket_send_confirmation_email" name="eep_ticket_send_confirmation_email" value="1" <?php checked((string) get_option('eep_ticket_send_confirmation_email', '1'), '1'); ?>> <?php esc_html_e('Send ticket confirmation emails', 'nexdirectory'); ?></label>
                                        </div>
                                        <div class="eep-settings-field eep-full">
                                            <input type="hidden" name="eep_ticket_qr_enabled" value="0">
                                            <label><input type="checkbox" id="eep_ticket_qr_enabled" name="eep_ticket_qr_enabled" value="1" <?php checked((string) get_option('eep_ticket_qr_enabled', '1'), '1'); ?>> <?php esc_html_e('Attach QR code on confirmations', 'nexdirectory'); ?></label>
                                            <p class="description"><?php esc_html_e('Includes a scannable QR image in the ticket confirmation email and receipt metadata.', 'nexdirectory'); ?></p>
                                        </div>
                                        <div class="eep-settings-field eep-full">
                                            <input type="hidden" name="eep_ticket_test_free_mode" value="0">
                                            <label><input type="checkbox" id="eep_ticket_test_free_mode" name="eep_ticket_test_free_mode" value="1" <?php checked((string) get_option('eep_ticket_test_free_mode', '0'), '1'); ?>> <?php esc_html_e('Enable free test mode (skip payment gateway)', 'nexdirectory'); ?></label>
                                            <p class="description"><?php esc_html_e('Useful for QA and launch rehearsals. Ticket checkout still records attendees and sends confirmation emails.', 'nexdirectory'); ?></p>
                                        </div>
                                        <div class="eep-settings-field eep-full">
                                            <label for="eep_ticket_promo_codes"><?php esc_html_e('Promo Codes', 'nexdirectory'); ?></label>
                                            <textarea id="eep_ticket_promo_codes" name="eep_ticket_promo_codes" rows="5" placeholder="WELCOME10|percent|10&#10;VIP25|fixed|25.00"><?php echo esc_textarea((string) get_option('eep_ticket_promo_codes', '')); ?></textarea>
                                            <p class="description"><?php esc_html_e('One per line using format: CODE|percent|10 or CODE|fixed|25.00. Codes are case-insensitive at checkout.', 'nexdirectory'); ?></p>
                                        </div>

                                        <div class="eep-settings-field eep-full">
                                            <input type="hidden" name="eep_ticket_stripe_enabled" value="0">
                                            <label><input type="checkbox" id="eep_ticket_stripe_enabled" name="eep_ticket_stripe_enabled" value="1" <?php checked((string) get_option('eep_ticket_stripe_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable Stripe for tickets', 'nexdirectory'); ?></label>
                                        </div>
                                        <div class="eep-settings-field eep-full" data-eep-conditional-field="ticket-stripe">
                                            <div class="eep-settings-grid">
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_stripe_test_secret_key"><?php esc_html_e('Stripe ticket test secret key', 'nexdirectory'); ?></label>
                                                    <input type="password" id="eep_ticket_stripe_test_secret_key" name="eep_ticket_stripe_test_secret_key" value="<?php echo esc_attr($ticket_stripe_test_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing key', 'nexdirectory'); ?>">
                                                </div>
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_stripe_live_secret_key"><?php esc_html_e('Stripe ticket live secret key', 'nexdirectory'); ?></label>
                                                    <input type="password" id="eep_ticket_stripe_live_secret_key" name="eep_ticket_stripe_live_secret_key" value="<?php echo esc_attr($ticket_stripe_live_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing key', 'nexdirectory'); ?>">
                                                </div>
                                            </div>
                                        </div>

                                        <div class="eep-settings-field eep-full">
                                            <input type="hidden" name="eep_ticket_paypal_enabled" value="0">
                                            <label><input type="checkbox" id="eep_ticket_paypal_enabled" name="eep_ticket_paypal_enabled" value="1" <?php checked((string) get_option('eep_ticket_paypal_enabled', '0'), '1'); ?>> <?php esc_html_e('Enable PayPal for tickets', 'nexdirectory'); ?></label>
                                        </div>
                                        <div class="eep-settings-field eep-full" data-eep-conditional-field="ticket-paypal">
                                            <div class="eep-settings-grid">
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_paypal_test_client_id"><?php esc_html_e('PayPal ticket test client ID', 'nexdirectory'); ?></label>
                                                    <input type="text" id="eep_ticket_paypal_test_client_id" name="eep_ticket_paypal_test_client_id" value="<?php echo esc_attr((string) get_option('eep_ticket_paypal_test_client_id', '')); ?>">
                                                </div>
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_paypal_test_secret"><?php esc_html_e('PayPal ticket test secret', 'nexdirectory'); ?></label>
                                                    <input type="password" id="eep_ticket_paypal_test_secret" name="eep_ticket_paypal_test_secret" value="<?php echo esc_attr($ticket_paypal_test_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing secret', 'nexdirectory'); ?>">
                                                </div>
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_paypal_live_client_id"><?php esc_html_e('PayPal ticket live client ID', 'nexdirectory'); ?></label>
                                                    <input type="text" id="eep_ticket_paypal_live_client_id" name="eep_ticket_paypal_live_client_id" value="<?php echo esc_attr((string) get_option('eep_ticket_paypal_live_client_id', '')); ?>">
                                                </div>
                                                <div class="eep-settings-field">
                                                    <label for="eep_ticket_paypal_live_secret"><?php esc_html_e('PayPal ticket live secret', 'nexdirectory'); ?></label>
                                                    <input type="password" id="eep_ticket_paypal_live_secret" name="eep_ticket_paypal_live_secret" value="<?php echo esc_attr($ticket_paypal_live_secret_masked); ?>" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing secret', 'nexdirectory'); ?>">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
