<?php

class kavehOptions
{
    private $prefix;

    public function __construct($prefix)
    {
        $this->prefix = $prefix;
        $this->create_options();
        add_filter('csf_field_typography_customwebfonts', [$this, 'my_custom_font_family']);
        
        // WPML compatibility hooks
        if ($this->is_wpml_active()) {
            add_action('csf_' . $prefix . '_saved', [$this, 'register_wpml_strings']);
            add_filter('csf_' . $prefix . '_get_option', [$this, 'translate_option_value'], 10, 3);
        }
    }

    public function create_options()
    {
        if (class_exists('CSF')) {
            CSF::createOptions(
                $this->prefix,
                array(
                    'menu_title' => __('Kaveh Settings', 'kavehTheme'),
                    'menu_slug' => 'kaveh-options',
                )
            );

            $sections = array(
                array(
                    'id' => 'one_tab',
                    'title' => __('General Settings', 'kavehTheme'),
                    'fields' => $this->get_section_general_fields(),
                ),
                array(
                    'id' => 'four_tab',
                    'title' => __('Appearance Settings', 'kavehTheme'),
                ),
                array(
                    'parent' => 'four_tab',
                    'title' => __('Color Settings', 'kavehTheme'),
                    'fields' => $this->get_section_appearance_fields(),
                ),
                array(
                    'parent' => 'four_tab',
                    'title' => __('Typography Settings', 'kavehTheme'),
                    'fields' => $this->get_section_typo_fields(),
                ),
                array(
                    'parent' => 'four_tab',
                    'title' => __('Custom Fonts', 'kavehTheme'),
                    'fields' => $this->get_section_custom_font_fields(),
                ),
                array(
                    'id' => 'mobile_tab',
                    'title' => __('Mobile Settings', 'kavehTheme'),
                    'fields' => $this->get_section_mobile_fields(),
                ),
                array(
                    'id' => 'two_tab',
                    'title' => __('Blog Settings', 'kavehTheme'),
                    'fields' => $this->get_section_blog_fields(),
                ),
                array(
                    'id' => 'three_tab',
                    'title' => __('Shop Settings', 'kavehTheme'),
                ),
                array(
                    'parent' => 'three_tab',
                    'title' => __('General WooCommerce Settings', 'kavehTheme'),
                    'fields' => $this->get_section_woo_general_fields(),
                ),
                array(
                    'parent' => 'three_tab',
                    'title' => __('Checkout Settings', 'kavehTheme'),
                    'fields' => $this->get_section_woo_checkout_fields(),
                ),
                array(
                    'parent' => 'three_tab',
                    'title' => __('Cart Settings', 'kavehTheme'),
                    'fields' => $this->get_section_woo_cart_fields(),
                ),
                array(
                    'parent' => 'three_tab',
                    'title' => __('Archive Page Settings', 'kavehTheme'),
                    'fields' => $this->get_section_woo_archive_fields(),
                ),
                array(
                    'parent' => 'three_tab',
                    'title' => __('Single Product Page Settings', 'kavehTheme'),
                    'fields' => $this->get_section_woo_single_fields(),
                ),
                array(
                    'id' => 'vor_tab',
                    'title' => __('Login and Registration Settings', 'kavehTheme'),
                ),
                array(
                    'parent' => 'vor_tab',
                    'title' => __('General Settings', 'kavehTheme'),
                    'fields' => $this->get_section_login_general_fields(),
                ),
                array(
                    'parent' => 'vor_tab',
                    'title' => __('Field Settings', 'kavehTheme'),
                    'fields' => $this->get_secion_inputs_fields(),
                ),
                array(
                    'parent' => 'vor_tab',
                    'title' => __('SMS Gateway Settings', 'kavehTheme'),
                    'fields' => $this->get_secion_sms_gateway_fields(),
                ),
                array(
                    'parent' => 'vor_tab',
                    'title' => __('Main SMS Gateway Details', 'kavehTheme'),
                    'fields' => $this->get_secion_main_gateway(),
                ),
                array(
                    'parent' => 'vor_tab',
                    'title' => __('Backup SMS Gateway Details', 'kavehTheme'),
                    'fields' => $this->get_secion_backup_gateway(),
                ),
                array(
                    'id' => 'factortab',
                    'title' => __('Invoice Settings', 'kavehTheme'),
                ),
                array(
                    'parent' => 'factortab',
                    'title' => __('General Settings', 'kavehTheme'),
                    'fields' => $this->get_section_factor_general(),
                ),
                array(
                    'parent' => 'factortab',
                    'title' => __('Invoice SMS Settings', 'kavehTheme'),
                    'fields' => $this->get_section_factor_sms(),
                ),
                array(
                    'parent' => 'factortab',
                    'title' => __('Pre-Invoice Settings', 'kavehTheme'),
                    'fields' => $this->get_sectionـpreـfactor_sms(),
                ),
                array(
                    'parent' => 'factortab',
                    'title' => __('Invoice Email Settings', 'kavehTheme'),
                    'fields' => $this->get_section_email_factor_sms(),
                ),
                array(
                    'id' => 'kaveh_custom_code',
                    'title' => __('Custom Codes', 'kavehTheme'),
                    'fields' => $this->get_section_custom_code(),
                ),
                array(
                    'id' => 'kaveh_backup_options',
                    'title' => __('Import/Export Settings', 'kavehTheme'),
                    'fields' => $this->get_secion_export_import(),
                ),
            );

            foreach ($sections as $section) {
                CSF::createSection($this->prefix, $section);
            }
        }
    }

    private function get_section_general_fields()
    {
        return array(
            array(
                'id' => 'kaveh_announcement_banner',
                'type' => 'switcher',
                'title' => __('Top Announcement Banner', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kaveh_announcement_banner_link',
                'type' => 'text',
                'title' => __('Top Announcement Banner Link', 'kavehTheme'),
                'default' => '#',
                'dependency' => array(
                    array('kaveh_announcement_banner', '==', '1'),
                ),
            ),
            array(
                'id' => 'kaveh_announcement_banner_image',
                'type' => 'upload',
                'desc' => __('The recommended size for the announcement banner is 2800px width and 100px height.', 'kavehTheme'),
                'title' => __('Upload Top Announcement Banner for Desktop', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'dependency' => array('kaveh_announcement_banner', '==', '1'),
                'default' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/top-banner.jpg',
            ),
            array(
                'id' => 'kaveh_announcement_banner_image_mobile',
                'type' => 'upload',
                'desc' => __('The recommended size for the mobile announcement banner is 500px width and 100px height.', 'kavehTheme'),
                'title' => __('Upload Top Announcement Banner for Mobile', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'dependency' => array('kaveh_announcement_banner', '==', '1'),
                'default' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/top-banner-mobile.jpg',
            ),
            array(
                'id' => 'bglogin',
                'type' => 'upload',
                'title' => __('Upload WordPress Login Page Background', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'default' => 'https://s21.uupload.ir/files/garousiamir/autumn-season-leafs-plant-scene-generative-ai.jpg',
            ),
            array(
                'id' => 'kaveh_logo_up',
                'type' => 'upload',
                'title' => __('Upload Logo', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'default' => 'https://kaveh.moeinwp.com/1/wp-content/uploads/2022/10/demo1.svg',
            ),
            array(
                'id' => 'search_kaveh_tasavir',
                'type' => 'switcher',
                'title' => __('Promotional Banners in Search Section', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'search-pic-repeater',
                'type' => 'repeater',
                'title' => __('Search Slider Images', 'kavehTheme'),
                'dependency' => array('search_kaveh_tasavir', '==', '1'),
                'fields' => array(
                    array(
                        'id' => 'searc-pic',
                        'type' => 'upload',
                        'title' => __('Slider Image', 'kavehTheme'),
                        'library' => 'image',
                        'placeholder' => 'http://',
                        'button_title' => __('Upload Image', 'kavehTheme'),
                        'remove_title' => __('Remove Image', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'searc-pic-url',
                        'type' => 'link',
                        'title' => __('Second Icon Link', 'kavehTheme'),
                        'add_title' => __('Add Link', 'kavehTheme'),
                        'edit_title' => __('Edit Link', 'kavehTheme'),
                        'remove_title' => __('Remove Link', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'searc-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/slider.png',
                    ),
                    array(
                        'searc-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/cloths3.jpg',
                    ),
                    array(
                        'searc-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/cloths2.jpg',
                    ),
                )
            ),
            array(
                'id' => 'aj-search',
                'type' => 'upload',
                'title' => __('First Small Search Image', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'dependency' => array('search_kaveh_tasavir', '==', '1'),
                'default' => 'https://kaveh.moeinwp.com/1/wp-content/uploads/2022/08/banner-03.png',
            ),
            array(
                'id' => 'aj-search2',
                'type' => 'upload',
                'title' => __('Second Small Search Image', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'dependency' => array('search_kaveh_tasavir', '==', '1'),
                'default' => 'https://kaveh.moeinwp.com/1/wp-content/uploads/2022/08/banner-02.png',
            ),
            array(
                'id' => 'kaveh_social_enable',
                'type' => 'switcher',
                'title' => __('Display Social Networks', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'my_svg_social_upload',
                'type' => 'upload',
                'dependency' => array('kaveh_social_enable', '==', '1'),
                'title' => __('Social Networks Icon Image', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_title_social',
                'type' => 'text',
                'title' => __('Main Title', 'kavehTheme'),
                'default' => __('Kaveh Store Support', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_title_two_social',
                'type' => 'text',
                'title' => __('Subtitle', 'kavehTheme'),
                'default' => __('Have a question? Contact us!', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_footer_menu-repeater',
                'type' => 'repeater',
                'title' => __('Social Network Icons', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'fields' => array(
                    array(
                        'id' => 'my_svg_two_social_upload',
                        'type' => 'upload',
                        'title' => __('Social Network Icon Image', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kaveh_title_social_social',
                        'type' => 'text',
                        'title' => __('Social Network Title', 'kavehTheme'),
                        'default' => __('WhatsApp', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kaveh_title_social_two_social',
                        'type' => 'text',
                        'title' => __('Subtitle', 'kavehTheme'),
                        'default' => __('We respond at the earliest opportunity', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kaveh_mobile_menu_text',
                        'type' => 'link',
                        'title' => __('Link', 'kavehTheme'),
                        'add_title' => __('Add Link', 'kavehTheme'),
                        'edit_title' => __('Edit Link', 'kavehTheme'),
                        'remove_title' => __('Remove Link', 'kavehTheme'),
                    ),
                ),
            ),
            array(
                'id' => 'my_svg_three_social_upload',
                'type' => 'upload',
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'title' => __('Contact Request Image', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_after_title_social_social',
                'type' => 'text',
                'title' => __('Contact Request Title', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'default' => __('Phone Contact Request', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_after_title_social_two_social',
                'type' => 'text',
                'title' => __('Contact Request Subtitle', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'default' => __('Contact us during business hours 9-18 every day of the week', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_callme_menu_text',
                'type' => 'link',
                'title' => __('Contact Request Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'back_main_icon',
                'type' => 'color',
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'title' => __('Social Network Icons Background Color', 'kavehTheme'),
            ),
            array(
                'id' => 'main_top_icon_social',
                'type' => 'color',
                'dependency' => array(
                    array('kaveh_social_enable', '==', 1),
                ),
                'title' => __('Social Network Box Top Color', 'kavehTheme'),
            ),
        );
    }

    private function get_section_appearance_fields()
    {
        return array(
            array(
                'id' => 'opt-color-5',
                'type' => 'color',
                'title' => __('Primary Site Color', 'kavehTheme'),
            ),
            array(
                'id' => 'opt-color-5-hover',
                'type' => 'color',
                'title' => __('Secondary Site Color', 'kavehTheme'),
            ),
            array(
                'id' => 'pricecolor',
                'type' => 'color',
                'title' => __('WooCommerce Prices Color', 'kavehTheme'),
            ),
        );
    }

    private function get_section_custom_font_fields()
    {
        return array(
            array(
                'id' => 'custom_fonts_heading',
                'type' => 'heading',
                'title' => __('Upload Custom Fonts', 'kavehTheme'),
                'subtitle' => __('In this section, you can upload your custom fonts.', 'kavehTheme'),
            ),
            array(
                'id' => 'custom_font_families',
                'type' => 'repeater',
                'title' => __('Custom Fonts', 'kavehTheme'),
                'button_title' => __('Add New Font', 'kavehTheme'),
                'fields' => array(
                    array(
                        'id' => 'font_family_name',
                        'type' => 'text',
                        'title' => __('Font Family Name', 'kavehTheme'),
                        'desc' => __('Enter a name for your font family. This name will be used in the font selection list.', 'kavehTheme'),
                        'placeholder' => __('Example: My Font', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'font_display',
                        'type' => 'select',
                        'title' => __('Font Display', 'kavehTheme'),
                        'options' => array(
                            'auto' => __('Auto', 'kavehTheme'),
                            'block' => __('Block', 'kavehTheme'),
                            'swap' => __('Swap', 'kavehTheme'),
                            'fallback' => __('Fallback', 'kavehTheme'),
                            'optional' => __('Optional', 'kavehTheme'),
                        ),
                        'default' => 'block',
                        'desc' => __('Set font-display: How text is displayed before the font is fully loaded.', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'font_weights',
                        'type' => 'repeater',
                        'title' => __('Font Weights', 'kavehTheme'),
                        'button_title' => __('Add Font Weight', 'kavehTheme'),
                        'desc' => __('Add a new entry for each font weight (e.g., Regular, Bold, etc.).', 'kavehTheme'),
                        'fields' => array(
                            array(
                                'id' => 'weight',
                                'type' => 'select',
                                'title' => __('Font Weight', 'kavehTheme'),
                                'options' => array(
                                    '100' => __('100 (Thin)', 'kavehTheme'),
                                    '200' => __('200 (Extra Light)', 'kavehTheme'),
                                    '300' => __('300 (Light)', 'kavehTheme'),
                                    '400' => __('400 (Regular)', 'kavehTheme'),
                                    '500' => __('500 (Medium)', 'kavehTheme'),
                                    '600' => __('600 (Semi Bold)', 'kavehTheme'),
                                    '700' => __('700 (Bold)', 'kavehTheme'),
                                    '800' => __('800 (Extra Bold)', 'kavehTheme'),
                                    '900' => __('900 (Black)', 'kavehTheme'),
                                ),
                                'default' => '400',
                            ),
                            array(
                                'id' => 'style',
                                'type' => 'select',
                                'title' => __('Font Style', 'kavehTheme'),
                                'options' => array(
                                    'normal' => __('Normal', 'kavehTheme'),
                                    'italic' => __('Italic', 'kavehTheme'),
                                ),
                                'default' => 'normal',
                            ),
                            array(
                                'id' => 'woff',
                                'type' => 'upload',
                                'title' => __('WOFF File', 'kavehTheme'),
                                'button_title' => __('Upload WOFF File', 'kavehTheme'),
                                'placeholder' => __('Upload or select file', 'kavehTheme'),
                                'desc' => __('WOFF format is recommended for compatibility with most browsers.', 'kavehTheme'),
                            ),
                            array(
                                'id' => 'woff2',
                                'type' => 'upload',
                                'title' => __('WOFF2 File', 'kavehTheme'),
                                'button_title' => __('Upload WOFF2 File', 'kavehTheme'),
                                'placeholder' => __('Upload or select file', 'kavehTheme'),
                                'desc' => __('WOFF2 format has better compression and is recommended for modern browsers.', 'kavehTheme'),
                            ),
                        ),
                    ),
                ),
            ),
            array(
                'id' => 'custom_fonts_notice',
                'type' => 'notice',
                'style' => 'info',
                'content' => __('After uploading custom fonts, they will appear in the typography section font selection menus.', 'kavehTheme')
            ),
        );
    }

    private function get_section_typo_fields()
    {
        return array(
            array(
                'id' => 'kaveh_advanced_typo',
                'type' => 'switcher',
                'title' => __('Advanced Typography Mode', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kaveh_typoselect',
                'type' => 'image_select',
                'title' => __('Select Font', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_advanced_typo', '!=', '1'),
                ),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/irsans.svg",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/iryekan.svg",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/ybakh.svg",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/dana.svg",
                    'value-5' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/moraba.svg",
                    'value-6' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/abr.svg",
                    'value-7' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/doran.svg",
                    'value-8' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/anjoman.svg",
                    'value-9' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/preloader/peyda.svg",
                ),
                'default' => 'value-3'
            ),
            array(
                'id' => 'typography_heading',
                'type' => 'heading',
                'title' => __('Typography Settings', 'kavehTheme'),
                'subtitle' => __('Adjust font, size, and style of various elements.', 'kavehTheme'),
            ),
            array(
                'id' => 'opt-typography-h1',
                'type' => 'typography',
                'title' => __('H1 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '900',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-h2',
                'type' => 'typography',
                'title' => __('H2 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '800',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-h3',
                'type' => 'typography',
                'title' => __('H3 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '700',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-h4',
                'type' => 'typography',
                'title' => __('H4 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '600',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-h5',
                'type' => 'typography',
                'title' => __('H5 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '500',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-h6',
                'type' => 'typography',
                'title' => __('H6 Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '500',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-p',
                'type' => 'typography',
                'title' => __('Paragraph Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '400',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-a',
                'type' => 'typography',
                'title' => __('Link Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => false,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '400',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-li',
                'type' => 'typography',
                'title' => __('List Item Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '400',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-ul',
                'type' => 'typography',
                'title' => __('List Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '400',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-button',
                'type' => 'typography',
                'title' => __('Buttons Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '600',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'center',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-input',
                'type' => 'typography',
                'title' => __('Inputs Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '400',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'opt-typography-label',
                'type' => 'typography',
                'title' => __('Labels Typography', 'kavehTheme'),
                'text_transform' => true,
                'text_align' => true,
                'subset' => false,
                'preview' => true,
                'color' => true,
                'exclude' => 'google,safe',
                'default' => array(
                    'font-family' => 'YekanBakh',
                    'font-weight' => '500',
                    'font-size' => '',
                    'line-height' => '',
                    'letter-spacing' => '0',
                    'text-align' => 'inherit',
                    'text-transform' => 'none',
                    'color' => ''
                ),
            ),
            array(
                'id' => 'typography_fallback',
                'type' => 'select',
                'title' => __('Fallback Fonts', 'kavehTheme'),
                'desc' => __('Fallback fonts are used if the primary font fails to load.', 'kavehTheme'),
                'options' => array(
                    'system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif' => __('System - Modern', 'kavehTheme'),
                    'Tahoma, Verdana, Segoe, sans-serif' => __('Tahoma and Verdana', 'kavehTheme'),
                    'Arial, Helvetica, sans-serif' => __('Arial and Helvetica', 'kavehTheme'),
                    '' => __('No Fallback Font', 'kavehTheme')
                ),
                'default' => 'system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif',
            ),
            array(
                'id' => 'font_optimization',
                'type' => 'switcher',
                'title' => __('Font Loading Optimization', 'kavehTheme'),
                'desc' => __('Enable preload for faster font loading', 'kavehTheme'),
                'default' => true
            ),
        );
    }

    private function get_section_mobile_fields()
    {
        return array(
            array(
                'id' => 'kaveh_header_mobile_on',
                'type' => 'switcher',
                'title' => __('Dedicated Mobile Header (Experimental)', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kaveh_header_mobile_select',
                'type' => 'image_select',
                'title' => __('Select Mobile Header Type', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_header_mobile_on', '==', 'true'),
                ),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/1.png",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/2.png",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/3.png",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/4.png",
                    'value-5' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/5.png",
                    'value-6' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/6.png",
                    'value-7' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/7.png",
                    'value-8' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/res-nav/header/8.png",
                ),
                'default' => 'value-1'
            ),
            array(
                'id' => 'kaveh_phone_header_mobile',
                'type' => 'text',
                'title' => __('Phone Number in Dedicated Mobile Header', 'kavehTheme'),
                'default' => '09120000000',
                'dependency' => array(
                    array('kaveh_header_mobile_select', '==', 'value-2'),
                ),
            ),
 
            array(
                'id' => 'kaveh_footer_mobile_on',
                'type' => 'switcher',
                'title' => __('Dedicated Mobile Footer', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_footer_mobile',
                'type' => 'image_select',
                'title' => __('Select Mobile Footer Type', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 'true'),
                ),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/fmobile1.png",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/fmobile2.png",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/fmobile3.png",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/fmobile4.png",
                ),
                'default' => 'value-1'
            ),
            array(
                'id' => 'kaveh_footer_mobile_texten',
                'type' => 'switcher',
                'title' => __('Use Text Below Icons', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile', 'any', 'value-2,value-3,value-4'),
                ),
                'default' => false
            ),
            array(
                'id' => 'kaveh_foomobile_icon1',
                'type' => 'text',
                'title' => __('First Footer Icon', 'kavehTheme'),
                'default' => 'icon-home-4',
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_text1',
                'type' => 'text',
                'title' => __('First Footer Icon Text', 'kavehTheme'),
                'default' => __('Home', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_texten', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_url_icon1',
                'type' => 'link',
                'title' => __('First Footer Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'default' => array(
                    'url' => home_url(),
                ),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_icon2',
                'type' => 'text',
                'title' => __('Second Footer Icon', 'kavehTheme'),
                'default' => 'icon-grid',
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_text2',
                'type' => 'text',
                'title' => __('Second Footer Icon Text', 'kavehTheme'),
                'default' => __('Shop', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_texten', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_url_icon2',
                'type' => 'link',
                'title' => __('Second Footer Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'default' => array(
                    'url' => home_url('/shop'),
                ),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_icon3',
                'type' => 'text',
                'title' => __('Third Footer Icon', 'kavehTheme'),
                'default' => 'icon-cart-3',
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_text3',
                'type' => 'text',
                'title' => __('Third Footer Icon Text', 'kavehTheme'),
                'default' => __('Cart', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_texten', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_url_icon3',
                'type' => 'link',
                'title' => __('Third Footer Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'default' => array(
                    'url' => '#',
                ),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_icon4',
                'type' => 'text',
                'title' => __('Fourth Footer Icon', 'kavehTheme'),
                'default' => 'icon-folder',
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_text4',
                'type' => 'text',
                'title' => __('Fourth Footer Icon Text', 'kavehTheme'),
                'default' => __('Blog', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_texten', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_url_icon4',
                'type' => 'link',
                'title' => __('Fourth Footer Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'default' => array(
                    'url' => home_url('/blog'),
                ),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_icon5',
                'type' => 'text',
                'title' => __('Fifth Footer Icon', 'kavehTheme'),
                'default' => 'icon-user-2',
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_text5',
                'type' => 'text',
                'title' => __('Fifth Footer Icon Text', 'kavehTheme'),
                'default' => __('User Account', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_footer_mobile_texten', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_foomobile_url_icon5',
                'type' => 'link',
                'title' => __('Fifth Footer Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'default' => array(
                    'url' => home_url('/my-account'),
                ),
                'dependency' => array(
                    array('kaveh_footer_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_mobile_select',
                'type' => 'select',
                'title' => __('Kaveh Mobile Menu', 'kavehTheme'),
                'placeholder' => __('Select a Menu', 'kavehTheme'),
                'chosen' => false,
                'ajax' => true,
                'options' => 'menus',
            ),
            array(
                'id' => 'kaveh_header_mobile_bg_type',
                'type' => 'select',
                'title' => __('Mobile Menu Background Type', 'kavehTheme'),
                'options' => array(
                    'option-1' => __('Image Background', 'kavehTheme'),
                    'option-2' => __('Color Background', 'kavehTheme'),
                ),
                'default' => 'option-2'
            ),
            array(
                'id' => 'kaveh_mobile_header_bg_image',
                'type' => 'upload',
                'title' => __('Menu Background Image', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload Image', 'kavehTheme'),
                'remove_title' => __('Remove Image', 'kavehTheme'),
                'default' => 'https://kaveh.moeinwp.com/1/wp-content/themes/kavehTheme/assets/images/bg-nav-responsive.png',
                'dependency' => array(
                    array('kaveh_header_mobile_bg_type', '==', 'option-1'),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_mobile_on',
                'type' => 'switcher',
                'title' => __('Mobile Menu Bottom Box', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_boxmenudown_text',
                'type' => 'text',
                'title' => __('Discount Button Text', 'kavehTheme'),
                'default' => __('Discounts', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_iconclass',
                'type' => 'text',
                'title' => __('Discount Button Icon', 'kavehTheme'),
                'default' => 'icon-offer-2',
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_url',
                'type' => 'link',
                'title' => __('Discount Button Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_icon1',
                'type' => 'text',
                'title' => __('First Icon Next to Discount Button', 'kavehTheme'),
                'default' => 'icon-document',
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_url_icon1',
                'type' => 'link',
                'title' => __('First Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_icon2',
                'type' => 'text',
                'title' => __('Second Icon Next to Discount Button', 'kavehTheme'),
                'default' => 'icon-phone-4',
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_boxmenudown_url_icon2',
                'type' => 'link',
                'title' => __('Second Icon Link', 'kavehTheme'),
                'add_title' => __('Add Link', 'kavehTheme'),
                'edit_title' => __('Edit Link', 'kavehTheme'),
                'remove_title' => __('Remove Link', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_boxmenudown_mobile_on', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_icons_mobile_on',
                'type' => 'switcher',
                'title' => __('Mobile Menu Social Networks', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_mobile_menu-repeater',
                'type' => 'repeater',
                'title' => __('Social Network Icons', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_icons_mobile_on', '==', true),
                ),
                'fields' => array(
                    array(
                        'id' => 'kaveh_mobile_menu_icon',
                        'type' => 'text',
                        'title' => __('Icon Class', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kaveh_mobile_menu_text',
                        'type' => 'link',
                        'title' => __('Link', 'kavehTheme'),
                        'add_title' => __('Add Link', 'kavehTheme'),
                        'edit_title' => __('Edit Link', 'kavehTheme'),
                        'remove_title' => __('Remove Link', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'kaveh_mobile_menu_icon' => 'icon-whatsapp',
                        'kaveh_mobile_menu_text' => '#',
                    ),
                    array(
                        'kaveh_mobile_menu_icon' => 'icon-linkedin',
                        'kaveh_mobile_menu_text' => '#',
                    ),
                    array(
                        'kaveh_mobile_menu_icon' => 'icon-twitter',
                        'kaveh_mobile_menu_text' => '#',
                    ),
                    array(
                        'kaveh_mobile_menu_icon' => 'icon-instagram',
                        'kaveh_mobile_menu_text' => '#',
                    ),
                )
            )
        );
    }

    private function get_section_blog_fields()
    {
        return array(
            array(
                'id' => 'kaveh_bl_cart_select',
                'type' => 'image_select',
                'title' => __('Select Blog Card Type', 'kavehTheme'),
                'description' => __('This option changes the style of blog cards on the blog page and post category pages. Other places with blog cards can be customized via Elementor.', 'kavehTheme'),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-1.png",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-2.png",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-3.png",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-4.png",
                    'value-5' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-5.png",
                    'value-6' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-6.png",
                    'value-7' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-7.png",
                    'value-8' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-8.png",
                    'value-9' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/blog-cart/bl-single-9.png",
                ),
                'default' => 'value-1'
            ),
            array(
                'id' => 'search_kaveh_blog_switch_slides',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Display Banners Above Blog', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'blog-pic-repeater',
                'type' => 'repeater',
                'title' => __('Blog Slider Images', 'kavehTheme'),
                'dependency' => array('search_kaveh_blog_switch_slides', '==', '1'),
                'fields' => array(
                    array(
                        'id' => 'blog-pic',
                        'type' => 'upload',
                        'title' => __('Slider Image', 'kavehTheme'),
                        'library' => 'image',
                        'placeholder' => 'http://',
                        'button_title' => __('Upload Image', 'kavehTheme'),
                        'remove_title' => __('Remove Image', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'blog-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/slider.png',
                    ),
                    array(
                        'blog-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/cloths3.jpg',
                    ),
                    array(
                        'blog-pic' => 'https://kaveh.moeinwp.com/4/wp-content/uploads/2023/02/cloths2.jpg',
                    ),
                )
            ),
        );
    }

    private function get_section_woo_general_fields()
    {
        return array(
            array(
                'id' => 'kaveh_pricechart_system',
                'type' => 'switcher',
                'title' => __('Product Price History Chart Feature', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kaveh_compare_system',
                'type' => 'switcher',
                'title' => __('Product Compare Feature', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kaveh_wishlist_system',
                'type' => 'switcher',
                'title' => __('Product wishlist Feature', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'currency_new_svg',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Enable Modern Toman Symbol for WooCommerce Unit', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'hide_outofstock_products',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Hide Out-of-Stock Products in WooCommerce Archive', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'move_outofstock_to_end',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Move Out-of-Stock Products to End of List', 'kavehTheme'),
                'desc' => __('When enabled, out-of-stock products will be moved to the end of the product list instead of being hidden.', 'kavehTheme'),
                'dependency' => array(
                    array('hide_outofstock_products', '!=', '1'),
                ),
                'default' => false
            ),
            array(
                'id' => 'variable_product_price_format',
                'type' => 'select',
                'title' => __('Variable Product Price Display Format', 'kavehTheme'),
                'desc' => __('Choose how to display prices for variable products.', 'kavehTheme'),
                'options' => array(
                    'range' => __('Price Range (e.g., $10 - $50)', 'kavehTheme'),
                    'lowest' => __('From Lowest Price (e.g., From $10)', 'kavehTheme'),
                    'highest' => __('Up to Highest Price (e.g., Up to $50)', 'kavehTheme')
                ),
                'default' => 'range'
            ),
            array(
                'id' => 'opencartonaddtocart',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Open Sidebar Cart After Adding to Cart', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'auto_register_guest_user',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Auto-Register Guest User at WooCommerce Checkout', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'prtamas',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Replace Add to Cart Button with Contact Us', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'prtamas_text',
                'type' => 'text',
                'title' => __('Contact Us Text', 'kavehTheme'),
                'dependency' => array(
                    array('prtamas', '==', true),
                ),
                'default' => __('Contact us for ordering', 'kavehTheme'),
            ),
            array(
                'id' => 'prtamas_link',
                'type' => 'text',
                'title' => __('Contact Us Link', 'kavehTheme'),
                'dependency' => array(
                    array('prtamas', '==', true),
                ),
                'default' => '#',
            ),
            array(
                'id' => 'prtamas_apply_all',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Apply Contact Button to All Products', 'kavehTheme'),
                'dependency' => array(
                    array('prtamas', '==', true),
                ),
                'default' => true
            ),
            array(
                'id' => 'prtamas_apply_oncat',
                'type' => 'select',
                'title' => __('Apply Button to Specific Categories', 'kavehTheme'),
                'placeholder' => __('Select relevant categories', 'kavehTheme'),
                'chosen' => true,
                'ajax' => true,
                'multiple' => true,
                'dependency' => array(
                    array('prtamas_apply_all', '!=', '1'),
                    array('prtamas', '==', '1'),
                ),
                'options' => 'categories',
                'query_args' => array(
                    'taxonomy' => 'product_cat'
                )
            ),
            array(
                'id' => 'prtamas_apply_onpr',
                'type' => 'select',
                'title' => __('Apply Button to Specific Products', 'kavehTheme'),
                'placeholder' => __('Select relevant products', 'kavehTheme'),
                'chosen' => true,
                'ajax' => true,
                'multiple' => true,
                'dependency' => array(
                    array('prtamas_apply_all', '!=', '1'),
                    array('prtamas', '==', '1'),
                ),
                'options' => 'posts',
                'query_args' => array(
                    'post_type' => 'product'
                )
            ),
        );
    }

    private function get_section_woo_checkout_fields()
    {
        return array(
            array(
                'id' => 'woofieldscontrol',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Control Checkout Fields', 'kavehTheme'),
                'dependency' => array('kcheckout_modern', '==', '1'),
                'default' => false
            ),
            array(
                'id' => 'kwoofields',
                'type' => 'sorter',
                'title' => __('Checkout Fields', 'kavehTheme'),
                'default' => array(
                    'enabled' => array(
                        'billing_first_name' => __('First Name', 'kavehTheme'),
                        'billing_last_name' => __('Last Name', 'kavehTheme'),
                        'billing_phone' => __('Mobile Number', 'kavehTheme'),
                        'billing_email' => __('Email', 'kavehTheme'),
                        'billing_state' => __('State', 'kavehTheme'),
                        'billing_city' => __('City', 'kavehTheme'),
                        'billing_address_1' => __('Address Field 1', 'kavehTheme'),
                        'billing_address_2' => __('Address Field 2', 'kavehTheme'),
                        'billing_postcode' => __('Postal Code', 'kavehTheme'),
                    ),
                    'disabled' => array(
                        'billing_company' => __('Company', 'kavehTheme'),
                        'billing_country' => __('Country', 'kavehTheme'),
                    ),
                ),
                'dependency' => array(
                    array('kcheckout_modern', '==', '1'),
                    array('woofieldscontrol', '==', '1'),
                ),
                'disabled_title' => __('Disabled Fields', 'kavehTheme'),
                'enabled_title' => __('Enabled Fields', 'kavehTheme'),
            ),
            array(
                'id' => 'fixed_checkout_submit',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Enable Sticky Checkout Button on Mobile', 'kavehTheme'),
                'desc' => __('Enabling this option adds a sticky button in the checkout section, making the purchase process easier for users.', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_map_oncheckout',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Enable Map On Checkout', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kcheckout_header',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Enable Dedicated Checkout Header', 'kavehTheme'),
                'desc' => __('If enabled, a header optimized for focusing on the purchase will be displayed, and other page headers will be hidden.', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kcheckout_header_text1',
                'type' => 'text',
                'title' => __('Cart Review Stage Text', 'kavehTheme'),
                'default' => __('Cart Review', 'kavehTheme'),
                'dependency' => array(
                    array('kcheckout_header', '==', 1),
                ),
            ),
            array(
                'id' => 'kcheckout_header_text2',
                'type' => 'text',
                'title' => __('Checkout Stage Text', 'kavehTheme'),
                'default' => __('Select Shipping and Payment Method', 'kavehTheme'),
                'dependency' => array(
                    array('kcheckout_header', '==', 1),
                ),
            ),
            array(
                'id' => 'kcheckout_header_text3',
                'type' => 'text',
                'title' => __('Purchase Completion Stage Text', 'kavehTheme'),
                'default' => __('Complete Purchase Process', 'kavehTheme'),
                'dependency' => array(
                    array('kcheckout_header', '==', 1),
                ),
            ),
            array(
                'id' => 'kwoocheckoutdesc',
                'type' => 'wp_editor',
                'title' => __('Order Description', 'kavehTheme'),
                'sanitize' => false,
            ),
        );
    }



    private function get_section_woo_archive_fields()
    {
        return array(
            array(
                'id' => 'kaveh_sh_cart_select',
                'type' => 'image_select',
                'title' => __('Select Shop Card Type', 'kavehTheme'),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-10.jpg",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-9.jpg",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-6.jpg",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-5.jpg",
                    'value-5' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-3.jpg",
                    'value-6' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-2.jpg",
                    'value-7' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-8.jpg",
                    'value-8' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-4.jpg",
                    'value-9' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-1.jpg",
                    'value-10' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-7.jpg",
                    'value-11' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-11.jpg",
                    'value-12' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-12.jpg",
                    'value-13' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-13.jpg",
                    'value-14' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-14.jpg",
                    'value-15' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-15.jpg",
                    'value-16' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-16.jpg",
                    'value-17' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-17.png",
                    'value-18' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-18.png",
                    'value-19' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-19.png",
                    'value-20' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-20.png",
                    'value-21' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/cart-shop/c-shop-21.png",
                ),
                'default' => 'value-1'
            ),
            array(
                'id' => 'kaveh_product_title_display',
                'type' => 'switcher',
                'title' => __('Show Full Product Titles in Cards', 'kavehTheme'),
                'desc' => __('Enable to show complete product titles in all product cards. Disable to trim titles for uniform card heights.', 'kavehTheme'),
                'text_on' => __('Show Full Titles', 'kavehTheme'),
                'text_off' => __('Trim Titles', 'kavehTheme'),
                'default' => false
            ),
        );
    }

    private function get_section_woo_single_fields()
    {
        return array(
            array(
                'id' => 'kaveh_pr_single_select',
                'type' => 'image_select',
                'title' => __('Select single product page type', 'kavehTheme'),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/1-pr-single.svg",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/2-pr-single.svg",
                    'value-3' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/3-pr-single.svg",
                    'value-4' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/4-pr-single.svg",
                ),
                'default' => 'value-2'
            ),
            array(
                'id' => 'kaveh_pr_single_select_fixed_footer',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Enable sticky add to cart', 'kavehTheme'),
                'dependency' => array('kaveh_pr_single_select', 'any', 'value-1,value-4'),
                'default' => true
            ),
            array(
                'id' => 'ajaxnosingle',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Disable AJAX on single product page', 'kavehTheme'),
                'desc' => __('If you use third-party plugins and encounter issues with adding to cart on the single product page, enable this option; otherwise, keep it disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'featuresinsingle',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Show features above short description', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'catlimitinsingle',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Limit category display to one', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'excerptinsingle',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Show short description', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'excerptlimit',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Limit the number of words in short description', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'excerptinsinglenumber',
                'type' => 'number',
                'dependency' => array(
                    array('excerptlimit', '==', true),
                ),
                'title' => __('Limit the number of words in short description', 'kavehTheme'),
                'default' => 40,
            ),
            array(
                'id' => 'pro-desc-show-more',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Show full description briefly with a show more button', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'pro-pic-repeater-show',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Show product box icons', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'pro-pic-repeater',
                'type' => 'repeater',
                'title' => __('Product box icons', 'kavehTheme'),
                'dependency' => array(
                    array('pro-pic-repeater-show', '==', true),
                ),
                'fields' => array(
                    array(
                        'id' => 'pro-pic-icon',
                        'type' => 'text',
                        'title' => __('Icon class', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'pro-pic-text',
                        'type' => 'text',
                        'title' => __('Box text', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'pro-pic-icon' => 'icon-box',
                        'pro-pic-text' => __('Express delivery', 'kavehTheme'),
                    ),
                    array(
                        'pro-pic-icon' => 'icon-money',
                        'pro-pic-text' => __('Cash on delivery', 'kavehTheme'),
                    ),
                    array(
                        'pro-pic-icon' => 'icon-seven-plus',
                        'pro-pic-text' => __('Seven-day return guarantee', 'kavehTheme'),
                    ),
                    array(
                        'pro-pic-icon' => 'icon-security',
                        'pro-pic-text' => __('Product warranty', 'kavehTheme'),
                    ),
                    array(
                        'pro-pic-icon' => 'icon-suport',
                        'pro-pic-text' => __('Online support', 'kavehTheme'),
                    ),
                )
            ),
            array(
                'id' => 'boxprsinglecustomcolor',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Customize product page box colors', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'boxsingleprbg',
                'type' => 'color',
                'title' => __('Icon box background', 'kavehTheme'),
                'dependency' => array(
                    array('boxprsinglecustomcolor', '==', true),
                ),
            ),
            array(
                'id' => 'boxsingleprbgicon',
                'type' => 'color',
                'title' => __('Icon background', 'kavehTheme'),
                'dependency' => array(
                    array('boxprsinglecustomcolor', '==', true),
                ),
            ),
            array(
                'id' => 'boxsinglepriconcolor',
                'type' => 'color',
                'title' => __('Icon color', 'kavehTheme'),
                'dependency' => array(
                    array('boxprsinglecustomcolor', '==', true),
                ),
            ),
            array(
                'id' => 'showheaderinsingle',
                'type' => 'switcher',
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'title' => __('Show normal header instead of mobile header style 4', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_pr_single_select', '==', 'value-4'),
                ),
                'default' => false
            ),
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('The settings below are available both here globally and individually on the product edit page in WooCommerce, allowing you to set them specifically for each product', 'kavehTheme'),
            ),
            array(
                'id' => 'kvideo_show',
                'type' => 'switcher',
                'title' => __('Product introduction video', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false
            ),
            array(
                'id' => 'kvideo_iframe',
                'desc' => __('In this style, you use third-party services like Aparat, etc.', 'kavehTheme'),
                'type' => 'code_editor',
                'sanitize' => false,
                'title' => __('Product introduction video iframe', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_show', '==', 'true'),
                ),
            ),
            array(
                'id' => 'kvideo_upload',
                'type' => 'upload',
                'title' => __('Upload product video', 'kavehTheme'),
                'button_title' => __('Upload video', 'kavehTheme'),
                'remove_title' => __('Remove video', 'kavehTheme'),
                'desc' => __('In this style, you directly upload the video to your host', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_show', '==', 'true'),
                ),
            ),
            array(
                'id' => 'kcoupon_single',
                'type' => 'switcher',
                'title' => __('Show discount code', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kcoupon_single_image',
                'type' => 'upload',
                'title' => __('Discount image', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload image', 'kavehTheme'),
                'remove_title' => __('Remove image', 'kavehTheme'),
                'dependency' => array('kcoupon_single', '==', 1),
                'default' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/coupon.png',
            ),
            array(
                'id' => 'kcoupon_single_text',
                'type' => 'text',
                'title' => __('Discount code text', 'kavehTheme'),
                'default' => __('10% discount code for first purchase: new', 'kavehTheme'),
                'dependency' => array(
                    array('kcoupon_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kcoupon_single_link',
                'type' => 'text',
                'title' => __('Link', 'kavehTheme'),
                'default' => '#',
                'dependency' => array(
                    array('kcoupon_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kvideo_qr_single',
                'type' => 'switcher',
                'title' => __('Show product QR code', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kvideo_qr_single_text1',
                'type' => 'text',
                'title' => __('First QR code scan text', 'kavehTheme'),
                'default' => __('View on mobile', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_qr_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kvideo_qr_single_text2',
                'type' => 'text',
                'title' => __('Second QR code scan text', 'kavehTheme'),
                'default' => __('Scan now', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_qr_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kvideo_ersalrygan_single',
                'type' => 'switcher',
                'title' => __('Free shipping box', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kvideo_ersalrygan_single_text1',
                'type' => 'text',
                'title' => __('First box text', 'kavehTheme'),
                'default' => __('Free shipping for DigiPlus members', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_ersalrygan_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kvideo_ersalrygan_single_text2',
                'type' => 'text',
                'title' => __('Second box text', 'kavehTheme'),
                'default' => __('39,000 Toman shipping cost to all of Iran for non-DigiPlus users', 'kavehTheme'),
                'dependency' => array(
                    array('kvideo_ersalrygan_single', '==', 1),
                ),
            ),
            array(
                'id' => 'kvideo_ersalrygan_single_image',
                'type' => 'upload',
                'title' => __('Left box image', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload image', 'kavehTheme'),
                'remove_title' => __('Remove image', 'kavehTheme'),
                'dependency' => array('kvideo_ersalrygan_single', '==', '1'),
                'default' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/date-send.svg',
            ),
            array(
                'id' => 'ktickets_single',
                'type' => 'repeater',
                'title' => __('Custom boxes under description', 'kavehTheme'),
                'fields' => array(
                    array(
                        'id' => 'ktickets_single_image',
                        'type' => 'upload',
                        'title' => __('Box image', 'kavehTheme'),
                        'library' => 'image',
                        'placeholder' => 'http://',
                        'button_title' => __('Upload image', 'kavehTheme'),
                        'remove_title' => __('Remove image', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_text1',
                        'type' => 'text',
                        'title' => __('First box text', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_text2',
                        'type' => 'text',
                        'title' => __('Second box text', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_link',
                        'type' => 'text',
                        'title' => __('Box link', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_color1',
                        'type' => 'color',
                        'title' => __('Box overall color', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_color2',
                        'type' => 'color',
                        'title' => __('Image box color', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'ktickets_single_color3',
                        'type' => 'color',
                        'title' => __('Text color', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'ktickets_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/snappaylogo.png',
                        'ktickets_single_text1' => __('Installment payment with SnapPay', 'kavehTheme'),
                        'ktickets_single_text2' => __('No need for check or promissory note', 'kavehTheme'),
                        'ktickets_single_link' => '#',
                        'ktickets_single_color1' => '#008efa',
                        'ktickets_single_color2' => '#096db9',
                        'ktickets_single_color3' => '#fff',
                    ),
                    array(
                        'ktickets_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/tara.svg',
                        'ktickets_single_text1' => __('Credit payment with Tara', 'kavehTheme'),
                        'ktickets_single_text2' => __('Buy now, pay at the end of the month', 'kavehTheme'),
                        'ktickets_single_link' => '#',
                        'ktickets_single_color1' => '#581f81',
                        'ktickets_single_color2' => '#f9abe0',
                        'ktickets_single_color3' => '#fff',
                    ),
                )
            ),
            array(
                'id' => 'kticketsthumnail_single',
                'type' => 'repeater',
                'title' => __('Custom boxes under images', 'kavehTheme'),
                'fields' => array(
                    array(
                        'id' => 'kticketsthumnail_single_image',
                        'type' => 'upload',
                        'title' => __('Box image', 'kavehTheme'),
                        'library' => 'image',
                        'placeholder' => 'http://',
                        'button_title' => __('Upload image', 'kavehTheme'),
                        'remove_title' => __('Remove image', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kticketsthumnail_single_text1',
                        'type' => 'text',
                        'title' => __('Box text', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kticketsthumnail_single_link',
                        'type' => 'text',
                        'title' => __('Box link', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kticketsthumnail_single_color1',
                        'type' => 'color',
                        'title' => __('Box overall color', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kticketsthumnail_single_color2',
                        'type' => 'color',
                        'title' => __('Image box color', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'kticketsthumnail_single_color3',
                        'type' => 'color',
                        'title' => __('Text color', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'kticketsthumnail_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/telegram.png',
                        'kticketsthumnail_single_text1' => __('Connect via Telegram', 'kavehTheme'),
                        'kticketsthumnail_single_link' => '#',
                        'kticketsthumnail_single_color1' => '#40b1e3',
                        'kticketsthumnail_single_color2' => '#0090c7',
                        'kticketsthumnail_single_color3' => '#fff',
                    ),
                    array(
                        'kticketsthumnail_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/whatsapp.png',
                        'kticketsthumnail_single_text1' => __('Connect via WhatsApp', 'kavehTheme'),
                        'kticketsthumnail_single_link' => '#',
                        'kticketsthumnail_single_color1' => '#41bf55',
                        'kticketsthumnail_single_color2' => '#32a346',
                        'kticketsthumnail_single_color3' => '#fff',
                    ),
                    array(
                        'kticketsthumnail_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/rubika.png',
                        'kticketsthumnail_single_text1' => __('Connect via Rubika', 'kavehTheme'),
                        'kticketsthumnail_single_link' => '#',
                        'kticketsthumnail_single_color1' => '#fe6600',
                        'kticketsthumnail_single_color2' => '#fff',
                        'kticketsthumnail_single_color3' => '#fff',
                    ),
                    array(
                        'kticketsthumnail_single_image' => esc_url(KAVEH_TEMPLATE_URI) . '/assets/images/single-pr/bale.png',
                        'kticketsthumnail_single_text1' => __('Connect via Bale', 'kavehTheme'),
                        'kticketsthumnail_single_link' => '#',
                        'kticketsthumnail_single_color1' => '#01b894',
                        'kticketsthumnail_single_color2' => '#04f2c4',
                        'kticketsthumnail_single_color3' => '#fff',
                    ),
                )
            ),
            array(
                'id' => 'klis_single',
                'type' => 'repeater',
                'title' => __('Product list features', 'kavehTheme'),
                'fields' => array(
                    array(
                        'id' => 'klis_single_icon',
                        'type' => 'text',
                        'title' => __('Icon', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'klis_single_text1',
                        'type' => 'text',
                        'title' => __('First text part', 'kavehTheme'),
                    ),
                    array(
                        'id' => 'klis_single_text2',
                        'type' => 'text',
                        'title' => __('Second text part', 'kavehTheme'),
                    ),
                ),
                'default' => array(
                    array(
                        'klis_single_icon' => 'far fa-dot-circle',
                        'klis_single_text1' => __('Ship from', 'kavehTheme'),
                        'klis_single_text2' => __('2 business days', 'kavehTheme'),
                    ),
                    array(
                        'klis_single_icon' => 'far fa-dot-circle',
                        'klis_single_text1' => __('Express shipping', 'kavehTheme'),
                        'klis_single_text2' => __('In Tehran city', 'kavehTheme'),
                    ),
                    array(
                        'klis_single_icon' => 'far fa-dot-circle',
                        'klis_single_text1' => __('Warranty', 'kavehTheme'),
                        'klis_single_text2' => __('Authenticity and physical condition', 'kavehTheme'),
                    ),
                )
            ),
        );
    }
    
    private function get_section_woo_cart_fields()
    {
        return array(
            array(
                'id' => 'kaveh_pr_cart_drop_select',
                'type' => 'image_select',
                'title' => __('Select dropdown cart type', 'kavehTheme'),
                'options' => array(
                    'value-1' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/cart1.png",
                    'value-2' => esc_url(KAVEH_TEMPLATE_URI) . "/assets/images/single-pr/cart2.png",
                ),
                'default' => 'value-2'
            ),
        );
    }
    
    private function get_section_login_general_fields()
    {
        return array(
            array(
                'id' => 'kaveh_login_redirect',
                'type' => 'switcher',
                'title' => __('Redirect to Kaveh login page', 'kavehTheme'),
                'desc' => __('By disabling this option, the Kaveh login and registration system will be completely deactivated, and you can use your preferred plugins for this purpose', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_login_type',
                'type' => 'select',
                'title' => __('Select login and registration system', 'kavehTheme'),
                'options' => array(
                    'option-1' => __('Only with SMS', 'kavehTheme'),
                    'option-2' => __('Only with fixed password', 'kavehTheme'),
                    'option-3' => __('SMS and fixed password', 'kavehTheme'),
                ),
                'default' => 'option-3'
            ),
        );
    }
    
    private function get_secion_sms_gateway_fields()
    {
        return array(
            array(
                'id' => 'kaveh_login_switchtobackup',
                'type' => 'switcher',
                'title' => __('Enable resend from backup SMS panel', 'kavehTheme'),
                'desc' => __('If enabled, after a specified time, the user can resend the code from your secondary SMS panel by clicking the resend option. This ensures peace of mind regarding SMS panel disruptions', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false,
            ),
            array(
                'id' => 'kaveh_login_send_again',
                'title' => __('Time to activate resend button (in seconds)', 'kavehTheme'),
                'type' => 'text',
                'default' => '45',
                'dependency' => array('kaveh_login_switchtobackup', 'any', '1'),
            ),
        );
    }
    
    private function get_secion_inputs_fields()
    {
        return array(
            array(
                'id' => 'kaveh_login_latin_fields',
                'type' => 'switcher',
                'title' => __('Force use of Latin and English characters for fields', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false,
            ),
            array(
                'id' => 'kloginfields',
                'type' => 'sorter',
                'title' => __('Login and registration fields', 'kavehTheme'),
                'default' => array(
                    'enabled' => array(
                        'first_name' => __('First name', 'kavehTheme'),
                        'last_name' => __('Last name', 'kavehTheme'),
                        'password' => __('Password', 'kavehTheme'),
                    ),
                    'disabled' => array(),
                ),
                'disabled_title' => __('Disabled fields', 'kavehTheme'),
                'enabled_title' => __('Enabled fields', 'kavehTheme'),
            ),
        );
    }
    
    private function get_secion_main_gateway()
    {
        return array(
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('Note: SMS panels Faraz SMS, Max SMS, and Mediana use ippanel. Most SMS panels are resellers of ippanel and are supported in Kaveh', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_sms_gateway',
                'type' => 'select',
                'title' => __('Select SMS panel', 'kavehTheme'),
                'options' => array(
                    'option-1' => 'ippanel',
                    'option-2' => 'sms.ir',
                    'option-3' => 'melipayamak',
                    'option-4' => 'kavenegar',
                    'option-5' => 'raygansms',
                    'option-6' => 'rahpayam',
                    'option-7' => 'panelchi',
                ),
                'default' => 'option-1'
            ),
            array(
                'id' => 'kaveh_username_sms',
                'type' => 'text',
                'title' => __('Username', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-1,option-3,option-5'),
            ),
            array(
                'id' => 'kaveh_password_sms',
                'type' => 'text',
                'title' => __('Password', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-1,option-3,option-5'),
            ),
            array(
                'id' => 'kaveh_matn_raygansms',
                'type' => 'text',
                'title' => __('Your SMS text', 'kavehTheme'),
                'default' => __('Welcome! Your verification code:', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-5'),
            ),
            array(
                'id' => 'kaveh_password_api',
                'type' => 'text',
                'sanitize' => false,
                'title' => __('Web service key (API key)', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-2,option-4,option-6,option-7'),
            ),
            array(
                'id' => 'kaveh_number_sms',
                'type' => 'text',
                'title' => __('Sender number', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-1,option-7'),
            ),
            array(
                'id' => 'kaveh_pattern_sms',
                'type' => 'text',
                'sanitize' => false,
                'title' => __('Template pattern', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', 'any', 'option-1,option-2,option-3,option-4,option-6,option-7'),
            ),
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('You must create a pattern as shown below in your SMS panel and place its code in the template pattern. Note that sending is not possible until the pattern is approved', 'kavehTheme'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code %verification-code%  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', '==', 'option-1'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code [code]  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', '==', 'option-2'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code {0}  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway', '==', 'option-3'),
            ),
        );
    }
    
    private function get_secion_backup_gateway()
    {
        return array(
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('Note: SMS panels Faraz SMS, Max SMS, and Mediana use ippanel. Most SMS panels are resellers of ippanel and are supported in Kaveh', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_sms_gateway2',
                'type' => 'select',
                'title' => __('Select SMS panel', 'kavehTheme'),
                'options' => array(
                    'option-1' => 'ippanel',
                    'option-2' => 'sms.ir',
                    'option-3' => 'melipayamak',
                    'option-4' => 'kavenegar',
                    'option-5' => 'raygansms',
                    'option-6' => 'rahpayam',
                    'option-7' => 'panelchi',
                ),
                'default' => 'option-1'
            ),
            array(
                'id' => 'kaveh_username_sms2',
                'type' => 'text',
                'title' => __('Username', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-1,option-3,option-5'),
            ),
            array(
                'id' => 'kaveh_password_sms2',
                'type' => 'text',
                'title' => __('Password', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-1,option-3,option-5'),
            ),
            array(
                'id' => 'kaveh_matn_raygansms2',
                'type' => 'text',
                'title' => __('Your SMS text', 'kavehTheme'),
                'default' => __('Welcome! Your verification code:', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-5'),
            ),
            array(
                'id' => 'kaveh_password_api2',
                'type' => 'text',
                'sanitize' => false,
                'title' => __('Web service key (API key)', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-2,option-4,option-6,option-7'),
            ),
            array(
                'id' => 'kaveh_number_sms2',
                'type' => 'text',
                'title' => __('Sender number', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-1,option-7'),
            ),
            array(
                'id' => 'kaveh_pattern_sms2',
                'type' => 'text',
                'sanitize' => false,
                'title' => __('Template pattern', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', 'any', 'option-1,option-2,option-3,option-4,option-6,option-7'),
            ),
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('You must create a pattern as shown below in your SMS panel and place its code in the template pattern. Note that sending is not possible until the pattern is approved', 'kavehTheme'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code %verification-code%  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', '==', 'option-1'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code [code]  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', '==', 'option-2'),
            ),
            array(
                'type' => 'notice',
                'style' => 'warning',
                'content' => __('Your verification code {0}  
    Your site name  
    Yoursite.com', 'kavehTheme'),
                'dependency' => array('kaveh_sms_gateway2', '==', 'option-3'),
            ),
        );
    }
    
    private function get_secion_export_import()
    {
        return array(
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('If you want to back up your settings and restore them on another site or this site later, use this section', 'kavehTheme'),
            ),
            array(
                'type' => 'backup',
            ),
        );
    }
    
    private function get_section_factor_general()
    {
        return array(
            array(
                'id' => 'kaveh_factor_enable',
                'type' => 'switcher',
                'title' => __('Kaveh invoice', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_delete_invoice_payment',
                'type' => 'number',
                'title' => __('Time to delete invoice from host (hours)', 'kavehTheme'),
                'default' => 240,
                'subtitle' => __('Invoices can always be created manually', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_name',
                'type' => 'text',
                'title' => __('Individual person name', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_economic_code',
                'type' => 'text',
                'title' => __('Economic code', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_registration_number',
                'type' => 'text',
                'title' => __('Registration number / National ID', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_province',
                'type' => 'text',
                'title' => __('Province', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_city',
                'type' => 'text',
                'title' => __('City', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_postal_code',
                'type' => 'text',
                'title' => __('10-digit postal code', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_address',
                'type' => 'textarea',
                'title' => __('Address', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_phone',
                'type' => 'text',
                'title' => __('Phone number', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_seller_stamp',
                'type' => 'upload',
                'title' => __('Seller stamp and signature', 'kavehTheme'),
                'library' => 'image',
                'placeholder' => 'http://',
                'button_title' => __('Upload image', 'kavehTheme'),
                'remove_title' => __('Remove image', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_enable_registration_number_field',
                'type' => 'switcher',
                'title' => __('Enable National ID / Registration Number Field', 'kavehTheme'),
                'desc' => __('Add a field for National ID / Registration Number in WooCommerce checkout', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => false,
                'dependency' => array(
                    array('kaveh_factor_enable', '==', 1),
                ),
            ),
            array(
                'type' => 'content',
                'content' => '<form method="post">
                    ' . wp_nonce_field('kaveh_delete_all_factors_action', 'kaveh_delete_all_factors_nonce', true, false) . '
                    <input type="submit" class="button button-secondary" name="delete_all_factors" value="' . esc_attr__('🗑 Delete all stored invoices', 'kavehTheme') . '">
                </form>',
                'title' => __('Bulk invoice deletion', 'kavehTheme'),
                'desc' => __('By clicking this button, all PDF files in the factor folder will be deleted', 'kavehTheme'),
            ),
        );
    }
    
    private function get_section_factor_sms()
    {
        return array(
            array(
                'id' => 'kaveh_sms_thankyou_auto',
                'type' => 'switcher',
                'title' => __('Automatic SMS sending after order completion', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_sms_thankyou_pattern',
                'type' => 'text',
                'title' => __('Invoice sending SMS pattern', 'kavehTheme'),
            ),
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('You must create a pattern with the pdf_url variable in your SMS panel and place its code in the SMS pattern. Note that sending is not possible until the pattern is approved', 'kavehTheme'),
            ),
        );
    }
    
    private function get_sectionـpreـfactor_sms()
    {
        return array(
            array(
                'id' => 'kaveh_sms_pre_invoice',
                'type' => 'switcher',
                'title' => __('Enable pre-invoice creation and download', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_preinvoice_button_text',
                'type' => 'text',
                'default' => __('Receive pre-invoice', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
                'title' => __('Pre-invoice button text', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_preinvoice_help_text',
                'type' => 'text',
                'default' => __('Please enter your email and details before receiving the pre-invoice', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
                'title' => __('Pre-invoice help text', 'kavehTheme'),
            ),
            array(
                'id' => 'kaveh_sms_pre_invoice_link',
                'type' => 'switcher',
                'title' => __('Enable pre-invoice payment link creation', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true,
                'dependency' => array(
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_sms_preinvoice_pattern',
                'type' => 'text',
                'title' => __('Pre-invoice payment link SMS pattern', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_sms_pre_invoice_link', '==', 1),
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
            ),
            array(
                'type' => 'notice',
                'style' => 'info',
                'content' => __('You must create a pattern with the payment_url variable in your SMS panel and place its code in the SMS pattern. Note that sending is not possible until the pattern is approved', 'kavehTheme'),
                'dependency' => array(
                    array('kaveh_sms_pre_invoice_link', '==', 1),
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_expired_preinvoice_payment',
                'type' => 'number',
                'title' => __('Payment link validity period (hours)', 'kavehTheme'),
                'default' => 24,
                'dependency' => array(
                    array('kaveh_sms_pre_invoice_link', '==', 1),
                    array('kaveh_sms_pre_invoice', '==', 1),
                ),
            ),
            array(
                'id' => 'kaveh_email_prepayment_pattern',
                'type' => 'textarea',
                'default' => __('To make a payment, click the link below:', 'kavehTheme'),
                'title' => __('Pre-invoice payment link email text', 'kavehTheme'),
            ),
        );
    }
    
    private function get_section_email_factor_sms()
    {
        return array(
            array(
                'id' => 'kaveh_email_thankyou_auto',
                'type' => 'switcher',
                'title' => __('Automatic email sending after order completion', 'kavehTheme'),
                'text_on' => __('Enabled', 'kavehTheme'),
                'text_off' => __('Disabled', 'kavehTheme'),
                'default' => true
            ),
            array(
                'id' => 'kaveh_email_thankyou_pattern',
                'type' => 'textarea',
                'default' => __('Your order has been completed, your order invoice:', 'kavehTheme'),
                'title' => __('Invoice sending email text', 'kavehTheme'),
            ),
        );
    }
    
    private function get_section_custom_code()
    {
        return array(
            array(
                'id' => 'kaveh_header_code',
                'type' => 'code_editor',
                'sanitize' => false,
                'title' => __('Custom code in header', 'kavehTheme'),
                'subtitle' => __('Add custom code such as Google Analytics integration', 'kavehTheme'),
                'settings' => array(
                    'theme' => 'shadowfox',
                    'mode' => 'htmlmixed',
                ),
                'default' => '
    <!-- <div class="wrapper">
      <h1>Hello world</h1>
      <p>Lorem <strong>ipsum</strong> dollar.</p>
    </div> -->',
            ),
            array(
                'id' => 'kaveh_footer_code',
                'type' => 'code_editor',
                'sanitize' => false,
                'title' => __('Custom code in footer', 'kavehTheme'),
                'subtitle' => __('Add custom code such as Google Analytics integration', 'kavehTheme'),
                'settings' => array(
                    'theme' => 'shadowfox',
                    'mode' => 'htmlmixed',
                ),
                'default' => '
    <!-- <div class="wrapper">
      <h1>Hello world</h1>
      <p>Lorem <strong>ipsum</strong> dollar.</p>
    </div> -->',
            ),
            array(
                'id' => 'kaveh_js_code',
                'type' => 'code_editor',
                'sanitize' => false,
                'title' => __('Custom JavaScript code', 'kavehTheme'),
                'subtitle' => __('Add custom JavaScript code to the theme here', 'kavehTheme'),
                'settings' => array(
                    'theme' => 'dracula',
                    'mode' => 'javascript',
                ),
                'default' => '
    jQuery(document).ready(function () {
    });
            ',
            ),
            array(
                'id' => 'kaveh_css_code',
                'type' => 'code_editor',
                'sanitize' => false,
                'title' => __('Custom CSS code', 'kavehTheme'),
                'subtitle' => __('Add custom CSS code to the theme here', 'kavehTheme'),
                'settings' => array(
                    'theme' => 'mbo',
                    'mode' => 'css',
                ),
                'default' => '
    .body {
     /*code*/
    }',
            ),
        );
    }
    
    public function my_custom_font_family($fonts)
    {
        // Built-in fonts
        $fonts['YekanBakh'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['IRANSansX'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['IRANYekanX'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['Morabba'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['Dana'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['Abr'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['Doran'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['Anjoman'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        
        // System fonts
        $fonts['system-ui'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['sans-serif'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['serif'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        $fonts['monospace'] = array('100', '200', '300', 'normal', '500', '600', '700', '800', '900');
        
        // Add custom uploaded fonts with their actual weights
        $options = get_option($this->prefix);
        if (isset($options['custom_font_families']) && is_array($options['custom_font_families'])) {
            foreach ($options['custom_font_families'] as $font_family) {
                if (!empty($font_family['font_family_name']) && 
                    isset($font_family['font_weights']) && 
                    is_array($font_family['font_weights'])) {
                    // Create array to hold available weights for this font
                    $available_weights = array();
                    // Collect all weight values from the font family
                    foreach ($font_family['font_weights'] as $weight_data) {
                        if (!empty($weight_data['weight']) && 
                            (!empty($weight_data['woff']) || !empty($weight_data['woff2']))) {
                            $available_weights[] = $weight_data['weight'];
                            // Add italic as a separate weight if available
                            if (!empty($weight_data['style']) && $weight_data['style'] === 'italic') {
                                $available_weights[] = $weight_data['weight'] . 'i'; // Add italic variant
                            }
                        }
                    }
                    // Only add the font if it has at least one valid weight
                    if (!empty($available_weights)) {
                        $fonts[$font_family['font_family_name']] = $available_weights;
                    }
                }
            }
        }
        
        return $fonts;
    }
    
    /**
     * Check if WPML is active
     */
    private function is_wpml_active()
    {
        return defined('ICL_SITEPRESS_VERSION') && function_exists('icl_object_id');
    }
    
    /**
     * Register WPML strings after options are saved
     */
    public function register_wpml_strings($options)
    {
        if (!$this->is_wpml_active()) {
            return;
        }
        
        $this->register_strings_recursively($options, 'admin_texts_' . $this->prefix);
    }
    
    /**
     * Register strings recursively for WPML
     */
    private function register_strings_recursively($options, $context, $prefix = '')
    {
        if (!is_array($options)) {
            return;
        }
        
        foreach ($options as $key => $value) {
            $string_name = $prefix ? $prefix . '_' . $key : $key;
            
            if (is_string($value) && !empty($value) && $this->is_translatable_string($key, $value)) {
                do_action('wpml_register_single_string', $context, $string_name, $value);
            } elseif (is_array($value)) {
                $this->register_strings_recursively($value, $context, $string_name);
            }
        }
    }
    
    /**
     * Check if a string should be translatable
     */
    private function is_translatable_string($key, $value)
    {
        // Skip URLs, colors, numbers, and other non-text values
        $skip_patterns = array(
            '/^https?:\/\//',  // URLs
            '/^#[0-9a-fA-F]{3,6}$/',  // Color codes
            '/^\d+$/',  // Pure numbers
            '/\.(jpg|jpeg|png|gif|svg|webp)$/i',  // Image extensions
            '/^icon-/',  // Icon classes
            '/^value-\d+$/'  // Option values
        );
        
        foreach ($skip_patterns as $pattern) {
            if (preg_match($pattern, $value)) {
                return false;
            }
        }
        
        // Skip certain key patterns
        $skip_keys = array(
            'url', 'link', 'color', 'icon', 'image', 'video', 'upload',
            'width', 'height', 'size', 'id', 'class', 'style'
        );
        
        foreach ($skip_keys as $skip_key) {
            if (strpos(strtolower($key), $skip_key) !== false) {
                return false;
            }
        }
        
        // Only register strings that contain actual text
        return strlen($value) > 2 && preg_match('/[a-zA-Z\x{0600}-\x{06FF}]/u', $value);
    }
    
    /**
     * Translate option values using WPML
     */
    public function translate_option_value($value, $option_key, $default)
    {
        if (!$this->is_wpml_active()) {
            return $value;
        }
        
        // Handle string translation
        if (is_string($value) && !empty($value)) {
            $translated = apply_filters('wpml_translate_single_string', $value, 'admin_texts_' . $this->prefix, $option_key);
            return $translated ? $translated : $value;
        }
        
        // Handle array translation (for repeater fields)
        if (is_array($value)) {
            return $this->translate_array_values($value, $option_key);
        }
        
        return $value;
    }
    
    /**
     * Translate array values recursively
     */
    private function translate_array_values($array, $context_key)
    {
        if (!is_array($array)) {
            return $array;
        }
        
        foreach ($array as $key => $value) {
            if (is_string($value) && !empty($value) && $this->is_translatable_string($key, $value)) {
                $string_name = $context_key . '_' . $key;
                $translated = apply_filters('wpml_translate_single_string', $value, 'admin_texts_' . $this->prefix, $string_name);
                if ($translated) {
                    $array[$key] = $translated;
                }
            } elseif (is_array($value)) {
                $array[$key] = $this->translate_array_values($value, $context_key . '_' . $key);
            }
        }
        
        return $array;
    }
}

// Options are initialized in kaveh-functions.php with license check
// Removed duplicate initialization to prevent double admin options

function kaveh_preload_fonts()
    {
        $options = kaveh_get_options(); // Replace with your prefix
        // Skip if optimization is disabled
        if (empty($options['font_optimization'])) {
            return;
        }
        $used_fonts = array();
        // Collect used fonts
        foreach (['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'li', 'ul'] as $element) {
            if (!empty($options['opt-typography-' . $element]['font-family'])) {
                $used_fonts[] = $options['opt-typography-' . $element]['font-family'];
            }
        }
        $used_fonts = array_unique($used_fonts);
        // Get built-in font map
        $built_in_fonts = [
            'YekanBakh' => 'yekanbakh/woff2/YekanBakhFaNum-VF.woff2',
            'IRANSansX' => 'iransans/IRANSansXV.woff2',
            'IRANYekanX' => 'iranyekan/IRANYekanXVF.woff2',
            'Morabba' => 'moraba/MorabbaVF.woff2',
            'Dana' => 'dana/DanaVF.woff2',
            'Abr' => 'abr/AbarFaNum-VF.woff2',
            'Doran' => 'doran/Doran-VF.woff2',
            'Anjoman' => 'anjoman/AnjomanMaxVF.woff2',
        ];
        // Preload built-in fonts
        foreach ($used_fonts as $font) {
            if (isset($built_in_fonts[$font])) {
                echo '<link rel="preload" href="' . KAVEH_TEMPLATE_URI . '/assets/fonts/' . $built_in_fonts[$font] . '" as="font" type="font/woff2" crossorigin>';
            }
        }
        // Preload custom fonts
        if (isset($options['custom_font_uploader']) && is_array($options['custom_font_uploader'])) {
            foreach ($options['custom_font_uploader'] as $font) {
                if (!empty($font['font_name']) && in_array($font['font_name'], $used_fonts)) {
                    if (!empty($font['font_woff2'])) {
                        echo '<link rel="preload" href="' . esc_url($font['font_woff2']) . '" as="font" type="font/woff2" crossorigin>';
                    } else if (!empty($font['font_woff'])) {
                        echo '<link rel="preload" href="' . esc_url($font['font_woff']) . '" as="font" type="font/woff" crossorigin>';
                    }
                }
            }
        }
    }
    
    // Hook to wp_head with priority 1 to load as early as possible
    add_action('wp_head', 'kaveh_preload_fonts', 1);
    
    function custom_theme_allow_font_uploads($mime_types)
    {
        // Add font MIME types
        $mime_types['woff'] = 'application/font-woff';
        $mime_types['woff2'] = 'application/font-woff2';
        $mime_types['ttf'] = 'application/x-font-ttf';
        $mime_types['svg'] = 'image/svg+xml';
        $mime_types['eot'] = 'application/vnd.ms-fontobject';
        return $mime_types;
    }
    add_filter('upload_mimes', 'custom_theme_allow_font_uploads');
    
    function custom_theme_fix_font_mime_type($data, $file, $filename, $mimes)
    {
        $ext = pathinfo($filename, PATHINFO_EXTENSION);
        // Fix MIME type detection for fonts
        if ($ext === 'ttf') {
            $data['type'] = 'application/x-font-ttf';
            $data['ext'] = 'ttf';
        } elseif ($ext === 'woff') {
            $data['type'] = 'application/font-woff';
            $data['ext'] = 'woff';
        } elseif ($ext === 'woff2') {
            $data['type'] = 'application/font-woff2';
            $data['ext'] = 'woff2';
        }
        return $data;
    }
    add_filter('wp_check_filetype_and_ext', 'custom_theme_fix_font_mime_type', 10, 4);
    
    function custom_theme_skip_mime_check_for_fonts($result, $file, $filename, $mimes)
    {
        $ext = pathinfo($filename, PATHINFO_EXTENSION);
        // Skip MIME check for these extensions
        $font_extensions = array('ttf', 'woff', 'woff2', 'eot', 'svg');
        if (in_array($ext, $font_extensions)) {
            // Return dummy result to bypass check
            return array(
                'ext' => $ext,
                'type' => 'application/font-' . $ext,
                'proper_filename' => false
            );
        }
        return $result;
    }
    // Only uncomment this if the solutions above don't work:
    // add_filter('wp_check_filetype_and_ext', 'custom_theme_skip_mime_check_for_fonts', 99, 4);