<?php
/**
 * Customizer: Page Header / Breadcrumb Settings Section
 *
 * @package Paws_And_Care
 * @since 1.2.9
 */

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

/**
 * Register Page Header / Breadcrumb Settings Section
 *
 * @param WP_Customize_Manager $wp_customize Customizer object.
 */
function paws_and_care_customizer_page_header($wp_customize)
{
    // ========================================
    // Page Header / Breadcrumb Section (inside Theme Settings panel)
    // ========================================
    $wp_customize->add_section('paws_and_care_page_header', array(
        'title' => __('Page Header / Breadcrumb Settings', 'paws-and-care'),
        'description' => __('Configure page header and breadcrumb settings for inner pages.', 'paws-and-care'),
        'panel' => 'paws_and_care_theme_settings',
        'priority' => 50,
    ));

    // Show Page Header
    $wp_customize->add_setting('paws_and_care_show_page_header', array(
        'default' => true,
        'sanitize_callback' => 'paws_and_care_sanitize_checkbox',
    ));
    $wp_customize->add_control(new Paws_And_Care_Customize_Toggle_Control($wp_customize, 'paws_and_care_show_page_header', array(
        'label' => __('Show Page Header', 'paws-and-care'),
        'description' => __('Display the page header section on inner pages.', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
    )));

    // Page Header Background Image
    $wp_customize->add_setting('paws_and_care_page_header_bg', array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw',
    ));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'paws_and_care_page_header_bg', array(
        'label' => __('Default Background Image', 'paws-and-care'),
        'description' => __('Upload a default background image for page headers.', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
        'active_callback' => 'paws_and_care_is_page_header_enabled',
    )));

    // Page Header Background Color
    $wp_customize->add_setting('paws_and_care_page_header_bg_color', array(
        'default' => '#f8f9fa',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'paws_and_care_page_header_bg_color', array(
        'label' => __('Background Color', 'paws-and-care'),
        'description' => __('Used when no background image is set.', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
        'active_callback' => 'paws_and_care_is_page_header_enabled',
    )));

    // Page Header Overlay Color
    $wp_customize->add_setting('paws_and_care_page_header_overlay', array(
        'default' => 'rgba(0, 0, 0, 0.5)',
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('paws_and_care_page_header_overlay', array(
        'label' => __('Overlay Color', 'paws-and-care'),
        'description' => __('Enter rgba color (e.g., rgba(0, 0, 0, 0.5)) for image overlay.', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
        'type' => 'text',
        'active_callback' => 'paws_and_care_is_page_header_enabled',
    ));

    // Show Breadcrumbs
    $wp_customize->add_setting('paws_and_care_show_breadcrumbs', array(
        'default' => true,
        'sanitize_callback' => 'paws_and_care_sanitize_checkbox',
    ));
    $wp_customize->add_control(new Paws_And_Care_Customize_Toggle_Control($wp_customize, 'paws_and_care_show_breadcrumbs', array(
        'label' => __('Show Breadcrumbs', 'paws-and-care'),
        'description' => __('Display breadcrumb navigation in page header.', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
        'active_callback' => 'paws_and_care_is_page_header_enabled',
    )));

    // Breadcrumb Style
    $wp_customize->add_setting('paws_and_care_breadcrumb_style', array(
        'default' => 'pill',
        'sanitize_callback' => 'paws_and_care_sanitize_select',
    ));
    $wp_customize->add_control('paws_and_care_breadcrumb_style', array(
        'label' => __('Breadcrumb Style', 'paws-and-care'),
        'section' => 'paws_and_care_page_header',
        'type' => 'select',
        'choices' => array(
            'pill' => __('Pill Style', 'paws-and-care'),
            'standard' => __('Standard', 'paws-and-care'),
            'arrow' => __('Arrow Separator', 'paws-and-care'),
        ),
        'active_callback' => 'paws_and_care_is_breadcrumbs_enabled',
    ));
}
