<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }

/**
 * Admin tooltip registry.
 *
 * Provides contextual help tooltips with links to feature documentation
 * for every setting in the admin panel.
 */
class TNC_Flipbook_3D_Tooltips {

    /** @var string Site base for feature pages. */
    const SITE_URL = 'https://tncflipbook.com';

    /** @var string Single-feature path prefix (CPT rewrite slug). */
    const FEATURE_PATH = '/3d-feature/';

    /** @var string Group / index path prefix. */
    const FEATURES_PATH = '/3d-features/';

    /**
     * Resolve a tooltip url entry to a full URL.
     *
     * - Values starting with '/' are treated as site-relative paths (used for
     *   group / index pages, e.g. '/3d-features/protection/').
     * - All other values are feature slugs and resolve to /3d-feature/{slug}/.
     */
    private static function resolve_url( $value ) {
        $value = (string) $value;
        if ( '' === $value ) {
            return tncfb3d_utm( self::SITE_URL . self::FEATURES_PATH, 'feature-page', 'tooltip-features-index' );
        }
        if ( '/' === $value[0] ) {
            return tncfb3d_utm( self::SITE_URL . $value, 'feature-page', 'tooltip' );
        }
        return tncfb3d_utm( self::SITE_URL . self::FEATURE_PATH . $value . '/', 'feature-page', 'tooltip-' . sanitize_key( $value ) );
    }

    /**
     * Get tooltip data for a given key.
     *
     * @param  string $key Tooltip key.
     * @return array|null  { desc, url } or null if not found.
     */
    public static function get( $key ) {
        $tips = self::registry();
        return isset( $tips[ $key ] ) ? $tips[ $key ] : null;
    }

    /**
     * Output tooltip HTML for a given key.
     *
     * @param string $key Tooltip key.
     */
    public static function render( $key ) {
        $tip = self::get( $key );
        if ( ! $tip ) {
            return;
        }
        $url = self::resolve_url( $tip['url'] );
        printf(
            '<span class="tncfb-tip" tabindex="0" aria-label="%s">' .
                '<svg class="tncfb-tip-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>' .
                '<span class="tncfb-tip-popup">' .
                    '<span class="tncfb-tip-text">%s</span>' .
                    '<a href="%s" target="_blank" rel="noopener noreferrer" class="tncfb-tip-link">%s &rarr;</a>' .
                '</span>' .
            '</span>',
            esc_attr( wp_strip_all_tags( $tip['desc'] ) ),
            esc_html( $tip['desc'] ),
            esc_url( $url ),
            esc_html__( 'Learn more', 'tnc-flipbook-3d-lite' )
        );
    }

    /**
     * Complete registry of all tooltips.
     *
     * Each entry: 'key' => [ 'desc' => '...', 'url' => 'slug' ]
     * URL becomes: https://tncflipbook.com/3d-feature/{slug}/
     *
     * @return array
     */
    private static function registry() {
        return array(

            // ── Content Source ──────────────────────────────────────
            'source_type' => array(
                'desc' => __( 'Choose how to provide FlipBook content: single PDF, multiple PDFs combined, or individual images.', 'tnc-flipbook-3d-lite' ),
                'url'  => '/3d-features/',
            ),
            'single_pdf' => array(
                'desc' => __( 'Upload one PDF file. Each PDF page becomes a FlipBook page with text selection and link support.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'pdf-flipbook',
            ),
            'multi_pdf' => array(
                'desc' => __( 'Combine multiple PDFs into a single FlipBook. Drag to reorder chapters.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'multi-pdf',
            ),
            'image_gallery' => array(
                'desc' => __( 'Use images (JPG, PNG, WebP) as FlipBook pages. Each image becomes one page.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'image-flipbook',
            ),

            // ── Display / Appearance ───────────────────────────────
            'defaultViewMode' => array(
                'desc' => __( 'Choose the initial view: 3D FlipBook, vertical PDF viewer, horizontal carousel, or single page. Three products in one plugin.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'view-modes',
            ),
            'renderMode' => array(
                'desc' => __( 'Choose between 3D WebGL rendering with realistic page physics or a lightweight 2D CSS fallback.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'render-modes',
            ),
            'pageMode' => array(
                'desc' => __( 'Control how pages are paired into spreads. Cover First shows page 1 alone; Spreads First pairs 1-2 together.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'page-mode',
            ),
            'flipbookStyle' => array(
                'desc' => __( 'Visual book style: Default (paperback), Hardcover (rigid cover with spine), or Spiral (ring-bound). 3D mode only.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flipbook-styles',
            ),
            'flipEffect' => array(
                'desc' => __( 'Page turn animation: Realistic (lifelike curl with bending), Hard Cover (flat flip), Slide, or Fade transitions.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flip-effects',
            ),
            'curlIntensity' => array(
                'desc' => __( 'How dramatic the page bend is during the Realistic flip effect. Higher values create a more pronounced curl.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'curl-intensity',
            ),
            'pageShininess' => array(
                'desc' => __( 'Page surface reflectivity in 3D mode. Creates glossy magazine-like pages at higher values.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'page-shininess',
            ),
            'paperType' => array(
                'desc' => __( 'Paper texture appearance: Matte, Glossy, Textured, or Newsprint. Affects 3D lighting and reflections.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'paper-types',
            ),
            'flipSound' => array(
                'desc' => __( 'Sound effect on each Page Flip. Choose from 13 built-in sounds, upload a custom audio file, or disable entirely.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flip-sounds',
            ),
            'flipSoundCustom' => array(
                'desc' => __( 'Upload a custom MP3 or WAV file for the flip sound. Keep it under 1 second for best results.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flip-sounds',
            ),
            'toolbarLayout' => array(
                'desc' => __( 'Position and width of the toolbar. Choose between centered or full-width, at the top or bottom of the viewer.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'toolbar-layout',
            ),
            'chrome' => array(
                'desc' => __( 'Surface palette for toolbar, sidebars, and popups. Pick a tonal scheme (Slate, Paper, Midnight, Ocean, Forest, Glass, or Sepia).', 'tnc-flipbook-3d-lite' ),
                'url'  => 'color-schemes',
            ),
            'brandColor' => array(
                'desc' => __( 'Single accent color used for buttons, active icons, focus rings, and progress. Set this to your brand color.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'custom-colors',
            ),
            'colorMode' => array(
                'desc' => __( 'Initial polarity of the chrome on load. Auto picks the chrome\'s natural default. Readers can flip via the toolbar toggle.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'color-schemes',
            ),
            'language' => array(
                /* translators: %d: number of available UI languages. */
                'desc' => sprintf( __( 'UI language for all FlipBook text, buttons, and labels. Supports %d languages with automatic RTL detection.', 'tnc-flipbook-3d-lite' ), TNC_Flipbook_3D_Helpers::count_languages() ),
                'url'  => 'multi-language-support',
            ),
            'logo' => array(
                'desc' => __( 'Brand logo displayed on the loading screen and toolbar. Upload separate versions for dark and light themes.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'custom-logo',
            ),
            'customColors' => array(
                'desc' => __( 'Define your own primary, secondary, page background, and toolbar colors for a fully branded experience.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'custom-colors',
            ),

            // ── General Settings ───────────────────────────────────
            'linkTarget' => array(
                'desc' => __( 'Whether PDF links open in a new browser tab or the same tab as the FlipBook.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'pdf-links',
            ),
            'flipDuration' => array(
                'desc' => __( 'How long a single Page Flip animation takes in milliseconds. Lower values feel snappier.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flip-duration',
            ),
            'renderScale' => array(
                'desc' => __( 'PDF rendering resolution multiplier. Higher values produce crisper text but use more memory. 2 is recommended.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'render-scale',
            ),
            'deepLinking' => array(
                'desc' => __( 'Updates the URL hash on page change (#page/N) so readers can share or bookmark specific pages.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'deep-linking',
            ),
            'startupPanel' => array(
                'desc' => __( 'Automatically open the Table of Contents, Thumbnails, or Search sidebar when this FlipBook first loads. Set per FlipBook.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'open-panel-on-load',
            ),
            'startupSearchQuery' => array(
                'desc' => __( 'When the startup panel is set to Search, the sidebar opens pre-filled with this keyword and shows matching results right away.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'open-panel-on-load',
            ),
            'startupPanelOnMobile' => array(
                'desc' => __( 'Whether the startup panel also opens on phones and small screens, where sidebars overlay the page. Turn off to limit it to desktop.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'open-panel-on-load',
            ),

            // ── Toolbar Items ──────────────────────────────────────
            'toolbar_share' => array(
                'desc' => __( 'Share button with social media links and a copy-URL option for easy FlipBook sharing.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'social-sharing',
            ),
            'toolbar_download' => array(
                'desc' => __( 'Download button lets readers save the PDF or individual pages to their device.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'download-button',
            ),
            'toolbar_print' => array(
                'desc' => __( 'Print button for sending FlipBook pages directly to a printer.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'print-button',
            ),
            'toolbar_search' => array(
                'desc' => __( 'Full-text search across all pages with highlighted results and instant navigation.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'search',
            ),
            'toolbar_zoom' => array(
                'desc' => __( 'Zoom controls for magnifying page content. Readers can also pinch-zoom on touch devices.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'zoom',
            ),
            'toolbar_readingMode' => array(
                'desc' => __( 'Reading mode expands the current page to fill the screen for comfortable reading.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'reading-mode',
            ),
            'toolbar_readAloud' => array(
                'desc' => __( 'Text-to-speech with sentence-level sync. Supports browser voices and cloud AI providers.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'read-aloud',
            ),
            'toolbar_fullscreen' => array(
                'desc' => __( 'Toggle fullscreen mode for an immersive reading experience.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'fullscreen',
            ),
            'toolbar_themeToggle' => array(
                'desc' => __( 'Let readers switch between dark and light themes while reading.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'dark-light-mode',
            ),
            'toolbar_pageIndicator' => array(
                'desc' => __( 'Shows the current page number and total pages. Click to jump to a specific page.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'deep-linking',
            ),
            'toolbar_logo' => array(
                'desc' => __( 'Display your brand logo in the toolbar for a professional, white-labeled appearance.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'custom-logo',
            ),
            'toolbar_close' => array(
                'desc' => __( 'Close button for popup/lightbox mode. Returns the reader to the parent page.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'shortcodes',
            ),
            'toolbar_navigation' => array(
                'desc' => __( 'Previous/next arrows for navigating between pages, plus first/last page buttons.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'keyboard-shortcuts',
            ),
            'toolbar_autoPlay' => array(
                'desc' => __( 'Auto-play automatically flips pages at a set interval for hands-free browsing.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'auto-play',
            ),
            'toolbar_sound' => array(
                'desc' => __( 'Mute/unmute button for controlling the Page Flip sound effect.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flip-sounds',
            ),
            'toolbar_singlePage' => array(
                'desc' => __( 'Toggle between double-page spread and single-page view mode.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'single-page-mode',
            ),
            'toolbar_bookmarks' => array(
                'desc' => __( 'Readers can bookmark pages and quickly return to them from the bookmarks sidebar.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'bookmarks',
            ),
            'toolbar_notes' => array(
                'desc' => __( 'Sticky note annotations that readers can place on any page for personal notes.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'notes',
            ),
            'toolbar_thumbnails' => array(
                'desc' => __( 'Page thumbnail sidebar for quick visual navigation across all pages.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'thumbnails',
            ),
            'toolbar_viewModes' => array(
                'desc' => __( 'Switch between FlipBook, vertical scroll, horizontal scroll, and form viewer modes.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'view-modes',
            ),
            'toolbar_formViewer' => array(
                'desc' => __( 'PDF form filling mode for interactive PDF forms with text fields, checkboxes, and dropdowns.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'form-filling-mode',
            ),
            'toolbar_flipbookStyles' => array(
                'desc' => __( 'Let readers switch between Default, Hardcover, and Spiral book styles in real-time.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'flipbook-styles',
            ),
            'toolbar_tilt' => array(
                'desc' => __( 'Tilt the 3D book for a different viewing angle. Great for showcasing covers.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'tilt-rotate',
            ),
            'toolbar_rotate' => array(
                'desc' => __( 'Rotate the 3D book left or right. Works in 3D render mode only.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'tilt-rotate',
            ),
            'toolbar_rtl' => array(
                'desc' => __( 'Right-to-left reading mode for Arabic, Hebrew, and other RTL languages. Reverses page order.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'rtl-support',
            ),

            // ── Protection ─────────────────────────────────────────
            'protection_admin_bypass' => array(
                'desc' => __( 'Disable all protection features for logged-in admins so you can test and review content freely.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'admin-bypass',
            ),
            'watermark' => array(
                'desc' => __( 'Overlay text or image watermarks on every page to deter unauthorized copying and screenshots.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'watermark',
            ),
            'copy_prevention' => array(
                'desc' => __( 'Block right-click, keyboard shortcuts, image dragging, text selection, and hide the download button.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'copy-prevention',
            ),
            'devtools_detection' => array(
                'desc' => __( 'Detect when browser developer tools are opened and blur the content or show a warning message.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'devtools-detection',
            ),
            'source_path_security' => array(
                'desc' => __( 'All PDF and image files are served via a secure REST proxy. Source file paths are never exposed to the browser.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'source-path-security',
            ),

            // ── SEO ────────────────────────────────────────────────
            'seo_title' => array(
                'desc' => __( 'Custom title for search engine results. Recommended under 60 characters.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'seo',
            ),
            'seo_description' => array(
                'desc' => __( 'Meta description shown in search results. Recommended 50-160 characters.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'seo',
            ),
            'seo_visibility' => array(
                'desc' => __( 'Control whether this FlipBook is visible to search engines (index) or hidden (noindex).', 'tnc-flipbook-3d-lite' ),
                'url'  => 'seo',
            ),
            'seo_canonical' => array(
                'desc' => __( 'Set a canonical URL if this FlipBook content also exists at another address.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'seo',
            ),
            'seo_og_image' => array(
                'desc' => __( 'Image shown when the FlipBook is shared on social media. Recommended 1200x630px.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'social-sharing',
            ),

            // ── Read Aloud (TTS) ───────────────────────────────────
            'tts_generated_audio' => array(
                'desc' => __( 'Pre-generate AI-powered voice audio with sentence-level sync for perfect read-aloud playback.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'read-aloud',
            ),
            'tts_speed' => array(
                'desc' => __( 'Default playback speed for Read Aloud. Readers can adjust this from the player controls.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'read-aloud',
            ),
            'tts_autoflip' => array(
                'desc' => __( 'Automatically flip to the next page when the current page finishes reading aloud.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'read-aloud',
            ),

            // ── Advanced ───────────────────────────────────────────
            'page_videos' => array(
                'desc' => __( 'Embed video overlays on specific pages. Videos play in-place on top of the FlipBook page.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'page-videos',
            ),
            'hotspots' => array(
                'desc' => __( 'Add interactive hotspots on pages: links, tooltips, images, videos, iframes, and custom HTML.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'hotspots',
            ),
            'toc_custom' => array(
                'desc' => __( 'Add custom table of contents entries. Merged with PDF outline for PDF FlipBooks.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'table-of-contents',
            ),
            'ga4' => array(
                'desc' => __( 'Track FlipBook views, Page Flips, downloads, and other interactions with Google Analytics 4.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'google-analytics',
            ),
            'custom_css' => array(
                'desc' => __( 'Add custom CSS that loads inside the FlipBook viewer for styling tweaks and branding.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'custom-css',
            ),

            // ── Sidebar / Embed ────────────────────────────────────
            'shortcode' => array(
                'desc' => __( 'Embed FlipBooks using shortcodes: iframe embed, text/button link, or image link with popup support.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'shortcodes',
            ),
            'container_size' => array(
                'desc' => __( 'Default width and height for the FlipBook embed container. Accepts CSS values: px, %, vh.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'container-size',
            ),

            // ── WooCommerce ────────────────────────────────────────
            'woo_product' => array(
                'desc' => __( 'Link products to restrict FlipBook access. Only customers who purchased the product can read the full FlipBook.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'woocommerce-integration',
            ),
            'woo_preview_pages' => array(
                'desc' => __( 'Number of free preview pages before the purchase gate appears. Set to 0 for full access.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'woocommerce-integration',
            ),
            'woo_purchase_overlay' => array(
                'desc' => __( 'Customize the overlay message, button text, and URL shown when readers hit the preview limit.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'woocommerce-integration',
            ),

            // ── Accessibility ──────────────────────────────────────
            'a11y_enabled' => array(
                'desc' => __( 'Master switch for WCAG 2.1 AA accessibility features including keyboard navigation and screen reader support.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_skipLinks' => array(
                'desc' => __( 'Hidden skip-to-content links for keyboard and screen reader users to bypass navigation.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_keyboardShortcuts' => array(
                'desc' => __( 'Arrow keys, spacebar, and other shortcuts for full keyboard-only FlipBook navigation.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'keyboard-shortcuts',
            ),
            'a11y_screenReaderAnnouncements' => array(
                'desc' => __( 'ARIA live region announcements for page changes and actions for screen reader users.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_focusIndicators' => array(
                'desc' => __( 'Visible focus outlines on interactive elements for keyboard navigation.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_reducedMotion' => array(
                'desc' => __( 'Respects the OS reduced motion preference by disabling Page Flip animations.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_highContrastMode' => array(
                'desc' => __( 'Adapts the UI when the browser is in high contrast or forced-colors mode.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'accessibility',
            ),
            'a11y_keyboardShortcutsHelp' => array(
                'desc' => __( 'Help panel listing all keyboard shortcuts, opened by pressing the ? key.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'keyboard-shortcuts',
            ),

            // ── Integrations ───────────────────────────────────────
            'ga4MeasurementId' => array(
                'desc' => __( 'Google Analytics 4 Measurement ID for tracking FlipBook interactions and engagement.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'google-analytics',
            ),
            'tts_google_key' => array(
                'desc' => __( 'Google Cloud Text-to-Speech API key for high-quality, natural-sounding voice generation.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'google-cloud-tts',
            ),
            'tts_elevenlabs_key' => array(
                'desc' => __( 'ElevenLabs API key for premium AI voices with the most natural intonation and emotion.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'elevenlabs-tts',
            ),
            'tts_azure_key' => array(
                'desc' => __( 'Azure Speech API key for Microsoft neural voices with multilingual support.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'azure-speech-tts',
            ),
            'tts_amazon_key' => array(
                'desc' => __( 'Amazon Polly access credentials for AWS neural and standard voices.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'amazon-polly-tts',
            ),
            'openai_key' => array(
                'desc' => __( 'OpenAI API key for text-to-speech, AI chatbot, and other AI-powered features.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'openai-integration',
            ),
            'anthropic_key' => array(
                'desc' => __( 'Anthropic API key for Claude-powered AI features like document chat and summarization.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'anthropic-integration',
            ),
            'google_ai_key' => array(
                'desc' => __( 'Google Gemini API key for AI-powered features using Google\'s Gemini models.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'gemini-integration',
            ),

            // ── Advanced Settings ──────────────────────────────────
            'delete_data_on_uninstall' => array(
                'desc' => __( 'When enabled, all FlipBook data, settings, and custom post types are permanently deleted upon plugin uninstall.', 'tnc-flipbook-3d-lite' ),
                'url'  => '/3d-features/',
            ),

            // ── Addons: SEO ────────────────────────────────────────
            'seo_addon_schema' => array(
                'desc' => __( 'Enhanced Schema.org DigitalDocument markup with author, publisher, and citation meta for rich search results.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'seo',
            ),
            'seo_addon_text_extract' => array(
                'desc' => __( 'Server-side PDF text extraction for search engine crawlers and AI-powered features.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'text-extraction',
            ),
            'seo_addon_llms' => array(
                'desc' => __( 'AI/LLM-friendly llms.txt endpoint for discoverability by ChatGPT, Perplexity, and other AI tools.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'text-extraction',
            ),

            // ── Addons: Chatbot ────────────────────────────────────
            'chatbot' => array(
                'desc' => __( 'AI chat widget that answers reader questions based on the FlipBook document content.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'ai-chatbot',
            ),
            'chatbot_enabled' => array(
                'desc' => __( 'Enable or disable the AI chatbot for this specific FlipBook.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'ai-chatbot',
            ),
            'chatbot_welcome' => array(
                'desc' => __( 'Custom welcome message shown when the chatbot opens. Leave empty for the global default.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'ai-chatbot',
            ),

            // ── Addons: Stamper ────────────────────────────────────
            'stamper' => array(
                'desc' => __( 'Collect visitor details before download and stamp every PDF page with their information for traceability.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'stamped-downloads',
            ),
            'stamper_enabled' => array(
                'desc' => __( 'When enabled, the download button opens a form. Visitor details are stamped on every page before download.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'stamped-downloads',
            ),
            'stamper_template' => array(
                'desc' => __( 'Stamp template with variables: {name}, {email}, {date}, {time}, {title}, {ip}.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'stamped-downloads',
            ),

            // ── Addons: Lead Capture ───────────────────────────────
            'lead_capture' => array(
                'desc' => __( 'Gate FlipBook access behind an email/name form with double opt-in verification.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'lead-capture',
            ),

            // ── Addons: Monetize ───────────────────────────────────
            'monetize' => array(
                'desc' => __( 'Display ads in 6 positions: preroll, banner, sidebar, overlay, inter-page, and endroll.', 'tnc-flipbook-3d-lite' ),
                'url'  => 'monetization',
            ),
        );
    }
}

/**
 * Shorthand function for rendering a tooltip.
 *
 * Usage in admin views: <?php tncfb3d_tip( 'flipEffect' ); ?>
 *
 * @param string $key Tooltip registry key.
 */
function tncfb3d_tip( $key ) {
    TNC_Flipbook_3D_Tooltips::render( $key );
}
