<?php
/**
 * Theme Customizer Controls
 *
 * @package Jungle Eco Tours
 */

if ( ! function_exists( 'jungle_eco_tours_customizer_general_setting_register' ) ) :
function jungle_eco_tours_customizer_general_setting_register( $wp_customize ) {
 
 	$wp_customize->add_section(
        'jungle_eco_tours_general_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'General Settings', 'jungle-eco-tours' )
        )
    );

 	// Add general Panel for preloader and scrolltop
    $wp_customize->add_panel(
        'jungle_eco_tours_general_settings_panel',
        array(
            'priority'      => 30,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'General Settings', 'jungle-eco-tours' ),
        )
    );

    // Section preloader
    $wp_customize->add_section(
        'jungle_eco_tours_prelodr_settings',
        array(
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Preloader', 'jungle-eco-tours' ),
            'panel'         => 'jungle_eco_tours_general_settings_panel',
        )
    );

    // Title label
	$wp_customize->add_setting( 
		'jungle_eco_tours_preloader_settings', 
		array(
		    'sanitize_callback' => 'jungle_eco_tours_sanitize_title',
		) 
	);

	$wp_customize->add_control( 
		new Jungle_Eco_Tours_Title_Info_Control( $wp_customize, 'jungle_eco_tours_preloader_settings', 
		array(
		    'label'       => esc_html__( 'Preloader Settings', 'jungle-eco-tours' ),
		    'section'     => 'jungle_eco_tours_prelodr_settings',
		    'type'        => 'jungle-eco-tours-title',
		    'settings'    => 'jungle_eco_tours_preloader_settings',
		) 
	));

	// Add an option to enable the preloader
	$wp_customize->add_setting( 
		'jungle_eco_tours_enable_preloader', 
		array(
		    'default'           => false,
		    'type'              => 'theme_mod',
		    'sanitize_callback' => 'jungle_eco_tours_sanitize_checkbox',
		) 
	);

	$wp_customize->add_control( 
		new Jungle_Eco_Tours_Toggle_Control( $wp_customize, 'jungle_eco_tours_enable_preloader', 
		array(
		    'label'       => esc_html__( 'Show Preloader', 'jungle-eco-tours' ),
		    'section'     => 'jungle_eco_tours_prelodr_settings',
		    'type'        => 'jungle-eco-tours-toggle',
		    'settings'    => 'jungle_eco_tours_enable_preloader',
		) 
	));

    $wp_customize->add_section(
        'jungle_eco_tours_scrol_settings',
        array(
            'priority'      => 30,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Scroll Top', 'jungle-eco-tours' ),
            'panel'         => 'jungle_eco_tours_general_settings_panel',
        )
    );


	// Title label
	$wp_customize->add_setting( 
		'jungle_eco_tours_scroll_top_settings', 
		array(
		    'sanitize_callback' => 'jungle_eco_tours_sanitize_title',
		) 
	);

	$wp_customize->add_control( 
		new Jungle_Eco_Tours_Title_Info_Control( $wp_customize, 'jungle_eco_tours_scroll_top_settings', 
		array(
		    'label'       => esc_html__( 'Scroll Top Settings', 'jungle-eco-tours' ),
		    'section'     => 'jungle_eco_tours_scrol_settings',
		    'type'        => 'jungle-eco-tours-title',
		    'settings'    => 'jungle_eco_tours_scroll_top_settings',
		) 
	));

	// Add an option to enable the scrolltop
	$wp_customize->add_setting( 
		'jungle_eco_tours_enable_scrolltop', 
		array(
		    'default'           => true,
		    'type'              => 'theme_mod',
		    'sanitize_callback' => 'jungle_eco_tours_sanitize_checkbox',
		) 
	);

	$wp_customize->add_control( 
		new Jungle_Eco_Tours_Toggle_Control( $wp_customize, 'jungle_eco_tours_enable_scrolltop', 
		array(
		    'label'       => esc_html__( 'Show Scroll Top', 'jungle-eco-tours' ),
		    'section'     => 'jungle_eco_tours_scrol_settings',
		    'type'        => 'jungle-eco-tours-toggle',
		    'settings'    => 'jungle_eco_tours_enable_scrolltop',
		) 
	));

	 $wp_customize->add_section(
        'jungle_eco_tours_button_settings',
        array(
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Buttons', 'jungle-eco-tours' ),
            'panel'         => 'jungle_eco_tours_general_settings_panel',
        )
    );

	 // Border Radius Setting
	$wp_customize->add_setting(
	    'jungle_eco_tours_button_border_radius',
	    array(
	        'default'           => '50px',
	        'sanitize_callback' => 'sanitize_text_field',
	        'transport'         => 'refresh',
	    )
	);

	$wp_customize->add_control(
	    'jungle_eco_tours_button_border_radius',
	    array(
	        'type'     => 'text',
	        'label'    => esc_html__( 'Button Border Radius (e.g. 4px, 50%)', 'jungle-eco-tours' ),
	        'section'  => 'jungle_eco_tours_button_settings',
	    )
	);

	// Button Padding Setting
	$wp_customize->add_setting(
	    'jungle_eco_tours_button_padding',
	    array(
	        'default'           => '12px 40px',
	        'sanitize_callback' => 'sanitize_text_field',
	        'transport'         => 'refresh',
	    )
	);

	$wp_customize->add_control(
	    'jungle_eco_tours_button_padding',
	    array(
	        'type'     => 'text',
	        'label'    => esc_html__( 'Button Padding (e.g. 10px 20px)', 'jungle-eco-tours' ),
	        'section'  => 'jungle_eco_tours_button_settings',
	    )
	);


}
endif;

add_action( 'customize_register', 'jungle_eco_tours_customizer_general_setting_register' );