<?php
/**
 * Header Section
 *
 * @package clothing_marketplace
 */

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

$wp_customize->add_section(
	'clothing_marketplace_header_options',
	array(
		'panel' => 'clothing_marketplace_front_page_options',
		'title' => esc_html__( 'Header Options', 'clothing-marketplace' ),
        'priority' => 1,
	)
);

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

$wp_customize->add_control(
	'clothing_marketplace_header_button_text',
	array(
		'label'           => sprintf( esc_html__( 'Button Text', 'clothing-marketplace' )),
		'section'         => 'clothing_marketplace_header_options',
		'settings'        => 'clothing_marketplace_header_button_text',
		'type'            => 'text',
	)
);

$wp_customize->add_setting(
	'clothing_marketplace_header_button_link' ,
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'clothing_marketplace_header_button_link' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link', 'clothing-marketplace' )  ),
		'section'         => 'clothing_marketplace_header_options',
		'settings'        => 'clothing_marketplace_header_button_link' ,
		'type'            => 'url',
	)
);

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

$wp_customize->add_control( new Clothing_Marketplace_Separator_Custom_Control( $wp_customize, 'clothing_marketplace_menu_separator', array(
	'label' => __( 'Menu Settings', 'clothing-marketplace' ),
	'section' => 'clothing_marketplace_header_options',
	'settings' => 'clothing_marketplace_menu_separator',
)));

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

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

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

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

$wp_customize->add_setting( 'clothing_marketplace_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( 'clothing_marketplace_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'clothing_marketplace_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'clothing-marketplace' ),
    'choices'  => array(
        'none'       => __( 'None', 'clothing-marketplace' ),
        'capitalize' => __( 'Capitalize', 'clothing-marketplace' ),
        'uppercase'  => __( 'Uppercase', 'clothing-marketplace' ),
        'lowercase'  => __( 'Lowercase', 'clothing-marketplace' ),
    ),
) );

// Menu Text Color 
$wp_customize->add_setting(
	'clothing_marketplace_menu_text_color', 
	array(
		'default' => '#5F222A',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'clothing_marketplace_menu_text_color', 
		array(
			'label' => __('Menu Color', 'clothing-marketplace'),
			'section' => 'clothing_marketplace_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'clothing_marketplace_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'clothing-marketplace'),
			'section' => 'clothing_marketplace_header_options',
		)
	)
);

// Topbar Padding Setting
$wp_customize->add_setting('clothing_marketplace_topbar_padding',array(
		'default' => '',
		'sanitize_callback' => 'absint'
	)
);
$wp_customize->add_control('clothing_marketplace_topbar_padding',array(
		'label' => __('Topbar Padding','clothing-marketplace'),
		'section' => 'clothing_marketplace_header_options',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 0,
			'max' => 50,
			'step' => 1
		)
	)
);
