<?php
if( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

$prefix = BREEK_LITE_THEMEPREFIX . '_';

$primary_color = '#E84E89';
$secondary_color = '#00BEC1';
$third_color = '#AEF3FF';
$decoration_color = '#F7DFD4';
$titles_color = '#333333';
$text_color = '#333333';
$border_color = '#F4F4F4';
$input_bg_color = '#FFFFFF';
$background_color = '#FAFAFA';
$boxes_bg_color = '#FFFFFF';
$boxes_border_color = '#F2F2F2';
$black = '#474041';
$white = '#FFFFFF';

/* Start Styling Panel */

$wp_customize->add_panel( $prefix . 'styling_panel', array(
    'title'       => esc_html_x( 'Styling', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Customize the visual appearance of your theme.', 'admin', 'breek-lite' ),
    'priority'    => 25,
));

/* Section: Styling -> Background Settings */
$wp_customize->add_section( $prefix . 'background_settings', array(
    'title'    => esc_html_x( 'Background Settings', 'admin', 'breek-lite' ),
    'priority' => 10,
    'panel'    => $prefix . 'styling_panel',
));

// Background Type
$wp_customize->add_setting( $prefix . 'background_type', array(
    'default'           => '0',
    'sanitize_callback' => 'sanitize_text_field',
));

$wp_customize->add_control( $prefix . 'background_type', array(
    'label'   => esc_html_x( 'Background Type', 'admin', 'breek-lite' ),
    'section' => $prefix . 'background_settings',
    'type'    => 'select',
    'choices' => array(
        '0' => esc_html_x( 'Default Gradient', 'admin', 'breek-lite' ),
        '1' => esc_html_x( 'Image Pattern', 'admin', 'breek-lite' ),
        '2' => esc_html_x( 'Solid Color', 'admin', 'breek-lite' ),
        '3' => esc_html_x( 'Fullscreen Image', 'admin', 'breek-lite' ),
        '4' => esc_html_x( 'Gradient', 'admin', 'breek-lite' ),
    ),
));

// Body Background Color
$wp_customize->add_setting( $prefix . 'bg_body_color', array(
    'default'           => $background_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'bg_body_color', array(
    'label'       => esc_html_x( 'Body Background Color', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Pick a background color for the theme.', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'background_settings',
    'active_callback' => function() use ( $prefix ) {
        return get_theme_mod( $prefix . 'background_type', '2' ) === '2';
    },
)));

// Pattern Uploader
$wp_customize->add_setting( $prefix . 'bg_body_pattern', array(
    'default'           => '',
    'sanitize_callback' => 'absint',
));

$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, $prefix . 'bg_body_pattern', array(
    'label'       => esc_html_x( 'Pattern Uploader', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'You can get a lot of free patterns on subtlepatterns.com', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'background_settings',
    'mime_type'   => 'image',
    'active_callback' => function() use ( $prefix ) {
        return get_theme_mod( $prefix . 'background_type', '2' ) === '1';
    },
)));

// Fullscreen Image
$wp_customize->add_setting( $prefix . 'bg_body_full', array(
    'default'           => '',
    'sanitize_callback' => 'absint',
));

$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, $prefix . 'bg_body_full', array(
    'label'       => esc_html_x( 'Fullscreen Image', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Recommended size: 1920x1080 pixels', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'background_settings',
    'mime_type'   => 'image',
    'active_callback' => function() use ( $prefix ) {
        return get_theme_mod( $prefix . 'background_type', '2' ) === '3';
    },
)));

// Gradient Color From
$wp_customize->add_setting( $prefix . 'bg_gradient_from', array(
    'default'           => '#6d327c',
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'bg_gradient_from', array(
    'label'       => esc_html_x( 'Gradient Color From', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Pick the starting color for the gradient.', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'background_settings',
    'active_callback' => function() use ( $prefix ) {
        return get_theme_mod( $prefix . 'background_type', '2' ) === '4';
    },
)));

// Gradient Color To
$wp_customize->add_setting( $prefix . 'bg_gradient_to', array(
    'default'           => '#32b37b',
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'bg_gradient_to', array(
    'label'       => esc_html_x( 'Gradient Color To', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Pick the ending color for the gradient.', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'background_settings',
    'active_callback' => function() use ( $prefix ) {
        return get_theme_mod( $prefix . 'background_type', '2' ) === '4';
    },
)));

/* Section: Styling -> Colors */

$wp_customize->add_section( $prefix . 'color_settings', array(
    'title'    => esc_html_x( 'Color Settings', 'admin', 'breek-lite' ),
    'priority' => 20,
    'panel'    => $prefix . 'styling_panel',
));

// Primary Color
$wp_customize->add_setting( $prefix . 'primary_color', array(
    'default'           => $primary_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'primary_color', array(
    'label'       => esc_html_x( 'Primary Color', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Accent color', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'color_settings',
)));

// Secondary Color
$wp_customize->add_setting( $prefix . 'secondary_color', array(
    'default'           => $secondary_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'secondary_color', array(
    'label'       => esc_html_x( 'Secondary Color', 'admin', 'breek-lite' ),
    'description' => esc_html_x( 'Some decorations.', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'color_settings',
)));

// Titles Color
$wp_customize->add_setting( $prefix . 'titles_color', array(
    'default'           => $titles_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'titles_color', array(
    'label'       => esc_html_x( 'Titles Color', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'color_settings',
)));

// Text Color
$wp_customize->add_setting( $prefix . 'text_color', array(
    'default'           => $text_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'text_color', array(
    'label'       => esc_html_x( 'Text Color', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'color_settings',
)));

// Content Border Color
$wp_customize->add_setting( $prefix . 'content_border_color', array(
    'default'           => $border_color,
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $prefix . 'content_border_color', array(
    'label'       => esc_html_x( 'Content Border Color', 'admin', 'breek-lite' ),
    'section'     => $prefix . 'color_settings',
))); 