<?php
/**
 * Theme Customizer Controls
 *
 * @package Kindergarten Art School
 */

if ( ! function_exists( 'kindergarten_art_school_customizer_general_setting_register' ) ) :
function kindergarten_art_school_customizer_general_setting_register( $wp_customize ) {
 
 	$wp_customize->add_section(
        'kindergarten_art_school_general_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'General Settings', 'kindergarten-art-school' )
        )
    );

 	// Add general Panel for preloader and scrolltop
    $wp_customize->add_panel(
        'kindergarten_art_school_general_settings_panel',
        array(
            'priority'      => 30,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'General Settings', 'kindergarten-art-school' ),
        )
    );

    // Section preloader
    $wp_customize->add_section(
        'kindergarten_art_school_prelodr_settings',
        array(
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Preloader', 'kindergarten-art-school' ),
            'panel'         => 'kindergarten_art_school_general_settings_panel',
        )
    );

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

	$wp_customize->add_control( 
		new Kindergarten_Art_School_Title_Info_Control( $wp_customize, 'kindergarten_art_school_preloader_settings', 
		array(
		    'label'       => esc_html__( 'Preloader Settings', 'kindergarten-art-school' ),
		    'section'     => 'kindergarten_art_school_prelodr_settings',
		    'type'        => 'kindergarten-art-school-title',
		    'settings'    => 'kindergarten_art_school_preloader_settings',
		) 
	));

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

	$wp_customize->add_control( 
		new Kindergarten_Art_School_Toggle_Control( $wp_customize, 'kindergarten_art_school_enable_preloader', 
		array(
		    'label'       => esc_html__( 'Show Preloader', 'kindergarten-art-school' ),
		    'section'     => 'kindergarten_art_school_prelodr_settings',
		    'type'        => 'kindergarten-art-school-toggle',
		    'settings'    => 'kindergarten_art_school_enable_preloader',
		) 
	));


    // Section Body Typography
    $wp_customize->add_section(
        'kindergarten_art_school_scrol_settings',
        array(
            'priority'      => 30,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Scroll Top', 'kindergarten-art-school' ),
            'panel'         => 'kindergarten_art_school_general_settings_panel',
        )
    );


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

	$wp_customize->add_control( 
		new Kindergarten_Art_School_Title_Info_Control( $wp_customize, 'kindergarten_art_school_scroll_top_settings', 
		array(
		    'label'       => esc_html__( 'Scroll Top Settings', 'kindergarten-art-school' ),
		    'section'     => 'kindergarten_art_school_scrol_settings',
		    'type'        => 'kindergarten-art-school-title',
		    'settings'    => 'kindergarten_art_school_scroll_top_settings',
		) 
	));

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

	$wp_customize->add_control( 
		new Kindergarten_Art_School_Toggle_Control( $wp_customize, 'kindergarten_art_school_enable_scrolltop', 
		array(
		    'label'       => esc_html__( 'Show Scroll Top', 'kindergarten-art-school' ),
		    'section'     => 'kindergarten_art_school_scrol_settings',
		    'type'        => 'kindergarten-art-school-toggle',
		    'settings'    => 'kindergarten_art_school_enable_scrolltop',
		) 
	));

	 $wp_customize->add_section(
        'kindergarten_art_school_button_settings',
        array(
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Buttons', 'kindergarten-art-school' ),
            'panel'         => 'kindergarten_art_school_general_settings_panel',
        )
    );

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

	$wp_customize->add_control(
	    'kindergarten_art_school_button_border_radius',
	    array(
	        'type'     => 'text',
	        'label'    => esc_html__( 'Button Border Radius (e.g. 4px, 50%)', 'kindergarten-art-school' ),
	        'section'  => 'kindergarten_art_school_button_settings',
	    )
	);

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

	$wp_customize->add_control(
	    'kindergarten_art_school_button_padding',
	    array(
	        'type'     => 'text',
	        'label'    => esc_html__( 'Button Padding (e.g. 10px 20px)', 'kindergarten-art-school' ),
	        'section'  => 'kindergarten_art_school_button_settings',
	    )
	);


}
endif;

add_action( 'customize_register', 'kindergarten_art_school_customizer_general_setting_register' );