<?php
/**
 * Header Section Settings
 *
 * @package bike_workshop
 */

// ---------------------------------------- HEADER OPTIONS ----------------------------------------------------

$wp_customize->add_section(
	'bike_workshop_header_options',
	array(
		'panel' => 'bike_workshop_front_page_options',
		'title' => esc_html__( 'Header Options', 'bike-workshop' ),
        'priority' => 1,
	)
);

// Add setting for sticky header
$wp_customize->add_setting(
	'bike_workshop_enable_sticky_header',
	array(
		'sanitize_callback' => 'bike_workshop_sanitize_switch',
		'default'           => false,
	)
);

// Add control for sticky header setting
$wp_customize->add_control(
	new Bike_Workshop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'bike_workshop_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Menu', 'bike-workshop' ),
			'section' => 'bike_workshop_header_options',
		)
	)
);

// Post Options - Show / Hide Sidebar.
$wp_customize->add_setting(
	'bike_workshop_post_hide_header_sidebar',
	array(
		'default'           => true,
		'sanitize_callback' => 'bike_workshop_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Bike_Workshop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'bike_workshop_post_hide_header_sidebar',
		array(
			'label'   => esc_html__( 'Show / Hide Header Sidebar', 'bike-workshop' ),
			'section' => 'bike_workshop_header_options',
		)
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'bike_workshop_menu_separator', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Bike_Workshop_Separator_Custom_Control( $wp_customize, 'bike_workshop_menu_separator', array(
	'label' => __( 'Menu Settings', 'bike-workshop' ),
	'section' => 'bike_workshop_header_options',
	'settings' => 'bike_workshop_menu_separator',
)));

$wp_customize->add_setting( 'bike_workshop_menu_font_size', array(
    'default'           => 15,
    'sanitize_callback' => 'absint',
) );

// Add control for site title size
$wp_customize->add_control( 'bike_workshop_menu_font_size', array(
    'type'        => 'number',
    'section'     => 'bike_workshop_header_options',
    'label'       => __( 'Menu Font Size ', 'bike-workshop' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));

// Add setting for menu font weight
$wp_customize->add_setting('bike_workshop_menu_font_weight', array(
    'default'           => '500',
    'sanitize_callback' => 'sanitize_text_field',
));

// Add control for menu font weight
$wp_customize->add_control('bike_workshop_menu_font_weight', array(
    'type'     => 'select',
    'section'  => 'bike_workshop_header_options', 
    'label'    => __('Menu Font Weight', 'bike-workshop'),
    'choices'  => array(
		'100' => __('100','bike-workshop'),
		'200' => __('200','bike-workshop'),
		'300' => __('300','bike-workshop'),
		'400' => __('400','bike-workshop'),
		'500' => __('500','bike-workshop'),
		'600' => __('600','bike-workshop'),
		'700' => __('700','bike-workshop'),
		'800' => __('800','bike-workshop'),
		'900' => __('900','bike-workshop'),
    ),
));

// Add setting for menu text transform
$wp_customize->add_setting('bike_workshop_menu_text_transform', array(
    'default'           => 'uppercase', // Default value for text transform
    'sanitize_callback' => 'sanitize_text_field',
));

// Add control for menu text transform
$wp_customize->add_control('bike_workshop_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'bike_workshop_header_options', // Section where the control will appear
    'label'    => __('Menu Text Transform', 'bike-workshop'),
    'choices'  => array(
        'none'       => __('None', 'bike-workshop'),
        'capitalize' => __('Capitalize', 'bike-workshop'),
        'uppercase'  => __('Uppercase', 'bike-workshop'),
        'lowercase'  => __('Lowercase', 'bike-workshop'),
    ),
));

// Menu Text Color 
$wp_customize->add_setting(
	'bike_workshop_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'bike_workshop_menu_text_color', 
		array(
			'label' => __('Menu Color', 'bike-workshop'),
			'section' => 'bike_workshop_header_options',
		)
	)
);

// Sub Menu Text Color 
$wp_customize->add_setting(
	'bike_workshop_sub_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'bike_workshop_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'bike-workshop'),
			'section' => 'bike_workshop_header_options',
		)
	)
);

$wp_customize->add_setting( 
	'bike_workshop_header_settings_upgraded_features',
	array(
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'bike_workshop_header_settings_upgraded_features', 
	array(
		'type'=> 'hidden',
		'description' => "
			<div class='customizer-upgraded-features'>
				<i class='fas fa-info-circle'></i>
				<span class='pro-text'>
					Unlock Premium <strong>Features</strong> ?<br>
					<a target='_blank' href='". esc_url(BIKE_WORKSHOP_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'bike_workshop_header_options'
	)
);