                <section class="eep-settings-panel space-y-6" id="eep-tab-seo" data-tab="advanced" data-subtab="seo">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('SEO', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Configure indexing controls and search engine submission settings.', 'nexdirectory'); ?></p>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <h3 class="text-lg font-bold text-slate-900 mb-6 flex items-center gap-2">
                            <i class="fas fa-search text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('Homepage SEO', 'nexdirectory'); ?>
                        </h3>

                        <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                            <div class="space-y-6">
                                <div>
                                    <label for="eep_home_meta_title" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Homepage Meta Title', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_home_meta_title" name="eep_home_meta_title" maxlength="60" value="<?php echo esc_attr($home_meta_title_value); ?>" placeholder="<?php esc_attr_e('Best between 50 and 60 characters', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                    <div class="flex justify-between items-center mt-1">
                                        <p class="text-[11px] text-slate-500" id="eep-home-meta-title-status"><?php esc_html_e('Set an SEO title for homepage search results.', 'nexdirectory'); ?></p>
                                        <p class="text-[11px] font-mono font-medium text-slate-400"><span id="eep-home-meta-title-count"><?php echo esc_html((string) $home_meta_title_count); ?></span> / 60</p>
                                    </div>
                                </div>

                                <div>
                                    <label for="eep_home_meta_description" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Homepage Meta Description', 'nexdirectory'); ?></label>
                                    <textarea id="eep_home_meta_description" name="eep_home_meta_description" rows="3" maxlength="158" placeholder="<?php esc_attr_e('Best between 120 and 158 characters', 'nexdirectory'); ?>" class="block w-full px-4 py-3 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors"><?php echo esc_textarea($home_meta_description_value); ?></textarea>
                                    <div class="flex justify-between items-center mt-1">
                                        <p class="text-[11px] text-slate-500" id="eep-home-meta-description-status"><?php esc_html_e('Write a concise summary for homepage search snippets.', 'nexdirectory'); ?></p>
                                        <p class="text-[11px] font-mono font-medium text-slate-400"><span id="eep-home-meta-description-count"><?php echo esc_html((string) $home_meta_description_count); ?></span> / 158</p>
                                    </div>
                                </div>
                            </div>

                            <div class="bg-slate-50 p-5 rounded-xl border border-slate-200 h-fit">
                                <span class="block text-xs font-bold text-slate-400 uppercase tracking-wider mb-3"><i class="fab fa-google text-slate-400 mr-1"></i> <?php esc_html_e('Live Google Preview', 'nexdirectory'); ?></span>
                                <div class="bg-white p-4 rounded-lg border border-slate-200 shadow-sm" id="eep-home-seo-serp-preview">
                                    <div class="text-[#202124] text-[13px] mb-1 flex items-center gap-2">
                                        <span class="w-6 h-6 rounded-full bg-slate-200 flex-shrink-0"></span>
                                        <span class="truncate" id="eep-seo-serp-url"><?php echo esc_html($home_meta_preview_url); ?></span>
                                    </div>
                                    <div class="text-[#1a0dab] text-xl font-medium leading-tight mb-1 truncate hover:underline cursor-pointer" id="eep-home-serp-title"><?php echo esc_html($home_meta_preview_title); ?></div>
                                    <div class="text-[#4d5156] text-sm leading-snug line-clamp-2" id="eep-home-serp-description"><?php echo esc_html($home_meta_preview_description); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <div class="mb-6 flex items-start justify-between gap-4 pb-4 border-b border-slate-100">
                            <div>
                                <h3 class="text-lg font-bold text-slate-900 flex items-center gap-2 mb-1">
                                    <i class="fas fa-bolt text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('IndexNow Auto Indexing', 'nexdirectory'); ?>
                                </h3>
                                <p class="text-xs text-slate-500 max-w-2xl"><?php esc_html_e('Automatically notify search engines (Bing, Yandex, etc.) when listings are published so discovery updates faster.', 'nexdirectory'); ?></p>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer flex-shrink-0 mt-2">
                                <input type="hidden" name="eep_indexnow_enabled" value="0">
                                <input type="checkbox" name="eep_indexnow_enabled" value="1" class="sr-only peer" <?php checked($indexnow_enabled); ?>>
                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div>
                                <label for="eep_indexnow_key" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('IndexNow API Key', 'nexdirectory'); ?></label>
                                <input type="text" id="eep_indexnow_key" name="eep_indexnow_key" value="<?php echo esc_attr($indexnow_key); ?>" autocomplete="off" class="block w-full px-4 py-2.5 text-sm font-mono border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                                <p class="text-[11px] text-slate-500 mt-1"><?php esc_html_e('8–128 alphanumeric characters. Leave unchanged to keep current key.', 'nexdirectory'); ?></p>
                            </div>
                            <div>
                                <label for="eep_indexnow_endpoint" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('IndexNow Endpoint', 'nexdirectory'); ?></label>
                                <input type="url" id="eep_indexnow_endpoint" name="eep_indexnow_endpoint" value="<?php echo esc_attr($indexnow_endpoint); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                                <p class="text-[11px] text-slate-500 mt-1"><?php esc_html_e('Default endpoint works for Bing, Yandex, Seznam, etc.', 'nexdirectory'); ?></p>
                            </div>

                            <div class="md:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 bg-slate-50 p-4 rounded-xl border border-slate-200">
                                <label class="flex items-start gap-3 cursor-pointer">
                                    <input type="hidden" name="eep_indexnow_submit_updates" value="0">
                                    <input type="checkbox" name="eep_indexnow_submit_updates" value="1" class="w-4 h-4 mt-0.5 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked($indexnow_submit_updates); ?>>
                                    <div>
                                        <span class="block text-sm font-bold text-slate-700"><?php esc_html_e('Submit on Update', 'nexdirectory'); ?></span>
                                        <span class="text-[11px] text-slate-500"><?php esc_html_e('Also ping search engines when an existing published listing is updated.', 'nexdirectory'); ?></span>
                                    </div>
                                </label>
                                <label class="flex items-start gap-3 cursor-pointer">
                                    <input type="hidden" name="eep_indexnow_submit_removals" value="0">
                                    <input type="checkbox" name="eep_indexnow_submit_removals" value="1" class="w-4 h-4 mt-0.5 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked($indexnow_submit_removals); ?>>
                                    <div>
                                        <span class="block text-sm font-bold text-slate-700"><?php esc_html_e('Submit on Removal', 'nexdirectory'); ?></span>
                                        <span class="text-[11px] text-slate-500"><?php esc_html_e('Helps search engines refresh deindexed or removed listing states faster.', 'nexdirectory'); ?></span>
                                    </div>
                                </label>
                            </div>

                            <div class="md:col-span-2">
                                <p class="text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Key File URL:', 'nexdirectory'); ?></p>
                                <?php if ($indexnow_key_url !== '') : ?>
                                    <a href="<?php echo esc_url($indexnow_key_url); ?>" target="_blank" rel="noopener noreferrer" class="inline-block px-3 py-1.5 bg-indigo-50 border border-indigo-100 text-indigo-700 rounded text-xs font-mono hover:bg-indigo-100 transition-colors">
                                        <i class="fas fa-external-link-alt mr-1"></i> <?php echo esc_html($indexnow_key_url); ?>
                                    </a>
                                <?php else : ?>
                                    <span class="inline-block px-3 py-1.5 bg-slate-100 text-slate-500 rounded text-xs font-mono"><?php esc_html_e('Save settings to generate a key URL.', 'nexdirectory'); ?></span>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-extension" data-tab="advanced" data-subtab="extension">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('Chrome Extension', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Manage extension handshake, import defaults, and ingestion behavior.', 'nexdirectory'); ?></p>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm hover:border-indigo-300 transition-colors eep-settings-field eep-full">
                        <div class="mb-6 flex items-start justify-between gap-4 pb-4 border-b border-slate-100">
                            <div>
                                <h3 class="text-lg font-bold text-slate-900 flex items-center gap-2 mb-1">
                                    <i class="fab fa-chrome text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('Chrome Extension Connector', 'nexdirectory'); ?>
                                </h3>
                                <p class="text-xs text-slate-500 max-w-2xl">
                                    <?php printf(esc_html__('Connect the %s Chrome extension for AI-assisted page scanning and listing draft imports.', 'nexdirectory'), esc_html($settings_brand_name)); ?>
                                </p>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer flex-shrink-0 mt-2">
                                <input type="hidden" name="eep_extension_enabled" value="0">
                                <input type="checkbox" name="eep_extension_enabled" value="1" class="sr-only peer" <?php checked((string) get_option('eep_extension_enabled', '0'), '1'); ?>>
                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>

                        <div class="space-y-6">

                            <div>
                                <label for="eep_extension_app_pass" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Extension App Pass', 'nexdirectory'); ?></label>
                                <p class="text-xs text-slate-500 mb-2"><?php esc_html_e('Keep this secret. The extension uses this key plus signed timestamps for secure handshakes.', 'nexdirectory'); ?></p>
                                <div class="flex gap-2">
                                    <input type="text" id="eep_extension_app_pass" name="eep_extension_app_pass" value="<?php echo esc_attr($extension_app_pass); ?>" autocomplete="off" readonly class="block w-full max-w-md px-4 py-2.5 text-sm font-mono border border-slate-300 bg-slate-50 text-slate-500 rounded-lg">
                                    <button type="button" class="eep-copy-shortcode inline-flex items-center px-4 py-2.5 border border-slate-300 rounded-lg text-sm font-medium text-slate-700 bg-white hover:bg-indigo-50 hover:text-indigo-600 transition-colors" data-shortcode="<?php echo esc_attr($extension_app_pass); ?>">
                                        <i class="far fa-copy"></i>
                                    </button>
                                    <button type="submit" form="eep-regenerate-app-pass-form" onclick="return confirm('<?php echo esc_js(__('Regenerate App Pass? Existing extension connections will stop working until updated.', 'nexdirectory')); ?>');" class="inline-flex items-center px-4 py-2.5 border border-red-200 rounded-lg text-sm font-medium text-red-700 bg-red-50 hover:bg-red-100 transition-colors">
                                        <i class="fas fa-sync-alt mr-2"></i> <?php esc_html_e('Regenerate', 'nexdirectory'); ?>
                                    </button>
                                </div>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6 pt-4 border-t border-slate-100">
                                <div>
                                    <label for="eep_extension_import_status" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Default Import Status', 'nexdirectory'); ?></label>
                                    <div class="relative">
                                        <select id="eep_extension_import_status" name="eep_extension_import_status" class="block w-full pl-4 pr-10 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                            <option value="draft" <?php selected($extension_import_status, 'draft'); ?>><?php esc_html_e('Draft (recommended)', 'nexdirectory'); ?></option>
                                            <option value="publish" <?php selected($extension_import_status, 'publish'); ?>><?php esc_html_e('Publish Immediately', 'nexdirectory'); ?></option>
                                        </select>
                                        <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                    </div>
                                </div>

                                <div>
                                    <label for="eep_extension_import_media_policy" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Media Upload Policy', 'nexdirectory'); ?></label>
                                    <div class="relative">
                                        <select id="eep_extension_import_media_policy" name="eep_extension_import_media_policy" class="block w-full pl-4 pr-10 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                            <option value="none" <?php selected($extension_import_media_policy, 'none'); ?>><?php esc_html_e('No Media (default)', 'nexdirectory'); ?></option>
                                            <option value="images" <?php selected($extension_import_media_policy, 'images'); ?>><?php esc_html_e('Images only', 'nexdirectory'); ?></option>
                                            <option value="video" <?php selected($extension_import_media_policy, 'video'); ?>><?php esc_html_e('Video only', 'nexdirectory'); ?></option>
                                            <option value="images_video" <?php selected($extension_import_media_policy, 'images_video'); ?>><?php esc_html_e('Images and video', 'nexdirectory'); ?></option>
                                        </select>
                                        <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                    </div>
                                </div>

                                <div>
                                    <label for="eep_extension_import_content_mode" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Imported Text Mode', 'nexdirectory'); ?></label>
                                    <div class="relative">
                                        <select id="eep_extension_import_content_mode" name="eep_extension_import_content_mode" class="block w-full pl-4 pr-10 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                            <option value="rewrite" <?php selected($extension_import_content_mode, 'rewrite'); ?>><?php esc_html_e('Rewrite for SEO (recommended)', 'nexdirectory'); ?></option>
                                            <option value="verbatim" <?php selected($extension_import_content_mode, 'verbatim'); ?>><?php esc_html_e('Use source text verbatim', 'nexdirectory'); ?></option>
                                        </select>
                                        <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                    </div>
                                </div>

                                <div>
                                    <label for="eep_extension_import_author_id" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Imported Listing Owner', 'nexdirectory'); ?></label>
                                    <div class="relative">
                                        <select id="eep_extension_import_author_id" name="eep_extension_import_author_id" class="block w-full pl-4 pr-10 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                            <option value="0" <?php selected($extension_import_author_id, 0); ?>><?php esc_html_e('Auto (current admin)', 'nexdirectory'); ?></option>
                                            <?php foreach ((array) $extension_import_author_options as $author_option) : ?>
                                                <?php
                                                if (!$author_option instanceof WP_User) {
                                                    continue;
                                                }
                                                $author_label = trim((string) $author_option->display_name);
                                                if ($author_label === '') {
                                                    $author_label = (string) $author_option->user_email;
                                                }
                                                ?>
                                                <option value="<?php echo esc_attr((string) $author_option->ID); ?>" <?php selected($extension_import_author_id, (int) $author_option->ID); ?>>
                                                    <?php echo esc_html($author_label . ' (' . (string) $author_option->user_email . ')'); ?>
                                                </option>
                                            <?php endforeach; ?>
                                        </select>
                                        <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                    </div>
                                </div>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-3 gap-4 pt-4 border-t border-slate-100">
                                <label class="flex items-start gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                    <input type="hidden" name="eep_extension_import_mark_claimable" value="0">
                                    <input type="checkbox" name="eep_extension_import_mark_claimable" value="1" class="w-4 h-4 mt-0.5 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_extension_import_mark_claimable', '1'), '1'); ?>>
                                    <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Mark imported listings as claimable', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-start gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                    <input type="hidden" name="eep_extension_notify_potential_owner_default" value="0">
                                    <input type="checkbox" name="eep_extension_notify_potential_owner_default" value="1" class="w-4 h-4 mt-0.5 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked($extension_notify_owner_default); ?>>
                                    <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Notify potential owner via email', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-start gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                    <input type="hidden" name="eep_enable_autogenerated_disclaimer" value="0">
                                    <input type="checkbox" name="eep_enable_autogenerated_disclaimer" value="1" class="w-4 h-4 mt-0.5 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_enable_autogenerated_disclaimer', '1'), '1'); ?>>
                                    <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Show autogenerated disclaimer on frontend', 'nexdirectory'); ?></span>
                                </label>
                            </div>

                            <div>
                                <label for="eep_autogenerated_disclaimer_text" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Disclaimer Text Override (Optional)', 'nexdirectory'); ?></label>
                                <textarea id="eep_autogenerated_disclaimer_text" name="eep_autogenerated_disclaimer_text" rows="2" placeholder="<?php esc_attr_e('This listing was auto-generated. Listing details may change. Please verify with the original source.', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors"><?php echo esc_textarea((string) get_option('eep_autogenerated_disclaimer_text', '')); ?></textarea>
                            </div>

                            <div class="bg-slate-800 text-slate-300 p-4 rounded-xl border border-slate-700 space-y-2 mt-4 font-mono text-[11px]">
                                <div class="flex flex-col sm:flex-row sm:justify-between gap-1">
                                    <span class="text-slate-400"><?php esc_html_e('API Endpoint:', 'nexdirectory'); ?></span>
                                    <span class="text-indigo-300 truncate select-all"><?php echo esc_html(esc_url_raw(rest_url('eep/v1/extension/import'))); ?></span>
                                </div>
                                <div class="flex flex-col sm:flex-row sm:justify-between gap-1">
                                    <span class="text-slate-400"><?php esc_html_e('Handshake Endpoint:', 'nexdirectory'); ?></span>
                                    <span class="text-indigo-300 truncate select-all"><?php echo esc_html(esc_url_raw(rest_url('eep/v1/extension/ping'))); ?></span>
                                </div>
                                <div class="flex flex-col sm:flex-row sm:justify-between gap-1">
                                    <span class="text-slate-400"><?php esc_html_e('Preferences Endpoint:', 'nexdirectory'); ?></span>
                                    <span class="text-indigo-300 truncate select-all"><?php echo esc_html(esc_url_raw(rest_url('eep/v1/extension/preferences'))); ?></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-email" data-tab="advanced" data-subtab="email">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('Email Delivery (SMTP)', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Configure SMTP delivery and test outbound email.', 'nexdirectory'); ?></p>
                    </div>

                    <?php $email_connected = !empty($settings_email_health['connected']); ?>
                    <div class="p-6 rounded-2xl border shadow-sm flex flex-col sm:flex-row gap-5 eep-settings-field eep-full <?php echo $email_connected ? 'border-emerald-200 bg-emerald-50/50' : 'border-amber-200 bg-amber-50/50'; ?>">
                        <div class="flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center <?php echo $email_connected ? 'bg-emerald-100 text-emerald-600' : 'bg-amber-100 text-amber-600'; ?>">
                            <i class="fas fa-envelope-open-text text-xl"></i>
                        </div>
                        <div class="flex-1">
                            <div class="flex items-center gap-3 mb-2">
                                <h3 class="text-lg font-bold text-slate-900 m-0"><?php esc_html_e('Email Connection Status', 'nexdirectory'); ?></h3>
                                <span class="px-2.5 py-1 text-[10px] uppercase font-bold tracking-wider rounded-full border <?php echo $email_connected ? 'bg-emerald-100 text-emerald-700 border-emerald-300' : 'bg-amber-100 text-amber-800 border-amber-300'; ?>">
                                    <?php echo esc_html($email_connected ? __('Connected', 'nexdirectory') : __('Not connected', 'nexdirectory')); ?>
                                </span>
                            </div>
                            <p class="text-sm text-slate-600 mb-4"><?php echo esc_html((string) ($settings_email_health['summary'] ?? '')); ?></p>

                            <div class="flex items-center gap-2 max-w-sm">
                                <input type="email" name="eep_test_email_to" form="eep-send-test-email-form" placeholder="<?php echo esc_attr(get_option('admin_email')); ?>" class="block w-full px-3 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg">
                                <button type="submit" form="eep-send-test-email-form" class="whitespace-nowrap inline-flex items-center px-4 py-2 border border-slate-300 rounded-lg shadow-sm text-sm font-semibold text-slate-700 bg-white hover:bg-slate-50 transition-colors">
                                    <?php esc_html_e('Send Test', 'nexdirectory'); ?>
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <div class="mb-6 flex items-start justify-between gap-4 pb-4 border-b border-slate-100">
                            <div>
                                <h3 class="text-lg font-bold text-slate-900 flex items-center gap-2 mb-1">
                                    <i class="fas fa-server text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('SMTP Configuration', 'nexdirectory'); ?>
                                </h3>
                                <p class="text-xs text-slate-500 max-w-2xl"><?php esc_html_e('Use your dedicated SMTP provider for platform emails (notifications, reminders, moderation updates).', 'nexdirectory'); ?></p>
                            </div>
                            <label class="relative inline-flex items-center cursor-pointer flex-shrink-0 mt-2">
                                <input type="hidden" name="eep_smtp_enabled" value="0">
                                <input type="checkbox" name="eep_smtp_enabled" value="1" class="sr-only peer" <?php checked((string) get_option('eep_smtp_enabled', '0'), '1'); ?>>
                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                            </label>
                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                            <div class="lg:col-span-2">
                                <label for="eep_smtp_host" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('SMTP Host', 'nexdirectory'); ?></label>
                                <input type="text" id="eep_smtp_host" name="eep_smtp_host" value="<?php echo esc_attr((string) get_option('eep_smtp_host', '')); ?>" placeholder="smtp.example.com" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                            </div>
                            <div>
                                <label for="eep_smtp_port" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('SMTP Port', 'nexdirectory'); ?></label>
                                <input type="number" id="eep_smtp_port" name="eep_smtp_port" min="1" max="65535" value="<?php echo esc_attr((string) get_option('eep_smtp_port', 587)); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                            </div>

                            <div>
                                <label for="eep_smtp_encryption" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Encryption', 'nexdirectory'); ?></label>
                                <div class="relative">
                                    <select id="eep_smtp_encryption" name="eep_smtp_encryption" class="block w-full pl-4 pr-10 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                        <option value="none" <?php selected((string) get_option('eep_smtp_encryption', 'tls'), 'none'); ?>><?php esc_html_e('None', 'nexdirectory'); ?></option>
                                        <option value="tls" <?php selected((string) get_option('eep_smtp_encryption', 'tls'), 'tls'); ?>><?php esc_html_e('TLS', 'nexdirectory'); ?></option>
                                        <option value="ssl" <?php selected((string) get_option('eep_smtp_encryption', 'tls'), 'ssl'); ?>><?php esc_html_e('SSL', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                </div>
                            </div>
                            <div class="lg:col-span-2 flex items-center pt-6">
                                <label class="relative inline-flex items-center cursor-pointer">
                                    <input type="hidden" name="eep_smtp_auth" value="0">
                                    <input type="checkbox" name="eep_smtp_auth" value="1" class="sr-only peer" <?php checked((string) get_option('eep_smtp_auth', '1'), '1'); ?>>
                                    <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                                    <span class="ml-3 text-sm font-bold text-slate-800"><?php esc_html_e('Use SMTP Authentication', 'nexdirectory'); ?></span>
                                </label>
                            </div>

                            <div>
                                <label for="eep_smtp_username" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('SMTP Username', 'nexdirectory'); ?></label>
                                <input type="text" id="eep_smtp_username" name="eep_smtp_username" value="<?php echo esc_attr((string) get_option('eep_smtp_username', '')); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                            </div>
                            <div class="lg:col-span-2">
                                <label for="eep_smtp_password" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('SMTP Password', 'nexdirectory'); ?></label>
                                <input type="password" id="eep_smtp_password" name="eep_smtp_password" value="" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing password', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                            </div>

                            <div class="md:col-span-2 lg:col-span-3 pt-6 border-t border-slate-100 grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div>
                                    <label for="eep_smtp_from_name" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('From Name (Global Sender)', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_smtp_from_name" name="eep_smtp_from_name" value="<?php echo esc_attr((string) get_option('eep_smtp_from_name', '')); ?>" placeholder="<?php echo esc_attr($this->get_white_label_brand_name()); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                                </div>
                                <div>
                                    <label for="eep_smtp_from_email" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('From Email (Global Sender)', 'nexdirectory'); ?></label>
                                    <input type="email" id="eep_smtp_from_email" name="eep_smtp_from_email" value="<?php echo esc_attr((string) get_option('eep_smtp_from_email', '')); ?>" placeholder="noreply@example.com" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                                    <p class="text-[11px] text-slate-500 mt-1"><?php esc_html_e('Used for automatic platform emails, even when SMTP is disabled.', 'nexdirectory'); ?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-apis" data-tab="advanced" data-subtab="apis">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('APIs & Credentials', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Manage API credentials for maps, OpenAI, and anti-spam protection.', 'nexdirectory'); ?></p>
                    </div>

                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <?php $ai_connected = !empty($settings_api_health['connected']); ?>
                        <div class="p-5 rounded-2xl border shadow-sm flex flex-col eep-settings-field <?php echo $ai_connected ? 'border-emerald-200 bg-emerald-50/50' : 'border-slate-200 bg-slate-50'; ?>">
                            <div class="flex items-center justify-between mb-3">
                                <div class="flex items-center gap-3">
                                    <div class="w-8 h-8 rounded-full flex items-center justify-center <?php echo $ai_connected ? 'bg-emerald-100 text-emerald-600' : 'bg-slate-200 text-slate-500'; ?>">
                                        <i class="fas fa-robot"></i>
                                    </div>
                                    <strong class="text-sm font-bold text-slate-900"><?php esc_html_e('OpenAI API', 'nexdirectory'); ?></strong>
                                </div>
                                <span class="px-2 py-0.5 text-[10px] uppercase font-bold tracking-wider rounded border <?php echo $ai_connected ? 'bg-emerald-100 text-emerald-700 border-emerald-300' : 'bg-slate-200 text-slate-600 border-slate-300'; ?>">
                                    <?php echo esc_html($ai_connected ? __('Connected', 'nexdirectory') : __('Not connected', 'nexdirectory')); ?>
                                </span>
                            </div>
                            <p class="text-xs text-slate-600 mb-4 flex-1"><?php echo esc_html((string) ($settings_api_health['summary'] ?? '')); ?></p>
                            <button type="submit" form="eep-chatbot-test-form" class="w-full justify-center inline-flex items-center px-4 py-2 border border-slate-300 rounded-lg shadow-sm text-xs font-semibold text-slate-700 bg-white hover:bg-slate-50 transition-colors" <?php disabled(!$premium_unlocked); ?>>
                                <?php esc_html_e('Test API', 'nexdirectory'); ?>
                            </button>
                        </div>

                        <?php $captcha_connected = !empty($settings_captcha_health['connected']); ?>
                        <div class="p-5 rounded-2xl border shadow-sm flex flex-col eep-settings-field <?php echo $captcha_connected ? 'border-emerald-200 bg-emerald-50/50' : 'border-slate-200 bg-slate-50'; ?>">
                            <div class="flex items-center justify-between mb-3">
                                <div class="flex items-center gap-3">
                                    <div class="w-8 h-8 rounded-full flex items-center justify-center <?php echo $captcha_connected ? 'bg-emerald-100 text-emerald-600' : 'bg-slate-200 text-slate-500'; ?>">
                                        <i class="fas fa-shield-alt"></i>
                                    </div>
                                    <strong class="text-sm font-bold text-slate-900"><?php esc_html_e('reCAPTCHA', 'nexdirectory'); ?></strong>
                                </div>
                                <span class="px-2 py-0.5 text-[10px] uppercase font-bold tracking-wider rounded border <?php echo $captcha_connected ? 'bg-emerald-100 text-emerald-700 border-emerald-300' : 'bg-slate-200 text-slate-600 border-slate-300'; ?>">
                                    <?php echo esc_html($captcha_connected ? __('Connected', 'nexdirectory') : __('Not connected', 'nexdirectory')); ?>
                                </span>
                            </div>
                            <p class="text-xs text-slate-600 mb-4 flex-1"><?php echo esc_html((string) ($settings_captcha_health['summary'] ?? '')); ?></p>
                            <button type="submit" form="eep-test-captcha-form" class="w-full justify-center inline-flex items-center px-4 py-2 border border-slate-300 rounded-lg shadow-sm text-xs font-semibold text-slate-700 bg-white hover:bg-slate-50 transition-colors">
                                <?php esc_html_e('Test Captcha', 'nexdirectory'); ?>
                            </button>
                        </div>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <h3 class="text-lg font-bold text-slate-900 mb-6 flex items-center gap-2">
                            <i class="fas fa-key text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('Credential Settings', 'nexdirectory'); ?>
                        </h3>

                        <div class="space-y-8">
                            <div>
                                <label for="eep_google_maps_api_key" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Google Maps API Key', 'nexdirectory'); ?></label>
                                <input type="password" id="eep_google_maps_api_key" name="eep_google_maps_api_key" value="" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing key', 'nexdirectory'); ?>" class="block w-full max-w-lg px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">
                                <p class="text-[11px] text-slate-500 mt-1">
                                    <?php esc_html_e('Used for map enhancements and address geocoding.', 'nexdirectory'); ?>
                                    <a href="https://developers.google.com/maps" target="_blank" rel="noopener noreferrer" class="text-indigo-600 hover:underline"><?php esc_html_e('Get a key', 'nexdirectory'); ?></a>.
                                </p>
                            </div>

                            <div class="pt-6 border-t border-slate-100">
                                <label for="eep_recaptcha_site_key" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('reCAPTCHA Site Key', 'nexdirectory'); ?></label>
                                <input type="text" id="eep_recaptcha_site_key" name="eep_recaptcha_site_key" value="<?php echo esc_attr((string) get_option('eep_recaptcha_site_key', '')); ?>" class="block w-full max-w-lg px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">

                                <label for="eep_recaptcha_secret_key" class="block text-sm font-bold text-slate-800 mt-4 mb-1"><?php esc_html_e('reCAPTCHA Secret Key', 'nexdirectory'); ?></label>
                                <input type="password" id="eep_recaptcha_secret_key" name="eep_recaptcha_secret_key" value="" autocomplete="off" placeholder="<?php esc_attr_e('Leave blank to keep existing secret', 'nexdirectory'); ?>" class="block w-full max-w-lg px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 transition-colors">

                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 max-w-2xl">
                                    <div>
                                        <label for="eep_recaptcha_version" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Version', 'nexdirectory'); ?></label>
                                        <div class="relative">
                                            <select id="eep_recaptcha_version" name="eep_recaptcha_version" class="block w-full pl-3 pr-8 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                                <option value="v3" <?php selected($recaptcha_version_value, 'v3'); ?>><?php esc_html_e('v3 (recommended)', 'nexdirectory'); ?></option>
                                                <option value="v2" <?php selected($recaptcha_version_value, 'v2'); ?>><?php esc_html_e('v2', 'nexdirectory'); ?></option>
                                            </select>
                                            <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                        </div>
                                    </div>
                                    <div class="flex items-center pt-6">
                                        <label class="flex items-center gap-2 cursor-pointer">
                                            <input type="hidden" name="eep_recaptcha_show_submit" value="0">
                                            <input type="checkbox" name="eep_recaptcha_show_submit" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_recaptcha_show_submit', '0'), '1'); ?>>
                                            <span class="text-sm font-semibold text-slate-700"><?php esc_html_e('Show on submission form', 'nexdirectory'); ?></span>
                                        </label>
                                    </div>
                                </div>
                                <p class="text-[11px] text-slate-500 mt-2">
                                    <?php esc_html_e('v3 runs silently. v2 shows a challenge box.', 'nexdirectory'); ?>
                                    <a href="https://www.google.com/recaptcha/admin/create" target="_blank" rel="noopener noreferrer" class="text-indigo-600 hover:underline"><?php esc_html_e('Create reCAPTCHA keys', 'nexdirectory'); ?></a>.
                                </p>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-display-advanced" data-tab="advanced" data-subtab="display">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('Display (Advanced)', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Control theme override behavior and resolve layout conflicts.', 'nexdirectory'); ?></p>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <h3 class="text-lg font-bold text-slate-900 mb-6 flex items-center gap-2">
                            <i class="fas fa-layer-group text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('Theme Layout Overrides', 'nexdirectory'); ?>
                        </h3>

                        <div class="space-y-4">
                            <div class="flex items-start gap-4 pb-4 border-b border-slate-100">
                                <label class="relative inline-flex items-center cursor-pointer mt-0.5 flex-shrink-0">
                                    <input type="hidden" name="eep_theme_override_all_plugin_pages" value="0">
                                    <input type="checkbox" id="eep_theme_override_all_plugin_pages" name="eep_theme_override_all_plugin_pages" value="1" class="sr-only peer" <?php checked((string) get_option('eep_theme_override_all_plugin_pages', '1'), '1'); ?>>
                                    <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                                </label>
                                <div>
                                    <span class="block text-sm font-bold text-slate-800"><?php esc_html_e('Override all theme settings on plugin pages (recommended)', 'nexdirectory'); ?></span>
                                    <span class="text-xs text-slate-500"><?php esc_html_e('Uses a clean full-width canvas: no theme titles, no theme padding, reduced conflicts.', 'nexdirectory'); ?></span>
                                </div>
                            </div>

                            <div id="eep-theme-override-granular" class="grid grid-cols-1 md:grid-cols-2 gap-3 pl-14">
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_full_width" value="0"><input type="checkbox" name="eep_theme_override_full_width" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_full_width', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Force full-width wrappers', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_remove_padding" value="0"><input type="checkbox" name="eep_theme_override_remove_padding" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_remove_padding', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Remove theme padding/margins', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_hide_title" value="0"><input type="checkbox" name="eep_theme_override_hide_title" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_hide_title', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Hide theme page titles', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_hide_comments" value="0"><input type="checkbox" name="eep_theme_override_hide_comments" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_hide_comments', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Disable comments areas', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_hide_featured_image" value="0"><input type="checkbox" name="eep_theme_override_hide_featured_image" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_hide_featured_image', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Suppress theme featured image', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors">
                                    <input type="hidden" name="eep_theme_override_hide_header" value="0"><input type="checkbox" name="eep_theme_override_hide_header" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_hide_header', '0'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Remove Header', 'nexdirectory'); ?></span>
                                </label>
                                <label class="flex items-center gap-3 cursor-pointer p-2 rounded hover:bg-slate-50 transition-colors md:col-span-2">
                                    <input type="hidden" name="eep_theme_override_reset_theme_styles" value="0"><input type="checkbox" name="eep_theme_override_reset_theme_styles" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_theme_override_reset_theme_styles', '1'), '1'); ?>>
                                    <span class="text-sm text-slate-700"><?php esc_html_e('Neutralize theme cards/shadows around plugin content', 'nexdirectory'); ?></span>
                                </label>
                            </div>
                            <input type="hidden" name="eep_hide_theme_titles_on_plugin_pages" value="<?php echo esc_attr((string) get_option('eep_hide_theme_titles_on_plugin_pages', '0')); ?>">
                        </div>
                    </div>

                    <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                        <h3 class="text-lg font-bold text-slate-900 mb-6 flex items-center gap-2">
                            <i class="fas fa-space-shuttle text-indigo-500 bg-indigo-50 p-2 rounded-lg"></i> <?php esc_html_e('SPA Navigation & Motion', 'nexdirectory'); ?>
                        </h3>

                        <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 mb-6 pb-6 border-b border-slate-100">
                            <label class="flex items-center gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                <input type="hidden" name="eep_enable_spa_hybrid" value="0">
                                <input type="checkbox" name="eep_enable_spa_hybrid" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_enable_spa_hybrid', '1'), '1'); ?>>
                                <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Enable Hybrid SPA', 'nexdirectory'); ?></span>
                            </label>
                            <label class="flex items-center gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                <input type="hidden" name="eep_show_spa_feedback_badge" value="0">
                                <input type="checkbox" name="eep_show_spa_feedback_badge" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_show_spa_feedback_badge', '0'), '1'); ?>>
                                <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Show SPA Toasts', 'nexdirectory'); ?></span>
                            </label>
                            <label class="flex items-center gap-3 cursor-pointer p-3 bg-slate-50 rounded-xl border border-slate-200 hover:border-indigo-300 transition-colors">
                                <input type="hidden" name="eep_enable_smooth_scrolling" value="0">
                                <input type="checkbox" name="eep_enable_smooth_scrolling" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_enable_smooth_scrolling', '0'), '1'); ?>>
                                <span class="text-sm font-bold text-slate-700 leading-snug"><?php esc_html_e('Smooth Scrolling', 'nexdirectory'); ?></span>
                            </label>
                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                            <?php $smooth_profile = method_exists($this, 'sanitize_smooth_scroll_profile_option') ? (string) $this->sanitize_smooth_scroll_profile_option((string) get_option('eep_smooth_scroll_profile', 'balanced')) : (string) get_option('eep_smooth_scroll_profile', 'balanced'); ?>
                            <div>
                                <label for="eep_smooth_scroll_profile" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Scroll Profile', 'nexdirectory'); ?></label>
                                <div class="relative">
                                    <select id="eep_smooth_scroll_profile" name="eep_smooth_scroll_profile" class="block w-full pl-3 pr-8 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                        <option value="gentle" <?php selected($smooth_profile, 'gentle'); ?>><?php esc_html_e('Gentle', 'nexdirectory'); ?></option>
                                        <option value="balanced" <?php selected($smooth_profile, 'balanced'); ?>><?php esc_html_e('Balanced (Recommended)', 'nexdirectory'); ?></option>
                                        <option value="snappy" <?php selected($smooth_profile, 'snappy'); ?>><?php esc_html_e('Snappy', 'nexdirectory'); ?></option>
                                        <option value="custom" <?php selected($smooth_profile, 'custom'); ?>><?php esc_html_e('Custom', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                </div>
                            </div>

                            <?php $smooth_touchpad_behavior = method_exists($this, 'sanitize_smooth_scroll_touchpad_behavior_option') ? (string) $this->sanitize_smooth_scroll_touchpad_behavior_option((string) get_option('eep_smooth_scroll_touchpad_behavior', 'native')) : (string) get_option('eep_smooth_scroll_touchpad_behavior', 'native'); ?>
                            <div class="lg:col-span-2">
                                <label for="eep_smooth_scroll_touchpad_behavior" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Trackpad Behavior', 'nexdirectory'); ?></label>
                                <div class="relative">
                                    <select id="eep_smooth_scroll_touchpad_behavior" name="eep_smooth_scroll_touchpad_behavior" class="block w-full pl-3 pr-8 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700 appearance-none cursor-pointer">
                                        <option value="native" <?php selected($smooth_touchpad_behavior, 'native'); ?>><?php esc_html_e('Use Native Trackpad Physics (Recommended)', 'nexdirectory'); ?></option>
                                        <option value="assist" <?php selected($smooth_touchpad_behavior, 'assist'); ?>><?php esc_html_e('Assist Trackpad Scroll', 'nexdirectory'); ?></option>
                                        <option value="force" <?php selected($smooth_touchpad_behavior, 'force'); ?>><?php esc_html_e('Force Full Engine on Trackpad', 'nexdirectory'); ?></option>
                                    </select>
                                    <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-slate-500"><i class="fas fa-chevron-down text-xs"></i></div>
                                </div>
                            </div>

                            <div>
                                <label for="eep_smooth_scroll_wheel_multiplier" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Multiplier', 'nexdirectory'); ?></label>
                                <input type="number" id="eep_smooth_scroll_wheel_multiplier" name="eep_smooth_scroll_wheel_multiplier" min="0.4" max="3" step="0.01" value="<?php echo esc_attr((string) get_option('eep_smooth_scroll_wheel_multiplier', '1')); ?>" class="block w-full px-3 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700">
                            </div>
                            <div>
                                <label for="eep_smooth_scroll_ease" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Duration (sec)', 'nexdirectory'); ?></label>
                                <input type="number" id="eep_smooth_scroll_ease" name="eep_smooth_scroll_ease" min="0.4" max="3" step="0.05" value="<?php echo esc_attr((string) get_option('eep_smooth_scroll_ease', '1.2')); ?>" class="block w-full px-3 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700">
                            </div>
                            <div>
                                <label for="eep_smooth_scroll_max_step_px" class="block text-xs font-bold text-slate-600 uppercase tracking-wide mb-1"><?php esc_html_e('Max Step (px)', 'nexdirectory'); ?></label>
                                <input type="number" id="eep_smooth_scroll_max_step_px" name="eep_smooth_scroll_max_step_px" min="180" max="2400" step="10" value="<?php echo esc_attr((string) get_option('eep_smooth_scroll_max_step_px', 960)); ?>" class="block w-full px-3 py-2 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-700">
                            </div>

                            <div class="md:col-span-2 lg:col-span-3 flex items-center justify-between mt-2">
                                <label class="flex items-center gap-3 cursor-pointer">
                                    <input type="hidden" name="eep_smooth_scroll_enable_on_touch" value="0">
                                    <input type="checkbox" name="eep_smooth_scroll_enable_on_touch" value="1" class="w-4 h-4 text-indigo-600 bg-white border-slate-300 rounded focus:ring-indigo-500" <?php checked((string) get_option('eep_smooth_scroll_enable_on_touch', '0'), '1'); ?>>
                                    <span class="text-sm font-semibold text-slate-700"><?php esc_html_e('Force engine on touch devices', 'nexdirectory'); ?></span>
                                </label>

                                <button type="submit" form="eep-reset-smooth-scroll-form" onclick="return confirm('<?php echo esc_js(__('Reset smooth scrolling settings to Lenis defaults?', 'nexdirectory')); ?>');" class="text-xs font-semibold text-red-600 hover:text-red-800 transition-colors">
                                    <?php esc_html_e('Reset Defaults', 'nexdirectory'); ?>
                                </button>
                            </div>
                        </div>
                    </div>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-white-label" data-tab="advanced" data-subtab="white-label">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('Plugin White Label', 'nexdirectory'); ?></h2>
                        <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Rename plugin branding for client handoff and lock this area behind an admin password.', 'nexdirectory'); ?></p>
                    </div>

                    <?php if ($white_label_lock_enabled && $white_label_has_password && !$white_label_is_unlocked) : ?>
                        <div class="p-8 bg-white border border-red-200 rounded-2xl shadow-sm text-center max-w-2xl mx-auto mt-12 relative overflow-hidden eep-settings-field eep-full">
                            <div class="absolute top-0 left-0 w-full h-2 bg-red-500"></div>

                            <input type="hidden" name="eep_white_label_password_hash" value="">
                            <input type="hidden" name="eep_white_label_enabled" value="<?php echo esc_attr((string) ($white_label_enabled ? '1' : '0')); ?>">
                            <input type="hidden" name="eep_white_label_plugin_name" value="<?php echo esc_attr($white_label_name_value); ?>">
                            <input type="hidden" name="eep_white_label_plugin_description" value="<?php echo esc_attr($white_label_description_value); ?>">
                            <input type="hidden" name="eep_white_label_plugin_author" value="<?php echo esc_attr($white_label_author_value); ?>">
                            <input type="hidden" name="eep_white_label_plugin_url" value="<?php echo esc_attr($white_label_url_value); ?>">
                            <input type="hidden" name="eep_white_label_support_url" value="<?php echo esc_attr($white_label_support_url_value); ?>">
                            <input type="hidden" name="eep_white_label_support_email" value="<?php echo esc_attr($white_label_support_email_value); ?>">
                            <input type="hidden" name="eep_white_label_admin_menu_icon" value="<?php echo esc_attr($white_label_menu_icon_value); ?>">
                            <input type="hidden" name="eep_white_label_admin_footer_text" value="<?php echo esc_attr($white_label_footer_text_value); ?>">
                            <input type="hidden" name="eep_white_label_lock_enabled" value="<?php echo esc_attr((string) ($white_label_lock_enabled ? '1' : '0')); ?>">

                            <div class="w-16 h-16 bg-red-50 rounded-full flex items-center justify-center mx-auto mb-4">
                                <i class="fas fa-lock text-red-500 text-2xl"></i>
                            </div>
                            <h3 class="text-xl font-bold text-slate-900 mb-2"><?php esc_html_e('Settings Locked', 'nexdirectory'); ?></h3>
                            <p class="text-sm text-slate-500 mb-6"><?php esc_html_e('Enter the white label password to unlock editing for this section.', 'nexdirectory'); ?></p>

                            <div class="flex gap-2 max-w-sm mx-auto">
                                <input type="password" name="eep_white_label_unlock_password" form="eep-white-label-unlock-form" required autocomplete="off" placeholder="<?php esc_attr_e('Enter password', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900">
                                <button type="submit" form="eep-white-label-unlock-form" class="whitespace-nowrap inline-flex items-center px-6 py-2.5 border border-transparent rounded-lg shadow-sm text-sm font-bold text-white bg-indigo-600 hover:bg-indigo-700 transition-colors">
                                    <?php esc_html_e('Unlock', 'nexdirectory'); ?>
                                </button>
                            </div>

                            <?php if ($white_label_force_reset_url !== '') : ?>
                                <div class="mt-8 pt-6 border-t border-slate-100">
                                    <p class="text-xs text-slate-400 mb-3"><?php esc_html_e('Forgot password? Use the emergency reset URL.', 'nexdirectory'); ?></p>
                                    <div class="flex items-center justify-center gap-2">
                                        <input type="text" readonly value="<?php echo esc_attr($white_label_force_reset_url); ?>" class="block w-full max-w-xs px-3 py-1.5 text-xs font-mono border border-slate-200 bg-slate-50 text-slate-400 rounded cursor-text">
                                        <a href="<?php echo esc_url($white_label_force_reset_url); ?>" onclick="return confirm('<?php echo esc_js(__('Clear white label lock now?', 'nexdirectory')); ?>');" class="text-xs font-bold text-indigo-600 hover:text-indigo-800 uppercase tracking-wide">
                                            <?php esc_html_e('Open', 'nexdirectory'); ?>
                                        </a>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </div>

                    <?php else : ?>
                        <div class="p-6 bg-white border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">

                            <div class="flex items-start justify-between gap-4 pb-6 mb-6 border-b border-slate-100">
                                <div>
                                    <h3 class="text-lg font-bold text-slate-900 mb-1"><?php esc_html_e('Enable Custom Branding', 'nexdirectory'); ?></h3>
                                    <p class="text-xs text-slate-500 max-w-xl"><?php esc_html_e('When enabled, the main admin menu label and plugin metadata uses your custom name.', 'nexdirectory'); ?></p>
                                </div>
                                <label class="relative inline-flex items-center cursor-pointer flex-shrink-0 mt-1">
                                    <input type="hidden" name="eep_white_label_password_hash" value="">
                                    <input type="hidden" name="eep_white_label_enabled" value="0">
                                    <input type="checkbox" name="eep_white_label_enabled" value="1" class="sr-only peer" <?php checked($white_label_enabled, true); ?>>
                                    <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div>
                                </label>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-5">
                                <div>
                                    <label for="eep_white_label_plugin_name" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Custom Plugin Name', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_white_label_plugin_name" name="eep_white_label_plugin_name" value="<?php echo esc_attr($white_label_name_value); ?>" placeholder="<?php esc_attr_e('Client Events', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                                <div>
                                    <label for="eep_white_label_admin_menu_icon" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Admin Menu Icon (Dashicons)', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_white_label_admin_menu_icon" name="eep_white_label_admin_menu_icon" value="<?php echo esc_attr($white_label_menu_icon_value); ?>" placeholder="dashicons-admin-generic" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>

                                <div class="md:col-span-2">
                                    <label for="eep_white_label_plugin_description" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Plugin Description Override', 'nexdirectory'); ?></label>
                                    <textarea id="eep_white_label_plugin_description" name="eep_white_label_plugin_description" rows="2" placeholder="<?php esc_attr_e('White-labeled events and listings management toolkit.', 'nexdirectory'); ?>" class="block w-full px-4 py-3 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors"><?php echo esc_textarea($white_label_description_value); ?></textarea>
                                </div>

                                <div>
                                    <label for="eep_white_label_plugin_author" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Plugin Author Label', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_white_label_plugin_author" name="eep_white_label_plugin_author" value="<?php echo esc_attr($white_label_author_value); ?>" placeholder="<?php esc_attr_e('Client Support Team', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                                <div>
                                    <label for="eep_white_label_plugin_url" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Plugin Website URL', 'nexdirectory'); ?></label>
                                    <input type="url" id="eep_white_label_plugin_url" name="eep_white_label_plugin_url" value="<?php echo esc_attr($white_label_url_value); ?>" placeholder="https://example.com" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>

                                <div>
                                    <label for="eep_white_label_support_url" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Support Website URL', 'nexdirectory'); ?></label>
                                    <input type="url" id="eep_white_label_support_url" name="eep_white_label_support_url" value="<?php echo esc_attr($white_label_support_url_value); ?>" placeholder="https://example.com/support" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                                <div>
                                    <label for="eep_white_label_support_email" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Support Email Address', 'nexdirectory'); ?></label>
                                    <input type="email" id="eep_white_label_support_email" name="eep_white_label_support_email" value="<?php echo esc_attr($white_label_support_email_value); ?>" placeholder="support@example.com" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>

                                <div class="md:col-span-2">
                                    <label for="eep_white_label_admin_footer_text" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Admin Footer Text Override', 'nexdirectory'); ?></label>
                                    <input type="text" id="eep_white_label_admin_footer_text" name="eep_white_label_admin_footer_text" value="<?php echo esc_attr($white_label_footer_text_value); ?>" placeholder="<?php esc_attr_e('Managed by Client Events Platform', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-slate-50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                            </div>
                        </div>

                        <div class="p-6 bg-slate-50 border border-slate-200 rounded-2xl shadow-sm eep-settings-field eep-full">
                            <div class="mb-5 flex items-start justify-between gap-4 pb-4 border-b border-slate-200">
                                <div>
                                    <h3 class="text-lg font-bold text-slate-900 flex items-center gap-2 mb-1">
                                        <i class="fas fa-lock text-slate-500"></i> <?php esc_html_e('Protect White Label Settings', 'nexdirectory'); ?>
                                    </h3>
                                    <p class="text-xs text-slate-500 max-w-xl"><?php esc_html_e('Require a password to access this specific settings tab.', 'nexdirectory'); ?></p>
                                </div>
                                <label class="relative inline-flex items-center cursor-pointer flex-shrink-0 mt-1">
                                    <input type="hidden" name="eep_white_label_lock_enabled" value="0">
                                    <input type="checkbox" name="eep_white_label_lock_enabled" value="1" class="sr-only peer" <?php checked($white_label_lock_enabled, true); ?>>
                                    <div class="w-11 h-6 bg-slate-300 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-slate-800"></div>
                                </label>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div>
                                    <label for="eep_white_label_password_new" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Set New Password', 'nexdirectory'); ?></label>
                                    <input type="password" id="eep_white_label_password_new" name="eep_white_label_password_new" value="" autocomplete="new-password" placeholder="<?php esc_attr_e('Minimum 8 characters', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                                <div>
                                    <label for="eep_white_label_password_confirm" class="block text-sm font-bold text-slate-800 mb-1"><?php esc_html_e('Confirm Password', 'nexdirectory'); ?></label>
                                    <input type="password" id="eep_white_label_password_confirm" name="eep_white_label_password_confirm" value="" autocomplete="new-password" placeholder="<?php esc_attr_e('Repeat password', 'nexdirectory'); ?>" class="block w-full px-4 py-2.5 text-sm border border-slate-300 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-500 rounded-lg text-slate-900 transition-colors">
                                </div>
                            </div>

                            <?php if ($white_label_is_unlocked || ($white_label_lock_enabled && $white_label_has_password)) : ?>
                                <div class="mt-6 flex flex-wrap gap-3">
                                    <?php if ($white_label_lock_enabled && $white_label_has_password) : ?>
                                        <button type="submit" form="eep-white-label-lock-form" class="inline-flex items-center px-4 py-2 border border-slate-800 rounded-lg shadow-sm text-sm font-bold text-white bg-slate-900 hover:bg-black transition-colors">
                                            <i class="fas fa-lock mr-2"></i> <?php esc_html_e('Lock Section Now', 'nexdirectory'); ?>
                                        </button>
                                    <?php endif; ?>
                                    <?php if ($white_label_is_unlocked && $white_label_unlock_token !== '') : ?>
                                        <button type="submit" form="eep-white-label-reset-defaults-form" onclick="return confirm('<?php echo esc_js(__('Reset all white label options to defaults?', 'nexdirectory')); ?>');" class="inline-flex items-center px-4 py-2 border border-slate-300 rounded-lg shadow-sm text-sm font-semibold text-red-600 bg-white hover:bg-red-50 hover:border-red-200 transition-colors">
                                            <i class="fas fa-trash-alt mr-2"></i> <?php esc_html_e('Reset All Defaults', 'nexdirectory'); ?>
                                        </button>
                                    <?php endif; ?>
                                </div>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                </section>

                <section class="eep-settings-panel space-y-6" id="eep-tab-logs" data-tab="advanced" data-subtab="logs">
                    <div class="mb-6 flex justify-between items-end">
                        <div>
                            <h2 class="text-2xl font-bold text-slate-900"><?php esc_html_e('Runtime Logs', 'nexdirectory'); ?></h2>
                            <p class="text-sm text-slate-500 mt-1"><?php esc_html_e('Review operational warnings/errors and clear logs.', 'nexdirectory'); ?></p>
                        </div>
                        <button type="submit" form="eep-clear-logs-form" onclick="return confirm('<?php echo esc_js(__('Clear all runtime logs?', 'nexdirectory')); ?>');" class="inline-flex items-center px-4 py-2 border border-slate-300 rounded-lg shadow-sm text-sm font-semibold text-slate-700 bg-white hover:bg-slate-50 transition-colors">
                            <i class="fas fa-eraser mr-2 text-slate-400"></i> <?php esc_html_e('Clear Logs', 'nexdirectory'); ?>
                        </button>
                    </div>

                    <div class="bg-white border border-slate-200 rounded-2xl shadow-sm overflow-hidden eep-settings-field eep-full">
                        <?php if (!empty($runtime_logs)) : ?>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-slate-200 text-left text-sm">
                                    <thead class="bg-slate-50">
                                        <tr>
                                            <th scope="col" class="px-6 py-3 font-bold text-slate-600 uppercase tracking-wider w-40"><?php esc_html_e('Time', 'nexdirectory'); ?></th>
                                            <th scope="col" class="px-6 py-3 font-bold text-slate-600 uppercase tracking-wider w-24"><?php esc_html_e('Level', 'nexdirectory'); ?></th>
                                            <th scope="col" class="px-6 py-3 font-bold text-slate-600 uppercase tracking-wider w-1/3"><?php esc_html_e('Message', 'nexdirectory'); ?></th>
                                            <th scope="col" class="px-6 py-3 font-bold text-slate-600 uppercase tracking-wider"><?php esc_html_e('Context', 'nexdirectory'); ?></th>
                                        </tr>
                                    </thead>
                                    <tbody class="divide-y divide-slate-100 bg-white font-mono text-[11px] text-slate-600">
                                        <?php foreach ((array) $runtime_logs as $entry) : ?>
                                            <?php
                                            $entry = is_array($entry) ? $entry : [];
                                            $entry_context = isset($entry['context']) && is_array($entry['context']) ? $entry['context'] : [];

                                            $level = strtoupper((string) ($entry['level'] ?? 'info'));
                                            $badge_class = 'bg-slate-100 text-slate-700 border-slate-200';
                                            if (in_array($level, ['ERROR', 'CRITICAL', 'FATAL', 'EMERGENCY'], true)) {
                                                $badge_class = 'bg-red-50 text-red-700 border-red-200';
                                            } elseif (in_array($level, ['WARNING', 'ALERT'], true)) {
                                                $badge_class = 'bg-amber-50 text-amber-700 border-amber-200';
                                            } elseif ($level === 'DEBUG') {
                                                $badge_class = 'bg-indigo-50 text-indigo-700 border-indigo-200';
                                            }
                                            ?>
                                            <tr class="hover:bg-slate-50/50 transition-colors">
                                                <td class="px-6 py-3 whitespace-nowrap text-slate-500"><?php echo esc_html((string) ($entry['time'] ?? '')); ?></td>
                                                <td class="px-6 py-3 whitespace-nowrap">
                                                    <span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold tracking-wider border <?php echo esc_attr($badge_class); ?>">
                                                        <?php echo esc_html($level); ?>
                                                    </span>
                                                </td>
                                                <td class="px-6 py-3 font-sans font-medium text-slate-800"><?php echo esc_html((string) ($entry['message'] ?? '')); ?></td>
                                                <td class="px-6 py-3">
                                                    <?php if (!empty($entry_context)) : ?>
                                                        <div class="bg-slate-50 p-2 rounded border border-slate-100 overflow-x-auto max-w-md">
                                                            <code><?php echo esc_html((string) wp_json_encode($entry_context)); ?></code>
                                                        </div>
                                                    <?php else : ?>
                                                        <span class="text-slate-400 italic">--</span>
                                                    <?php endif; ?>
                                                </td>
                                            </tr>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php else : ?>
                            <div class="p-12 text-center text-slate-500">
                                <i class="fas fa-clipboard-check text-4xl mb-3 text-slate-200"></i>
                                <p class="text-base font-semibold text-slate-700"><?php esc_html_e('No logs recorded yet.', 'nexdirectory'); ?></p>
                                <p class="text-sm"><?php esc_html_e('System operations are running smoothly.', 'nexdirectory'); ?></p>
                            </div>
                        <?php endif; ?>
                    </div>
                </section>
