<?php

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/*********************
Scroll to TOP
*******************/
		$wp_customize->add_section(
				'magazinestyle_scrolltop_section',
				array(
					'title'       => __( 'Scroll To Top', 'magazine-style' ),
					'capability'  => 'edit_theme_options',						
					'panel'			=> 'panel_general',
				));
			
			//back to top
		$wp_customize->add_setting('magazinestyle_backtotop',	
			array(
				'default'			=> 'enable',
				'type'				=> 'theme_mod',
				'capability'		=> 'edit_theme_options',
				'sanitize_callback'	=> 'magazinestyle_customize_sanitize_select'
			));
		$wp_customize->add_control('magazinestyle_backtotop',
			 array (                             
				'type' => 'radio',
				'label' => __('Scroll to Top Button Control','magazine-style'),
				'settings'   => 'magazinestyle_backtotop',
				'section' => 'magazinestyle_scrolltop_section',
				'choices' => array(
					'enable' => __('Enable','magazine-style'),
					'disable' => __('Disable','magazine-style'),
				 ),
			 ));
			 $wp_customize->add_setting(
				'magazinestyle_scroll_top_position',
				array(
					'transport'         => 'postMessage',
					'default'           => 'right',
					'sanitize_callback' => 'magazinestyle_customize_sanitize_select',
				)
			);

			$wp_customize->add_control(
				new magazinestyle_Customizer_Buttonset_Control(
					$wp_customize,
					'magazinestyle_scroll_top_position',
					array(
						'label'           => esc_html__( 'Scroll Button Position', 'magazine-style' ),
						'section'         => 'magazinestyle_scrolltop_section',
						'settings'        => 'magazinestyle_scroll_top_position',						
						'choices'         => array(
							'left'  => esc_html__( 'Left', 'magazine-style' ),
							'right' => esc_html__( 'Right', 'magazine-style' ),
						),
					)
				)
			);
		$wp_customize->add_setting(
		'magazinestyle_scrollcolor_heading',
		array(
			'sanitize_callback' => 'wp_kses',
		));

		$wp_customize->add_control(
		new magazinestyle_Customizer_Heading_Control(
			$wp_customize,
			'magazinestyle_scrollcolor_heading',
			array(
				'label'    => esc_html__( 'Style Customize (Pro Only)', 'magazine-style' ),
				'section'  => 'magazinestyle_scrolltop_section',
				
			)));	 
		$wp_customize->add_setting( 'magazinestyle_backtotop_bg' , array(
			'default'     => '#E53B2C',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_backtotop_bg', array(
		'description'        => __( 'Background Color', 'magazine-style' ),
		'section'    => 'magazinestyle_scrolltop_section',
		'settings'   => 'magazinestyle_backtotop_bg',
		) ) );
		$wp_customize->add_setting( 'magazinestyle_backtotop_bghover' , array(
			'default'     => '#9E9E9E',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_backtotop_bghover', array(
		'description'        => __( 'Background Hover Color', 'magazine-style' ),
		'section'    => 'magazinestyle_scrolltop_section',
		'settings'   => 'magazinestyle_backtotop_bghover',
		) ) );
		$wp_customize->add_setting( 'magazinestyle_backtotop_text' , array(
			'default'     => '#ffffff',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_backtotop_text', array(
		'description'        => __( 'Icon Color', 'magazine-style' ),
		'section'    => 'magazinestyle_scrolltop_section',
		'settings'   => 'magazinestyle_backtotop_text',
		) ) );
		$wp_customize->add_setting( 'magazinestyle_backtotop_texthover' , array(
			'default'     => '#333333',
			'transport'   => 'refresh',
			'sanitize_callback'	=> 'sanitize_hex_color',
		) );
		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'magazinestyle_backtotop_texthover', array(
		'description'        => __( 'Icon Hover Color', 'magazine-style' ),
		'section'    => 'magazinestyle_scrolltop_section',
		'settings'   => 'magazinestyle_backtotop_texthover',
		) ) );


		
			$wp_customize->add_setting('magazinestyle_scrolltop_radius', array(
				'default'           => 5,
				'transport'         => 'postMessage',
				'sanitize_callback' => 'absint', // Sanitize as integer
			));
	
			$wp_customize->add_control('magazinestyle_scrolltop_radius', array(
				'type'        => 'range',
				'section'     => 'magazinestyle_scrolltop_section',
				'settings'    => 'magazinestyle_scrolltop_radius',
				'description' => __('Button Radius', 'magazine-style'),
				'priority' => 20,
				'input_attrs' => array(
					'min'  => 1,
					'max'  => 100,
					'step' => 5,
				),
			));	