<?php
/**
 * @package     productive-commerce
 * @author      productiveminds.com
 * @copyright   productiveminds.com
 */

// Start:: Content
$this->start_controls_section(
    'section_content_header',
    [
        'label' => esc_html__( 'Heading', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
    ]
);

$this->add_control(
    'section_content_header_is_show_section_header',
    [
        'label' => esc_html__( 'Show Header', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'label_on' => esc_html__( 'Show', 'productive-commerce' ),
        'label_off' => esc_html__( 'Hide', 'productive-commerce' ),
        'return_value' => 'yes',
        'default' => 'yes',
    ]
);

$this->add_control(
    'section_content_header_is_show_section_header_info',
    [
        'label' => esc_html__( 'Switch the toggle to show the header', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
        'condition' => [
                'section_content_header_is_show_section_header' => '',
        ],
    ]
);

$this->add_control(
    'section_content_header_hr_1',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
                'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

$this->add_control(
    'section_title_html_tag',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'HTML Tag for Title', 'productive-commerce' ),
        'options' => productive_global_get_content_html_tags(),
        'default' => 'h2',
        'condition' => [
            'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

$this->add_control(
    'section_content_header_hr_title_end',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
                'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

$this->add_control(
    'section_intro',
    [
        'label' => esc_html__( 'Intro', 'productive-commerce' ),
        'label_block' => true,
        'type' => \Elementor\Controls_Manager::WYSIWYG,
        'default' => esc_html__( 'Section overview', 'productive-commerce' ),
        'placeholder' => esc_html__( 'Section overview here', 'productive-commerce' ),
        'dynamic' => [
            'active' => true,
        ],
        'condition' => [
            'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

$this->end_controls_section();
// End:: Content



/**
 * 
 * Start:: Styles
 * 
 */
$this->start_controls_section(
    'section_style_header',
    [
        'label' => esc_html__( 'Heading', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        'condition' => [
                'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

// Start:: Header
$this->add_control(
    'section_style_title_text_color',
    [
        'label' => esc_html__( 'Title Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
                '{{WRAPPER}} .section-title' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => 'Title Typography',
        'name' => 'section_style_title_typography',
        'selector' => '{{WRAPPER}} .section-title',
    ]
);

$this->add_responsive_control(
    'section_style_title_margin',
    [
        'label' => esc_html__( 'Title Margin', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .section-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_title_padding',
    [
        'label' => esc_html__( 'Title Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .section-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_header_hr_1',
    [
            'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);

$this->add_control(
    'section_style_intro_text_color',
    [
        'label' => esc_html__( 'Intro Color', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
                '{{WRAPPER}} .section-intro' => 'color: {{VALUE}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Typography::get_type(),
    [
        'label' => 'Intro Typography',
        'name' => 'section_style_intro_typography',
        'selector' => '{{WRAPPER}} .section-intro',
    ]
);

$this->add_responsive_control(
    'section_style_intro_padding',
    [
        'label' => esc_html__( 'Intro Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .section-intro' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);


// Header Alignments and Width Settings
$this->add_control(
    'section_content_header_hr_alignments',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
                'section_content_header_is_show_section_header' => 'yes',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_header_width_content_box',
    [
        'label' => esc_html__( 'Width', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px', '%' ],
        'range' => [
            'px' => [
                'min' => 100,
                'max' => 32000,
                'step' => 10,
            ],
            '%' => [
                'min' => 10,
                'max' => 100,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => '%',
            'size' => 100,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-header-container .productiveminds_section-header-container_uno' => 'width: {{SIZE}}{{UNIT}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_header_max_width_content_box',
    [
        'label' => esc_html__( 'Max Width (px)', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px' ],
        'range' => [
            'px' => [
                'min' => 100,
                'max' => 3000,
                'step' => 10,
            ],
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-header-container .productiveminds_section-header-container_uno' => 'max-width: {{SIZE}}{{UNIT}};',
        ],
    ]
);

// Content Alignment
$this->add_responsive_control(
    'section_style_header_align_text',
    [
        'label' => esc_html__( 'Alignment', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::CHOOSE,
        'options' => [
                'left' => [
                        'title' => esc_html__( 'Left', 'productive-commerce' ),
                        'icon' => 'eicon-text-align-left',
                ],
                'center' => [
                        'title' => esc_html__( 'Center', 'productive-commerce' ),
                        'icon' => 'eicon-text-align-center',
                ],
                'right' => [
                        'title' => esc_html__( 'Right', 'productive-commerce' ),
                        'icon' => 'eicon-text-align-right',
                ],
        ],
        'toggle' => true,
        'default' => 'center',
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-header-container' => 'text-align: {{VALUE}};',
                '{{WRAPPER}} .productiveminds_section-header-container .section-title' => 'text-align: {{VALUE}};',
                '{{WRAPPER}} .productiveminds_section-header-container .section-intro' => 'text-align: {{VALUE}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_header_align_box',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Container Justification', 'productive-commerce' ),
        'options' => [
        ] + productive_global_get_horizontal_css_align_options(),
        'default' => 'center',
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-header-container' => 'justify-content: {{VALUE}}; justify-items: {{VALUE}}',
        ],
    ]
);

$this->end_controls_section();
// End:: Styles
        