<?php
/**
 * Theme Customizer – EasySite Settings panel.
 *
 * @package EasySite_Pro
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Register customizer settings.
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function easysite_customize_register( $wp_customize ) {
	$wp_customize->add_panel( 'easysite_settings', array(
		'title'       => __( 'EasySite Settings', 'easysite-pro' ),
		'description' => __( 'Fill in these boxes to customize your website. Changes appear live on the right.', 'easysite-pro' ),
		'priority'    => 10,
	) );

	/* Branding */
	$wp_customize->add_section( 'easysite_branding', array(
		'title' => __( 'Branding', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_main_color', array(
		'section' => 'easysite_branding',
		'label'   => __( 'Main brand color', 'easysite-pro' ),
		'description' => __( 'Used for buttons, links, and highlights across your site.', 'easysite-pro' ),
		'type'    => 'color',
		'default' => '#2563eb',
	) );

	easysite_add_setting( $wp_customize, 'easysite_accent_color', array(
		'section' => 'easysite_branding',
		'label'   => __( 'Accent color', 'easysite-pro' ),
		'description' => __( 'A secondary color for accents and backgrounds.', 'easysite-pro' ),
		'type'    => 'color',
		'default' => '#0ea5e9',
	) );

	$font_choices = array();
	foreach ( easysite_get_font_pairs() as $key => $pair ) {
		$font_choices[ $key ] = $pair['label'];
	}

	easysite_add_setting( $wp_customize, 'easysite_font_pair', array(
		'section' => 'easysite_branding',
		'label'   => __( 'Font pair', 'easysite-pro' ),
		'description' => __( 'Choose a heading and body font combination.', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => $font_choices,
		'default' => 'inter-system',
	) );

	easysite_add_setting( $wp_customize, 'easysite_design_preset', array(
		'section' => 'easysite_branding',
		'label'   => __( 'Design preset', 'easysite-pro' ),
		'description' => __( 'Quick color, gradient, and font combinations.', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => wp_list_pluck( easysite_get_design_presets(), 'label' ),
		'default' => 'modern',
	) );

	$wp_customize->add_section( 'easysite_gradients', array(
		'title'       => __( 'Gradient Colors', 'easysite-pro' ),
		'description' => __( 'Beautiful gradient backgrounds for buttons, heroes, and call-to-action sections. Pick a preset or create your own.', 'easysite-pro' ),
		'panel'       => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_use_gradients', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Enable gradient colors site-wide', 'easysite-pro' ),
		'description' => __( 'Applies gradients to buttons, CTAs, heroes, and accents.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	$gradient_choices = array();
	foreach ( easysite_get_gradient_presets() as $key => $g ) {
		$gradient_choices[ $key ] = $g['label'];
	}

	easysite_add_setting( $wp_customize, 'easysite_gradient_preset', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Gradient preset', 'easysite-pro' ),
		'description' => __( 'Choose a ready-made gradient look for your site.', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => $gradient_choices,
		'default' => 'brand',
	) );

	easysite_add_setting( $wp_customize, 'easysite_gradient_color_1', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Custom gradient – start color', 'easysite-pro' ),
		'description' => __( 'Used when preset is "Custom gradient".', 'easysite-pro' ),
		'type'    => 'color',
		'default' => '#2563eb',
	) );

	easysite_add_setting( $wp_customize, 'easysite_gradient_color_2', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Custom gradient – end color', 'easysite-pro' ),
		'description' => __( 'The second color in your custom gradient.', 'easysite-pro' ),
		'type'    => 'color',
		'default' => '#0ea5e9',
	) );

	easysite_add_setting( $wp_customize, 'easysite_gradient_direction', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Gradient direction', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => easysite_get_gradient_directions(),
		'default' => '135',
	) );

	easysite_add_setting( $wp_customize, 'easysite_gradient_buttons', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Gradient buttons', 'easysite-pro' ),
		'description' => __( 'Style buttons with your gradient instead of a solid color.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_gradient_hero', array(
		'section' => 'easysite_gradients',
		'label'   => __( 'Gradient hero overlay', 'easysite-pro' ),
		'description' => __( 'Blend a gradient over homepage hero images.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	/* Layout */
	$wp_customize->add_section( 'easysite_layout', array(
		'title' => __( 'Layout', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_layout_style', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Layout style', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'full-width' => __( 'Full width', 'easysite-pro' ),
			'boxed'      => __( 'Boxed', 'easysite-pro' ),
		),
		'default' => 'full-width',
	) );

	easysite_add_setting( $wp_customize, 'easysite_header_style', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Header style', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'logo-left'   => __( 'Logo left', 'easysite-pro' ),
			'logo-center' => __( 'Logo center', 'easysite-pro' ),
		),
		'default' => 'logo-left',
	) );

	easysite_add_setting( $wp_customize, 'easysite_sticky_header', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Sticky header', 'easysite-pro' ),
		'description' => __( 'Keep the menu visible when visitors scroll.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_show_sidebar', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Show sidebar on blog', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_button_style', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Button style', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'pill'   => __( 'Rounded pill', 'easysite-pro' ),
			'rounded'=> __( 'Rounded corners', 'easysite-pro' ),
			'square' => __( 'Square', 'easysite-pro' ),
		),
		'default' => 'pill',
	) );

	easysite_add_setting( $wp_customize, 'easysite_section_spacing', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Section spacing', 'easysite-pro' ),
		'description' => __( 'How much space between page sections.', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'compact' => __( 'Compact', 'easysite-pro' ),
			'normal'  => __( 'Normal', 'easysite-pro' ),
			'relaxed' => __( 'Relaxed', 'easysite-pro' ),
		),
		'default' => 'normal',
	) );

	easysite_add_setting( $wp_customize, 'easysite_animations', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Smooth scroll animations', 'easysite-pro' ),
		'description' => __( 'Subtle fade-in effects as visitors scroll.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_header_transparent', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Transparent header on homepage', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => false,
	) );

	easysite_add_setting( $wp_customize, 'easysite_rounded_corners', array(
		'section' => 'easysite_layout',
		'label'   => __( 'Rounded card corners', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'large'  => __( 'Large radius', 'easysite-pro' ),
			'medium' => __( 'Medium', 'easysite-pro' ),
			'sharp'  => __( 'Sharp', 'easysite-pro' ),
		),
		'default' => 'large',
	) );

	/* Homepage */
	$wp_customize->add_section( 'easysite_homepage', array(
		'title'       => __( 'Homepage Content', 'easysite-pro' ),
		'description' => __( 'Start by telling visitors who you are and what you offer. Use these boxes to write your main message. You can change it anytime.', 'easysite-pro' ),
		'panel'       => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_hero_title', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Hero title', 'easysite-pro' ),
		'description' => __( 'This text appears at the top of your homepage.', 'easysite-pro' ),
		'default' => __( 'Welcome to Our Business', 'easysite-pro' ),
	) );

	easysite_add_setting( $wp_customize, 'easysite_hero_subtitle', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Hero subtitle', 'easysite-pro' ),
		'description' => easysite_is_bundle() ? __( 'Short line under your main headline. Use “Suggest text” in AI Assistant settings after adding your API key.', 'easysite-pro' ) : '',
		'default' => __( 'We help you grow with friendly, reliable service.', 'easysite-pro' ),
	) );

	easysite_add_setting( $wp_customize, 'easysite_hero_button_text', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Hero button text', 'easysite-pro' ),
		'default' => __( 'Get Started', 'easysite-pro' ),
	) );

	easysite_add_setting( $wp_customize, 'easysite_hero_button_link', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Hero button link', 'easysite-pro' ),
		'default' => '/contact',
	) );

	$wp_customize->add_setting( 'easysite_hero_bg_image' );
	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'easysite_hero_bg_image', array(
		'label'       => __( 'Hero background image', 'easysite-pro' ),
		'description' => __( 'Upload a clear photo that represents your business.', 'easysite-pro' ),
		'section'     => 'easysite_homepage',
	) ) );

	easysite_add_setting( $wp_customize, 'easysite_about_show', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Show About section', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_about_title', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'About title', 'easysite-pro' ),
		'default' => __( 'About Us', 'easysite-pro' ),
	) );

	easysite_add_setting( $wp_customize, 'easysite_about_text', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'About text', 'easysite-pro' ),
		'type'    => 'textarea',
		'default' => __( 'We are a friendly team dedicated to helping our customers succeed.', 'easysite-pro' ),
	) );

	$wp_customize->add_setting( 'easysite_about_image' );
	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'easysite_about_image', array(
		'label'   => __( 'About image', 'easysite-pro' ),
		'section' => 'easysite_homepage',
	) ) );

	easysite_add_setting( $wp_customize, 'easysite_services_show', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Show Services section', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_services_title', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Services section title', 'easysite-pro' ),
		'default' => __( 'Our Services', 'easysite-pro' ),
	) );

	for ( $i = 1; $i <= 6; $i++ ) {
		easysite_add_setting( $wp_customize, "easysite_service_{$i}_title", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Service %d title', 'easysite-pro' ), $i ),
			'default' => $i <= 3 ? sprintf( __( 'Service %d', 'easysite-pro' ), $i ) : '',
		) );
		easysite_add_setting( $wp_customize, "easysite_service_{$i}_desc", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Service %d description', 'easysite-pro' ), $i ),
			'type'    => 'textarea',
			'default' => $i <= 3 ? __( 'Describe what you offer and how it helps your customers.', 'easysite-pro' ) : '',
		) );
		easysite_add_setting( $wp_customize, "easysite_service_{$i}_price", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Service %d price (optional)', 'easysite-pro' ), $i ),
			'default' => '',
		) );
	}

	easysite_add_setting( $wp_customize, 'easysite_testimonials_show', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Show Testimonials section', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => true,
	) );

	easysite_add_setting( $wp_customize, 'easysite_testimonials_title', array(
		'section' => 'easysite_homepage',
		'label'   => __( 'Testimonials section title', 'easysite-pro' ),
		'default' => __( 'What Our Customers Say', 'easysite-pro' ),
	) );

	for ( $i = 1; $i <= 3; $i++ ) {
		easysite_add_setting( $wp_customize, "easysite_testimonial_{$i}_name", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Testimonial %d name', 'easysite-pro' ), $i ),
			'default' => $i <= 2 ? sprintf( __( 'Happy Customer %d', 'easysite-pro' ), $i ) : '',
		) );
		easysite_add_setting( $wp_customize, "easysite_testimonial_{$i}_role", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Testimonial %d role', 'easysite-pro' ), $i ),
			'default' => $i <= 2 ? __( 'Local Business Owner', 'easysite-pro' ) : '',
		) );
		easysite_add_setting( $wp_customize, "easysite_testimonial_{$i}_quote", array(
			'section' => 'easysite_homepage',
			'label'   => sprintf( __( 'Testimonial %d quote', 'easysite-pro' ), $i ),
			'type'    => 'textarea',
			'default' => $i <= 2 ? __( 'Great service and an easy website to manage. Highly recommended!', 'easysite-pro' ) : '',
		) );
	}

	if ( easysite_wc_active() ) {
		easysite_add_setting( $wp_customize, 'easysite_shop_show', array(
			'section' => 'easysite_homepage',
			'label'   => __( 'Show Shop section on homepage', 'easysite-pro' ),
			'type'    => 'checkbox',
			'default' => true,
		) );
		easysite_add_setting( $wp_customize, 'easysite_shop_title', array(
			'section' => 'easysite_homepage',
			'label'   => __( 'Shop section title', 'easysite-pro' ),
			'default' => __( 'Featured Products', 'easysite-pro' ),
		) );
		easysite_add_setting( $wp_customize, 'easysite_shop_count', array(
			'section' => 'easysite_homepage',
			'label'   => __( 'Number of products to show', 'easysite-pro' ),
			'type'    => 'number',
			'default' => 4,
		) );
		easysite_add_setting( $wp_customize, 'easysite_shop_view_all', array(
			'section' => 'easysite_homepage',
			'label'   => __( 'Show "View all products" button', 'easysite-pro' ),
			'type'    => 'checkbox',
			'default' => true,
		) );
	}

	/* Contact & Footer */
	$wp_customize->add_section( 'easysite_contact', array(
		'title' => __( 'Contact & Footer', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	$contact_fields = array(
		'easysite_contact_phone'   => array( __( 'Phone number', 'easysite-pro' ), '' ),
		'easysite_contact_email'   => array( __( 'Email address', 'easysite-pro' ), '' ),
		'easysite_contact_address' => array( __( 'Address', 'easysite-pro' ), '', 'textarea' ),
		'easysite_contact_hours'   => array( __( 'Opening hours', 'easysite-pro' ), __( 'Mon–Fri: 9am–5pm', 'easysite-pro' ) ),
		'easysite_footer_text'     => array( __( 'Footer text', 'easysite-pro' ), __( '© Your Business. All rights reserved.', 'easysite-pro' ) ),
	);

	foreach ( $contact_fields as $key => $data ) {
		easysite_add_setting( $wp_customize, $key, array(
			'section' => 'easysite_contact',
			'label'   => $data[0],
			'type'    => isset( $data[2] ) ? $data[2] : 'text',
			'default' => $data[1],
		) );
	}

	foreach ( array( 'facebook', 'instagram', 'twitter', 'linkedin' ) as $network ) {
		easysite_add_setting( $wp_customize, 'easysite_social_' . $network, array(
			'section' => 'easysite_contact',
			'label'   => ucfirst( $network ) . ' URL',
			'default' => '',
		) );
	}

	easysite_add_setting( $wp_customize, 'easysite_newsletter_toggle', array(
		'section' => 'easysite_contact',
		'label'   => __( 'Show newsletter signup in footer', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => false,
	) );

	if ( easysite_is_bundle() ) {
		easysite_register_bundle_customizer( $wp_customize );
	}
}
add_action( 'customize_register', 'easysite_customize_register' );

/**
 * Helper to add a customizer setting + control.
 *
 * @param WP_Customize_Manager $wp_customize Customizer.
 * @param string               $id         Setting ID.
 * @param array                $args       Arguments.
 */
function easysite_add_setting( $wp_customize, $id, $args ) {
	$defaults = array(
		'type'    => 'text',
		'default' => '',
		'choices' => array(),
		'description' => '',
	);

	$args = wp_parse_args( $args, $defaults );

	$wp_customize->add_setting( $id, array(
		'default'           => $args['default'],
		'sanitize_callback' => 'easysite_sanitize_customizer',
		'transport'         => 'refresh',
	) );

	$control_args = array(
		'label'       => $args['label'],
		'section'     => $args['section'],
		'type'        => $args['type'],
		'description' => $args['description'],
	);

	if ( ! empty( $args['choices'] ) ) {
		$control_args['choices'] = $args['choices'];
	}

	$wp_customize->add_control( $id, $control_args );
}

/**
 * Sanitize customizer values.
 *
 * @param mixed $value Value.
 * @return mixed
 */
function easysite_sanitize_customizer( $value ) {
	if ( is_bool( $value ) ) {
		return $value;
	}
	if ( is_numeric( $value ) ) {
		return $value;
	}
	if ( is_array( $value ) ) {
		return array_map( 'sanitize_text_field', $value );
	}
	return sanitize_text_field( $value );
}

/**
 * Bundle-only customizer sections.
 *
 * @param WP_Customize_Manager $wp_customize Customizer.
 */
function easysite_register_bundle_customizer( $wp_customize ) {
	$wp_customize->add_section( 'easysite_sections_library', array(
		'title' => __( 'Section Library', 'easysite-pro' ),
		'description' => __( 'Enable or disable pre-built sections on your pages.', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	$sections = array(
		'hero_variants'      => __( 'Hero variants', 'easysite-pro' ),
		'about_variants'     => __( 'About variants', 'easysite-pro' ),
		'services_layouts'   => __( 'Services layouts', 'easysite-pro' ),
		'pricing_tables'     => __( 'Pricing tables', 'easysite-pro' ),
		'testimonials_layouts' => __( 'Testimonials layouts', 'easysite-pro' ),
		'faq_blocks'         => __( 'FAQ blocks', 'easysite-pro' ),
		'contact_blocks'     => __( 'Contact blocks', 'easysite-pro' ),
	);

	foreach ( $sections as $key => $label ) {
		easysite_add_setting( $wp_customize, 'easysite_section_' . $key, array(
			'section' => 'easysite_sections_library',
			'label'   => $label,
			'type'    => 'checkbox',
			'default' => true,
		) );
	}

	$wp_customize->add_section( 'easysite_popup', array(
		'title' => __( 'Popup Builder', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_popup_enabled', array(
		'section' => 'easysite_popup',
		'label'   => __( 'Enable popup', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => false,
	) );

	easysite_add_setting( $wp_customize, 'easysite_popup_type', array(
		'section' => 'easysite_popup',
		'label'   => __( 'Popup type', 'easysite-pro' ),
		'type'    => 'select',
		'choices' => array(
			'newsletter'   => __( 'Newsletter', 'easysite-pro' ),
			'promo'        => __( 'Promo', 'easysite-pro' ),
			'announcement' => __( 'Announcement', 'easysite-pro' ),
		),
		'default' => 'newsletter',
	) );

	$popup_fields = array(
		'easysite_popup_title'       => __( 'Popup title', 'easysite-pro' ),
		'easysite_popup_text'        => array( __( 'Popup text', 'easysite-pro' ), 'textarea' ),
		'easysite_popup_button_text' => __( 'Button text', 'easysite-pro' ),
		'easysite_popup_button_link' => __( 'Button link', 'easysite-pro' ),
		'easysite_popup_trigger'     => array( __( 'Display rule', 'easysite-pro' ), 'select', array(
			'load'   => __( 'On page load', 'easysite-pro' ),
			'delay'  => __( 'After a few seconds', 'easysite-pro' ),
			'scroll' => __( 'On scroll', 'easysite-pro' ),
			'exit'   => __( 'Exit intent', 'easysite-pro' ),
		) ),
	);

	foreach ( $popup_fields as $key => $data ) {
		$type    = is_array( $data ) ? $data[1] : 'text';
		$choices = is_array( $data ) && isset( $data[2] ) ? $data[2] : array();
		easysite_add_setting( $wp_customize, $key, array(
			'section' => 'easysite_popup',
			'label'   => is_array( $data ) ? $data[0] : $data,
			'type'    => $type,
			'choices' => $choices,
			'default' => '',
		) );
	}

	$wp_customize->add_section( 'easysite_seo', array(
		'title' => __( 'SEO Helper', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_seo_description', array(
		'section' => 'easysite_seo',
		'label'   => __( 'Site meta description', 'easysite-pro' ),
		'description' => __( 'A short summary of your site for search engines.', 'easysite-pro' ),
		'type'    => 'textarea',
		'default' => '',
	) );

	$wp_customize->add_setting( 'easysite_seo_social_image' );
	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'easysite_seo_social_image', array(
		'label'   => __( 'Default social share image', 'easysite-pro' ),
		'section' => 'easysite_seo',
	) ) );

	$wp_customize->add_section( 'easysite_performance', array(
		'title' => __( 'Performance', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	$perf_toggles = array(
		'easysite_lazy_load'      => __( 'Lazy load images', 'easysite-pro' ),
		'easysite_minify_assets'  => __( 'Minify CSS/JS', 'easysite-pro' ),
		'easysite_preload_fonts'  => __( 'Preload fonts', 'easysite-pro' ),
		'easysite_disable_emojis' => __( 'Disable emojis', 'easysite-pro' ),
		'easysite_disable_widgets' => __( 'Disable unused widgets', 'easysite-pro' ),
	);

	foreach ( $perf_toggles as $key => $label ) {
		easysite_add_setting( $wp_customize, $key, array(
			'section' => 'easysite_performance',
			'label'   => $label,
			'type'    => 'checkbox',
			'default' => in_array( $key, array( 'easysite_lazy_load' ), true ),
		) );
	}

	$wp_customize->add_section( 'easysite_white_label', array(
		'title' => __( 'White Label / Client Mode', 'easysite-pro' ),
		'panel' => 'easysite_settings',
	) );

	easysite_add_setting( $wp_customize, 'easysite_client_mode', array(
		'section' => 'easysite_white_label',
		'label'   => __( 'Enable Client Mode', 'easysite-pro' ),
		'description' => __( 'Simplify the dashboard for your clients.', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => false,
	) );

	easysite_add_setting( $wp_customize, 'easysite_hide_wp_branding', array(
		'section' => 'easysite_white_label',
		'label'   => __( 'Hide WordPress branding', 'easysite-pro' ),
		'type'    => 'checkbox',
		'default' => false,
	) );

	easysite_add_setting( $wp_customize, 'easysite_agency_name', array(
		'section' => 'easysite_white_label',
		'label'   => __( 'Agency name', 'easysite-pro' ),
		'default' => '',
	) );

	easysite_add_setting( $wp_customize, 'easysite_help_message', array(
		'section' => 'easysite_white_label',
		'label'   => __( 'Custom welcome message', 'easysite-pro' ),
		'type'    => 'textarea',
		'default' => '',
	) );
}
