<?php
//================================ Header Setting=======================================//
$wp_customize->add_section('neatnote_header_setting', array(
    'title' => esc_html__('Header Setting', 'neatnote'),
    'priority' => 40,
    'panel' => 'neatnote_theme_options_panel',
));

$wp_customize->add_setting('neatnote_sticky_header_enable', array(
    'default' => false,
    'sanitize_callback' => 'wp_validate_boolean',
));

$wp_customize->add_control('neatnote_sticky_header_enable', array(
    'type' => 'checkbox',
    'label' => esc_html__('Enable Sticky Header', 'neatnote'),
    'section' => 'neatnote_header_setting',
));

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

$wp_customize->add_control(new WP_Customize_Image_Control(
    $wp_customize,
    'neatnote_header_logo',
    array(
        'label' => esc_html__('Header Logo', 'neatnote'),
        'section' => 'neatnote_header_setting',
        'settings' => 'neatnote_header_logo',
        'description' => esc_html__('Upload a logo for the header.', 'neatnote')
    )
));

$headercolors = [
    'header_background_color' => '#F1F7FC',
    'sticky_header_background_color' => '#F1F7FC',
    'header_menu_color' => '#174474',
    'header_menu_hover_color' => '#174474',
    'header_sub_menu_dropdown_bg_color' => "#f1f7fc",
];

foreach ($headercolors as $neatnote_key => $_neatnote_default) {
    $wp_customize->add_setting("neatnote_{$neatnote_key}", array(
        'default' => $_neatnote_default,
        'transport' => 'refresh',
        'sanitize_callback' => 'sanitize_hex_color',
    ));

    $wp_customize->add_control(new WP_Customize_Color_Control(
        $wp_customize,
        "neatnote_{$neatnote_key}",
        array(
            'label' => sprintf(esc_html__('%s', 'neatnote'), ucwords(str_replace('_', ' ', $neatnote_key))),
            'section' => 'neatnote_header_setting',
            'settings' => "neatnote_{$neatnote_key}",
        )
    ));
}
