<?php
/**
 * Refrigerator Repair: Customizer
 *
 * @subpackage Refrigerator Repair
 * @since 1.0
 */

use WPTRT\Customize\Section\Refrigerator_Repair_Button;

add_action( 'customize_register', function( $manager ) {

	$manager->register_section_type( Refrigerator_Repair_Button::class );

	$manager->add_section(
		new Refrigerator_Repair_Button( $manager, 'refrigerator_repair_pro', [
			'title' => __( 'Refrigerator Repair Pro', 'refrigerator-repair' ),
			'priority' => 0,
			'button_text' => __( 'Go Pro', 'refrigerator-repair' ),
			'button_url'  => esc_url( 'https://www.luzuk.com/products/refrigerator-repair-wordpress-theme/', 'refrigerator-repair')
		] )
	);

} );

// Load the JS and CSS.
add_action( 'customize_controls_enqueue_scripts', function() {

	$version = wp_get_theme()->get( 'Version' );

	wp_enqueue_script(
		'refrigerator-repair-customize-section-button',
		get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/js/customize-controls.js' ),
		[ 'customize-controls' ],
		$version,
		true
	);

	wp_enqueue_style(
		'refrigerator-repair-customize-section-button',
		get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/css/customize-controls.css' ),
		[ 'customize-controls' ],
 		$version
	);

} );

function refrigerator_repair_customize_register( $wp_customize ) {

	$wp_customize->add_setting('refrigerator_repair_logo_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_logo_size',array(
		'type' => 'range',
		'description' => __('Logo Size (0-100%)','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('refrigerator_repair_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('refrigerator_repair_logo_padding',array(
		'label' => __('Logo Padding','refrigerator-repair'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('refrigerator_repair_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('refrigerator_repair_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('refrigerator_repair_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('refrigerator_repair_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
 	));
 	$wp_customize->add_control('refrigerator_repair_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','refrigerator-repair'),
		'section' => 'title_tagline',
    ));

	$wp_customize->add_setting('refrigerator_repair_show_site_title',array(
		'default' => true,
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_checkbox'
	));
	$wp_customize->add_control('refrigerator_repair_show_site_title',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Title','refrigerator-repair'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('refrigerator_repair_site_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_site_title_font_size',array(
		'type' => 'number',
		'label' => __('Site Title Font Size','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting( 'refrigerator_repair_site_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_site_title_color', array(
		'label' => 'Title Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_setting('refrigerator_repair_show_tagline',array(
		'default' => true,
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_checkbox'
	));
	$wp_customize->add_control('refrigerator_repair_show_tagline',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Tagline','refrigerator-repair'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('refrigerator_repair_site_tagline_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_site_tagline_font_size',array(
		'type' => 'number',
		'label' => __('Site Tagline Font Size','refrigerator-repair'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting( 'refrigerator_repair_site_tagline_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_site_tagline_color', array(
		'label' => 'Tagline Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_panel( 'refrigerator_repair_panel_id', array(
		'priority' => 10,
		'capability' => 'edit_theme_options',
		'theme_supports' => '',
		'title' => __( 'Theme Settings', 'refrigerator-repair' ),
		'description' => __( 'Description of what this panel does.', 'refrigerator-repair' ),
	) );

	$wp_customize->add_section( 'refrigerator_repair_theme_options_section', array(
    	'title'      => __( 'General Settings', 'refrigerator-repair' ),
		'priority'   => 30,
		'panel' => 'refrigerator_repair_panel_id'
	) );

	$wp_customize->add_setting('refrigerator_repair_theme_options',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control('refrigerator_repair_theme_options',array(
		'type' => 'select',
		'label' => __('Blog Page Sidebar Layout','refrigerator-repair'),
		'section' => 'refrigerator_repair_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','refrigerator-repair'),
		   'Right Sidebar' => __('Right Sidebar','refrigerator-repair'),
		   'One Column' => __('One Column','refrigerator-repair'),
		   'Grid Layout' => __('Grid Layout','refrigerator-repair')
		),
	));

	$wp_customize->add_setting('refrigerator_repair_single_post_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control('refrigerator_repair_single_post_sidebar',array(
        'type' => 'select',
        'label' => __('Single Post Sidebar Layout','refrigerator-repair'),
        'section' => 'refrigerator_repair_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','refrigerator-repair'),
            'Right Sidebar' => __('Right Sidebar','refrigerator-repair'),
            'One Column' => __('One Column','refrigerator-repair')
        ),
	));

	$wp_customize->add_setting('refrigerator_repair_page_sidebar',array(
		'default' => 'One Column',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control('refrigerator_repair_page_sidebar',array(
        'type' => 'select',
        'label' => __('Page Sidebar Layout','refrigerator-repair'),
        'section' => 'refrigerator_repair_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','refrigerator-repair'),
            'Right Sidebar' => __('Right Sidebar','refrigerator-repair'),
            'One Column' => __('One Column','refrigerator-repair')
        ),
	));

	$wp_customize->add_setting('refrigerator_repair_archive_page_sidebar',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control('refrigerator_repair_archive_page_sidebar',array(
        'type' => 'select',
        'label' => __('Archive & Search Page Sidebar Layout','refrigerator-repair'),
        'section' => 'refrigerator_repair_theme_options_section',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','refrigerator-repair'),
            'Right Sidebar' => __('Right Sidebar','refrigerator-repair'),
            'One Column' => __('One Column','refrigerator-repair'),
            'Grid Layout' => __('Grid Layout','refrigerator-repair')
        ),
	));

	$wp_customize->add_setting( 'refrigerator_repair_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	
	$wp_customize->add_control( 'refrigerator_repair_boxfull_width', array(
		'label'    => __( 'Section Width', 'refrigerator-repair' ),
		'section'  => 'refrigerator_repair_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'refrigerator-repair'),
			'container-fluid' => __('Full Width', 'refrigerator-repair'),
			'none' => __('None', 'refrigerator-repair')
		),
	));

	$wp_customize->add_setting( 'refrigerator_repair_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control( 'refrigerator_repair_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'refrigerator-repair' ),
		'section'  => 'refrigerator_repair_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'refrigerator-repair'),
			'fadeInUp' => __('fadeInUp', 'refrigerator-repair'),
			'zoomIn'    => __('zoomIn', 'refrigerator-repair'),
			'None'    => __('None', 'refrigerator-repair')
		),
	));

	//Header
	$wp_customize->add_section( 'refrigerator_repair_header_section' , array(
    	'title'    => __( 'Header', 'refrigerator-repair' ),
		'priority' => null,
		'panel' => 'refrigerator_repair_panel_id'
	) );

	$wp_customize->add_setting('refrigerator_repair_phone_number',array(
    	'default' => '',
    	'sanitize_callback'	=> 'refrigerator_repair_sanitize_phone_number'
	));
	$wp_customize->add_control('refrigerator_repair_phone_number',array(
	   	'type' => 'text',
	   	'label' => __('Add Phone Number','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_facebook_url',array(
    	'default' => '',
    	'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('refrigerator_repair_facebook_url',array(
	   	'type' => 'url',
	   	'label' => __('Add Facebook URL','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_twitter_url',array(
    	'default' => '',
    	'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('refrigerator_repair_twitter_url',array(
	   	'type' => 'url',
	   	'label' => __('Add Twitter URL','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_instagram_url',array(
    	'default' => '',
    	'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('refrigerator_repair_instagram_url',array(
	   	'type' => 'url',
	   	'label' => __('Add Instagram URL','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_telegram_url',array(
    	'default' => '',
    	'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('refrigerator_repair_telegram_url',array(
	   	'type' => 'url',
	   	'label' => __('Add Telegram URL','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_header_btn_text',array(
    	'default' => '',
    	'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('refrigerator_repair_header_btn_text',array(
	   	'type' => 'text',
	   	'label' => __('Add Button Text','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting('refrigerator_repair_header_btn_url',array(
    	'default' => '',
    	'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('refrigerator_repair_header_btn_url',array(
	   	'type' => 'url',
	   	'label' => __('Add Button URL','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_header_section',
	));

	$wp_customize->add_setting( 'refrigerator_repair_phone_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_phone_color', array(
		'label' => 'Phone Text Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_social_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_social_color', array(
		'label' => 'Social Icon Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_menu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_menu_color', array(
		'label' => 'Menu Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_menuhvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_menuhvr_color', array(
		'label' => 'Menu Hover Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_menubghvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_menubghvr_color', array(
		'label' => 'Menu Bg Hover Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_hbtn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_hbtn_color', array(
		'label' => 'Button Text Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_hbtnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_hbtnbg_color', array(
		'label' => 'Button Bg Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_topbarbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_topbarbg_color', array(
		'label' => 'Top Bar Bg Color',
		'section' => 'refrigerator_repair_header_section',
	)));

	//home page slider
	$wp_customize->add_section( 'refrigerator_repair_slider_section' , array(
    	'title'    => __( 'Slider Settings', 'refrigerator-repair' ),
		'priority' => null,
		'panel' => 'refrigerator_repair_panel_id'
	) );

	$wp_customize->add_setting('refrigerator_repair_slider_hide_show',array(
    	'default' => false,
    	'sanitize_callback'	=> 'refrigerator_repair_sanitize_checkbox'
	));
	$wp_customize->add_control('refrigerator_repair_slider_hide_show',array(
	   	'type' => 'checkbox',
	   	'label' => __('Show / Hide Slider','refrigerator-repair'),
	   	'section' => 'refrigerator_repair_slider_section',
	));

	$wp_customize->add_setting( 'refrigerator_repair_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices'
	));
	$wp_customize->add_control( 'refrigerator_repair_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'refrigerator-repair' ),
		'section'  => 'refrigerator_repair_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'refrigerator-repair'),
			'bounceInRight' => __('bounceInRight', 'refrigerator-repair'),
			'bounceInUp'    => __('bounceInUp', 'refrigerator-repair'),
			'bounceInDown'    => __('bounceInDown', 'refrigerator-repair'),
			'zoomIn'  => __('zoomIn', 'refrigerator-repair'),
			'zoomOut' => __('zoomOut', 'refrigerator-repair'),
			'fadeInDown'    => __('fadeInDown', 'refrigerator-repair'),
			'fadeInUp'    => __('fadeInUp', 'refrigerator-repair'),
			'fadeInLeft'  => __('fadeInLeft', 'refrigerator-repair'),
			'fadeInRight' => __('fadeInRight', 'refrigerator-repair'),
			'flip-up'    => __('flip-up', 'refrigerator-repair'),
			'none'    => __('none', 'refrigerator-repair')
		),
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'refrigerator_repair_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'refrigerator_repair_sanitize_dropdown_pages'
		));
		$wp_customize->add_control( 'refrigerator_repair_slider' . $count, array(
			'label' => __('Select Slider Image Page', 'refrigerator-repair' ),
			'description'=> __('Image size (1600px x 400px)','refrigerator-repair'),
			'section' => 'refrigerator_repair_slider_section',
			'type' => 'dropdown-pages'
		));
	}

	$wp_customize->add_setting('refrigerator_repair_slider_excerpt_length',array(
		'default' => '15',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_slider_excerpt_length',array(
		'type' => 'number',
		'label' => __('Slider Excerpt Length','refrigerator-repair'),
		'section' => 'refrigerator_repair_slider_section',
	));

	$wp_customize->add_setting('refrigerator_repair_slider_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_slider_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_slider_section',
	));

	$wp_customize->add_setting('refrigerator_repair_slider_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_slider_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_slider_section',
	));

	$wp_customize->add_setting('refrigerator_repair_slider_opacity', array(
		'default'           => '',
		'sanitize_callback' => 'refrigerator_repair_sanitize_float',
	));

	$wp_customize->add_control('refrigerator_repair_slider_opacity', array(
		'type'     => 'range',
		'label'    => __('Image Opacity', 'refrigerator-repair'),
		'section'  => 'refrigerator_repair_slider_section',
		'input_attrs' => array(
			'min'  => '0',
			'max'  => '1',
			'step' => '0.1',
		),
	));

	$wp_customize->add_setting( 'refrigerator_repair_slider_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_color', array(
		'label' => 'Title Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_text_color', array(
		'label' => 'Text Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_btn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_btn_color', array(
		'label' => 'Button Text Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_btnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_btnbg_color', array(
		'label' => 'Button Bg Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_btnhvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_btnhvr_color', array(
		'label' => 'Button Hover Text Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_btnhvrbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_btnhvrbg_color', array(
		'label' => 'Button Hover Bg Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_np_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_np_color', array(
		'label' => 'Next/Pre Arrow Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_slider_npbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_slider_npbg_color', array(
		'label' => 'Next/Pre Arrow Bg Color',
		'section' => 'refrigerator_repair_slider_section',
	)));

	//Features Section
	$wp_customize->add_section('refrigerator_repair_features_section',array(
		'title'	=> __('Features Section','refrigerator-repair'),
		'description'=> __('Note : This section will appear below the slider.','refrigerator-repair'),
		'panel' => 'refrigerator_repair_panel_id',
	));

	$categories = get_categories();
	$cats = array();
	$i = 0;
	$cat_pst1[]= 'select';
	foreach($categories as $category){
		if($i==0){
			$default = $category->slug;
			$i++;
		}
		$cat_pst1[$category->slug] = $category->name;
	}

	$wp_customize->add_setting('refrigerator_repair_features_category',array(
		'default' => 'select',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices',
	));
	$wp_customize->add_control('refrigerator_repair_features_category',array(
		'type' => 'select',
		'choices' => $cat_pst1,
		'label' => __('Select Category To Display Post','refrigerator-repair'),
		'section' => 'refrigerator_repair_features_section',
	));

	$wp_customize->add_setting('refrigerator_repair_features_number',array(
		'default'	=> '4',
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('refrigerator_repair_features_number',array(
		'label'	=> __('Number Of Posts To Show In A Category','refrigerator-repair'),
		'section' => 'refrigerator_repair_features_section',
		'type'	  => 'number'
	));

	$refrigerator_repair_features_number = get_theme_mod('refrigerator_repair_features_number', 4);
	for ($i=1; $i <= $refrigerator_repair_features_number; $i++) { 
	   	$wp_customize->add_setting('refrigerator_repair_feature_icon' . $i, array(
	      	'default' => 'fas fa-snowflake',
	      	'sanitize_callback' => 'sanitize_text_field'
	   	));
	   	$wp_customize->add_control(new Refrigerator_Repair_Fontawesome_Icon_Chooser($wp_customize, 'refrigerator_repair_feature_icon' . $i, array(
	      	'section' => 'refrigerator_repair_features_section',
	      	'type' => 'icon',
	      	'label' => esc_html__('Features Icon ', 'refrigerator-repair') . $i
	  	)));
	}

	$wp_customize->add_setting('refrigerator_repair_feature_icon_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_feature_icon_size',array(
		'type' => 'number',
		'label' => __('Icon Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_features_section',
	));

	$wp_customize->add_setting('refrigerator_repair_feature_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_feature_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_features_section',
	));

	$wp_customize->add_setting( 'refrigerator_repair_features_icon_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_features_icon_color', array(
		'label' => 'Icon Color',
		'section' => 'refrigerator_repair_features_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_features_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_features_color', array(
		'label' => 'Text Color',
		'section' => 'refrigerator_repair_features_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_featuresbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_featuresbg_color', array(
		'label' => 'Background Color',
		'section' => 'refrigerator_repair_features_section',
	)));

	//Services Section
	$wp_customize->add_section('refrigerator_repair_service_section',array(
		'title'	=> __('Service Section','refrigerator-repair'),
		'description'=> __('Note : This section will appear below the Features Section.','refrigerator-repair'),
		'panel' => 'refrigerator_repair_panel_id',
	));

    $wp_customize->add_setting('refrigerator_repair_small_title',array(
		'default' => '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('refrigerator_repair_small_title',array(
		'label'	=> __('Section Small Title','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
		'type' => 'text'
	));

    $wp_customize->add_setting('refrigerator_repair_section_title',array(
		'default' => '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('refrigerator_repair_section_title',array(
		'label'	=> __('Section Title','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
		'type' => 'text'
	));

	$wp_customize->add_setting('refrigerator_repair_small_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_small_title_font_size',array(
		'type' => 'number',
		'label' => __('Small Title Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
	));

	$wp_customize->add_setting('refrigerator_repair_section_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_section_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
	));

	$categories = get_categories();
	$cats = array();
	$i = 0;
	$cat_pst[]= 'select';
	foreach($categories as $category){
		if($i==0){
			$default = $category->slug;
			$i++;
		}
		$cat_pst[$category->slug] = $category->name;
	}

	$wp_customize->add_setting('refrigerator_repair_category_setting',array(
		'default' => 'select',
		'sanitize_callback' => 'refrigerator_repair_sanitize_choices',
	));
	$wp_customize->add_control('refrigerator_repair_category_setting',array(
		'type' => 'select',
		'choices' => $cat_pst,
		'label' => __('Select Category To Display Post','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
	));

	$wp_customize->add_setting('refrigerator_repair_service_number',array(
		'default'	=> '3',
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('refrigerator_repair_service_number',array(
		'label'	=> __('Number Of Posts To Show In A Category','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
		'type'	  => 'number'
	));

	$refrigerator_repair_service_number = get_theme_mod('refrigerator_repair_service_number', 3);
	for ($i=1; $i <= $refrigerator_repair_service_number; $i++) { 
	   	$wp_customize->add_setting('refrigerator_repair_service_icon' . $i, array(
	      	'default' => 'fas fa-truck',
	      	'sanitize_callback' => 'sanitize_text_field'
	   	));
	   	$wp_customize->add_control(new Refrigerator_Repair_Fontawesome_Icon_Chooser($wp_customize, 'refrigerator_repair_service_icon' . $i, array(
	      	'section' => 'refrigerator_repair_service_section',
	      	'type' => 'icon',
	      	'label' => esc_html__('Service Icon ', 'refrigerator-repair') . $i
	  	)));
	}

	$wp_customize->add_setting('refrigerator_repair_service_img_size',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('refrigerator_repair_service_img_size',array(
		'label'	=> __('Image size','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
		'type'	  => 'number'
	));

	$wp_customize->add_setting('refrigerator_repair_service_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_service_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
	));

	$wp_customize->add_setting('refrigerator_repair_service_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_service_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_service_section',
	));

	$wp_customize->add_setting( 'refrigerator_repair_service_smallTitle_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_service_smallTitle_color', array(
		'label' => 'Small Title Color',
		'section' => 'refrigerator_repair_service_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_service_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_service_title_color', array(
		'label' => 'Title Color',
		'section' => 'refrigerator_repair_service_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_service_icon_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_service_icon_color', array(
		'label' => 'Icon Color',
		'section' => 'refrigerator_repair_service_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_service_iconbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_service_iconbg_color', array(
		'label' => 'Icon Bg Color',
		'section' => 'refrigerator_repair_service_section',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_service_overlay_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_service_overlay_color', array(
		'label' => 'Image Overlay Color',
		'section' => 'refrigerator_repair_service_section',
	)));

	//Footer
    $wp_customize->add_section( 'refrigerator_repair_footer', array(
    	'title'  => __( 'Footer Setting', 'refrigerator-repair' ),
		'priority' => null,
		'panel' => 'refrigerator_repair_panel_id'
	) );

	$wp_customize->add_setting('refrigerator_repair_show_back_totop',array(
       'default' => true,
       'sanitize_callback'	=> 'refrigerator_repair_sanitize_checkbox'
    ));
    $wp_customize->add_control('refrigerator_repair_show_back_totop',array(
       'type' => 'checkbox',
       'label' => __('Show / Hide Back to Top','refrigerator-repair'),
       'section' => 'refrigerator_repair_footer'
    ));

    $wp_customize->add_setting('refrigerator_repair_footer_copy',array(
		'default' => '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('refrigerator_repair_footer_copy',array(
		'label'	=> __('Copyright Text','refrigerator-repair'),
		'section' => 'refrigerator_repair_footer',
		'setting' => 'refrigerator_repair_footer_copy',
		'type' => 'text'
	));

	$wp_customize->add_setting('refrigerator_repair_footer_copy_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'refrigerator_repair_sanitize_float'
	));
	$wp_customize->add_control('refrigerator_repair_footer_copy_font_size',array(
		'type' => 'number',
		'label' => __('Copyright Font Size','refrigerator-repair'),
		'section' => 'refrigerator_repair_footer',
	));

	$wp_customize->add_setting( 'refrigerator_repair_footer_widget_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_footer_widget_color', array(
		'label' => 'Widget Title Color',
		'section' => 'refrigerator_repair_footer',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_footer_widget_menu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_footer_widget_menu_color', array(
		'label' => 'Widget Menus Color',
		'section' => 'refrigerator_repair_footer',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_footer_copy_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_footer_copy_color', array(
		'label' => 'Copyright Color',
		'section' => 'refrigerator_repair_footer',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_footer_copybg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_footer_copybg_color', array(
		'label' => 'Copyright BG Color',
		'section' => 'refrigerator_repair_footer',
	)));

	$wp_customize->add_setting( 'refrigerator_repair_footerbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'refrigerator_repair_footerbg_color', array(
		'label' => 'Footer BG Color',
		'section' => 'refrigerator_repair_footer',
	)));

	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'refrigerator_repair_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'refrigerator_repair_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'refrigerator_repair_customize_register' );

function refrigerator_repair_customize_partial_blogname() {
	bloginfo( 'name' );
}

function refrigerator_repair_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

if (class_exists('WP_Customize_Control')) {

   	class Refrigerator_Repair_Fontawesome_Icon_Chooser extends WP_Customize_Control {

      	public $type = 'icon';

      	public function render_content() { ?>
	     	<label>
	            <span class="customize-control-title">
	               <?php echo esc_html($this->label); ?>
	            </span>

	            <?php if ($this->description) { ?>
	                <span class="description customize-control-description">
	                   <?php echo wp_kses_post($this->description); ?>
	                </span>
	            <?php } ?>

	            <div class="refrigerator-repair-selected-icon">
	                <i class="fa <?php echo esc_attr($this->value()); ?>"></i>
	                <span><i class="fa fa-angle-down"></i></span>
	            </div>

	            <ul class="refrigerator-repair-icon-list clearfix">
	                <?php
	                $refrigerator_repair_font_awesome_icon_array = refrigerator_repair_font_awesome_icon_array();
	                foreach ($refrigerator_repair_font_awesome_icon_array as $refrigerator_repair_font_awesome_icon) {
	                   $icon_class = $this->value() == $refrigerator_repair_font_awesome_icon ? 'icon-active' : '';
	                   echo '<li class=' . esc_attr($icon_class) . '><i class="' . esc_attr($refrigerator_repair_font_awesome_icon) . '"></i></li>';
	                }
	                ?>
	            </ul>
	            <input type="hidden" value="<?php $this->value(); ?>" <?php $this->link(); ?> />
	        </label>
	        <?php
      	}
  	}
}
function refrigerator_repair_customizer_script() {
   wp_enqueue_style( 'font-awesome-1', esc_url(get_template_directory_uri()).'/assets/css/fontawesome-all.css');
}
add_action( 'customize_controls_enqueue_scripts', 'refrigerator_repair_customizer_script' );