<?php
/**
 * Blog Over Complete Customizer Settings
 * 
 * Matches Blogus functionality with 100% unique code
 *
 * @package Blog_Over
 */

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

/**
 * Register All Customizer Settings
 */
function blog_over_blog_customizer_register($wp_customize)
{

    // =========================================
    // PANEL: Header Options
    // =========================================
    $wp_customize->add_panel('blog_over_header_panel', array(
        'title' => __('Header Options', 'blog-over'),
        'priority' => 25,
    ));

    // -----------------------------------------
    // Section: Social Icons
    // -----------------------------------------
    $wp_customize->add_section('blog_over_social_section', array(
        'title' => __('Social Icons', 'blog-over'),
        'panel' => 'blog_over_header_panel',
    ));

    $wp_customize->add_setting('blog_over_header_social_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_header_social_show', array(
        'label' => __('Show Social Icons in Header', 'blog-over'),
        'section' => 'blog_over_social_section',
        'type' => 'checkbox',
    ));

    // Social URLs
    $social_networks = array(
        'facebook' => __('Facebook URL', 'blog-over'),
        'twitter' => __('Twitter/X URL', 'blog-over'),
        'instagram' => __('Instagram URL', 'blog-over'),
        'youtube' => __('YouTube URL', 'blog-over'),
        'linkedin' => __('LinkedIn URL', 'blog-over'),
        'pinterest' => __('Pinterest URL', 'blog-over'),
    );

    foreach ($social_networks as $id => $label) {
        $wp_customize->add_setting('blog_over_social_' . $id, array(
            'default' => '',
            'sanitize_callback' => 'esc_url_raw',
        ));
        $wp_customize->add_control('blog_over_social_' . $id, array(
            'label' => $label,
            'section' => 'blog_over_social_section',
            'type' => 'url',
        ));
    }

    // -----------------------------------------
    // Section: Top Bar & Menu Features
    // -----------------------------------------
    $wp_customize->add_section('blog_over_topbar_section', array(
        'title' => __('Top Bar & Menu', 'blog-over'),
        'panel' => 'blog_over_header_panel',
    ));

    $wp_customize->add_setting('blog_over_show_search', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_search', array(
        'label' => __('Show Search Icon', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_show_subscribe_btn', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_subscribe_btn', array(
        'label' => __('Show Subscribe Button', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_subscribe_url', array(
        'default' => '#',
        'sanitize_callback' => 'esc_url_raw',
    ));
    $wp_customize->add_control('blog_over_subscribe_url', array(
        'label' => __('Subscribe Button URL', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'url',
    ));

    // Subscribe Button Text
    $wp_customize->add_setting('blog_over_subscribe_text', array(
        'default' => __('Subscribe', 'blog-over'),
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_subscribe_text', array(
        'label' => __('Subscribe Button Text', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'text',
    ));

    // Open Subscribe in New Tab
    $wp_customize->add_setting('blog_over_subscribe_new_tab', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_subscribe_new_tab', array(
        'label' => __('Open Subscribe Link in New Tab', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'checkbox',
    ));

    // Topbar Date Text (optional custom text)
    $wp_customize->add_setting('blog_over_topbar_date_text', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_topbar_date_text', array(
        'label' => __('Custom Topbar Text', 'blog-over'),
        'description' => __('Leave empty to show current date', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'text',
    ));

    // Show Topbar
    $wp_customize->add_setting('blog_over_topbar_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_topbar_show', array(
        'label' => __('Show Top Bar', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_dark_mode_toggle', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_dark_mode_toggle', array(
        'label' => __('Show Dark/Light Mode Switcher', 'blog-over'),
        'section' => 'blog_over_topbar_section',
        'type' => 'checkbox',
    ));

    // =========================================
    // PANEL: Theme Options
    // =========================================
    $wp_customize->add_panel('blog_over_theme_panel', array(
        'title' => __('Theme Options', 'blog-over'),
        'priority' => 30,
    ));

    // -----------------------------------------
    // Section: Typography
    // -----------------------------------------
    $wp_customize->add_section('blog_over_typography_section', array(
        'title' => __('Typography Settings', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_enable_typography', array(
        'default' => false,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_enable_typography', array(
        'label' => __('Enable Custom Typography', 'blog-over'),
        'section' => 'blog_over_typography_section',
        'type' => 'checkbox',
    ));

    $font_choices = array(
        'Inter' => 'Inter',
        'Open Sans' => 'Open Sans',
        'Roboto' => 'Roboto',
        'Lato' => 'Lato',
        'Poppins' => 'Poppins',
        'Josefin Sans' => 'Josefin Sans',
        'Raleway' => 'Raleway',
        'Noto Serif' => 'Noto Serif',
    );

    $wp_customize->add_setting('blog_over_heading_font', array(
        'default' => 'Inter',
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_heading_font', array(
        'label' => __('Heading Font Family', 'blog-over'),
        'section' => 'blog_over_typography_section',
        'type' => 'select',
        'choices' => $font_choices,
    ));

    $wp_customize->add_setting('blog_over_body_font', array(
        'default' => 'Open Sans',
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_body_font', array(
        'label' => __('Body Font Family', 'blog-over'),
        'section' => 'blog_over_typography_section',
        'type' => 'select',
        'choices' => $font_choices,
    ));

    // -----------------------------------------
    // Section: Blog Page Settings
    // -----------------------------------------
    $wp_customize->add_section('blog_over_blog_section', array(
        'title' => __('Blog Page', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_show_category', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_category', array(
        'label' => __('Show Category', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_show_date', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_date', array(
        'label' => __('Show Date', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_show_author', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_author', array(
        'label' => __('Show Author', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_show_comments_count', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_show_comments_count', array(
        'label' => __('Show Comments Count', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_content_type', array(
        'default' => 'excerpt',
        'sanitize_callback' => 'blog_over_sanitize_select',
    ));
    $wp_customize->add_control('blog_over_content_type', array(
        'label' => __('Content Display', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'radio',
        'choices' => array(
            'excerpt' => __('Excerpt', 'blog-over'),
            'content' => __('Full Content', 'blog-over'),
        ),
    ));

    $wp_customize->add_setting('blog_over_drop_caps', array(
        'default' => false,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_drop_caps', array(
        'label' => __('Enable Drop Caps', 'blog-over'),
        'section' => 'blog_over_blog_section',
        'type' => 'checkbox',
    ));

    // -----------------------------------------
    // Section: Single Post Settings
    // -----------------------------------------
    $wp_customize->add_section('blog_over_single_section', array(
        'title' => __('Single Post Page', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_single_featured_img', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_single_featured_img', array(
        'label' => __('Show Featured Image', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_single_category', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_single_category', array(
        'label' => __('Show Categories', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_single_tags', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_single_tags', array(
        'label' => __('Show Tags', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_single_share', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_single_share', array(
        'label' => __('Show Share Icons', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_single_author_box', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_single_author_box', array(
        'label' => __('Show Author Box', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_related_posts', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_related_posts', array(
        'label' => __('Show Related Posts', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_related_title', array(
        'default' => __('Related Posts', 'blog-over'),
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_related_title', array(
        'label' => __('Related Posts Title', 'blog-over'),
        'section' => 'blog_over_single_section',
        'type' => 'text',
    ));

    // -----------------------------------------
    // Section: Breadcrumb
    // Breadcrumb settings are now managed via Kirki in:
    // inc/customizer/sections/breadcrumb.php
    // -----------------------------------------

    // -----------------------------------------
    // Section: Sidebar
    // -----------------------------------------
    $wp_customize->add_section('blog_over_sidebar_section', array(
        'title' => __('Sidebar Settings', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_sidebar_sticky', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_sidebar_sticky', array(
        'label' => __('Enable Sticky Sidebar', 'blog-over'),
        'section' => 'blog_over_sidebar_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_sidebar_layout', array(
        'default' => 'right',
        'sanitize_callback' => 'blog_over_sanitize_select',
    ));
    $wp_customize->add_control('blog_over_sidebar_layout', array(
        'label' => __('Default Sidebar Position', 'blog-over'),
        'section' => 'blog_over_sidebar_section',
        'type' => 'select',
        'choices' => array(
            'right' => __('Right Sidebar', 'blog-over'),
            'left' => __('Left Sidebar', 'blog-over'),
            'none' => __('No Sidebar', 'blog-over'),
        ),
    ));

    // -----------------------------------------
    // You Missed Section - All settings defined in inc/customizer/sections/missed.php
    // -----------------------------------------

    // -----------------------------------------
    // Section: Footer Options
    // -----------------------------------------
    $wp_customize->add_section('blog_over_footer_section', array(
        'title' => __('Footer Options', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_footer_columns', array(
        'default' => 3,
        'sanitize_callback' => 'absint',
    ));
    $wp_customize->add_control('blog_over_footer_columns', array(
        'label' => __('Footer Widget Columns', 'blog-over'),
        'section' => 'blog_over_footer_section',
        'type' => 'select',
        'choices' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4'),
    ));

    $wp_customize->add_setting('blog_over_footer_bg_image', array(
        'default' => '',
        'sanitize_callback' => 'absint',
    ));
    $wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'blog_over_footer_bg_image', array(
        'label' => __('Footer Background Image', 'blog-over'),
        'section' => 'blog_over_footer_section',
        'mime_type' => 'image',
    )));

    $wp_customize->add_setting('blog_over_footer_bg_color', array(
        'default' => '#1e293b',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_footer_bg_color', array(
        'label' => __('Footer Background Color', 'blog-over'),
        'section' => 'blog_over_footer_section',
    )));

    $wp_customize->add_setting('blog_over_footer_text_color', array(
        'default' => '#94a3b8',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_footer_text_color', array(
        'label' => __('Footer Text Color', 'blog-over'),
        'section' => 'blog_over_footer_section',
    )));

    $wp_customize->add_setting('blog_over_footer_social_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_footer_social_show', array(
        'label' => __('Show Social Icons in Footer', 'blog-over'),
        'section' => 'blog_over_footer_section',
        'type' => 'checkbox',
    ));

    // -----------------------------------------
    // Section: Footer Copyright
    // -----------------------------------------
    $wp_customize->add_section('blog_over_copyright_section', array(
        'title' => __('Footer Copyright', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_copyright_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_copyright_show', array(
        'label' => __('Show Copyright Section', 'blog-over'),
        'section' => 'blog_over_copyright_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_copyright_text', array(
        'default' => __('Copyright © All rights reserved', 'blog-over'),
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('blog_over_copyright_text', array(
        'label' => __('Copyright Text', 'blog-over'),
        'section' => 'blog_over_copyright_section',
        'type' => 'text',
    ));

    $wp_customize->add_setting('blog_over_copyright_bg', array(
        'default' => '#0f172a',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_copyright_bg', array(
        'label' => __('Copyright Background', 'blog-over'),
        'section' => 'blog_over_copyright_section',
    )));

    $wp_customize->add_setting('blog_over_copyright_text_color', array(
        'default' => '#64748b',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_copyright_text_color', array(
        'label' => __('Copyright Text Color', 'blog-over'),
        'section' => 'blog_over_copyright_section',
    )));

    // -----------------------------------------
    // Section: Back to Top / Scroller
    // -----------------------------------------
    $wp_customize->add_section('blog_over_scroller_section', array(
        'title' => __('Back to Top Button', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
    ));

    $wp_customize->add_setting('blog_over_scrolltop_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_scrolltop_show', array(
        'label' => __('Show Scroll to Top Button', 'blog-over'),
        'section' => 'blog_over_scroller_section',
        'type' => 'checkbox',
    ));

    // =========================================
    // PANEL: Frontpage Options
    // =========================================
    $wp_customize->add_panel('blog_over_frontpage_panel', array(
        'title' => __('Frontpage Settings', 'blog-over'),
        'priority' => 35,
    ));

    // -----------------------------------------
    // Section: Banner / Slider
    // -----------------------------------------
    $wp_customize->add_section('blog_over_banner_section', array(
        'title' => __('Banner / Slider', 'blog-over'),
        'panel' => 'blog_over_frontpage_panel',
    ));

    $wp_customize->add_setting('blog_over_banner_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_banner_show', array(
        'label' => __('Show Banner Section', 'blog-over'),
        'section' => 'blog_over_banner_section',
        'type' => 'checkbox',
    ));

    $wp_customize->add_setting('blog_over_banner_posts_count', array(
        'default' => 5,
        'sanitize_callback' => 'absint',
    ));
    $wp_customize->add_control('blog_over_banner_posts_count', array(
        'label' => __('Number of Slides', 'blog-over'),
        'section' => 'blog_over_banner_section',
        'type' => 'number',
        'input_attrs' => array('min' => 1, 'max' => 10),
    ));

    // -----------------------------------------
    // Section: Featured Links (Promo Boxes)
    // -----------------------------------------
    $wp_customize->add_section('blog_over_promo_section', array(
        'title' => __('Featured Links', 'blog-over'),
        'panel' => 'blog_over_frontpage_panel',
    ));

    $wp_customize->add_setting('blog_over_promo_show', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control('blog_over_promo_show', array(
        'label' => __('Show Featured Links Section', 'blog-over'),
        'section' => 'blog_over_promo_section',
        'type' => 'checkbox',
    ));

    // 3 Promo Boxes
    for ($i = 1; $i <= 3; $i++) {
        $wp_customize->add_setting('blog_over_promo_' . $i . '_image', array(
            'default' => '',
            'sanitize_callback' => 'absint',
        ));
        $wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'blog_over_promo_' . $i . '_image', array(
            'label' => sprintf(__('Promo %d Image', 'blog-over'), $i),
            'section' => 'blog_over_promo_section',
            'mime_type' => 'image',
        )));

        $wp_customize->add_setting('blog_over_promo_' . $i . '_text', array(
            'default' => '',
            'sanitize_callback' => 'sanitize_text_field',
        ));
        $wp_customize->add_control('blog_over_promo_' . $i . '_text', array(
            'label' => sprintf(__('Promo %d Button Text', 'blog-over'), $i),
            'section' => 'blog_over_promo_section',
            'type' => 'text',
        ));

        $wp_customize->add_setting('blog_over_promo_' . $i . '_url', array(
            'default' => '',
            'sanitize_callback' => 'esc_url_raw',
        ));
        $wp_customize->add_control('blog_over_promo_' . $i . '_url', array(
            'label' => sprintf(__('Promo %d URL', 'blog-over'), $i),
            'section' => 'blog_over_promo_section',
            'type' => 'url',
        ));

        $wp_customize->add_setting('blog_over_promo_' . $i . '_newtab', array(
            'default' => false,
            'sanitize_callback' => 'blog_over_sanitize_bool',
        ));
        $wp_customize->add_control('blog_over_promo_' . $i . '_newtab', array(
            'label' => sprintf(__('Promo %d Open in New Tab', 'blog-over'), $i),
            'section' => 'blog_over_promo_section',
            'type' => 'checkbox',
        ));
    }

    // =========================================
    // PANEL: General Layout
    // =========================================
    $wp_customize->add_panel('blog_over_layout_panel', array(
        'title' => __('General Layout', 'blog-over'),
        'priority' => 32,
    ));

    // -----------------------------------------
    // Section: Sidebar Width
    // -----------------------------------------
    $wp_customize->add_section('blog_over_sidebar_width_section', array(
        'title' => __('Sidebar Width', 'blog-over'),
        'panel' => 'blog_over_layout_panel',
        'priority' => 10,
    ));

    $wp_customize->add_setting('blog_over_sidebar_width', array(
        'default' => 300,
        'sanitize_callback' => 'absint',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control('blog_over_sidebar_width', array(
        'label' => __('Sidebar Width (px)', 'blog-over'),
        'section' => 'blog_over_sidebar_width_section',
        'type' => 'number',
        'input_attrs' => array('min' => 200, 'max' => 450, 'step' => 10),
    ));

    // -----------------------------------------
    // Section: Blog Layout
    // -----------------------------------------
    $wp_customize->add_section('blog_over_blog_layout_section', array(
        'title' => __('Blog Layout', 'blog-over'),
        'panel' => 'blog_over_layout_panel',
        'priority' => 20,
    ));

    $wp_customize->add_setting('blog_over_blog_layout', array(
        'default' => 'list-right',
        'sanitize_callback' => 'blog_over_sanitize_layout',
    ));
    $wp_customize->add_control(new Blog_Over_Radio_Image_Control($wp_customize, 'blog_over_blog_layout', array(
        'label' => __('Blog Page Layout', 'blog-over'),
        'section' => 'blog_over_blog_layout_section',
        'choices' => array(
            'list-right' => get_template_directory_uri() . '/assets/images/layout-right-sidebar.svg',
            'list-left' => get_template_directory_uri() . '/assets/images/layout-left-sidebar.svg',
            'list-full' => get_template_directory_uri() . '/assets/images/layout-fullwidth.svg',
            'grid-right' => get_template_directory_uri() . '/assets/images/layout-grid-right.svg',
            'grid-left' => get_template_directory_uri() . '/assets/images/layout-grid-left.svg',
            'grid-full' => get_template_directory_uri() . '/assets/images/layout-grid-full.svg',
        ),
    )));

    // -----------------------------------------
    // Section: Single Post Layout
    // -----------------------------------------
    $wp_customize->add_section('blog_over_single_layout_section', array(
        'title' => __('Single Post Layout', 'blog-over'),
        'panel' => 'blog_over_layout_panel',
        'priority' => 30,
    ));

    $wp_customize->add_setting('blog_over_single_layout', array(
        'default' => 'single-right',
        'sanitize_callback' => 'blog_over_sanitize_layout',
    ));
    $wp_customize->add_control(new Blog_Over_Radio_Image_Control($wp_customize, 'blog_over_single_layout', array(
        'label' => __('Single Post Layout', 'blog-over'),
        'section' => 'blog_over_single_layout_section',
        'choices' => array(
            'single-right' => get_template_directory_uri() . '/assets/images/layout-right-sidebar.svg',
            'single-left' => get_template_directory_uri() . '/assets/images/layout-left-sidebar.svg',
            'single-full' => get_template_directory_uri() . '/assets/images/layout-fullwidth.svg',
        ),
    )));

    // -----------------------------------------
    // Section: Page Layout
    // -----------------------------------------
    $wp_customize->add_section('blog_over_page_layout_section', array(
        'title' => __('Page Layout', 'blog-over'),
        'panel' => 'blog_over_layout_panel',
        'priority' => 40,
    ));

    $wp_customize->add_setting('blog_over_page_layout', array(
        'default' => 'page-right',
        'sanitize_callback' => 'blog_over_sanitize_layout',
    ));
    $wp_customize->add_control(new Blog_Over_Radio_Image_Control($wp_customize, 'blog_over_page_layout', array(
        'label' => __('Page Layout', 'blog-over'),
        'section' => 'blog_over_page_layout_section',
        'choices' => array(
            'page-right' => get_template_directory_uri() . '/assets/images/layout-right-sidebar.svg',
            'page-left' => get_template_directory_uri() . '/assets/images/layout-left-sidebar.svg',
            'page-full' => get_template_directory_uri() . '/assets/images/layout-fullwidth.svg',
        ),
    )));

    // Page Content Width
    $wp_customize->add_setting('blog_over_page_content_width', array(
        'default' => 'boxed',
        'sanitize_callback' => 'blog_over_sanitize_select',
    ));
    $wp_customize->add_control('blog_over_page_content_width', array(
        'label' => __('Page Content Width', 'blog-over'),
        'section' => 'blog_over_page_layout_section',
        'type' => 'select',
        'choices' => array(
            'boxed' => __('Boxed', 'blog-over'),
            'full-width' => __('Full Width', 'blog-over'),
        ),
    ));

    // =========================================
    // COLORS SECTION ENHANCEMENTS
    // =========================================

    // Site Title Font Size
    $wp_customize->add_setting('blog_over_title_font_size', array(
        'default' => 36,
        'sanitize_callback' => 'absint',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control('blog_over_title_font_size', array(
        'label' => __('Site Title Size (px)', 'blog-over'),
        'section' => 'title_tagline',
        'type' => 'number',
        'priority' => 50,
        'input_attrs' => array('min' => 16, 'max' => 100),
    ));

    // Theme Skin Mode
    $wp_customize->add_setting('blog_over_skin_mode', array(
        'default' => 'light',
        'sanitize_callback' => 'blog_over_sanitize_select',
    ));
    $wp_customize->add_control('blog_over_skin_mode', array(
        'label' => __('Default Color Scheme', 'blog-over'),
        'section' => 'colors',
        'type' => 'select',
        'priority' => 1,
        'choices' => array(
            'light' => __('Light Mode', 'blog-over'),
            'dark' => __('Dark Mode', 'blog-over'),
        ),
    ));

    // Primary Menu Background Color
    $wp_customize->add_setting('blog_over_menu_bg_color', array(
        'default' => '#2271b1',
        'sanitize_callback' => 'sanitize_hex_color',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_menu_bg_color', array(
        'label' => __('Menu Background Color', 'blog-over'),
        'section' => 'colors',
        'priority' => 30,
    )));

    // Primary Menu Text Color
    $wp_customize->add_setting('blog_over_menu_text_color', array(
        'default' => '#ffffff',
        'sanitize_callback' => 'sanitize_hex_color',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'blog_over_menu_text_color', array(
        'label' => __('Menu Text Color', 'blog-over'),
        'section' => 'colors',
        'priority' => 31,
    )));

    // =========================================
    // POST IMAGE SETTINGS
    // =========================================
    $wp_customize->add_section('blog_over_post_image_section', array(
        'title' => __('Post Image Settings', 'blog-over'),
        'panel' => 'blog_over_theme_panel',
        'priority' => 85,
    ));

    $wp_customize->add_setting('blog_over_post_image_type', array(
        'default' => 'fixed',
        'sanitize_callback' => 'blog_over_sanitize_select',
    ));
    $wp_customize->add_control('blog_over_post_image_type', array(
        'label' => __('Post Image Display', 'blog-over'),
        'section' => 'blog_over_post_image_section',
        'type' => 'radio',
        'choices' => array(
            'fixed' => __('Fixed Height', 'blog-over'),
            'auto' => __('Auto Height', 'blog-over'),
        ),
    ));

    // Pagination Visibility
    $wp_customize->add_setting('blog_over_show_pagination', array(
        'default' => true,
        'sanitize_callback' => 'blog_over_sanitize_bool',
    ));
    $wp_customize->add_control(new blog_over_Toggle_Control($wp_customize, 'blog_over_show_pagination', array(
        'label' => __('Show Pagination', 'blog-over'),
        'section' => 'blog_over_blog_section',
    )));

}
// DISABLED: Using Kirki-based customizer instead (customizer-kirki.php)
// add_action('customize_register', 'blog_over_blog_customizer_register');

// =========================================
// Sanitization Functions
// =========================================
function blog_over_sanitize_bool($input)
{
    return (isset($input) && $input == true) ? true : false;
}

function blog_over_sanitize_select($input, $setting)
{
    $input = sanitize_key($input);
    $choices = $setting->manager->get_control($setting->id)->choices;
    return (array_key_exists($input, $choices) ? $input : $setting->default);
}

/**
 * Sanitize layout choices
 */
function blog_over_sanitize_layout($input)
{
    $valid_layouts = array(
        'list-right',
        'list-left',
        'list-full',
        'grid-right',
        'grid-left',
        'grid-full',
        'single-right',
        'single-left',
        'single-full',
        'page-right',
        'page-left',
        'page-full',
    );
    return in_array($input, $valid_layouts) ? $input : 'list-right';
}
