<?php
/**
 * Footer — all content is controlled from Appearance → Customize (no dashboard widgets).
 *
 * @package express-movers
 */

$wp_customize->add_section(
	'express_movers_footer_section',
	array(
		'title'       => esc_html__( 'Footer Section', 'express-movers' ),
		'description' => esc_html__( 'Edit the main footer columns, stats, links, contact block, and bottom bar here.', 'express-movers' ),
		'capability'  => 'edit_theme_options',
		'panel'       => 'express_movers_theme_section_panel',
	)
);

// —— Brand column —— //
$wp_customize->add_setting(
	'express_movers_footer_brand_icon',
	array(
		'default'           => 'fa-solid fa-cube',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_brand_icon',
	array(
		'label'   => esc_html__( 'Brand: icon (Font Awesome class)', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_brand_title',
	array(
		'default'           => 'SwiftShip',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_brand_title',
	array(
		'label'   => esc_html__( 'Brand: site name', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_about_text',
	array(
		'default'           => 'Trusted logistics partner delivering speed and reliability across ocean, air, and ground—connecting businesses to 150+ countries with 24/7 support.',
		'sanitize_callback' => 'sanitize_textarea_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_about_text',
	array(
		'label'   => esc_html__( 'Brand: short description', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'textarea',
	)
);

// —— Stats (3 boxes) —— //
$express_movers_footer_stat_defaults = array(
	1 => array( 'fa-solid fa-globe', '150+', 'Countries' ),
	2 => array( 'fa-solid fa-award', '25+', 'Years' ),
	3 => array( 'fa-solid fa-headset', '24/7', 'Support' ),
);
for ( $i = 1; $i <= 3; $i++ ) {
	$wp_customize->add_setting(
		'express_movers_footer_stat_' . $i . '_icon',
		array(
			'default'           => $express_movers_footer_stat_defaults[ $i ][0],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_stat_' . $i . '_icon',
		array(
			/* translators: %d stat box number 1–3 */
			'label'   => sprintf( esc_html__( 'Stat %d: icon class', 'express-movers' ), $i ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);

	$wp_customize->add_setting(
		'express_movers_footer_stat_' . $i . '_number',
		array(
			'default'           => $express_movers_footer_stat_defaults[ $i ][1],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_stat_' . $i . '_number',
		array(
			/* translators: %d stat box number */
			'label'   => sprintf( esc_html__( 'Stat %d: number', 'express-movers' ), $i ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);

	$wp_customize->add_setting(
		'express_movers_footer_stat_' . $i . '_label',
		array(
			'default'           => $express_movers_footer_stat_defaults[ $i ][2],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_stat_' . $i . '_label',
		array(
			/* translators: %d stat box number */
			'label'   => sprintf( esc_html__( 'Stat %d: label', 'express-movers' ), $i ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);
}

// —— Social (4) —— //
$social_defaults = array(
	1 => array( 'fa-brands fa-facebook-f', '' ),
	2 => array( 'fa-brands fa-x-twitter', '' ),
	3 => array( 'fa-brands fa-linkedin-in', '' ),
	4 => array( 'fa-brands fa-instagram', '' ),
);
for ( $s = 1; $s <= 4; $s++ ) {
	$wp_customize->add_setting(
		'express_movers_foot_featured_icon_footer' . $s,
		array(
			'default'           => $social_defaults[ $s ][0],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_foot_featured_icon_footer' . $s,
		array(
			/* translators: %d icon slot */
			'label'   => sprintf( esc_html__( 'Social %d: Font Awesome class', 'express-movers' ), $s ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);

	$wp_customize->add_setting(
		'express_movers_featured_icon_url_footer' . $s,
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'express_movers_featured_icon_url_footer' . $s,
		array(
			/* translators: %d icon slot */
			'label'   => sprintf( esc_html__( 'Social %d: URL', 'express-movers' ), $s ),
			'section' => 'express_movers_footer_section',
			'type'    => 'url',
		)
	);
}

// —— Column titles —— //
$wp_customize->add_setting(
	'express_movers_footer_col2_title',
	array(
		'default'           => 'Quick Links',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_col2_title',
	array(
		'label'   => esc_html__( 'Column 2 heading', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_col3_title',
	array(
		'default'           => 'Our Services',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_col3_title',
	array(
		'label'   => esc_html__( 'Column 3 heading', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_col4_title',
	array(
		'default'           => 'Contact Us',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_col4_title',
	array(
		'label'   => esc_html__( 'Column 4 heading', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

// —— Quick links —— //
$quick_defaults = array(
	1 => array( 'About Us', '' ),
	2 => array( 'Careers', '' ),
	3 => array( 'News & Media', '' ),
	4 => array( 'Support', '' ),
);
for ( $q = 1; $q <= 4; $q++ ) {
	$wp_customize->add_setting(
		'express_movers_footer_quick_' . $q . '_label',
		array(
			'default'           => $quick_defaults[ $q ][0],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_quick_' . $q . '_label',
		array(
			/* translators: %d link number */
			'label'   => sprintf( esc_html__( 'Quick link %d: label', 'express-movers' ), $q ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);
	$wp_customize->add_setting(
		'express_movers_footer_quick_' . $q . '_url',
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_quick_' . $q . '_url',
		array(
			/* translators: %d link number */
			'label'   => sprintf( esc_html__( 'Quick link %d: URL', 'express-movers' ), $q ),
			'section' => 'express_movers_footer_section',
			'type'    => 'url',
		)
	);
}

// —— Services —— //
$service_defaults = array(
	1 => array( 'Ocean Freight', '' ),
	2 => array( 'Air Freight', '' ),
	3 => array( 'Ground Transport', '' ),
	4 => array( 'Warehousing', '' ),
);
for ( $v = 1; $v <= 4; $v++ ) {
	$wp_customize->add_setting(
		'express_movers_footer_service_' . $v . '_label',
		array(
			'default'           => $service_defaults[ $v ][0],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_service_' . $v . '_label',
		array(
			/* translators: %d link number */
			'label'   => sprintf( esc_html__( 'Service %d: label', 'express-movers' ), $v ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);
	$wp_customize->add_setting(
		'express_movers_footer_service_' . $v . '_url',
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_service_' . $v . '_url',
		array(
			/* translators: %d link number */
			'label'   => sprintf( esc_html__( 'Service %d: URL', 'express-movers' ), $v ),
			'section' => 'express_movers_footer_section',
			'type'    => 'url',
		)
	);
}

// —— Contact + CTA —— //
$wp_customize->add_setting(
	'express_movers_footer_contact_address',
	array(
		'default'           => '123 Logistics Ave, Suite 500 New York, NY 10001',
		'sanitize_callback' => 'sanitize_textarea_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_contact_address',
	array(
		'label'   => esc_html__( 'Contact: address', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'textarea',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_contact_phone',
	array(
		'default'           => '+1 (800) 123-4567',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_contact_phone',
	array(
		'label'   => esc_html__( 'Contact: phone (display)', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_contact_email',
	array(
		'default'           => 'info@swiftship.com',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_contact_email',
	array(
		'label'   => esc_html__( 'Contact: email', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_cta_text',
	array(
		'default'           => 'Get a Quote',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_footer_cta_text',
	array(
		'label'   => esc_html__( 'Contact: button text', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$wp_customize->add_setting(
	'express_movers_footer_cta_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);
$wp_customize->add_control(
	'express_movers_footer_cta_url',
	array(
		'label'   => esc_html__( 'Contact: button URL', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'url',
	)
);

// —— Bottom bar —— //
$wp_customize->add_setting(
	'express_movers_foot_themename',
	array(
		'default'           => '© 2026 SwiftShip Logistics. All rights reserved.',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'express_movers_foot_themename',
	array(
		'label'   => esc_html__( 'Copyright line', 'express-movers' ),
		'section' => 'express_movers_footer_section',
		'type'    => 'text',
	)
);

$legal = array(
	'privacy'  => array( 'Privacy Policy', '' ),
	'terms'    => array( 'Terms & Conditions', '' ),
	'cookie'   => array( 'Cookie Policy', '' ),
	'sitemap'  => array( 'Sitemap', '' ),
);
foreach ( $legal as $key => $pair ) {
	$wp_customize->add_setting(
		'express_movers_footer_legal_' . $key . '_label',
		array(
			'default'           => $pair[0],
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_legal_' . $key . '_label',
		array(
			/* translators: %s legal link key */
			'label'   => sprintf( esc_html__( 'Legal — %s: label', 'express-movers' ), ucfirst( $key ) ),
			'section' => 'express_movers_footer_section',
			'type'    => 'text',
		)
	);
	$wp_customize->add_setting(
		'express_movers_footer_legal_' . $key . '_url',
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'express_movers_footer_legal_' . $key . '_url',
		array(
			'label'   => sprintf( esc_html__( 'Legal — %s: URL', 'express-movers' ), ucfirst( $key ) ),
			'section' => 'express_movers_footer_section',
			'type'    => 'url',
		)
	);
}

// —— Colors —— //
$wp_customize->add_setting(
	'express_movers_footer_bg_color',
	array(
		'default'           => '#0a1628',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize,
		'express_movers_footer_bg_color',
		array(
			'label'   => esc_html__( 'Footer background', 'express-movers' ),
			'section' => 'express_movers_footer_section',
		)
	)
);

$wp_customize->add_setting(
	'express_movers_footer_accent_color',
	array(
		'default'           => '#f97316',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize,
		'express_movers_footer_accent_color',
		array(
			'label'   => esc_html__( 'Footer accent (icons, underlines, button)', 'express-movers' ),
			'section' => 'express_movers_footer_section',
		)
	)
);

$wp_customize->add_setting(
	'express_movers_footer_surface_color',
	array(
		'default'           => '#132a45',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize,
		'express_movers_footer_surface_color',
		array(
			'label'   => esc_html__( 'Stat cards & social tiles', 'express-movers' ),
			'section' => 'express_movers_footer_section',
		)
	)
);

$wp_customize->add_setting(
	'express_movers_footer_subbar_bg_color',
	array(
		'default'           => '#060d18',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize,
		'express_movers_footer_subbar_bg_color',
		array(
			'label'   => esc_html__( 'Bottom bar background', 'express-movers' ),
			'section' => 'express_movers_footer_section',
		)
	)
);

$wp_customize->add_setting(
	'footer_icon_color',
	array(
		'default'           => '#ffffff',
		'transport'         => 'refresh',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize,
		'footer_icon_color',
		array(
			'label'       => esc_html__( 'Footer text & icon color', 'express-movers' ),
			'description' => esc_html__( 'Main body text and icons on the footer background.', 'express-movers' ),
			'section'     => 'express_movers_footer_section',
		)
	)
);
