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

class FORMFORGE_Templates {
    private static $instance = null;
    public static function instance() { if (!self::$instance) self::$instance = new self(); return self::$instance; }
    private function __construct() {}

    /**
 * Get all template categories with metadata
 */
    public static function get_categories() {
        $templates = self::get_all();
        $cats = [];
        foreach ($templates as $tpl) {
            $cat = $tpl['category'];
            if (!isset($cats[$cat])) {
                $cats[$cat] = ['slug' => $cat, 'label' => self::category_label($cat), 'icon' => self::category_icon($cat), 'count' => 0];
            }
            $cats[$cat]['count']++;
        }
        return $cats;
    }

    /**
 * Get templates filtered by category
 */
    public static function get_by_category($category) {
        return array_filter(self::get_all(), function($tpl) use ($category) {
            return $tpl['category'] === $category;
        });
    }

    /**
 * Category labels
 */
    private static function category_label($slug) {
        $labels = [
            'contact'       => __('Contact', 'formforge'),
            'feedback'      => __('Feedback & Reviews', 'formforge'),
            'registration'  => __('Registration & Signup', 'formforge'),
            'survey'        => __('Surveys & Research', 'formforge'),
            'order'         => __('Orders & Payments', 'formforge'),
            'application'   => __('Applications', 'formforge'),
            'healthcare'    => __('Healthcare', 'formforge'),
            'education'     => __('Education', 'formforge'),
            'real-estate'   => __('Real Estate', 'formforge'),
            'marketing'     => __('Marketing', 'formforge'),
            'hr'            => __('HR & Internal', 'formforge'),
            'event'         => __('Events', 'formforge'),
            'ecommerce'     => __('E-Commerce', 'formforge'),
            'legal'         => __('Legal & Compliance', 'formforge'),
            'nonprofit'     => __('Nonprofit', 'formforge'),
            'restaurant'    => __('Restaurant & Food', 'formforge'),
            'fitness'       => __('Fitness & Wellness', 'formforge'),
            'travel'        => __('Travel & Hospitality', 'formforge'),
            'beauty'        => __('Beauty & Salon', 'formforge'),
            'automotive'    => __('Automotive', 'formforge'),
            'pet'           => __('Pets & Veterinary', 'formforge'),
            'church'        => __('Church & Ministry', 'formforge'),
            'technology'    => __('Technology & SaaS', 'formforge'),
            'photography'   => __('Photography', 'formforge'),
            'wedding'       => __('Wedding', 'formforge'),
            'government'    => __('Government & Public', 'formforge'),
            'insurance'     => __('Insurance', 'formforge'),
        ];
        return $labels[$slug] ?? ucfirst($slug);
    }

    private static function category_icon($slug) {
        $icons = [
            'contact'       => 'email',
            'feedback'      => 'star-filled',
            'registration'  => 'admin-users',
            'survey'        => 'forms',
            'order'         => 'cart',
            'application'   => 'id-alt',
            'healthcare'    => 'heart',
            'education'     => 'welcome-learn-more',
            'real-estate'   => 'admin-home',
            'marketing'     => 'megaphone',
            'hr'            => 'groups',
            'event'         => 'calendar-alt',
            'ecommerce'     => 'store',
            'legal'         => 'shield',
            'nonprofit'     => 'universal-access',
            'restaurant'    => 'food',
            'fitness'       => 'heart',
            'travel'        => 'airplane',
            'beauty'        => 'art',
            'automotive'    => 'car',
            'pet'           => 'pets',
            'church'        => 'admin-home',
            'technology'    => 'laptop',
            'photography'   => 'camera',
            'wedding'       => 'heart',
            'government'    => 'building',
            'insurance'     => 'shield',
        ];
        return $icons[$slug] ?? 'forms';
    }

    /**
 * All templates, organized by category
 */
    public static function get_all() {
        static $cache = null;
        if ($cache !== null) return $cache;

        $cache = array_merge(
            self::contact_templates(),
            self::feedback_templates(),
            self::registration_templates(),
            self::survey_templates(),
            self::order_templates(),
            self::application_templates(),
            self::healthcare_templates(),
            self::education_templates(),
            self::real_estate_templates(),
            self::marketing_templates(),
            self::hr_templates(),
            self::event_templates(),
            self::ecommerce_templates(),
            self::legal_templates(),
            self::nonprofit_templates(),
            self::load_file_templates()
        );

        // Filter out premium templates if user does not have Pro access
        if (!FORMFORGE_License::instance()->can('advanced_templates')) {
            $cache = array_filter($cache, function ($tpl) {
                return empty($tpl['premium']);
            });
        }

        return $cache;
    }

    /**
 * Load templates from external PHP files in /templates/ directory
 */
    private static function load_file_templates() {
        $dir = __DIR__ . '/templates/';
        if (!is_dir($dir)) return [];
        $all = [];
        foreach (glob($dir . '*.php') as $file) {
            $tpls = include $file;
            if (is_array($tpls)) {
                $all = array_merge($all, $tpls);
            }
        }
        return $all;
    }

    // =================================================================
    // CONTACT (~8)
    // =================================================================
    private static function contact_templates() {
        return [
            'contact' => [
                'title' => __('Basic Contact', 'formforge'),
                'description' => __('Simple contact form with name, email, and message', 'formforge'),
                'icon' => 'email', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email Address', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => false],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'required' => true, 'rows' => 5],
                ],
            ],
            'contact_advanced' => [
                'title' => __('Advanced Contact', 'formforge'),
                'description' => __('Contact form with department selection and priority', 'formforge'),
                'icon' => 'email-alt', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                    ['id' => 'department', 'type' => 'select', 'label' => 'Department', 'required' => true, 'options' => [
                        ['value' => 'sales', 'label' => 'Sales'], ['value' => 'support', 'label' => 'Support'],
                        ['value' => 'billing', 'label' => 'Billing'], ['value' => 'general', 'label' => 'General'],
                    ]],
                    ['id' => 'subject', 'type' => 'text', 'label' => 'Subject', 'required' => true],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'required' => true, 'rows' => 5],
                    ['id' => 'attachment', 'type' => 'file_upload', 'label' => 'Attachment', 'accept' => '.jpg,.png,.pdf'],
                ],
            ],
            'callback_request' => [
                'title' => __('Callback Request', 'formforge'),
                'description' => __('Request a phone call back at a preferred time', 'formforge'),
                'icon' => 'phone', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone Number', 'required' => true],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Preferred Date', 'required' => true],
                    ['id' => 'time', 'type' => 'time', 'label' => 'Preferred Time', 'required' => true],
                    ['id' => 'topic', 'type' => 'text', 'label' => 'Topic'],
                ],
            ],
            'quick_question' => [
                'title' => __('Quick Question', 'formforge'),
                'description' => __('Minimal form — email + one question', 'formforge'),
                'icon' => 'editor-help', 'category' => 'contact',
                'fields' => [
                    ['id' => 'email', 'type' => 'email', 'label' => 'Your Email', 'required' => true],
                    ['id' => 'question', 'type' => 'textarea', 'label' => 'Your Question', 'required' => true, 'rows' => 3],
                ],
            ],
            'department_contact' => [
                'title' => __('Department Contact', 'formforge'),
                'description' => __('Route messages to different teams', 'formforge'),
                'icon' => 'networking', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'text', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'dept', 'type' => 'radio', 'label' => 'Department', 'required' => true, 'options' => [
                        ['value' => 'sales', 'label' => 'Sales'], ['value' => 'engineering', 'label' => 'Engineering'],
                        ['value' => 'marketing', 'label' => 'Marketing'], ['value' => 'hr', 'label' => 'Human Resources'],
                        ['value' => 'finance', 'label' => 'Finance'],
                    ]],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'required' => true, 'rows' => 4],
                ],
            ],
            'multi_location' => [
                'title' => __('Multi-Location Contact', 'formforge'),
                'description' => __('Contact form for businesses with multiple offices', 'formforge'),
                'icon' => 'location-alt', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'location', 'type' => 'select', 'label' => 'Office Location', 'required' => true, 'options' => [
                        ['value' => 'new-york', 'label' => 'New York'], ['value' => 'london', 'label' => 'London'],
                        ['value' => 'tokyo', 'label' => 'Tokyo'], ['value' => 'berlin', 'label' => 'Berlin'],
                    ]],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'required' => true, 'rows' => 4],
                ],
            ],
            'emergency_contact' => [
                'title' => __('Emergency Contact', 'formforge'),
                'description' => __('Urgent contact form with priority escalation', 'formforge'),
                'icon' => 'warning', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'severity', 'type' => 'select', 'label' => 'Severity', 'required' => true, 'options' => [
                        ['value' => 'critical', 'label' => 'Critical — System Down'],
                        ['value' => 'high', 'label' => 'High — Major Impact'],
                        ['value' => 'medium', 'label' => 'Medium — Partial Impact'],
                    ]],
                    ['id' => 'description', 'type' => 'textarea', 'label' => 'Describe the Issue', 'required' => true, 'rows' => 4],
                ],
            ],
            'contact_with_map' => [
                'title' => __('Contact with Address', 'formforge'),
                'description' => __('Contact form with visitor address collection', 'formforge'),
                'icon' => 'location', 'category' => 'contact',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Your Address'],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'required' => true, 'rows' => 4],
                ],
            ],
        ];
    }

    // =================================================================
    // FEEDBACK & REVIEWS (~8)
    // =================================================================
    private static function feedback_templates() {
        return [
            'feedback' => [
                'title' => __('Customer Feedback', 'formforge'),
                'description' => __('Collect customer feedback with rating', 'formforge'),
                'icon' => 'star-filled', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'name', 'type' => 'text', 'label' => 'Name'],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'rating', 'type' => 'rating', 'label' => 'Overall Rating', 'required' => true, 'max_stars' => 5],
                    ['id' => 'category', 'type' => 'select', 'label' => 'Category', 'options' => [
                        ['value' => 'product', 'label' => 'Product'], ['value' => 'service', 'label' => 'Service'], ['value' => 'support', 'label' => 'Support'],
                    ]],
                    ['id' => 'comments', 'type' => 'textarea', 'label' => 'Comments', 'rows' => 4],
                ],
            ],
            'product_review' => [
                'title' => __('Product Review', 'formforge'),
                'description' => __('Detailed product review with multiple ratings', 'formforge'),
                'icon' => 'products', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'name', 'type' => 'text', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'product', 'type' => 'text', 'label' => 'Product Name', 'required' => true],
                    ['id' => 'rating_quality', 'type' => 'rating', 'label' => 'Quality', 'required' => true, 'max_stars' => 5],
                    ['id' => 'rating_value', 'type' => 'rating', 'label' => 'Value for Money', 'required' => true, 'max_stars' => 5],
                    ['id' => 'rating_ease', 'type' => 'rating', 'label' => 'Ease of Use', 'max_stars' => 5],
                    ['id' => 'pros', 'type' => 'textarea', 'label' => 'Pros', 'rows' => 3],
                    ['id' => 'cons', 'type' => 'textarea', 'label' => 'Cons', 'rows' => 3],
                    ['id' => 'recommend', 'type' => 'radio', 'label' => 'Would you recommend?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'], ['value' => 'maybe', 'label' => 'Maybe'],
                    ]],
                ],
            ],
            'nps_survey' => [
                'title' => __('NPS Survey', 'formforge'),
                'description' => __('Net Promoter Score — how likely to recommend (0-10)', 'formforge'),
                'icon' => 'chart-bar', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'score', 'type' => 'range', 'label' => 'How likely are you to recommend us? (0-10)', 'required' => true, 'min' => 0, 'max' => 10],
                    ['id' => 'reason', 'type' => 'textarea', 'label' => 'What is the primary reason for your score?', 'rows' => 3],
                    ['id' => 'improve', 'type' => 'textarea', 'label' => 'What could we do better?', 'rows' => 3],
                ],
            ],
            'testimonial' => [
                'title' => __('Testimonial', 'formforge'),
                'description' => __('Collect customer testimonials for your website', 'formforge'),
                'icon' => 'format-quote', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company / Title'],
                    ['id' => 'photo', 'type' => 'file_upload', 'label' => 'Your Photo', 'accept' => '.jpg,.png,.webp'],
                    ['id' => 'rating', 'type' => 'rating', 'label' => 'Rating', 'max_stars' => 5],
                    ['id' => 'testimonial', 'type' => 'textarea', 'label' => 'Your Testimonial', 'required' => true, 'rows' => 5],
                    ['id' => 'permission', 'type' => 'checkbox', 'label' => 'I allow my testimonial to be published', 'required' => true],
                ],
            ],
            'app_review' => [
                'title' => __('App Review', 'formforge'),
                'description' => __('Mobile or web application review form', 'formforge'),
                'icon' => 'smartphone', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'app_version', 'type' => 'text', 'label' => 'App Version'],
                    ['id' => 'device', 'type' => 'select', 'label' => 'Device', 'options' => [
                        ['value' => 'ios', 'label' => 'iPhone/iPad'], ['value' => 'android', 'label' => 'Android'],
                        ['value' => 'web', 'label' => 'Web Browser'], ['value' => 'desktop', 'label' => 'Desktop App'],
                    ]],
                    ['id' => 'rating', 'type' => 'rating', 'label' => 'Overall Rating', 'required' => true, 'max_stars' => 5],
                    ['id' => 'bug', 'type' => 'radio', 'label' => 'Did you encounter bugs?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'feedback', 'type' => 'textarea', 'label' => 'Your Feedback', 'required' => true, 'rows' => 4],
                ],
            ],
            'service_rating' => [
                'title' => __('Service Rating', 'formforge'),
                'description' => __('Rate various aspects of service quality', 'formforge'),
                'icon' => 'star-half', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'service_type', 'type' => 'text', 'label' => 'Service Used', 'required' => true],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Date of Service'],
                    ['id' => 'speed', 'type' => 'rating', 'label' => 'Speed', 'max_stars' => 5],
                    ['id' => 'quality', 'type' => 'rating', 'label' => 'Quality', 'max_stars' => 5],
                    ['id' => 'communication', 'type' => 'rating', 'label' => 'Communication', 'max_stars' => 5],
                    ['id' => 'value', 'type' => 'rating', 'label' => 'Value for Money', 'max_stars' => 5],
                    ['id' => 'comments', 'type' => 'textarea', 'label' => 'Additional Comments', 'rows' => 3],
                ],
            ],
            'course_evaluation' => [
                'title' => __('Course Evaluation', 'formforge'),
                'description' => __('Evaluate training or course quality', 'formforge'),
                'icon' => 'welcome-learn-more', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'course', 'type' => 'text', 'label' => 'Course Name', 'required' => true],
                    ['id' => 'instructor', 'type' => 'text', 'label' => 'Instructor Name'],
                    ['id' => 'content_rating', 'type' => 'rating', 'label' => 'Content Quality', 'max_stars' => 5],
                    ['id' => 'instructor_rating', 'type' => 'rating', 'label' => 'Instructor Effectiveness', 'max_stars' => 5],
                    ['id' => 'materials', 'type' => 'rating', 'label' => 'Learning Materials', 'max_stars' => 5],
                    ['id' => 'recommend', 'type' => 'radio', 'label' => 'Would you recommend this course?', 'options' => [
                        ['value' => 'yes', 'label' => 'Definitely'], ['value' => 'maybe', 'label' => 'Maybe'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'suggestions', 'type' => 'textarea', 'label' => 'Suggestions for improvement', 'rows' => 4],
                ],
            ],
            'website_feedback' => [
                'title' => __('Website Feedback', 'formforge'),
                'description' => __('Collect feedback about website usability', 'formforge'),
                'icon' => 'admin-site', 'category' => 'feedback',
                'fields' => [
                    ['id' => 'page_url', 'type' => 'url', 'label' => 'Which page?'],
                    ['id' => 'ease', 'type' => 'rating', 'label' => 'Ease of Use', 'max_stars' => 5],
                    ['id' => 'design', 'type' => 'rating', 'label' => 'Design & Layout', 'max_stars' => 5],
                    ['id' => 'found', 'type' => 'radio', 'label' => 'Did you find what you were looking for?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'partially', 'label' => 'Partially'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'comments', 'type' => 'textarea', 'label' => 'Suggestions', 'rows' => 3],
                ],
            ],
        ];
    }

    // =================================================================
    // REGISTRATION & SIGNUP (~8)
    // =================================================================
    private static function registration_templates() {
        return [
            'registration' => [
                'title' => __('User Registration', 'formforge'),
                'description' => __('Account or event registration', 'formforge'),
                'icon' => 'admin-users', 'category' => 'registration',
                'fields' => [
                    ['id' => 'fname', 'type' => 'text', 'label' => 'First Name', 'required' => true],
                    ['id' => 'lname', 'type' => 'text', 'label' => 'Last Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company'],
                    ['id' => 'role', 'type' => 'select', 'label' => 'Role', 'options' => [
                        ['value' => 'attendee', 'label' => 'Attendee'], ['value' => 'speaker', 'label' => 'Speaker'], ['value' => 'sponsor', 'label' => 'Sponsor'],
                    ]],
                ],
            ],
            'event_registration' => [
                'title' => __('Event Registration', 'formforge'),
                'description' => __('Register attendees for conferences, meetups', 'formforge'),
                'icon' => 'calendar-alt', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'ticket', 'type' => 'select', 'label' => 'Ticket Type', 'required' => true, 'options' => [
                        ['value' => 'general', 'label' => 'General Admission'], ['value' => 'vip', 'label' => 'VIP'], ['value' => 'student', 'label' => 'Student'],
                    ]],
                    ['id' => 'dietary', 'type' => 'select', 'label' => 'Dietary Requirements', 'options' => [
                        ['value' => 'none', 'label' => 'None'], ['value' => 'vegetarian', 'label' => 'Vegetarian'],
                        ['value' => 'vegan', 'label' => 'Vegan'], ['value' => 'gluten-free', 'label' => 'Gluten-free'],
                    ]],
                    ['id' => 'special', 'type' => 'textarea', 'label' => 'Special Requirements', 'rows' => 3],
                ],
            ],
            'course_enrollment' => [
                'title' => __('Course Enrollment', 'formforge'),
                'description' => __('Online course or workshop enrollment', 'formforge'),
                'icon' => 'welcome-learn-more', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'course', 'type' => 'select', 'label' => 'Course', 'required' => true, 'options' => [
                        ['value' => 'beginner', 'label' => 'Beginner'], ['value' => 'intermediate', 'label' => 'Intermediate'], ['value' => 'advanced', 'label' => 'Advanced'],
                    ]],
                    ['id' => 'experience', 'type' => 'textarea', 'label' => 'Previous Experience', 'rows' => 3],
                    ['id' => 'goals', 'type' => 'textarea', 'label' => 'Learning Goals', 'rows' => 3],
                ],
            ],
            'membership_signup' => [
                'title' => __('Membership Signup', 'formforge'),
                'description' => __('Club, gym, or organization membership', 'formforge'),
                'icon' => 'groups', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth'],
                    ['id' => 'plan', 'type' => 'radio', 'label' => 'Membership Plan', 'required' => true, 'options' => [
                        ['value' => 'monthly', 'label' => 'Monthly'], ['value' => 'annual', 'label' => 'Annual'], ['value' => 'lifetime', 'label' => 'Lifetime'],
                    ]],
                    ['id' => 'terms', 'type' => 'checkbox', 'label' => 'I agree to the terms and conditions', 'required' => true],
                ],
            ],
            'webinar_registration' => [
                'title' => __('Webinar Registration', 'formforge'),
                'description' => __('Register for online webinars', 'formforge'),
                'icon' => 'video-alt3', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company'],
                    ['id' => 'role', 'type' => 'text', 'label' => 'Job Title'],
                    ['id' => 'questions', 'type' => 'textarea', 'label' => 'Questions for the speaker', 'rows' => 3],
                ],
            ],
            'conference_registration' => [
                'title' => __('Conference Registration', 'formforge'),
                'description' => __('Multi-day conference with session selection', 'formforge'),
                'icon' => 'megaphone', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'company', 'type' => 'text', 'label' => 'Organization', 'required' => true],
                    ['id' => 'badge_name', 'type' => 'text', 'label' => 'Badge Name'],
                    ['id' => 'sessions', 'type' => 'checkbox', 'label' => 'Sessions of Interest', 'options' => [
                        ['value' => 'keynote', 'label' => 'Keynote'], ['value' => 'workshop', 'label' => 'Workshops'],
                        ['value' => 'networking', 'label' => 'Networking'], ['value' => 'hackathon', 'label' => 'Hackathon'],
                    ]],
                    ['id' => 'dietary', 'type' => 'text', 'label' => 'Dietary Needs'],
                ],
            ],
            'workshop_signup' => [
                'title' => __('Workshop Signup', 'formforge'),
                'description' => __('Hands-on workshop registration', 'formforge'),
                'icon' => 'hammer', 'category' => 'registration',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'skill_level', 'type' => 'radio', 'label' => 'Skill Level', 'required' => true, 'options' => [
                        ['value' => 'beginner', 'label' => 'Beginner'], ['value' => 'intermediate', 'label' => 'Intermediate'], ['value' => 'advanced', 'label' => 'Advanced'],
                    ]],
                    ['id' => 'laptop', 'type' => 'radio', 'label' => 'Bringing your own laptop?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No, I need one provided'],
                    ]],
                ],
            ],
            'waitlist' => [
                'title' => __('Waitlist', 'formforge'),
                'description' => __('Join a waitlist for a product or event', 'formforge'),
                'icon' => 'clock', 'category' => 'registration',
                'fields' => [
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email Address', 'required' => true],
                    ['id' => 'name', 'type' => 'text', 'label' => 'Name'],
                    ['id' => 'interest', 'type' => 'textarea', 'label' => 'Why are you interested?', 'rows' => 3],
                    ['id' => 'notify', 'type' => 'checkbox', 'label' => 'Notify me when available', 'required' => true],
                ],
            ],
        ];
    }

    // =================================================================
    // SURVEYS & RESEARCH (~10)
    // =================================================================
    private static function survey_templates() {
        return [
            'customer_satisfaction' => [
                'title' => __('Customer Satisfaction (CSAT)', 'formforge'),
                'description' => __('Measure customer satisfaction with your service', 'formforge'),
                'icon' => 'smiley', 'category' => 'survey',
                'fields' => [
                    ['id' => 'satisfaction', 'type' => 'rating', 'label' => 'How satisfied are you?', 'required' => true, 'max_stars' => 5],
                    ['id' => 'aspect', 'type' => 'select', 'label' => 'What aspect?', 'options' => [
                        ['value' => 'product', 'label' => 'Product'], ['value' => 'support', 'label' => 'Customer Support'],
                        ['value' => 'delivery', 'label' => 'Delivery'], ['value' => 'overall', 'label' => 'Overall Experience'],
                    ]],
                    ['id' => 'best', 'type' => 'textarea', 'label' => 'What did we do well?', 'rows' => 3],
                    ['id' => 'worst', 'type' => 'textarea', 'label' => 'What could we improve?', 'rows' => 3],
                ],
            ],
            'market_research' => [
                'title' => __('Market Research', 'formforge'),
                'description' => __('Multi-step market research questionnaire', 'formforge'),
                'icon' => 'chart-area', 'category' => 'survey',
                'fields' => [
                    ['id' => 'h1', 'type' => 'heading', 'label' => 'Demographics'],
                    ['id' => 'age', 'type' => 'select', 'label' => 'Age Group', 'options' => [
                        ['value' => '18-24', 'label' => '18-24'], ['value' => '25-34', 'label' => '25-34'],
                        ['value' => '35-44', 'label' => '35-44'], ['value' => '45-54', 'label' => '45-54'], ['value' => '55+', 'label' => '55+'],
                    ]],
                    ['id' => 'industry', 'type' => 'text', 'label' => 'Industry'],
                    ['id' => 'company_size', 'type' => 'radio', 'label' => 'Company Size', 'options' => [
                        ['value' => '1-10', 'label' => '1-10'], ['value' => '11-50', 'label' => '11-50'],
                        ['value' => '51-200', 'label' => '51-200'], ['value' => '200+', 'label' => '200+'],
                    ]],
                    ['id' => 'pb', 'type' => 'page_break', 'label' => ''],
                    ['id' => 'h2', 'type' => 'heading', 'label' => 'Product Awareness'],
                    ['id' => 'awareness', 'type' => 'radio', 'label' => 'How did you hear about us?', 'options' => [
                        ['value' => 'search', 'label' => 'Search Engine'], ['value' => 'social', 'label' => 'Social Media'],
                        ['value' => 'referral', 'label' => 'Friend/Colleague'], ['value' => 'ad', 'label' => 'Advertisement'],
                    ]],
                    ['id' => 'competitors', 'type' => 'textarea', 'label' => 'What alternatives have you considered?', 'rows' => 3],
                    ['id' => 'budget', 'type' => 'select', 'label' => 'Annual Budget', 'options' => [
                        ['value' => '<1k', 'label' => 'Under $1,000'], ['value' => '1k-5k', 'label' => '$1,000-$5,000'],
                        ['value' => '5k-20k', 'label' => '$5,000-$20,000'], ['value' => '20k+', 'label' => 'Over $20,000'],
                    ]],
                ],
            ],
            'survey' => [
                'title' => __('General Survey', 'formforge'),
                'description' => __('Multi-step general purpose survey', 'formforge'),
                'icon' => 'forms', 'category' => 'survey',
                'fields' => [
                    ['id' => 'h1', 'type' => 'heading', 'label' => 'About You'],
                    ['id' => 'age', 'type' => 'select', 'label' => 'Age Group', 'options' => [
                        ['value' => '18-24', 'label' => '18-24'], ['value' => '25-34', 'label' => '25-34'],
                        ['value' => '35-44', 'label' => '35-44'], ['value' => '45+', 'label' => '45+'],
                    ]],
                    ['id' => 'usage', 'type' => 'radio', 'label' => 'How often do you use our product?', 'options' => [
                        ['value' => 'daily', 'label' => 'Daily'], ['value' => 'weekly', 'label' => 'Weekly'],
                        ['value' => 'monthly', 'label' => 'Monthly'], ['value' => 'rarely', 'label' => 'Rarely'],
                    ]],
                    ['id' => 'pb', 'type' => 'page_break', 'label' => ''],
                    ['id' => 'h2', 'type' => 'heading', 'label' => 'Your Experience'],
                    ['id' => 'satisfaction', 'type' => 'rating', 'label' => 'Overall Satisfaction', 'max_stars' => 5],
                    ['id' => 'recommend', 'type' => 'range', 'label' => 'Likelihood to recommend (0-10)', 'min' => 0, 'max' => 10],
                    ['id' => 'improve', 'type' => 'textarea', 'label' => 'What can we improve?', 'rows' => 4],
                ],
            ],
            'employee_engagement' => [
                'title' => __('Employee Engagement', 'formforge'),
                'description' => __('Measure employee satisfaction and engagement', 'formforge'),
                'icon' => 'groups', 'category' => 'survey',
                'fields' => [
                    ['id' => 'department', 'type' => 'select', 'label' => 'Department', 'options' => [
                        ['value' => 'engineering', 'label' => 'Engineering'], ['value' => 'sales', 'label' => 'Sales'],
                        ['value' => 'marketing', 'label' => 'Marketing'], ['value' => 'hr', 'label' => 'HR'], ['value' => 'operations', 'label' => 'Operations'],
                    ]],
                    ['id' => 'tenure', 'type' => 'select', 'label' => 'How long at company?', 'options' => [
                        ['value' => '<1y', 'label' => 'Less than 1 year'], ['value' => '1-3y', 'label' => '1-3 years'],
                        ['value' => '3-5y', 'label' => '3-5 years'], ['value' => '5y+', 'label' => '5+ years'],
                    ]],
                    ['id' => 'satisfaction', 'type' => 'rating', 'label' => 'Overall Job Satisfaction', 'max_stars' => 5],
                    ['id' => 'culture', 'type' => 'rating', 'label' => 'Company Culture', 'max_stars' => 5],
                    ['id' => 'growth', 'type' => 'rating', 'label' => 'Growth Opportunities', 'max_stars' => 5],
                    ['id' => 'management', 'type' => 'rating', 'label' => 'Management', 'max_stars' => 5],
                    ['id' => 'comments', 'type' => 'textarea', 'label' => 'Additional Comments', 'rows' => 4],
                ],
            ],
            'exit_interview' => [
                'title' => __('Exit Interview', 'formforge'),
                'description' => __('Departing employee feedback form', 'formforge'),
                'icon' => 'migrate', 'category' => 'survey',
                'fields' => [
                    ['id' => 'reason', 'type' => 'select', 'label' => 'Primary Reason for Leaving', 'required' => true, 'options' => [
                        ['value' => 'opportunity', 'label' => 'Better Opportunity'], ['value' => 'compensation', 'label' => 'Compensation'],
                        ['value' => 'culture', 'label' => 'Company Culture'], ['value' => 'management', 'label' => 'Management'],
                        ['value' => 'relocation', 'label' => 'Relocation'], ['value' => 'personal', 'label' => 'Personal Reasons'],
                    ]],
                    ['id' => 'experience', 'type' => 'rating', 'label' => 'Overall Experience', 'max_stars' => 5],
                    ['id' => 'recommend_employer', 'type' => 'radio', 'label' => 'Would you recommend as employer?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'], ['value' => 'maybe', 'label' => 'Maybe'],
                    ]],
                    ['id' => 'liked', 'type' => 'textarea', 'label' => 'What did you like most?', 'rows' => 3],
                    ['id' => 'disliked', 'type' => 'textarea', 'label' => 'What could be improved?', 'rows' => 3],
                ],
            ],
            'product_market_fit' => [
                'title' => __('Product-Market Fit', 'formforge'),
                'description' => __('Sean Ellis PMF survey — how disappointed if gone?', 'formforge'),
                'icon' => 'chart-pie', 'category' => 'survey',
                'fields' => [
                    ['id' => 'disappointed', 'type' => 'radio', 'label' => 'How would you feel if you could no longer use our product?', 'required' => true, 'options' => [
                        ['value' => 'very', 'label' => 'Very disappointed'], ['value' => 'somewhat', 'label' => 'Somewhat disappointed'],
                        ['value' => 'not', 'label' => 'Not disappointed'],
                    ]],
                    ['id' => 'benefit', 'type' => 'textarea', 'label' => 'What is the main benefit you get?', 'required' => true, 'rows' => 3],
                    ['id' => 'alternative', 'type' => 'textarea', 'label' => 'What would you use instead?', 'rows' => 3],
                    ['id' => 'ideal_user', 'type' => 'textarea', 'label' => 'Describe who would benefit most', 'rows' => 3],
                ],
            ],
            'ux_research' => [
                'title' => __('UX Research', 'formforge'),
                'description' => __('Usability and user experience research', 'formforge'),
                'icon' => 'visibility', 'category' => 'survey',
                'fields' => [
                    ['id' => 'task', 'type' => 'text', 'label' => 'Task Performed', 'required' => true],
                    ['id' => 'difficulty', 'type' => 'range', 'label' => 'Difficulty (1=Easy, 10=Hard)', 'min' => 1, 'max' => 10],
                    ['id' => 'completed', 'type' => 'radio', 'label' => 'Task Completed?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'partially', 'label' => 'Partially'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'confusion', 'type' => 'textarea', 'label' => 'Points of confusion', 'rows' => 3],
                    ['id' => 'suggestions', 'type' => 'textarea', 'label' => 'Improvement suggestions', 'rows' => 3],
                ],
            ],
            'post_event_survey' => [
                'title' => __('Post-Event Survey', 'formforge'),
                'description' => __('Feedback after an event or conference', 'formforge'),
                'icon' => 'tickets-alt', 'category' => 'survey',
                'fields' => [
                    ['id' => 'overall', 'type' => 'rating', 'label' => 'Overall Event Rating', 'required' => true, 'max_stars' => 5],
                    ['id' => 'speakers', 'type' => 'rating', 'label' => 'Speaker Quality', 'max_stars' => 5],
                    ['id' => 'venue', 'type' => 'rating', 'label' => 'Venue', 'max_stars' => 5],
                    ['id' => 'organization', 'type' => 'rating', 'label' => 'Organization', 'max_stars' => 5],
                    ['id' => 'favorite', 'type' => 'textarea', 'label' => 'Favorite session or moment', 'rows' => 2],
                    ['id' => 'attend_again', 'type' => 'radio', 'label' => 'Would you attend again?', 'options' => [
                        ['value' => 'yes', 'label' => 'Definitely'], ['value' => 'maybe', 'label' => 'Maybe'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'suggestions', 'type' => 'textarea', 'label' => 'Suggestions for next time', 'rows' => 3],
                ],
            ],
            'feature_request' => [
                'title' => __('Feature Request', 'formforge'),
                'description' => __('Collect product feature ideas from users', 'formforge'),
                'icon' => 'lightbulb', 'category' => 'survey',
                'fields' => [
                    ['id' => 'email', 'type' => 'email', 'label' => 'Your Email', 'required' => true],
                    ['id' => 'title', 'type' => 'text', 'label' => 'Feature Title', 'required' => true],
                    ['id' => 'description', 'type' => 'textarea', 'label' => 'Describe the feature', 'required' => true, 'rows' => 5],
                    ['id' => 'use_case', 'type' => 'textarea', 'label' => 'Use case / why you need it', 'rows' => 3],
                    ['id' => 'priority', 'type' => 'radio', 'label' => 'How important is this?', 'options' => [
                        ['value' => 'critical', 'label' => 'Critical — blocking my work'],
                        ['value' => 'important', 'label' => 'Important — would help a lot'],
                        ['value' => 'nice', 'label' => 'Nice to have'],
                    ]],
                ],
            ],
            'brand_awareness' => [
                'title' => __('Brand Awareness', 'formforge'),
                'description' => __('Measure how well people know your brand', 'formforge'),
                'icon' => 'flag', 'category' => 'survey',
                'fields' => [
                    ['id' => 'heard', 'type' => 'radio', 'label' => 'Have you heard of our brand?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'],
                    ]],
                    ['id' => 'where', 'type' => 'checkbox', 'label' => 'Where did you see us?', 'options' => [
                        ['value' => 'social', 'label' => 'Social Media'], ['value' => 'search', 'label' => 'Search'],
                        ['value' => 'ad', 'label' => 'Advertisement'], ['value' => 'friend', 'label' => 'Friend'],
                        ['value' => 'event', 'label' => 'Event'], ['value' => 'press', 'label' => 'Press/Blog'],
                    ]],
                    ['id' => 'impression', 'type' => 'textarea', 'label' => 'What comes to mind when you hear our brand?', 'rows' => 3],
                ],
            ],
        ];
    }

    // =================================================================
    // ORDERS & PAYMENTS (~8)
    // =================================================================
    private static function order_templates() {
        return [
            'order' => [
                'title' => __('Product Order', 'formforge'),
                'description' => __('Standard product order form', 'formforge'),
                'icon' => 'cart', 'category' => 'order',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'product', 'type' => 'select', 'label' => 'Product', 'required' => true, 'options' => [
                        ['value' => 'basic', 'label' => 'Basic Plan'], ['value' => 'pro', 'label' => 'Pro Plan'], ['value' => 'enterprise', 'label' => 'Enterprise'],
                    ]],
                    ['id' => 'quantity', 'type' => 'number', 'label' => 'Quantity', 'required' => true, 'min' => 1, 'max' => 100],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Shipping Address', 'required' => true],
                    ['id' => 'notes', 'type' => 'textarea', 'label' => 'Notes', 'rows' => 3],
                ],
            ],
            'service_booking' => [
                'title' => __('Service Booking', 'formforge'),
                'description' => __('Book an appointment or service', 'formforge'),
                'icon' => 'calendar', 'category' => 'order',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'service', 'type' => 'select', 'label' => 'Service', 'required' => true, 'options' => [
                        ['value' => 'consultation', 'label' => 'Consultation'], ['value' => 'audit', 'label' => 'Audit'],
                        ['value' => 'implementation', 'label' => 'Implementation'], ['value' => 'training', 'label' => 'Training'],
                    ]],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Preferred Date', 'required' => true],
                    ['id' => 'time', 'type' => 'time', 'label' => 'Preferred Time', 'required' => true],
                    ['id' => 'notes', 'type' => 'textarea', 'label' => 'Additional Notes', 'rows' => 3],
                ],
            ],
            'donation' => [
                'title' => __('Donation Form', 'formforge'),
                'description' => __('Accept charitable donations', 'formforge'),
                'icon' => 'heart', 'category' => 'order',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Donor Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'amount', 'type' => 'radio', 'label' => 'Donation Amount', 'required' => true, 'options' => [
                        ['value' => '10', 'label' => '$10'], ['value' => '25', 'label' => '$25'],
                        ['value' => '50', 'label' => '$50'], ['value' => '100', 'label' => '$100'],
                    ]],
                    ['id' => 'recurring', 'type' => 'radio', 'label' => 'Frequency', 'options' => [
                        ['value' => 'one-time', 'label' => 'One-time'], ['value' => 'monthly', 'label' => 'Monthly'], ['value' => 'annual', 'label' => 'Annual'],
                    ]],
                    ['id' => 'dedication', 'type' => 'text', 'label' => 'In honor/memory of (optional)'],
                    ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'rows' => 3],
                ],
            ],
            'quote_request' => [
                'title' => __('Quote Request', 'formforge'),
                'description' => __('Request a price quote for services', 'formforge'),
                'icon' => 'media-text', 'category' => 'order',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company'],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                    ['id' => 'service', 'type' => 'select', 'label' => 'Service Needed', 'required' => true, 'options' => [
                        ['value' => 'web-design', 'label' => 'Web Design'], ['value' => 'development', 'label' => 'Development'],
                        ['value' => 'marketing', 'label' => 'Marketing'], ['value' => 'consulting', 'label' => 'Consulting'],
                    ]],
                    ['id' => 'budget', 'type' => 'select', 'label' => 'Budget Range', 'options' => [
                        ['value' => '<5k', 'label' => 'Under $5,000'], ['value' => '5k-10k', 'label' => '$5,000-$10,000'],
                        ['value' => '10k-25k', 'label' => '$10,000-$25,000'], ['value' => '25k+', 'label' => 'Over $25,000'],
                    ]],
                    ['id' => 'timeline', 'type' => 'text', 'label' => 'Desired Timeline'],
                    ['id' => 'details', 'type' => 'textarea', 'label' => 'Project Details', 'required' => true, 'rows' => 5],
                ],
            ],
            'invoice_request' => [
                'title' => __('Invoice Request', 'formforge'),
                'description' => __('Request an invoice for completed work', 'formforge'),
                'icon' => 'media-spreadsheet', 'category' => 'order',
                'fields' => [
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Billing Email', 'required' => true],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Billing Address', 'required' => true],
                    ['id' => 'tax_id', 'type' => 'text', 'label' => 'Tax ID / VAT Number'],
                    ['id' => 'description', 'type' => 'textarea', 'label' => 'Invoice Description', 'required' => true, 'rows' => 4],
                    ['id' => 'amount', 'type' => 'number', 'label' => 'Amount', 'required' => true],
                    ['id' => 'po_number', 'type' => 'text', 'label' => 'PO Number'],
                ],
            ],
            'sponsorship' => [
                'title' => __('Sponsorship Request', 'formforge'),
                'description' => __('Request or offer event sponsorship', 'formforge'),
                'icon' => 'money-alt', 'category' => 'order',
                'fields' => [
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company', 'required' => true],
                    ['id' => 'contact', 'type' => 'name', 'label' => 'Contact Person', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'tier', 'type' => 'radio', 'label' => 'Sponsorship Tier', 'options' => [
                        ['value' => 'gold', 'label' => 'Gold — $10,000'], ['value' => 'silver', 'label' => 'Silver — $5,000'],
                        ['value' => 'bronze', 'label' => 'Bronze — $2,500'],
                    ]],
                    ['id' => 'goals', 'type' => 'textarea', 'label' => 'Sponsorship Goals', 'rows' => 3],
                ],
            ],
            'wholesale_order' => [
                'title' => __('Wholesale Order', 'formforge'),
                'description' => __('Bulk/wholesale purchase request', 'formforge'),
                'icon' => 'archive', 'category' => 'order',
                'fields' => [
                    ['id' => 'company', 'type' => 'text', 'label' => 'Business Name', 'required' => true],
                    ['id' => 'contact', 'type' => 'name', 'label' => 'Contact Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'products', 'type' => 'textarea', 'label' => 'Products & Quantities', 'required' => true, 'rows' => 5],
                    ['id' => 'delivery_date', 'type' => 'date', 'label' => 'Required By Date'],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Delivery Address', 'required' => true],
                ],
            ],
            'simple_order' => [
                'title' => __('Simple Order', 'formforge'),
                'description' => __('Minimal order form — product, name, email', 'formforge'),
                'icon' => 'tag', 'category' => 'order',
                'fields' => [
                    ['id' => 'product', 'type' => 'text', 'label' => 'What would you like to order?', 'required' => true],
                    ['id' => 'quantity', 'type' => 'number', 'label' => 'Quantity', 'required' => true, 'min' => 1],
                    ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'notes', 'type' => 'textarea', 'label' => 'Special Instructions', 'rows' => 3],
                ],
            ],
        ];
    }

    // =================================================================
    // APPLICATIONS (~8)
    // =================================================================
    private static function application_templates() {
        return [
            'job_application' => [
                'title' => __('Job Application', 'formforge'),
                'description' => __('Recruitment and hiring form', 'formforge'),
                'icon' => 'businessman', 'category' => 'application',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'position', 'type' => 'text', 'label' => 'Position Applied For', 'required' => true],
                    ['id' => 'experience', 'type' => 'select', 'label' => 'Years of Experience', 'options' => [
                        ['value' => '0-1', 'label' => '0-1'], ['value' => '1-3', 'label' => '1-3'],
                        ['value' => '3-5', 'label' => '3-5'], ['value' => '5+', 'label' => '5+'],
                    ]],
                    ['id' => 'portfolio', 'type' => 'url', 'label' => 'Portfolio URL'],
                    ['id' => 'resume', 'type' => 'file_upload', 'label' => 'Resume/CV', 'required' => true, 'accept' => '.pdf,.doc,.docx'],
                    ['id' => 'cover', 'type' => 'textarea', 'label' => 'Cover Letter', 'rows' => 5],
                ],
            ],
            'scholarship' => [
                'title' => __('Scholarship Application', 'formforge'),
                'description' => __('Academic scholarship application', 'formforge'),
                'icon' => 'awards', 'category' => 'application',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'gpa', 'type' => 'number', 'label' => 'GPA', 'required' => true],
                    ['id' => 'institution', 'type' => 'text', 'label' => 'Current Institution', 'required' => true],
                    ['id' => 'essay', 'type' => 'textarea', 'label' => 'Essay: Why do you deserve this scholarship?', 'required' => true, 'rows' => 8],
                    ['id' => 'transcript', 'type' => 'file_upload', 'label' => 'Transcript', 'accept' => '.pdf'],
                    ['id' => 'recommendation', 'type' => 'file_upload', 'label' => 'Letter of Recommendation', 'accept' => '.pdf,.doc,.docx'],
                ],
            ],
            'volunteer' => [
                'title' => __('Volunteer Application', 'formforge'),
                'description' => __('Volunteer signup with availability', 'formforge'),
                'icon' => 'universal-access', 'category' => 'application',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'interests', 'type' => 'checkbox', 'label' => 'Areas of Interest', 'options' => [
                        ['value' => 'events', 'label' => 'Events'], ['value' => 'admin', 'label' => 'Administration'],
                        ['value' => 'tech', 'label' => 'Technical'], ['value' => 'outreach', 'label' => 'Community Outreach'],
                    ]],
                    ['id' => 'availability', 'type' => 'checkbox', 'label' => 'Availability', 'options' => [
                        ['value' => 'weekdays', 'label' => 'Weekdays'], ['value' => 'evenings', 'label' => 'Evenings'],
                        ['value' => 'weekends', 'label' => 'Weekends'],
                    ]],
                    ['id' => 'experience', 'type' => 'textarea', 'label' => 'Relevant Experience', 'rows' => 3],
                    ['id' => 'motivation', 'type' => 'textarea', 'label' => 'Why do you want to volunteer?', 'rows' => 3],
                ],
            ],
            'internship' => [
                'title' => __('Internship Application', 'formforge'),
                'description' => __('Student internship application', 'formforge'),
                'icon' => 'welcome-learn-more', 'category' => 'application',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'university', 'type' => 'text', 'label' => 'University', 'required' => true],
                    ['id' => 'major', 'type' => 'text', 'label' => 'Major', 'required' => true],
                    ['id' => 'grad_year', 'type' => 'select', 'label' => 'Expected Graduation', 'options' => [
                        ['value' => '2025', 'label' => '2025'], ['value' => '2026', 'label' => '2026'],
                        ['value' => '2027', 'label' => '2027'], ['value' => '2028', 'label' => '2028'],
                    ]],
                    ['id' => 'start_date', 'type' => 'date', 'label' => 'Available Start Date'],
                    ['id' => 'resume', 'type' => 'file_upload', 'label' => 'Resume', 'required' => true, 'accept' => '.pdf,.doc,.docx'],
                    ['id' => 'why', 'type' => 'textarea', 'label' => 'Why this internship?', 'required' => true, 'rows' => 4],
                ],
            ],
            'partnership' => [
                'title' => __('Partnership Inquiry', 'formforge'),
                'description' => __('Business partnership or collaboration request', 'formforge'),
                'icon' => 'networking', 'category' => 'application',
                'fields' => [
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company Name', 'required' => true],
                    ['id' => 'name', 'type' => 'name', 'label' => 'Contact Person', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'website', 'type' => 'url', 'label' => 'Company Website'],
                    ['id' => 'type', 'type' => 'select', 'label' => 'Partnership Type', 'options' => [
                        ['value' => 'technology', 'label' => 'Technology'], ['value' => 'marketing', 'label' => 'Marketing'],
                        ['value' => 'reseller', 'label' => 'Reseller'], ['value' => 'affiliate', 'label' => 'Affiliate'],
                    ]],
                    ['id' => 'proposal', 'type' => 'textarea', 'label' => 'Partnership Proposal', 'required' => true, 'rows' => 5],
                ],
            ],
            'vendor_application' => [
                'title' => __('Vendor Application', 'formforge'),
                'description' => __('Supplier/vendor onboarding application', 'formforge'),
                'icon' => 'store', 'category' => 'application',
                'fields' => [
                    ['id' => 'company', 'type' => 'text', 'label' => 'Company Name', 'required' => true],
                    ['id' => 'contact', 'type' => 'name', 'label' => 'Primary Contact', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Business Address', 'required' => true],
                    ['id' => 'products', 'type' => 'textarea', 'label' => 'Products/Services Offered', 'required' => true, 'rows' => 4],
                    ['id' => 'references', 'type' => 'textarea', 'label' => 'Client References', 'rows' => 3],
                    ['id' => 'cert', 'type' => 'file_upload', 'label' => 'Business License/Certification', 'accept' => '.pdf,.jpg,.png'],
                ],
            ],
            'rental_application' => [
                'title' => __('Rental Application', 'formforge'),
                'description' => __('Property rental/lease application', 'formforge'),
                'icon' => 'admin-home', 'category' => 'application',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'current_address', 'type' => 'address', 'label' => 'Current Address', 'required' => true],
                    ['id' => 'employer', 'type' => 'text', 'label' => 'Current Employer'],
                    ['id' => 'income', 'type' => 'select', 'label' => 'Monthly Income', 'options' => [
                        ['value' => '<3k', 'label' => 'Under $3,000'], ['value' => '3k-5k', 'label' => '$3,000-$5,000'],
                        ['value' => '5k-8k', 'label' => '$5,000-$8,000'], ['value' => '8k+', 'label' => 'Over $8,000'],
                    ]],
                    ['id' => 'move_date', 'type' => 'date', 'label' => 'Desired Move-in Date', 'required' => true],
                    ['id' => 'pets', 'type' => 'radio', 'label' => 'Pets?', 'options' => [
                        ['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'],
                    ]],
                ],
            ],
            'grant_application' => [
                'title' => __('Grant Application', 'formforge'),
                'description' => __('Grant or funding application', 'formforge'),
                'icon' => 'money', 'category' => 'application',
                'fields' => [
                    ['id' => 'org_name', 'type' => 'text', 'label' => 'Organization Name', 'required' => true],
                    ['id' => 'contact', 'type' => 'name', 'label' => 'Contact Person', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'amount', 'type' => 'number', 'label' => 'Amount Requested ($)', 'required' => true],
                    ['id' => 'project_title', 'type' => 'text', 'label' => 'Project Title', 'required' => true],
                    ['id' => 'summary', 'type' => 'textarea', 'label' => 'Project Summary', 'required' => true, 'rows' => 5],
                    ['id' => 'budget', 'type' => 'file_upload', 'label' => 'Budget Document', 'accept' => '.pdf,.xlsx,.csv'],
                    ['id' => 'timeline', 'type' => 'textarea', 'label' => 'Project Timeline', 'rows' => 3],
                ],
            ],
        ];
    }

    // =================================================================
    // HEALTHCARE (~6)
    // =================================================================
    private static function healthcare_templates() {
        return [
            'patient_intake' => [
                'title' => __('Patient Intake', 'formforge'),
                'description' => __('New patient registration and medical info', 'formforge'),
                'icon' => 'heart', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Patient Name', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Address', 'required' => true],
                    ['id' => 'emergency_contact', 'type' => 'text', 'label' => 'Emergency Contact', 'required' => true],
                    ['id' => 'emergency_phone', 'type' => 'phone', 'label' => 'Emergency Phone', 'required' => true],
                    ['id' => 'conditions', 'type' => 'textarea', 'label' => 'Current Medical Conditions', 'rows' => 3],
                    ['id' => 'medications', 'type' => 'textarea', 'label' => 'Current Medications', 'rows' => 3],
                    ['id' => 'allergies', 'type' => 'textarea', 'label' => 'Allergies', 'rows' => 2],
                ],
            ],
            'appointment_request' => [
                'title' => __('Appointment Request', 'formforge'),
                'description' => __('Request a medical or service appointment', 'formforge'),
                'icon' => 'clock', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Patient Name', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email'],
                    ['id' => 'visit_type', 'type' => 'select', 'label' => 'Visit Type', 'required' => true, 'options' => [
                        ['value' => 'new', 'label' => 'New Patient'], ['value' => 'followup', 'label' => 'Follow-up'],
                        ['value' => 'urgent', 'label' => 'Urgent'], ['value' => 'telehealth', 'label' => 'Telehealth'],
                    ]],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Preferred Date', 'required' => true],
                    ['id' => 'time', 'type' => 'select', 'label' => 'Preferred Time', 'options' => [
                        ['value' => 'morning', 'label' => 'Morning'], ['value' => 'afternoon', 'label' => 'Afternoon'], ['value' => 'evening', 'label' => 'Evening'],
                    ]],
                    ['id' => 'reason', 'type' => 'textarea', 'label' => 'Reason for Visit', 'rows' => 3],
                ],
            ],
            'health_assessment' => [
                'title' => __('Health Assessment', 'formforge'),
                'description' => __('General health screening questionnaire', 'formforge'),
                'icon' => 'clipboard', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'general_health', 'type' => 'radio', 'label' => 'Overall health?', 'options' => [
                        ['value' => 'excellent', 'label' => 'Excellent'], ['value' => 'good', 'label' => 'Good'],
                        ['value' => 'fair', 'label' => 'Fair'], ['value' => 'poor', 'label' => 'Poor'],
                    ]],
                    ['id' => 'exercise', 'type' => 'select', 'label' => 'Exercise frequency', 'options' => [
                        ['value' => 'daily', 'label' => 'Daily'], ['value' => '3-5', 'label' => '3-5 times/week'],
                        ['value' => '1-2', 'label' => '1-2 times/week'], ['value' => 'rarely', 'label' => 'Rarely'],
                    ]],
                    ['id' => 'sleep', 'type' => 'range', 'label' => 'Average sleep hours', 'min' => 3, 'max' => 12],
                    ['id' => 'stress', 'type' => 'range', 'label' => 'Stress level (1-10)', 'min' => 1, 'max' => 10],
                    ['id' => 'concerns', 'type' => 'textarea', 'label' => 'Health concerns', 'rows' => 3],
                ],
            ],
            'consent_form' => [
                'title' => __('Medical Consent', 'formforge'),
                'description' => __('Procedure consent and agreement form', 'formforge'),
                'icon' => 'yes-alt', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Patient Name', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'procedure', 'type' => 'text', 'label' => 'Procedure Name', 'required' => true],
                    ['id' => 'info', 'type' => 'html_block', 'label' => '', 'content' => '<p>I understand the risks, benefits, and alternatives of the procedure described above. I consent to the procedure and authorize the healthcare provider to proceed.</p>'],
                    ['id' => 'consent', 'type' => 'checkbox', 'label' => 'I provide my informed consent', 'required' => true],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Date', 'required' => true],
                ],
            ],
            'prescription_refill' => [
                'title' => __('Prescription Refill', 'formforge'),
                'description' => __('Request medication refill', 'formforge'),
                'icon' => 'plus-alt', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'name', 'type' => 'name', 'label' => 'Patient Name', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'medication', 'type' => 'text', 'label' => 'Medication Name', 'required' => true],
                    ['id' => 'dosage', 'type' => 'text', 'label' => 'Dosage'],
                    ['id' => 'pharmacy', 'type' => 'text', 'label' => 'Preferred Pharmacy'],
                    ['id' => 'notes', 'type' => 'textarea', 'label' => 'Additional Notes', 'rows' => 3],
                ],
            ],
            'symptom_checker' => [
                'title' => __('Symptom Checker', 'formforge'),
                'description' => __('Patient symptom reporting form', 'formforge'),
                'icon' => 'editor-help', 'category' => 'healthcare',
                'fields' => [
                    ['id' => 'name', 'type' => 'text', 'label' => 'Name'],
                    ['id' => 'symptoms', 'type' => 'checkbox', 'label' => 'Symptoms', 'options' => [
                        ['value' => 'fever', 'label' => 'Fever'], ['value' => 'cough', 'label' => 'Cough'],
                        ['value' => 'headache', 'label' => 'Headache'], ['value' => 'fatigue', 'label' => 'Fatigue'],
                        ['value' => 'nausea', 'label' => 'Nausea'], ['value' => 'pain', 'label' => 'Pain'],
                    ]],
                    ['id' => 'severity', 'type' => 'range', 'label' => 'Severity (1-10)', 'min' => 1, 'max' => 10],
                    ['id' => 'duration', 'type' => 'select', 'label' => 'Duration', 'options' => [
                        ['value' => 'today', 'label' => 'Started today'], ['value' => 'days', 'label' => 'Few days'],
                        ['value' => 'week', 'label' => 'About a week'], ['value' => 'longer', 'label' => 'More than a week'],
                    ]],
                    ['id' => 'details', 'type' => 'textarea', 'label' => 'Additional details', 'rows' => 3],
                ],
            ],
        ];
    }

    // =================================================================
    // EDUCATION (~6)
    // =================================================================
    private static function education_templates() {
        return [
            'student_enrollment' => [
                'title' => __('Student Enrollment', 'formforge'), 'description' => __('School enrollment application', 'formforge'),
                'icon' => 'welcome-learn-more', 'category' => 'education',
                'fields' => [
                    ['id' => 'student_name', 'type' => 'name', 'label' => 'Student Name', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'parent_name', 'type' => 'name', 'label' => 'Parent/Guardian Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Parent Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'grade', 'type' => 'select', 'label' => 'Grade Level', 'required' => true, 'options' => [
                        ['value' => 'k', 'label' => 'Kindergarten'], ['value' => '1', 'label' => '1st Grade'],
                        ['value' => '2', 'label' => '2nd Grade'], ['value' => '3', 'label' => '3rd Grade'],
                    ]],
                    ['id' => 'address', 'type' => 'address', 'label' => 'Home Address', 'required' => true],
                    ['id' => 'special_needs', 'type' => 'textarea', 'label' => 'Special Needs or Accommodations', 'rows' => 3],
                ],
            ],
            'teacher_evaluation' => [
                'title' => __('Teacher Evaluation', 'formforge'), 'description' => __('Student evaluates teacher performance', 'formforge'),
                'icon' => 'admin-users', 'category' => 'education',
                'fields' => [
                    ['id' => 'course', 'type' => 'text', 'label' => 'Course Name', 'required' => true],
                    ['id' => 'teacher', 'type' => 'text', 'label' => 'Teacher Name', 'required' => true],
                    ['id' => 'knowledge', 'type' => 'rating', 'label' => 'Subject Knowledge', 'max_stars' => 5],
                    ['id' => 'clarity', 'type' => 'rating', 'label' => 'Clarity of Teaching', 'max_stars' => 5],
                    ['id' => 'engagement', 'type' => 'rating', 'label' => 'Student Engagement', 'max_stars' => 5],
                    ['id' => 'availability', 'type' => 'rating', 'label' => 'Availability for Help', 'max_stars' => 5],
                    ['id' => 'feedback', 'type' => 'textarea', 'label' => 'Comments', 'rows' => 4],
                ],
            ],
            'homework_submission' => [
                'title' => __('Homework Submission', 'formforge'), 'description' => __('Submit assignments online', 'formforge'),
                'icon' => 'media-document', 'category' => 'education',
                'fields' => [
                    ['id' => 'student_name', 'type' => 'text', 'label' => 'Student Name', 'required' => true],
                    ['id' => 'student_id', 'type' => 'text', 'label' => 'Student ID', 'required' => true],
                    ['id' => 'course', 'type' => 'text', 'label' => 'Course', 'required' => true],
                    ['id' => 'assignment', 'type' => 'text', 'label' => 'Assignment Title', 'required' => true],
                    ['id' => 'file', 'type' => 'file_upload', 'label' => 'Upload Assignment', 'required' => true, 'accept' => '.pdf,.doc,.docx,.pptx,.zip'],
                    ['id' => 'notes', 'type' => 'textarea', 'label' => 'Notes for Teacher', 'rows' => 3],
                ],
            ],
            'permission_slip' => [
                'title' => __('Permission Slip', 'formforge'), 'description' => __('Parent permission for school activities', 'formforge'),
                'icon' => 'yes', 'category' => 'education',
                'fields' => [
                    ['id' => 'student_name', 'type' => 'text', 'label' => 'Student Name', 'required' => true],
                    ['id' => 'parent_name', 'type' => 'name', 'label' => 'Parent/Guardian Name', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Emergency Phone', 'required' => true],
                    ['id' => 'activity', 'type' => 'text', 'label' => 'Activity/Event', 'required' => true],
                    ['id' => 'date', 'type' => 'date', 'label' => 'Date of Activity'],
                    ['id' => 'medical', 'type' => 'textarea', 'label' => 'Medical Information', 'rows' => 2],
                    ['id' => 'consent', 'type' => 'checkbox', 'label' => 'I give permission for my child to participate', 'required' => true],
                ],
            ],
            'tutoring_request' => [
                'title' => __('Tutoring Request', 'formforge'), 'description' => __('Request tutoring sessions', 'formforge'),
                'icon' => 'book', 'category' => 'education',
                'fields' => [
                    ['id' => 'student_name', 'type' => 'text', 'label' => 'Student Name', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'subject', 'type' => 'text', 'label' => 'Subject', 'required' => true],
                    ['id' => 'level', 'type' => 'select', 'label' => 'Level', 'options' => [
                        ['value' => 'elementary', 'label' => 'Elementary'], ['value' => 'middle', 'label' => 'Middle School'],
                        ['value' => 'high', 'label' => 'High School'], ['value' => 'college', 'label' => 'College'],
                    ]],
                    ['id' => 'frequency', 'type' => 'radio', 'label' => 'Desired Frequency', 'options' => [
                        ['value' => 'once', 'label' => 'One-time'], ['value' => 'weekly', 'label' => 'Weekly'], ['value' => 'biweekly', 'label' => 'Bi-weekly'],
                    ]],
                    ['id' => 'goals', 'type' => 'textarea', 'label' => 'Learning Goals', 'rows' => 3],
                ],
            ],
            'school_admission' => [
                'title' => __('School Admission', 'formforge'), 'description' => __('School admission application', 'formforge'),
                'icon' => 'building', 'category' => 'education',
                'fields' => [
                    ['id' => 'student_name', 'type' => 'name', 'label' => 'Student Name', 'required' => true],
                    ['id' => 'dob', 'type' => 'date', 'label' => 'Date of Birth', 'required' => true],
                    ['id' => 'parent', 'type' => 'name', 'label' => 'Parent/Guardian', 'required' => true],
                    ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                    ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                    ['id' => 'prev_school', 'type' => 'text', 'label' => 'Previous School'],
                    ['id' => 'grade', 'type' => 'select', 'label' => 'Applying for Grade', 'required' => true, 'options' => [
                        ['value' => 'pre-k', 'label' => 'Pre-K'], ['value' => 'k', 'label' => 'Kindergarten'],
                        ['value' => '1-5', 'label' => 'Grades 1-5'], ['value' => '6-8', 'label' => 'Grades 6-8'], ['value' => '9-12', 'label' => 'Grades 9-12'],
                    ]],
                    ['id' => 'why', 'type' => 'textarea', 'label' => 'Why are you interested in our school?', 'rows' => 4],
                    ['id' => 'records', 'type' => 'file_upload', 'label' => 'Academic Records', 'accept' => '.pdf'],
                ],
            ],
        ];
    }

    // =================================================================
    // REMAINING CATEGORIES (compact)
    // =================================================================
    private static function real_estate_templates() {
        return [
            'property_inquiry' => ['title' => __('Property Inquiry', 'formforge'), 'description' => __('Ask about a property listing', 'formforge'), 'icon' => 'admin-home', 'category' => 'real-estate', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                ['id' => 'property', 'type' => 'text', 'label' => 'Property Address/Listing'], ['id' => 'budget', 'type' => 'select', 'label' => 'Budget', 'options' => [['value' => '<200k', 'label' => 'Under $200K'], ['value' => '200-500k', 'label' => '$200K-$500K'], ['value' => '500k+', 'label' => 'Over $500K']]],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'rows' => 3],
            ]],
            'maintenance_request' => ['title' => __('Maintenance Request', 'formforge'), 'description' => __('Report property maintenance issues', 'formforge'), 'icon' => 'admin-tools', 'category' => 'real-estate', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Tenant Name', 'required' => true], ['id' => 'unit', 'type' => 'text', 'label' => 'Unit Number', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                ['id' => 'category', 'type' => 'select', 'label' => 'Category', 'options' => [['value' => 'plumbing', 'label' => 'Plumbing'], ['value' => 'electrical', 'label' => 'Electrical'], ['value' => 'hvac', 'label' => 'HVAC'], ['value' => 'appliance', 'label' => 'Appliance'], ['value' => 'other', 'label' => 'Other']]],
                ['id' => 'urgency', 'type' => 'radio', 'label' => 'Urgency', 'options' => [['value' => 'emergency', 'label' => 'Emergency'], ['value' => 'urgent', 'label' => 'Urgent'], ['value' => 'normal', 'label' => 'Normal']]],
                ['id' => 'description', 'type' => 'textarea', 'label' => 'Description', 'required' => true, 'rows' => 4],
                ['id' => 'photo', 'type' => 'file_upload', 'label' => 'Photo', 'accept' => '.jpg,.png,.webp'],
            ]],
            'open_house' => ['title' => __('Open House Registration', 'formforge'), 'description' => __('Register visitors for property open house', 'formforge'), 'icon' => 'visibility', 'category' => 'real-estate', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'buyer_type', 'type' => 'radio', 'label' => 'Are you...', 'options' => [['value' => 'first-time', 'label' => 'First-time Buyer'], ['value' => 'upgrade', 'label' => 'Upgrading'], ['value' => 'investor', 'label' => 'Investor']]],
                ['id' => 'agent', 'type' => 'radio', 'label' => 'Working with an agent?', 'options' => [['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No']]],
            ]],
            'home_valuation' => ['title' => __('Home Valuation', 'formforge'), 'description' => __('Request a free home valuation', 'formforge'), 'icon' => 'chart-line', 'category' => 'real-estate', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'address', 'type' => 'address', 'label' => 'Property Address', 'required' => true],
                ['id' => 'type', 'type' => 'select', 'label' => 'Property Type', 'options' => [['value' => 'house', 'label' => 'House'], ['value' => 'condo', 'label' => 'Condo'], ['value' => 'townhouse', 'label' => 'Townhouse']]],
                ['id' => 'bedrooms', 'type' => 'number', 'label' => 'Bedrooms', 'min' => 1], ['id' => 'sqft', 'type' => 'number', 'label' => 'Square Feet'],
            ]],
        ];
    }

    private static function marketing_templates() {
        return [
            'lead_generation' => ['title' => __('Lead Generation', 'formforge'), 'description' => __('Capture sales leads', 'formforge'), 'icon' => 'megaphone', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'company', 'type' => 'text', 'label' => 'Company'], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'interest', 'type' => 'select', 'label' => 'Interested In', 'options' => [['value' => 'product', 'label' => 'Product Demo'], ['value' => 'pricing', 'label' => 'Pricing Info'], ['value' => 'consultation', 'label' => 'Free Consultation']]],
            ]],
            'newsletter' => ['title' => __('Newsletter Signup', 'formforge'), 'description' => __('Email subscription form', 'formforge'), 'icon' => 'email-alt', 'category' => 'marketing', 'fields' => [
                ['id' => 'email', 'type' => 'email', 'label' => 'Email Address', 'required' => true, 'placeholder' => 'Enter your email'],
                ['id' => 'consent', 'type' => 'checkbox', 'label' => 'I agree to receive newsletters', 'required' => true],
            ]],
            'content_download' => ['title' => __('Content Download', 'formforge'), 'description' => __('Gated content — ebook, whitepaper download', 'formforge'), 'icon' => 'download', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Work Email', 'required' => true],
                ['id' => 'company', 'type' => 'text', 'label' => 'Company'], ['id' => 'role', 'type' => 'text', 'label' => 'Job Title'],
                ['id' => 'consent', 'type' => 'checkbox', 'label' => 'I agree to receive related content', 'required' => true],
            ]],
            'demo_request' => ['title' => __('Demo Request', 'formforge'), 'description' => __('Request a product demo', 'formforge'), 'icon' => 'desktop', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Work Email', 'required' => true],
                ['id' => 'company', 'type' => 'text', 'label' => 'Company', 'required' => true], ['id' => 'size', 'type' => 'select', 'label' => 'Company Size', 'options' => [['value' => '1-10', 'label' => '1-10'], ['value' => '11-50', 'label' => '11-50'], ['value' => '51-200', 'label' => '51-200'], ['value' => '200+', 'label' => '200+']]],
                ['id' => 'needs', 'type' => 'textarea', 'label' => 'What are you looking to solve?', 'rows' => 3],
            ]],
            'free_trial' => ['title' => __('Free Trial', 'formforge'), 'description' => __('Sign up for a free trial', 'formforge'), 'icon' => 'star-empty', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'company', 'type' => 'text', 'label' => 'Company'], ['id' => 'use_case', 'type' => 'textarea', 'label' => 'How will you use the product?', 'rows' => 3],
                ['id' => 'terms', 'type' => 'checkbox', 'label' => 'I agree to the terms of service', 'required' => true],
            ]],
            'contest_entry' => ['title' => __('Contest Entry', 'formforge'), 'description' => __('Enter a contest or giveaway', 'formforge'), 'icon' => 'awards', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'answer', 'type' => 'textarea', 'label' => 'Contest Answer', 'required' => true, 'rows' => 3],
                ['id' => 'rules', 'type' => 'checkbox', 'label' => 'I accept the contest rules', 'required' => true],
            ]],
            'referral' => ['title' => __('Referral Program', 'formforge'), 'description' => __('Refer a friend and earn rewards', 'formforge'), 'icon' => 'share', 'category' => 'marketing', 'fields' => [
                ['id' => 'your_name', 'type' => 'text', 'label' => 'Your Name', 'required' => true], ['id' => 'your_email', 'type' => 'email', 'label' => 'Your Email', 'required' => true],
                ['id' => 'friend_name', 'type' => 'text', 'label' => "Friend's Name", 'required' => true], ['id' => 'friend_email', 'type' => 'email', 'label' => "Friend's Email", 'required' => true],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Personal Message', 'rows' => 3],
            ]],
            'webinar_lead' => ['title' => __('Webinar Lead', 'formforge'), 'description' => __('Register for a webinar with lead capture', 'formforge'), 'icon' => 'video-alt3', 'category' => 'marketing', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'company', 'type' => 'text', 'label' => 'Company'], ['id' => 'role', 'type' => 'text', 'label' => 'Job Title'],
                ['id' => 'questions', 'type' => 'textarea', 'label' => 'Questions for the presenter', 'rows' => 3],
            ]],
        ];
    }

    private static function hr_templates() {
        return [
            'leave_request' => ['title' => __('Leave Request', 'formforge'), 'description' => __('Request time off', 'formforge'), 'icon' => 'calendar-alt', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Employee Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'type', 'type' => 'select', 'label' => 'Leave Type', 'required' => true, 'options' => [['value' => 'vacation', 'label' => 'Vacation'], ['value' => 'sick', 'label' => 'Sick Leave'], ['value' => 'personal', 'label' => 'Personal']]],
                ['id' => 'start', 'type' => 'date', 'label' => 'Start Date', 'required' => true], ['id' => 'end', 'type' => 'date', 'label' => 'End Date', 'required' => true],
                ['id' => 'reason', 'type' => 'textarea', 'label' => 'Reason', 'rows' => 3],
            ]],
            'expense_report' => ['title' => __('Expense Report', 'formforge'), 'description' => __('Submit expenses for reimbursement', 'formforge'), 'icon' => 'money', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Employee', 'required' => true], ['id' => 'department', 'type' => 'text', 'label' => 'Department'], ['id' => 'date', 'type' => 'date', 'label' => 'Expense Date', 'required' => true],
                ['id' => 'category', 'type' => 'select', 'label' => 'Category', 'options' => [['value' => 'travel', 'label' => 'Travel'], ['value' => 'meals', 'label' => 'Meals'], ['value' => 'supplies', 'label' => 'Supplies'], ['value' => 'other', 'label' => 'Other']]],
                ['id' => 'amount', 'type' => 'number', 'label' => 'Amount ($)', 'required' => true], ['id' => 'description', 'type' => 'text', 'label' => 'Description', 'required' => true],
                ['id' => 'receipt', 'type' => 'file_upload', 'label' => 'Receipt', 'required' => true, 'accept' => '.jpg,.png,.pdf'],
            ]],
            'it_support' => ['title' => __('IT Support Ticket', 'formforge'), 'description' => __('Internal IT help desk request', 'formforge'), 'icon' => 'laptop', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'category', 'type' => 'select', 'label' => 'Issue Type', 'options' => [['value' => 'hardware', 'label' => 'Hardware'], ['value' => 'software', 'label' => 'Software'], ['value' => 'network', 'label' => 'Network'], ['value' => 'access', 'label' => 'Access/Permissions']]],
                ['id' => 'priority', 'type' => 'radio', 'label' => 'Priority', 'options' => [['value' => 'low', 'label' => 'Low'], ['value' => 'medium', 'label' => 'Medium'], ['value' => 'high', 'label' => 'High']]],
                ['id' => 'description', 'type' => 'textarea', 'label' => 'Description', 'required' => true, 'rows' => 4],
                ['id' => 'screenshot', 'type' => 'file_upload', 'label' => 'Screenshot', 'accept' => '.jpg,.png'],
            ]],
            'equipment_request' => ['title' => __('Equipment Request', 'formforge'), 'description' => __('Request office equipment or supplies', 'formforge'), 'icon' => 'desktop', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Employee', 'required' => true], ['id' => 'department', 'type' => 'text', 'label' => 'Department', 'required' => true],
                ['id' => 'item', 'type' => 'text', 'label' => 'Item Requested', 'required' => true], ['id' => 'quantity', 'type' => 'number', 'label' => 'Quantity', 'min' => 1],
                ['id' => 'reason', 'type' => 'textarea', 'label' => 'Justification', 'required' => true, 'rows' => 3],
                ['id' => 'needed_by', 'type' => 'date', 'label' => 'Needed By'],
            ]],
            'incident_report' => ['title' => __('Incident Report', 'formforge'), 'description' => __('Report workplace incidents', 'formforge'), 'icon' => 'warning', 'category' => 'hr', 'fields' => [
                ['id' => 'reporter', 'type' => 'text', 'label' => 'Reporter Name', 'required' => true], ['id' => 'date', 'type' => 'date', 'label' => 'Date of Incident', 'required' => true], ['id' => 'time', 'type' => 'time', 'label' => 'Time'],
                ['id' => 'location', 'type' => 'text', 'label' => 'Location', 'required' => true],
                ['id' => 'type', 'type' => 'select', 'label' => 'Incident Type', 'options' => [['value' => 'safety', 'label' => 'Safety'], ['value' => 'security', 'label' => 'Security'], ['value' => 'conduct', 'label' => 'Conduct'], ['value' => 'other', 'label' => 'Other']]],
                ['id' => 'description', 'type' => 'textarea', 'label' => 'Description', 'required' => true, 'rows' => 5],
                ['id' => 'witnesses', 'type' => 'textarea', 'label' => 'Witnesses', 'rows' => 2],
                ['id' => 'photo', 'type' => 'file_upload', 'label' => 'Photo/Evidence', 'accept' => '.jpg,.png,.pdf'],
            ]],
            'onboarding' => ['title' => __('Onboarding Checklist', 'formforge'), 'description' => __('New employee onboarding form', 'formforge'), 'icon' => 'yes-alt', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Employee Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Personal Email', 'required' => true], ['id' => 'start_date', 'type' => 'date', 'label' => 'Start Date', 'required' => true],
                ['id' => 'department', 'type' => 'text', 'label' => 'Department'], ['id' => 'manager', 'type' => 'text', 'label' => 'Manager Name'],
                ['id' => 'address', 'type' => 'address', 'label' => 'Home Address', 'required' => true],
                ['id' => 'emergency_name', 'type' => 'text', 'label' => 'Emergency Contact Name', 'required' => true], ['id' => 'emergency_phone', 'type' => 'phone', 'label' => 'Emergency Contact Phone', 'required' => true],
                ['id' => 'tshirt', 'type' => 'select', 'label' => 'T-Shirt Size', 'options' => [['value' => 's', 'label' => 'S'], ['value' => 'm', 'label' => 'M'], ['value' => 'l', 'label' => 'L'], ['value' => 'xl', 'label' => 'XL']]],
            ]],
            'travel_request' => ['title' => __('Travel Request', 'formforge'), 'description' => __('Business travel approval', 'formforge'), 'icon' => 'airplane', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Employee', 'required' => true], ['id' => 'destination', 'type' => 'text', 'label' => 'Destination', 'required' => true],
                ['id' => 'departure', 'type' => 'date', 'label' => 'Departure', 'required' => true], ['id' => 'return', 'type' => 'date', 'label' => 'Return', 'required' => true],
                ['id' => 'purpose', 'type' => 'textarea', 'label' => 'Purpose of Travel', 'required' => true, 'rows' => 3],
                ['id' => 'budget', 'type' => 'number', 'label' => 'Estimated Budget ($)'],
            ]],
            'performance_review' => ['title' => __('Performance Review', 'formforge'), 'description' => __('Employee self-assessment', 'formforge'), 'icon' => 'chart-bar', 'category' => 'hr', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Employee Name', 'required' => true], ['id' => 'period', 'type' => 'text', 'label' => 'Review Period', 'required' => true],
                ['id' => 'achievements', 'type' => 'textarea', 'label' => 'Key Achievements', 'required' => true, 'rows' => 4],
                ['id' => 'challenges', 'type' => 'textarea', 'label' => 'Challenges Faced', 'rows' => 3],
                ['id' => 'goals', 'type' => 'textarea', 'label' => 'Goals for Next Period', 'required' => true, 'rows' => 3],
                ['id' => 'self_rating', 'type' => 'rating', 'label' => 'Self Rating', 'max_stars' => 5],
            ]],
        ];
    }

    private static function event_templates() {
        return [
            'event_rsvp' => ['title' => __('Event RSVP', 'formforge'), 'description' => __('Simple event RSVP', 'formforge'), 'icon' => 'calendar-alt', 'category' => 'event', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'attending', 'type' => 'radio', 'label' => 'Will you attend?', 'required' => true, 'options' => [['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No'], ['value' => 'maybe', 'label' => 'Maybe']]],
                ['id' => 'guests', 'type' => 'number', 'label' => 'Number of Guests', 'min' => 0, 'max' => 10],
                ['id' => 'dietary', 'type' => 'text', 'label' => 'Dietary Requirements'],
            ]],
            'wedding_rsvp' => ['title' => __('Wedding RSVP', 'formforge'), 'description' => __('Wedding invitation response', 'formforge'), 'icon' => 'heart', 'category' => 'event', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Your Name', 'required' => true],
                ['id' => 'attending', 'type' => 'radio', 'label' => 'Will you attend?', 'required' => true, 'options' => [['value' => 'yes', 'label' => 'Joyfully Accept'], ['value' => 'no', 'label' => 'Regretfully Decline']]],
                ['id' => 'plus_one', 'type' => 'text', 'label' => 'Guest Name (if bringing +1)'],
                ['id' => 'meal', 'type' => 'radio', 'label' => 'Meal Preference', 'options' => [['value' => 'beef', 'label' => 'Beef'], ['value' => 'chicken', 'label' => 'Chicken'], ['value' => 'fish', 'label' => 'Fish'], ['value' => 'vegetarian', 'label' => 'Vegetarian']]],
                ['id' => 'song', 'type' => 'text', 'label' => 'Song Request'],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Message for the Couple', 'rows' => 3],
            ]],
            'ticket_booking' => ['title' => __('Ticket Booking', 'formforge'), 'description' => __('Book tickets for shows, movies, etc.', 'formforge'), 'icon' => 'tickets-alt', 'category' => 'event', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'event', 'type' => 'text', 'label' => 'Event', 'required' => true], ['id' => 'date', 'type' => 'date', 'label' => 'Date', 'required' => true],
                ['id' => 'tickets', 'type' => 'number', 'label' => 'Number of Tickets', 'required' => true, 'min' => 1, 'max' => 20],
                ['id' => 'type', 'type' => 'select', 'label' => 'Ticket Type', 'options' => [['value' => 'standard', 'label' => 'Standard'], ['value' => 'premium', 'label' => 'Premium'], ['value' => 'vip', 'label' => 'VIP']]],
            ]],
            'speaker_submission' => ['title' => __('Speaker Submission', 'formforge'), 'description' => __('Submit a talk proposal', 'formforge'), 'icon' => 'microphone', 'category' => 'event', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Speaker Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'bio', 'type' => 'textarea', 'label' => 'Short Bio', 'required' => true, 'rows' => 3],
                ['id' => 'title', 'type' => 'text', 'label' => 'Talk Title', 'required' => true],
                ['id' => 'abstract', 'type' => 'textarea', 'label' => 'Abstract', 'required' => true, 'rows' => 5],
                ['id' => 'level', 'type' => 'radio', 'label' => 'Level', 'options' => [['value' => 'beginner', 'label' => 'Beginner'], ['value' => 'intermediate', 'label' => 'Intermediate'], ['value' => 'advanced', 'label' => 'Advanced']]],
                ['id' => 'slides', 'type' => 'file_upload', 'label' => 'Slides (optional)', 'accept' => '.pdf,.pptx'],
            ]],
            'party_invitation' => ['title' => __('Party Invitation', 'formforge'), 'description' => __('Party RSVP with preferences', 'formforge'), 'icon' => 'smiley', 'category' => 'event', 'fields' => [
                ['id' => 'name', 'type' => 'text', 'label' => 'Your Name', 'required' => true],
                ['id' => 'attending', 'type' => 'radio', 'label' => 'Coming?', 'required' => true, 'options' => [['value' => 'yes', 'label' => "Yes, I'll be there!"], ['value' => 'no', 'label' => "Sorry, can't make it"]]],
                ['id' => 'guests', 'type' => 'number', 'label' => 'How many guests?', 'min' => 0, 'max' => 5],
                ['id' => 'allergies', 'type' => 'text', 'label' => 'Food allergies'],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Message', 'rows' => 2],
            ]],
            'exhibitor_registration' => ['title' => __('Exhibitor Registration', 'formforge'), 'description' => __('Register as an exhibitor at an event', 'formforge'), 'icon' => 'store', 'category' => 'event', 'fields' => [
                ['id' => 'company', 'type' => 'text', 'label' => 'Company Name', 'required' => true], ['id' => 'contact', 'type' => 'name', 'label' => 'Contact Person', 'required' => true],
                ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                ['id' => 'booth_size', 'type' => 'radio', 'label' => 'Booth Size', 'options' => [['value' => 'small', 'label' => 'Small (3x3m)'], ['value' => 'medium', 'label' => 'Medium (6x3m)'], ['value' => 'large', 'label' => 'Large (6x6m)']]],
                ['id' => 'needs', 'type' => 'checkbox', 'label' => 'Extra Needs', 'options' => [['value' => 'electricity', 'label' => 'Electricity'], ['value' => 'wifi', 'label' => 'WiFi'], ['value' => 'table', 'label' => 'Table & Chairs']]],
            ]],
        ];
    }

    private static function ecommerce_templates() {
        return [
            'product_return' => ['title' => __('Product Return', 'formforge'), 'description' => __('Return or exchange request', 'formforge'), 'icon' => 'undo', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'order_number', 'type' => 'text', 'label' => 'Order Number', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'product', 'type' => 'text', 'label' => 'Product Name', 'required' => true],
                ['id' => 'reason', 'type' => 'select', 'label' => 'Return Reason', 'required' => true, 'options' => [['value' => 'defective', 'label' => 'Defective'], ['value' => 'wrong', 'label' => 'Wrong Item'], ['value' => 'size', 'label' => 'Wrong Size'], ['value' => 'changed_mind', 'label' => 'Changed Mind']]],
                ['id' => 'action', 'type' => 'radio', 'label' => 'Preferred Action', 'options' => [['value' => 'refund', 'label' => 'Refund'], ['value' => 'exchange', 'label' => 'Exchange']]],
                ['id' => 'details', 'type' => 'textarea', 'label' => 'Details', 'rows' => 3],
                ['id' => 'photo', 'type' => 'file_upload', 'label' => 'Product Photo', 'accept' => '.jpg,.png'],
            ]],
            'warranty_claim' => ['title' => __('Warranty Claim', 'formforge'), 'description' => __('File a warranty claim', 'formforge'), 'icon' => 'shield', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'product', 'type' => 'text', 'label' => 'Product', 'required' => true], ['id' => 'purchase_date', 'type' => 'date', 'label' => 'Purchase Date', 'required' => true],
                ['id' => 'serial', 'type' => 'text', 'label' => 'Serial Number'],
                ['id' => 'issue', 'type' => 'textarea', 'label' => 'Describe the Issue', 'required' => true, 'rows' => 4],
                ['id' => 'receipt', 'type' => 'file_upload', 'label' => 'Proof of Purchase', 'accept' => '.pdf,.jpg,.png'],
            ]],
            'gift_card' => ['title' => __('Gift Card Request', 'formforge'), 'description' => __('Purchase or redeem a gift card', 'formforge'), 'icon' => 'money-alt', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'sender_name', 'type' => 'text', 'label' => 'Your Name', 'required' => true], ['id' => 'sender_email', 'type' => 'email', 'label' => 'Your Email', 'required' => true],
                ['id' => 'recipient_name', 'type' => 'text', 'label' => 'Recipient Name', 'required' => true], ['id' => 'recipient_email', 'type' => 'email', 'label' => 'Recipient Email', 'required' => true],
                ['id' => 'amount', 'type' => 'radio', 'label' => 'Amount', 'required' => true, 'options' => [['value' => '25', 'label' => '$25'], ['value' => '50', 'label' => '$50'], ['value' => '100', 'label' => '$100']]],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Personal Message', 'rows' => 3],
            ]],
            'affiliate_signup' => ['title' => __('Affiliate Signup', 'formforge'), 'description' => __('Join affiliate / referral program', 'formforge'), 'icon' => 'share-alt', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'website', 'type' => 'url', 'label' => 'Website/Blog URL', 'required' => true],
                ['id' => 'audience', 'type' => 'textarea', 'label' => 'Describe your audience', 'required' => true, 'rows' => 3],
                ['id' => 'monthly_traffic', 'type' => 'select', 'label' => 'Monthly Traffic', 'options' => [['value' => '<1k', 'label' => 'Under 1K'], ['value' => '1k-10k', 'label' => '1K-10K'], ['value' => '10k-100k', 'label' => '10K-100K'], ['value' => '100k+', 'label' => 'Over 100K']]],
                ['id' => 'promotion', 'type' => 'textarea', 'label' => 'How will you promote us?', 'rows' => 3],
                ['id' => 'terms', 'type' => 'checkbox', 'label' => 'I agree to the affiliate terms', 'required' => true],
            ]],
            'product_customization' => ['title' => __('Product Customization', 'formforge'), 'description' => __('Custom product request', 'formforge'), 'icon' => 'art', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'product', 'type' => 'text', 'label' => 'Base Product', 'required' => true],
                ['id' => 'color', 'type' => 'color', 'label' => 'Preferred Color'],
                ['id' => 'text', 'type' => 'text', 'label' => 'Custom Text/Engraving'],
                ['id' => 'design', 'type' => 'file_upload', 'label' => 'Upload Design', 'accept' => '.jpg,.png,.svg,.pdf'],
                ['id' => 'instructions', 'type' => 'textarea', 'label' => 'Special Instructions', 'rows' => 3],
            ]],
            'size_guide' => ['title' => __('Size Guide Request', 'formforge'), 'description' => __('Help customers find their size', 'formforge'), 'icon' => 'editor-expand', 'category' => 'ecommerce', 'fields' => [
                ['id' => 'product', 'type' => 'text', 'label' => 'Product You Are Interested In'], ['id' => 'height', 'type' => 'text', 'label' => 'Height'],
                ['id' => 'weight', 'type' => 'text', 'label' => 'Weight'], ['id' => 'usual_size', 'type' => 'text', 'label' => 'Usual Size'],
                ['id' => 'email', 'type' => 'email', 'label' => 'Email (for recommendation)', 'required' => true],
            ]],
        ];
    }

    private static function legal_templates() {
        return [
            'gdpr_request' => ['title' => __('GDPR Data Request', 'formforge'), 'description' => __('Data subject access or deletion request', 'formforge'), 'icon' => 'shield', 'category' => 'legal', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'request_type', 'type' => 'radio', 'label' => 'Request Type', 'required' => true, 'options' => [['value' => 'access', 'label' => 'Access My Data'], ['value' => 'delete', 'label' => 'Delete My Data'], ['value' => 'rectify', 'label' => 'Correct My Data'], ['value' => 'export', 'label' => 'Export My Data']]],
                ['id' => 'details', 'type' => 'textarea', 'label' => 'Additional Details', 'rows' => 4],
                ['id' => 'id_proof', 'type' => 'file_upload', 'label' => 'ID Verification', 'accept' => '.pdf,.jpg,.png'],
            ]],
            'terms_acceptance' => ['title' => __('Terms Acceptance', 'formforge'), 'description' => __('Accept terms and conditions', 'formforge'), 'icon' => 'media-text', 'category' => 'legal', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Full Legal Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'company', 'type' => 'text', 'label' => 'Company (if applicable)'],
                ['id' => 'terms', 'type' => 'checkbox', 'label' => 'I have read and accept the Terms of Service', 'required' => true],
                ['id' => 'privacy', 'type' => 'checkbox', 'label' => 'I have read and accept the Privacy Policy', 'required' => true],
                ['id' => 'date', 'type' => 'date', 'label' => 'Date', 'required' => true],
            ]],
            'nda_agreement' => ['title' => __('NDA Agreement', 'formforge'), 'description' => __('Non-disclosure agreement form', 'formforge'), 'icon' => 'lock', 'category' => 'legal', 'fields' => [
                ['id' => 'party_name', 'type' => 'text', 'label' => 'Full Name / Company', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'address', 'type' => 'address', 'label' => 'Address', 'required' => true],
                ['id' => 'purpose', 'type' => 'textarea', 'label' => 'Purpose of Disclosure', 'required' => true, 'rows' => 3],
                ['id' => 'accept', 'type' => 'checkbox', 'label' => 'I agree to the NDA terms', 'required' => true],
                ['id' => 'signature_date', 'type' => 'date', 'label' => 'Date', 'required' => true],
            ]],
            'privacy_consent' => ['title' => __('Privacy Consent', 'formforge'), 'description' => __('Data processing consent form', 'formforge'), 'icon' => 'privacy', 'category' => 'legal', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Full Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'consent_marketing', 'type' => 'checkbox', 'label' => 'I consent to receiving marketing communications'],
                ['id' => 'consent_analytics', 'type' => 'checkbox', 'label' => 'I consent to analytics data collection'],
                ['id' => 'consent_sharing', 'type' => 'checkbox', 'label' => 'I consent to data sharing with partners'],
                ['id' => 'consent_required', 'type' => 'checkbox', 'label' => 'I consent to necessary data processing', 'required' => true],
            ]],
        ];
    }

    private static function nonprofit_templates() {
        return [
            'volunteer_signup' => ['title' => __('Volunteer Signup', 'formforge'), 'description' => __('Sign up as a volunteer', 'formforge'), 'icon' => 'universal-access', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone', 'required' => true],
                ['id' => 'availability', 'type' => 'checkbox', 'label' => 'Availability', 'options' => [['value' => 'weekday', 'label' => 'Weekdays'], ['value' => 'weekend', 'label' => 'Weekends'], ['value' => 'evening', 'label' => 'Evenings']]],
                ['id' => 'skills', 'type' => 'textarea', 'label' => 'Skills & Experience', 'rows' => 3],
                ['id' => 'motivation', 'type' => 'textarea', 'label' => 'Why do you want to volunteer?', 'rows' => 3],
            ]],
            'donation_nonprofit' => ['title' => __('Nonprofit Donation', 'formforge'), 'description' => __('Donation form with tax receipt option', 'formforge'), 'icon' => 'heart', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'amount', 'type' => 'radio', 'label' => 'Amount', 'required' => true, 'options' => [['value' => '25', 'label' => '$25'], ['value' => '50', 'label' => '$50'], ['value' => '100', 'label' => '$100'], ['value' => '250', 'label' => '$250']]],
                ['id' => 'recurring', 'type' => 'radio', 'label' => 'Frequency', 'options' => [['value' => 'once', 'label' => 'One-time'], ['value' => 'monthly', 'label' => 'Monthly']]],
                ['id' => 'receipt', 'type' => 'radio', 'label' => 'Tax Receipt?', 'options' => [['value' => 'yes', 'label' => 'Yes'], ['value' => 'no', 'label' => 'No']]],
                ['id' => 'dedication', 'type' => 'text', 'label' => 'In honor/memory of'],
            ]],
            'membership_renewal' => ['title' => __('Membership Renewal', 'formforge'), 'description' => __('Renew organization membership', 'formforge'), 'icon' => 'groups', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'member_id', 'type' => 'text', 'label' => 'Member ID'], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'level', 'type' => 'radio', 'label' => 'Membership Level', 'required' => true, 'options' => [['value' => 'basic', 'label' => 'Basic'], ['value' => 'standard', 'label' => 'Standard'], ['value' => 'premium', 'label' => 'Premium']]],
                ['id' => 'auto_renew', 'type' => 'checkbox', 'label' => 'Enable auto-renewal'],
            ]],
            'petition' => ['title' => __('Petition / Signature', 'formforge'), 'description' => __('Collect petition signatures', 'formforge'), 'icon' => 'edit', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'name', 'type' => 'name', 'label' => 'Name', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'city', 'type' => 'text', 'label' => 'City'], ['id' => 'zip', 'type' => 'text', 'label' => 'ZIP/Postal Code'],
                ['id' => 'comment', 'type' => 'textarea', 'label' => 'Why this matters to you', 'rows' => 3],
                ['id' => 'sign', 'type' => 'checkbox', 'label' => 'I sign this petition', 'required' => true],
            ]],
            'sponsorship_nonprofit' => ['title' => __('Sponsorship Package', 'formforge'), 'description' => __('Choose a sponsorship tier', 'formforge'), 'icon' => 'money-alt', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'company', 'type' => 'text', 'label' => 'Company/Organization', 'required' => true], ['id' => 'contact', 'type' => 'name', 'label' => 'Contact', 'required' => true],
                ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true], ['id' => 'phone', 'type' => 'phone', 'label' => 'Phone'],
                ['id' => 'tier', 'type' => 'radio', 'label' => 'Tier', 'required' => true, 'options' => [['value' => 'platinum', 'label' => 'Platinum — $10,000'], ['value' => 'gold', 'label' => 'Gold — $5,000'], ['value' => 'silver', 'label' => 'Silver — $2,500'], ['value' => 'bronze', 'label' => 'Bronze — $1,000']]],
                ['id' => 'message', 'type' => 'textarea', 'label' => 'Additional Notes', 'rows' => 3],
            ]],
            'grant_nonprofit' => ['title' => __('Grant Application', 'formforge'), 'description' => __('Apply for nonprofit grants', 'formforge'), 'icon' => 'media-spreadsheet', 'category' => 'nonprofit', 'fields' => [
                ['id' => 'org', 'type' => 'text', 'label' => 'Organization', 'required' => true], ['id' => 'ein', 'type' => 'text', 'label' => 'EIN / Tax ID', 'required' => true],
                ['id' => 'contact', 'type' => 'name', 'label' => 'Contact', 'required' => true], ['id' => 'email', 'type' => 'email', 'label' => 'Email', 'required' => true],
                ['id' => 'amount', 'type' => 'number', 'label' => 'Amount Requested ($)', 'required' => true],
                ['id' => 'project', 'type' => 'textarea', 'label' => 'Project Description', 'required' => true, 'rows' => 5],
                ['id' => 'impact', 'type' => 'textarea', 'label' => 'Expected Impact', 'required' => true, 'rows' => 3],
                ['id' => 'budget', 'type' => 'file_upload', 'label' => 'Budget Document', 'accept' => '.pdf,.xlsx'],
            ]],
        ];
    }
}
