<?php

if (! defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}
function initialize_kirki_settings()
{
    if (! class_exists('Kirki')) {
        return;
    }

    // Customizer panel
    new \Kirki\Panel(
        'welding_for_elementor_panel',
        [
            'priority'    => 10,
            'title'       => esc_html__('Welding for Elementor', 'welding-for-elementor'),
            'description' => esc_html__('Welding for Elementor theme customization panel', 'welding-for-elementor'),
        ]
    );
    // Header section start here
    new \Kirki\Section(
        'welding_for_elementor_header',
        [
            'title'       => esc_html__('Header', 'welding-for-elementor'),
            'description' => esc_html__('You can customize theme header here.', 'welding-for-elementor'),
            'panel'       => 'welding_for_elementor_panel',
            'priority'    => 160,
        ]
    );
    new \Kirki\Field\Dimension(
        [
            'settings'    => 'welding_for_elementor_header_height',
            'label'       => esc_html__('Header Height', 'welding-for-elementor'),
            'description' => esc_html__('Set the height of the header.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_header',
            'default'     => '72px',
            'choices'     => [
                'accept_unitless' => false,
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_header_bg',
            'label'       => esc_html__('Header Background', 'welding-for-elementor'),
            'description' => esc_html__('Choose the background color for the header.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_header',
            'default'     => 'rgb(23 23 23 / 60%)',
            'choices'     => [
                'alpha' => true,
            ],
            'output' => [
                [
                    'element'  => '.tr-header-area',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_header_sticky',
            'label'       => esc_html__('Sticky Header', 'welding-for-elementor'),
            'description' => esc_html__('Make the header sticky on scroll', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_header',
            'default'     => 'on',
            'choices'     => [
                'on'  => esc_html__('On', 'welding-for-elementor'),
                'off' => esc_html__('Off', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_button_switch',
            'label'       => esc_html__('Show Button', 'welding-for-elementor'),
            'description' => esc_html__('Show/Hide right side button', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_header',
            'default'     => 'on',
            'choices'     => [
                'on'  => esc_html__('Show', 'welding-for-elementor'),
                'off' => esc_html__('Hide', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Text(
        [
            'settings' => 'welding_for_elementor_button_text',
            'label'    => esc_html__('Button text', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_header',
            'default'  => esc_html__('CONTACT US', 'welding-for-elementor'),
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_button_url',
            'label'    => esc_html__('Button URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_header',
            'priority' => 10,
        ]
    );
    // Header section end here

    // Global section start here
    new \Kirki\Section(
        'welding_for_elementor_global',
        [
            'title'       => esc_html__('Global', 'welding-for-elementor'),
            'description' => esc_html__('You can customize theme global settings here.', 'welding-for-elementor'),
            'panel'       => 'welding_for_elementor_panel',
            'priority'    => 160,
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_back_to_top',
            'label'       => esc_html__('Back to Top Button', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => true,
            'choices'     => [
                true  => esc_html__('Enable', 'welding-for-elementor'),
                false => esc_html__('Disable', 'welding-for-elementor'),
            ],
            'priority'    => 10,
            'transport'   => 'refresh',
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_back_to_top_bg',
            'label'       => esc_html__('Background Color', 'welding-for-elementor'),
            'description' => esc_html__('Set the back to top button background color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#ff6b00',
            'priority'    => 10,
            'transport'   => 'refresh',
            'output'      => [
                [
                    'element'  => '#back-to-top',
                    'property' => 'background-color',
                ],
            ],
        ]
    );

    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_back_to_top_color',
            'label'       => esc_html__('Icon Color', 'welding-for-elementor'),
            'description' => esc_html__('Set the back to top button icon color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#ffffff',
            'priority'    => 10,
            'transport'   => 'refresh',
            'output'      => [
                [
                    'element'  => '#back-to-top',
                    'property' => 'color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_preloader',
            'label'       => esc_html__('Preloader', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => 'on',
            'choices'     => [
                'on'  => esc_html__('Enable', 'welding-for-elementor'),
                'off' => esc_html__('Disable', 'welding-for-elementor'),
            ],
            'priority'    => 10,
            'transport'   => 'refresh',
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_preloader_color',
            'label'       => esc_html__('Preloader Color', 'welding-for-elementor'),
            'description' => esc_html__('Set the preloader color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#FF6B00',
            'output' => [
                [
                    'element'  => [
                        '.tr-preloader::before',
                        '.tr-preloader::after'
                    ],
                    'property' => 'background',
                ],
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_preloader_background',
            'label'       => esc_html__('Preloader Background', 'welding-for-elementor'),
            'description' => esc_html__('Set the preloader background color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#1a1a1b',
            'output' => [
                [
                    'element'  => '#tr-preloader',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_scrollbar_enable',
            'label'       => esc_html__('Custom Scrollbar', 'welding-for-elementor'),
            'description' => esc_html__('Enable custom scrollbar colors.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => true,
            'choices'     => [
                'on'  => esc_html__('Enable', 'welding-for-elementor'),
                'off' => esc_html__('Disable', 'welding-for-elementor'),
            ],
            'priority'    => 10,
            'transport'   => 'refresh',
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_scrollbar_thumb',
            'label'       => esc_html__('Scrollbar Thumb Color', 'welding-for-elementor'),
            'description' => esc_html__('The draggable part of the scrollbar.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#FF6B00',
            'alpha'       => true,
            'transport'   => 'refresh',
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_scrollbar_track',
            'label'       => esc_html__('Scrollbar Track Color', 'welding-for-elementor'),
            'description' => esc_html__('The background behind the thumb.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_global',
            'default'     => '#1a1a1b',
            'alpha'       => true,
        ]
    );

    // Colors section start here
    new \Kirki\Section(
        'welding_for_elementor_colors',
        [
            'title' => esc_html__('Colors', 'welding-for-elementor'),
            'description' => esc_html__('Customize the color scheme of your theme.', 'welding-for-elementor'),
            'panel' => 'welding_for_elementor_panel',
            'priority' => 160,
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_body_bg',
            'label'       => esc_html__('Background', 'welding-for-elementor'),
            'description' => esc_html__('Set the overall background color of the website.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#1a1a1b',
            'output' => [
                [
                    'element'  => 'body',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_blog_card_bg',
            'label'       => esc_html__('Card Background', 'welding-for-elementor'),
            'description' => esc_html__('Choose the background color for blog post cards.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#303031',
            'output' => [
                [
                    'element'  => '.tr-blog-card',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_blog_card_border_color',
            'label'       => esc_html__('Card Border', 'welding-for-elementor'),
            'description' => esc_html__('Set the border color for blog post cards.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#474647',
            'output' => [
                [
                    'element'  => '.tr-blog-card',
                    'property' => 'border-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Multicolor(
        [
            'settings'  => 'welding_for_elementor_blog_card_category_bg',
            'label'     => esc_html__('Category Background', 'welding-for-elementor'),
            'description' => esc_html__('Select the background color for category on blog cards.', 'welding-for-elementor'),
            'section'   => 'welding_for_elementor_colors',
            'priority'  => 10,
            'choices'   => [
                'link'     => esc_html__('Color', 'welding-for-elementor'),
                'hover'    => esc_html__('Hover', 'welding-for-elementor'),
            ],
            'alpha'     => true,
            'default'   => [
                'link'   => '#474747',
                'hover'  => '#5e5e5e',
            ],
            'output' => [
                [
                    'choice' => 'link',
                    'element'  => '.tr-blog-category a',
                    'property' => 'background-color',
                ],
                [
                    'choice' => 'hover',
                    'element'  => '.tr-blog-category a:hover',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Multicolor(
        [
            'settings'  => 'welding_for_elementor_blog_card_category_text_color',
            'label'     => esc_html__('Category Text', 'welding-for-elementor'),
            'description' => esc_html__('Choose the text color for category on blog cards.', 'welding-for-elementor'),
            'section'   => 'welding_for_elementor_colors',
            'priority'  => 10,
            'choices'   => [
                'link'     => esc_html__('Color', 'welding-for-elementor'),
                'hover'    => esc_html__('Hover', 'welding-for-elementor'),
            ],
            'alpha'     => true,
            'default'   => [
                'link'   => '#E2E2E2',
                'hover'  => '#E2E2E2',
            ],
            'output' => [
                [
                    'choice' => 'link',
                    'element'  => '.tr-blog-category a',
                    'property' => 'color',
                ],
                [
                    'choice' => 'hover',
                    'element'  => '.tr-blog-category a:hover',
                    'property' => 'color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_blog_card_reading_time_color',
            'label'       => esc_html__('Reading Time', 'welding-for-elementor'),
            'description' => esc_html__('Text color for reading time on blog cards & blog posts.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#a0a0a0',
            'output' => [
                [
                    'element'  => '.tr-blog-reading-time',
                    'property' => 'color',
                ],
            ],
        ]
    );

    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_blog_card_date_color',
            'label'       => esc_html__('Date', 'welding-for-elementor'),
            'description' => esc_html__('Text color for the date on blog cards & blog posts.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#a0a0a0',
            'output' => [
                [
                    'element'  => '.tr-blog-date',
                    'property' => 'color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Multicolor(
        [
            'settings'  => 'welding_for_elementor_blog_card_button_color',
            'label'     => esc_html__('Button', 'welding-for-elementor'),
            'description' => esc_html__('Choose the color for buttons on blog cards.', 'welding-for-elementor'),
            'section'   => 'welding_for_elementor_colors',
            'priority'  => 10,
            'choices'   => [
                'link'     => esc_html__('Color', 'welding-for-elementor'),
                'hover'    => esc_html__('Hover', 'welding-for-elementor'),
            ],
            'alpha'     => true,
            'default'   => [
                'link'   => '#ff6b00',
                'hover'  => '#f26500',
            ],
            'output' => [
                [
                    'choice' => 'link',
                    'element'  => '.tr-blog-read-more',
                    'property' => 'color',
                ],
                [
                    'choice' => 'hover',
                    'element'  => '.tr-blog-read-more:hover',
                    'property' => 'color',
                ],
            ],
        ]
    );

    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_blog_card_body_text',
            'label'       => esc_html__('Card Text', 'welding-for-elementor'),
            'description' => esc_html__('Text color for the body content on blog cards.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_colors',
            'default'     => '#e0e0e0',
            'output' => [
                [
                    'element'  => '.tr-blog-card-body-text',
                    'property' => 'color',
                ],
            ],
        ]
    );
    // Colors section end here

    // Blog section start here
    new \Kirki\Section(
        'welding_for_elementor_blog',
        [
            'title' => esc_html__('Blog', 'welding-for-elementor'),
            'description' => esc_html__('You can customize blog layout here.', 'welding-for-elementor'),
            'panel' => 'welding_for_elementor_panel',
            'priority' => 160,
        ]
    );
    new \Kirki\Field\Select(
        [
            'settings'    => 'welding_for_elementor_blog_sidebar_position',
            'label'       => esc_html__('Sidebar Position', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 'right',
            'placeholder' => esc_html__('Choose an option', 'welding-for-elementor'),
            'choices'     => [
                'left' => esc_html__('Left', 'welding-for-elementor'),
                'right' => esc_html__('Right', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Select(
        [
            'settings'    => 'welding_for_elementor_blog_style',
            'label'       => esc_html__('Blog Style', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 'masonry',
            'placeholder' => esc_html__('Choose an option', 'welding-for-elementor'),
            'choices'     => [
                'masonry' => esc_html__('Masonry', 'welding-for-elementor'),
                'grid'    => esc_html__('Grid', 'welding-for-elementor'),
                'list'    => esc_html__('List', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_reading_progress_bar',
            'label'       => esc_html__('Show Reading Progress Bar', 'welding-for-elementor'),
            'description' => esc_html__('Show/Hide Reading Progress Bar', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 'on',
            'choices'     => [
                'on'  => esc_html__('Show', 'welding-for-elementor'),
                'off' => esc_html__('Hide', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Select(
        [
            'settings'    => 'welding_for_elementor_progress_bar_position',
            'label'       => esc_html__('Progress Bar Position', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 'top',
            'placeholder' => esc_html__('Choose an option', 'welding-for-elementor'),
            'choices'     => [
                'top' => esc_html__('Top', 'welding-for-elementor'),
                'bottom' => esc_html__('Bottom', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Slider(
        [
            'settings'    => 'welding_for_elementor_adjust_progress_bar_position',
            'label'       => esc_html__('Adjust Progress Bar Position', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 72,
            'choices'     => [
                'min'  => 0,
                'max'  => 200,
                'step' => 1,
            ],
        ]
    );
    new \Kirki\Field\Slider(
        [
            'settings'    => 'welding_for_elementor_progress_bar_thickness',
            'label'       => esc_html__('Progress Bar Thickness', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => 3,
            'choices'     => [
                'min'  => 0,
                'max'  => 50,
                'step' => 1,
            ],
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_progress_bar_color',
            'label'       => esc_html__('Progress Bar Color', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_blog',
            'default'     => '#FF6B00',
            'output' => [
                [
                    'element'  => '#tr-progress-bar',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    // Blog section end here

    // Footer section start here
    new \Kirki\Section(
        'welding_for_elementor_footer',
        [
            'title' => esc_html__('Footer', 'welding-for-elementor'),
            'description' => esc_html__('You can customize theme footer here.', 'welding-for-elementor'),
            'panel' => 'welding_for_elementor_panel',
            'priority' => 160,
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_footer_bg',
            'label'       => esc_html__('Background', 'welding-for-elementor'),
            'description' => esc_html__('Set the footer background color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_footer',
            'default'     => '#0A0A0A',
            'output' => [
                [
                    'element'  => '.tr-footer',
                    'property' => 'background-color',
                ],
            ],
        ]
    );
    new \Kirki\Field\Select(
        [
            'settings'    => 'welding_for_elementor_footer_columns',
            'label'       => esc_html__('Footer Columns', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_footer',
            'default'     => '4',
            'placeholder' => esc_html__('Choose an option', 'welding-for-elementor'),
            'choices'     => [
                '1' => esc_html__('1 Column', 'welding-for-elementor'),
                '2' => esc_html__('2 Columns', 'welding-for-elementor'),
                '3' => esc_html__('3 Columns', 'welding-for-elementor'),
                '4' => esc_html__('4 Columns', 'welding-for-elementor'),
            ],
        ]
    );
    // site copyright settings start here
    new \Kirki\Field\Checkbox_Switch(
        [
            'settings'    => 'welding_for_elementor_copyright_switch',
            'label'       => esc_html__('Show Copyright', 'welding-for-elementor'),
            'description' => esc_html__('Show/Hide Copyright', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_footer',
            'default'     => 'on',
            'choices'     => [
                'on'  => esc_html__('Show', 'welding-for-elementor'),
                'off' => esc_html__('Hide', 'welding-for-elementor'),
            ],
        ]
    );
    new \Kirki\Field\Text(
        [
            'settings' => 'welding_for_elementor_copyright_text',
            'label' => esc_html__('Copyright text', 'welding-for-elementor'),
            'section' => 'welding_for_elementor_footer',
            'default' => esc_html__('© 2026 Welding for Elementor. All rights reserved.', 'welding-for-elementor'),
            'priority' => 10,
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_copyright_text_color',
            'label'       => esc_html__('Text Color', 'welding-for-elementor'),
            'description' => esc_html__('Set the copyright text color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_footer',
            'default'     => '#474647',
            'output' => [
                [
                    'element'  => '.tr-footer-copyright-text',
                    'property' => 'color',
                ],
            ],
        ]
    );
    // site copyright settings end here
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_facebook_url',
            'label'    => esc_html__('Facebook URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_twitter_url',
            'label'    => esc_html__('Twitter/X URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_instagram_url',
            'label'    => esc_html__('Instagram URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_linkedin_url',
            'label'    => esc_html__('LinkedIn URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_youtube_url',
            'label'    => esc_html__('YouTube URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_pinterest_url',
            'label'    => esc_html__('Pinterest URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_whatsapp_url',
            'label'    => esc_html__('WhatsApp URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\URL(
        [
            'settings' => 'welding_for_elementor_snapchat_url',
            'label'    => esc_html__('Snapchat URL', 'welding-for-elementor'),
            'section'  => 'welding_for_elementor_footer',
            'default'  => '#',
            'priority' => 10,
        ]
    );
    new \Kirki\Field\Color(
        [
            'settings'    => 'welding_for_elementor_social_icon_color',
            'label'       => esc_html__('Icon Color', 'welding-for-elementor'),
            'description' => esc_html__('Set the social icon color.', 'welding-for-elementor'),
            'section'     => 'welding_for_elementor_footer',
            'default'     => '#FFFFFF',
            'output' => [
                [
                    'element'  => '.tr-copyright-social a i',
                    'property' => 'color',
                ],
            ],
        ]
    );
    // Footer section end here

}

add_action('after_setup_theme', 'initialize_kirki_settings', 20);
