<?php

/**
 * General Customizer options
 *
 * @package Acoustics
 */
/*--------------------------------------------
	General Panel
---------------------------------------------*/
$wp_customize->add_panel(
	'acoustics_general_panel',
	array(
		'title'         => esc_html__('General', 'acoustics'),
		'priority'      => 5,
	)
);

/**
 * Button
 *
 */
$wp_customize->add_section(
	'acoustics_button_section',
	array(
		'title'      => esc_html__('Button', 'acoustics'),
		'panel'      => 'acoustics_general_panel',
		'priority'       => 10
	)
);

$wp_customize->add_setting(
	'acoustics_button_tabs',
	array(
		'default'           => '',
		'sanitize_callback'	=> 'acoustics_sanitize_text'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_Tabs(
		$wp_customize,
		'acoustics_button_tabs',
		array(
			'label' 				=> esc_html__('Button tabs', 'acoustics'),
			'section'       		=> 'acoustics_button_section',
			'controls_general'		=> json_encode(
				array(
					'#customize-control-acoustics_button_font_size',
					'#customize-control-acoustics_button_text_transform',
					'#customize-control-acoustics_button_letter_spacing',
					'#customize-control-acoustics_button_top_bottom_padding',
					'#customize-control-acoustics_button_border_radius'
				)
			),
			'controls_design'		=> json_encode(
				array(
					'#customize-control-acoustics_button_color',
					'#customize-control-acoustics_button_background_color',
					'#customize-control-acoustics_button_border_color'
				)
			),
			'priority'      => 10,
		)
	)
);

/*--------------------------------------------
	Button General
---------------------------------------------*/
// Button Font Size
$wp_customize->add_setting('acoustics_button_font_size_desktop', array(
	'default'           => 14,
	'sanitize_callback' => 'absint',
));

$wp_customize->add_setting('acoustics_button_font_size_tablet', array(
	'default'           => 14,
	'sanitize_callback' => 'absint',
));

$wp_customize->add_setting('acoustics_button_font_size_mobile', array(
	'default'           => 14,
	'sanitize_callback' => 'absint',
));
$wp_customize->add_control(
	new Acoustics_Control_Slider(
		$wp_customize,
		'acoustics_button_font_size',
		array(
			'label'         => esc_html__('Font size', 'acoustics'),
			'section'       => 'acoustics_button_section',
			'responsive' 	=> true,
			'settings'      => array(
				'size_desktop' => 'acoustics_button_font_size_desktop',
				'size_tablet'  => 'acoustics_button_font_size_tablet',
				'size_mobile'  => 'acoustics_button_font_size_mobile',
			),
			'input_attrs' => array(
				'min'	=> 0,
				'max'	=> 50
			)
		)
	)
);

// Button Text Transform
$wp_customize->add_setting(
	'acoustics_button_text_transform',
	array(
		'default' 			=> 'none',
		'sanitize_callback' => 'acoustics_sanitize_text',
	)
);
$wp_customize->add_control(new Acoustics_Control_RadioButtons(
	$wp_customize,
	'acoustics_button_text_transform',
	array(
		'label'   => esc_html__('Text transform', 'acoustics'),
		'section' => 'acoustics_button_section',
		'choices' => array(
			'none' 			=> '-',
			'capitalize' 	=> 'Aa',
			'lowercase' 	=> 'aa',
			'uppercase' 	=> 'AA',
		)
	)
));

// Button Letter Spacing
$wp_customize->add_setting('acoustics_button_letter_spacing', array(
	'default'           => 0,
	'sanitize_callback' => 'acoustics_sanitize_text',
));
$wp_customize->add_control(new Acoustics_Control_Slider(
	$wp_customize,
	'acoustics_button_letter_spacing',
	array(
		'label'         => esc_html__('Letter spacing', 'acoustics'),
		'section'       => 'acoustics_button_section',
		'responsive' => false,
		'settings'      => array(
			'size_desktop' => 'acoustics_button_letter_spacing',
		),
		'input_attrs' => array(
			'min'  => 0,
			'max'  => 5,
			'step' => 0.1,
			'unit'  => 'em'
		)
	)
));

// Button Top and Bottom Padding
$wp_customize->add_setting('acoustics_button_top_bottom_padding_desktop', array(
	'default'           => 16,
	'sanitize_callback' => 'absint',
));

$wp_customize->add_setting('acoustics_button_top_bottom_padding_tablet', array(
	'default'           => 16,
	'sanitize_callback' => 'absint',
));

$wp_customize->add_setting('acoustics_button_top_bottom_padding_mobile', array(
	'default'           => 16,
	'sanitize_callback' => 'absint',
));
$wp_customize->add_control(
	new Acoustics_Control_Slider(
		$wp_customize,
		'acoustics_button_top_bottom_padding',
		array(
			'label' 		=> esc_html__('Button padding', 'acoustics'),
			'section' 		=> 'acoustics_button_section',
			'responsive'	=> true,
			'settings' 		=> array(
				'size_desktop' 		=> 'acoustics_button_top_bottom_padding_desktop',
				'size_tablet' 		=> 'acoustics_button_top_bottom_padding_tablet',
				'size_mobile' 		=> 'acoustics_button_top_bottom_padding_mobile',
			),
			'input_attrs' => array(
				'min'	=> 0,
				'max'	=> 50,
				'unit'  => 'px'
			)
		)
	)
);

// Button Border Radius
$wp_customize->add_setting('acoustics_button_border_radius', array(
	'default'           => 4,
	'sanitize_callback' => 'absint',
));

$wp_customize->add_control(
	new Acoustics_Control_Slider(
		$wp_customize,
		'acoustics_button_border_radius',
		array(
			'label' 		=> esc_html__('Button radius', 'acoustics'),
			'section' 		=> 'acoustics_button_section',
			'responsive'	=> true,
			'settings' 		=> array(
				'size_desktop' 		=> 'acoustics_button_border_radius',
			),
			'input_attrs' => array(
				'min'	=> 0,
				'max'	=> 100,
				'unit'  => 'px'
			),
		)
	)
);

/*--------------------------------------------
	Button Style
---------------------------------------------*/
// Color
$wp_customize->add_setting(
	'acoustics_button_color',
	array(
		'default'           => '#FFFFFF',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_setting(
	'acoustics_button_color_hover',
	array(
		'default'           => '#FFFFFF',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_ColorGroup(
		$wp_customize,
		'acoustics_button_color',
		array(
			'label'    => esc_html__('Color', 'acoustics'),
			'section'  => 'acoustics_button_section',
			'border' 	=> true,
			'settings' => array(
				'normal' => 'acoustics_button_color',
				'hover'  => 'acoustics_button_color_hover',
			),
			'priority' => 31
		)
	)
);

// Background
$wp_customize->add_setting(
	'acoustics_button_background_color',
	array(
		'default'           => '#000000',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_setting(
	'acoustics_button_background_color_hover',
	array(
		'default'           => '#121212',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_ColorGroup(
		$wp_customize,
		'acoustics_button_background_color',
		array(
			'label'    => esc_html__('Background Color', 'acoustics'),
			'section'  => 'acoustics_button_section',
			'border' 	=> true,
			'settings' => array(
				'normal' => 'acoustics_button_background_color',
				'hover'  => 'acoustics_button_background_color_hover',
			),
			'priority' => 31
		)
	)
);

// Background
$wp_customize->add_setting(
	'acoustics_button_border_color',
	array(
		'default'           => '#000000',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_setting(
	'acoustics_button_border_color_hover',
	array(
		'default'           => '#121212',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_ColorGroup(
		$wp_customize,
		'acoustics_button_border_color',
		array(
			'label'    => esc_html__('Border Color', 'acoustics'),
			'section'  => 'acoustics_button_section',
			'settings' => array(
				'normal' => 'acoustics_button_border_color',
				'hover'  => 'acoustics_button_border_color_hover',
			),
			'priority' => 31
		)
	)
);

/*--------------------------------------------
	Builder
---------------------------------------------*/
$wp_customize->add_section(
	'acoustics_builder_section',
	array(
		'title'      => esc_html__('Builder', 'acoustics'),
		'panel'      => 'acoustics_general_panel',
		'priority'   => 20
	)
);

$wp_customize->add_setting(
	'acoustics_builder_type',
	array(
		'default' 			=> 'editor',
		'sanitize_callback' => 'acoustics_sanitize_text'
	)
);
$wp_customize->add_control(new Acoustics_Control_RadioButtons(
	$wp_customize,
	'acoustics_builder_type',
	array(
		'label' 	=> esc_html__('Activate builder', 'acoustics'),
		'section' 	=> 'acoustics_builder_section',
		'choices' 	=> array(
			'editor' 		=> esc_html__('Default', 'acoustics'),
			'elementor' 	=> esc_html__('WpBakery Builder', 'acoustics'),
		)
	)
));

/**
 * Container
 *
 */
$wp_customize->add_section(
	'acoustics_container_section',
	array(
		'title'      => esc_html__('Container', 'acoustics'),
		'panel'      => 'acoustics_general_panel',
		'priority'   => 30
	)
);

$wp_customize->add_setting(
	'acoustics_website_container',
	array(
		'default' 			=> 'container',
		'sanitize_callback' => 'acoustics_sanitize_text'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_RadioButtons(
		$wp_customize,
		'acoustics_website_container',
		array(
			'label' 		=> esc_html__('Container', 'acoustics'),
			'section' 		=> 'acoustics_container_section',
			'choices' => array(
				'container' 		=> esc_html__('Contained', 'acoustics'),
				'container-fluid' 	=> esc_html__('Full Width', 'acoustics'),
			),
			'priority'		  => 35
		)
	)
);

$wp_customize->add_setting(
	'acoustics_container_width',
	array(
		'default'           => 1260,
		'sanitize_callback' => 'absint',
	)
);

$wp_customize->add_control(
	new Acoustics_Control_Slider(
		$wp_customize,
		'acoustics_container_width',
		array(
			'label' 		=> esc_html__('Container Width', 'acoustics'),
			'section' 		=> 'acoustics_container_section',
			'responsive'	=> false,
			'settings' 		=> array(
				'size_desktop' 		=> 'acoustics_container_width',
			),
			'input_attrs' => array(
				'min'	=> 990,
				'max'	=> 1920,
				'unit'  => 'px'
			),
			'priority'		  => 35
		)
	)
);

/*--------------------------------------------
	Page Header
---------------------------------------------*/
$wp_customize->add_section(
	'acoustics_page_header_section',
	array(
		'title'      => esc_html__('Header inner', 'acoustics'),
		'panel'      => 'acoustics_general_panel',
		'priority'   => 50
	)
);

$wp_customize->add_setting(
	'acoustics_page_header_tabs',
	array(
		'default'           => '',
		'sanitize_callback' => 'acoustics_sanitize_text'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_Tabs(
		$wp_customize,
		'acoustics_page_header_tabs',
		array(
			'label' 				=> '',
			'section'       		=> 'acoustics_page_header_section',
			'controls_general'		=> json_encode(
				array(
					'#customize-control-acoustics_page_header_breadcrumb_enable',
				)
			),
			'controls_design'		=> json_encode(
				array(
					'#customize-control-acoustics_page_header_color',
					'#customize-control-acoustics_page_header_link_color',
					'#customize-control-acoustics_page_header_background',
					'#customize-control-acoustics_page_header_background_divider',
					'#customize-control-acoustics_page_header_padding'
				)
			)
		)
	)
);

// Color
$wp_customize->add_setting( 'acoustics_page_header_color',
	array(
		'default'           => '#FFFFFF',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba',
		'transport'         => 'refresh'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_AlphaColor(
		$wp_customize,
		'acoustics_page_header_color',
		array(
			'label'         	=> esc_html__( 'Color', 'acoustics' ),
			'section'       	=> 'acoustics_page_header_section',
			'border'			=> true,
            'priority' 			=> 25
		)
	)
);

// Link color
$wp_customize->add_setting(
	'acoustics_page_header_link_color',
	array(
		'default'           => '#D0F224',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_setting(
	'acoustics_page_header_link_color_hover',
	array(
		'default'           => '#D0F224',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_ColorGroup(
		$wp_customize,
		'acoustics_page_header_link_color',
		array(
			'label'    => esc_html__('Link color', 'acoustics'),
			'section'  => 'acoustics_page_header_section',
			'settings' => array(
				'normal' => 'acoustics_page_header_link_color',
				'hover'  => 'acoustics_page_header_link_color_hover',
			),
			'border'			=> true,
			'priority' => 30
		)
	)
);

// Background
$wp_customize->add_setting( 'acoustics_page_header_background',
	array(
		'default'           => '#121212',
		'sanitize_callback' => 'acoustics_sanitize_hex_rgba',
		'transport'         => 'refresh'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_AlphaColor(
		$wp_customize,
		'acoustics_page_header_background',
		array(
			'label'         	=> esc_html__( 'Background', 'acoustics' ),
			'section'       	=> 'acoustics_page_header_section',
            'priority' 			=> 35
		)
	)
);

// Divider
$wp_customize->add_setting( 'acoustics_page_header_background_divider',
	array(
		'sanitize_callback' => 'acoustics_sanitize_text'
	)
);

$wp_customize->add_control(
	new Acoustics_Control_Divider(
		$wp_customize,
		'acoustics_page_header_background_divider',
		array(
			'section' 		=> 'acoustics_page_header_section',
			'priority' 			=> 40
		)
	)
);

// Padding
$wp_customize->add_setting(
    'acoustics_page_header_padding_desktop',
    array(
        'default'           => '{ "unit": "px","top": "120", "right": "", "bottom": "32", "left": "" }',
        'sanitize_callback' => 'acoustics_sanitize_text'
    )
);
$wp_customize->add_setting(
    'acoustics_page_header_padding_tablet',
    array(
        'default'           => '{ "unit": "px","top": "120", "right": "", "bottom": "32", "left": "" }',
        'sanitize_callback' => 'acoustics_sanitize_text'
    )
);
$wp_customize->add_setting(
    'acoustics_page_header_padding_mobile',
    array(
        'default'           => '{ "unit": "px","top": "120", "right": "", "bottom": "32", "left": "" }',
        'sanitize_callback' => 'acoustics_sanitize_text'
    )
);

$wp_customize->add_control(
    new Acoustics_Control_Dimensions(
        $wp_customize,
        'acoustics_page_header_padding',
        array(
            'label'           	=> __( 'Padding', 'acoustics' ),
            'section'         	=> 'acoustics_page_header_section',
            'sides'             => array(
                'top'    => true,
                'right'  => true,
                'bottom' => true,
                'left'   => true
            ),
            'units'              => array( 'px', 'em', 'rem' ),
            'responsive'   	     => true,
            'settings'        	 => array(
                'desktop' => 'acoustics_page_header_padding_desktop',
                'tablet'  => 'acoustics_page_header_padding_tablet',
                'mobile'  => 'acoustics_page_header_padding_mobile'
            ),
            'priority'	      	 => 45
        )
    )
);

/*-------------------------------------
 #Breadcrumbs
---------------------------------------*/
$wp_customize->add_section(
	'acoustics_breadcrumb_section',
	array(
		'title'          => esc_html__('Breadcrumb', 'acoustics'),
		'capability'     => 'edit_theme_options',
		'panel'			 => 'acoustics_general_panel',
		'priority'       => 55,
	)
);

$wp_customize->add_setting(
	'acoustics_breadcrumb_layout',
	array(
		'default'  =>      true,
		'sanitize_callback' => 'acoustics_sanitize_checkbox'
	)
);

$wp_customize->add_control(
	'acoustics_breadcrumb_layout',
	array(
		'section'       =>      'acoustics_breadcrumb_section',
		'label'         =>      esc_html__('Enable breadcrumbs', 'acoustics'),
		'type'          =>      'checkbox',
	)
);

/*-------------------------------------
 #Social
---------------------------------------*/
$wp_customize->add_section('acoustics_social_section', array(
    'title'          => esc_html__('Social profiles', 'acoustics'),
    'capability'     => 'edit_theme_options',
    'panel'          => 'acoustics_general_panel',
    'priority'       => 60,
));

$social_icons = array('twitter', 'facebook', 'linkedin', 'instagram', 'pinterest', 'youtube');
foreach ($social_icons as $icon) {
    $label = ucfirst($icon);
    $wp_customize->add_setting('acoustics_' . $icon . '_url', array(
        'sanitize_callback' => 'esc_url_raw'
    ));

    $wp_customize->add_control('acoustics_' . $icon . '_url', array(
        'label'         => esc_html($label),
        'type'          => 'url',
        'section'       => 'acoustics_social_section',
    ));
}
