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

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

$wp_customize->add_section(
	'lawyer_consultant_firm_header_options',
	array(
		'panel' => 'lawyer_consultant_firm_front_page_options',
		'title' => esc_html__( 'Header Options', 'lawyer-consultant-firm' ),
        'priority' => 1,
	)
);


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

// Add control for sticky header setting
$wp_customize->add_control(
	new Lawyer_Consultant_Firm_Toggle_Switch_Custom_Control(
		$wp_customize,
		'lawyer_consultant_firm_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'lawyer-consultant-firm' ),
			'section' => 'lawyer_consultant_firm_header_options',
		)
	)
);

// Enable Slider Section
$wp_customize->add_setting(
	'lawyer_consultant_firm_enable_topbar',
	array(
		'default'           => false,
		'sanitize_callback' => 'lawyer_consultant_firm_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Lawyer_Consultant_Firm_Toggle_Switch_Custom_Control(
		$wp_customize,
		'lawyer_consultant_firm_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'lawyer-consultant-firm' ),
			'section'  => 'lawyer_consultant_firm_header_options',
			'settings' => 'lawyer_consultant_firm_enable_topbar',
		)
	)
);

// Topbar Section - Time icon.
$wp_customize->add_setting(
    'lawyer_consultant_firm_time_icon',
    array(
        'default' => 'fas fa-clock', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Lawyer_Consultant_Firm_Change_Icon_Control(
    $wp_customize, 
    'lawyer_consultant_firm_time_icon',
    array(
        'label'    => __('Topbar Time Icon','lawyer-consultant-firm'),
        'section'  => 'lawyer_consultant_firm_header_options',
        'iconset'  => 'fa',
    )
));

// Topbar Section - Opening Timing.
$wp_customize->add_setting(
	'lawyer_consultant_firm_opening_timing',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_opening_timing',
	array(
		'label'           => esc_html__( 'Opening Timing', 'lawyer-consultant-firm' ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'type'            => 'text',
	)
);

// Topbar Section - location icon.
$wp_customize->add_setting(
    'lawyer_consultant_firm_location_header_icon',
    array(
        'default' => 'fas fa-map-marker-alt', 
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Lawyer_Consultant_Firm_Change_Icon_Control(
    $wp_customize, 
    'lawyer_consultant_firm_location_header_icon',
    array(
        'label'    => __('Topbar Location Icon','lawyer-consultant-firm'),
        'section'  => 'lawyer_consultant_firm_header_options',
        'iconset'  => 'fa',
    )
));

// Topbar Section - Topbar Location.
$wp_customize->add_setting(
	'lawyer_consultant_firm_header_location',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_header_location',
	array(
		'label'           => esc_html__( 'Topbar Location', 'lawyer-consultant-firm'  ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'settings'        => 'lawyer_consultant_firm_header_location',
		'type'            => 'text',
	)
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'lawyer_consultant_firm_header_phone_icon',
    array(
        'default' => 'fas fa-phone-alt', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Lawyer_Consultant_Firm_Change_Icon_Control(
    $wp_customize, 
    'lawyer_consultant_firm_header_phone_icon',
    array(
        'label'    => __('Phone Icon','lawyer-consultant-firm'),
        'section'  => 'lawyer_consultant_firm_header_options',
        'iconset'  => 'fa',
    )
));

// Contact Section - Phone Number.
$wp_customize->add_setting(
	'lawyer_consultant_firm_phone_number',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'lawyer-consultant-firm' ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'settings'        => 'lawyer_consultant_firm_phone_number',
		'type'            => 'text',
	)
);

// Topbar Section - Topbar Mail icon.
$wp_customize->add_setting(
    'lawyer_consultant_firm_email_icon',
    array(
        'default' => 'fas fa-envelope', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Lawyer_Consultant_Firm_Change_Icon_Control(
    $wp_customize, 
    'lawyer_consultant_firm_email_icon',
    array(
        'label'    => __('Topbar Email Icon','lawyer-consultant-firm'),
        'section'  => 'lawyer_consultant_firm_header_options',
        'iconset'  => 'fa',
    )
));

// Topbar Section - Topbar Email Label.
$wp_customize->add_setting(
	'lawyer_consultant_firm_email_topbar_address',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_email_topbar_address',
	array(
		'label'           => esc_html__( 'Topbar Email', 'lawyer-consultant-firm'  ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'settings'        => 'lawyer_consultant_firm_email_topbar_address',
		'type'            => 'text',
	)
);

// Header Section - Button Label.
$wp_customize->add_setting(
	'lawyer_consultant_firm_topheader_button_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_topheader_button_text',
	array(
		'label'           => esc_html__( 'Button Label', 'lawyer-consultant-firm'  ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'settings'        => 'lawyer_consultant_firm_topheader_button_text',
		'type'            => 'text',
	)
);

// Header Section - Button Link.
$wp_customize->add_setting(
	'lawyer_consultant_firm_topheader_button_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'lawyer_consultant_firm_topheader_button_url',
	array(
		'label'           => esc_html__( 'Button Link', 'lawyer-consultant-firm' ),
		'section'         => 'lawyer_consultant_firm_header_options',
		'settings'        => 'lawyer_consultant_firm_topheader_button_url',
		'type'            => 'url',
	)
);

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

$wp_customize->add_control( new Lawyer_Consultant_Firm_Separator_Custom_Control( $wp_customize, 'lawyer_consultant_firm_menu_separator', array(
	'label' => __( 'Menu Settings', 'lawyer-consultant-firm' ),
	'section' => 'lawyer_consultant_firm_header_options',
	'settings' => 'lawyer_consultant_firm_menu_separator',
)));

$wp_customize->add_setting( 'lawyer_consultant_firm_menu_font_size', array(
    'default'           => 13,
    'sanitize_callback' => 'absint',
));

// Add control for site title size
$wp_customize->add_control( 'lawyer_consultant_firm_menu_font_size', array(
    'type'        => 'number',
    'section'     => 'lawyer_consultant_firm_header_options',
    'label'       => __( 'Menu Font Size ', 'lawyer-consultant-firm' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));

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

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

$wp_customize->add_setting( 'lawyer_consultant_firm_menu_text_transform', array(
    'default'           => 'capitalize', // Default value for text transform
    'sanitize_callback' => 'sanitize_text_field',
) );

// Add control for menu text transform
$wp_customize->add_control( 'lawyer_consultant_firm_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'lawyer_consultant_firm_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'lawyer-consultant-firm' ),
    'choices'  => array(
        'none'       => __( 'None', 'lawyer-consultant-firm' ),
        'capitalize' => __( 'Capitalize', 'lawyer-consultant-firm' ),
        'uppercase'  => __( 'Uppercase', 'lawyer-consultant-firm' ),
        'lowercase'  => __( 'Lowercase', 'lawyer-consultant-firm' ),
    ),
) );

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'lawyer_consultant_firm_menu_text_color', 
		array(
			'label' => __('Menu Color', 'lawyer-consultant-firm'),
			'section' => 'lawyer_consultant_firm_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'lawyer_consultant_firm_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'lawyer-consultant-firm'),
			'section' => 'lawyer_consultant_firm_header_options',
		)
	)
);

// Topbar Padding Setting
$wp_customize->add_setting('lawyer_consultant_firm_topbar_padding',array(
		'default' => '',
		'sanitize_callback' => 'absint'
	)
);
$wp_customize->add_control('lawyer_consultant_firm_topbar_padding',array(
		'label' => __('Topbar Padding','lawyer-consultant-firm'),
		'section' => 'lawyer_consultant_firm_header_options',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 0,
			'max' => 50,
			'step' => 1
		)
	)
);

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

$wp_customize->add_control(
	'lawyer_consultant_firm_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(LAWYER_CONSULTANT_FIRM_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'lawyer_consultant_firm_header_options'
	)
);