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


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

$this->add_control(
    'section_content_layout_format',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Format', 'productive-commerce' ),
        'options' => [
            'list' => esc_html__( 'List', 'productive-commerce' ),
        ],
        'default' => 'list',
    ]
);

$this->add_control(
    'section_content_layout_enable_accordion_toggle',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Toggle Accordion', 'productive-commerce' ),
        'options' => [
                'toggle_only_selected' => esc_html__( 'Toggle Selected Only', 'productive-commerce' ),
                'toggle_reset_before_toggle' => esc_html__( 'Reset, then Toggle Selected', 'productive-commerce' ),
                'toggle_disabled' => esc_html__( 'Disable Toggle', 'productive-commerce' ),
        ],
        'default' => 'toggle_only_selected',
        'condition' => [
            'section_content_layout_format' => 'list',
        ],
        'frontend_available' => true,
    ]
);

$this->add_control(
    'section_toggle_icon_style',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Toggle Icon', 'productive-commerce' ),
        'options' => [
                'angled' => esc_html__( 'Angle', 'productive-commerce' ),
                'arrowed' => esc_html__( 'Arrow', 'productive-commerce' ),
                'plusminused' => esc_html__( 'Plus / Minus', 'productive-commerce' ),
        ],
        'default' => 'plusminused',
	'frontend_available' => true,
        'condition' => [
            'section_content_layout_enable_accordion_toggle' => [ 'toggle_only_selected', 'toggle_reset_before_toggle' ],
        ],
    ]
);


$this->add_control(
    'section_style_layout_media_box_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
            'productive_cpt_is_show_image_or_icon' => [ 'icon', 'image' ],
        ],
    ]
);
$this->add_control(
    'section_style_layout_media_box_group_label',
    [
        'label' => esc_html__( 'Media Box', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
        'condition' => [
            'productive_cpt_is_show_image_or_icon' => [ 'icon', 'image' ],
        ],
    ]
);


$this->add_responsive_control(
    'section_style_content_image_size',
    [
        'label' => esc_html__( 'Media Size', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px', '%' ],
        'range' => [
            'px' => [
                'min' => 10,
                'max' => 1200,
                'step' => 1,
            ],
            '%' => [
                'min' => 10,
                'max' => 100,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => '%',
            'size' => 100,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-single-item-media img' => 'width: {{SIZE}}{{UNIT}}; height: auto',
        ],
        'condition' => [
            'productive_cpt_is_show_image_or_icon' => 'image',
        ],
    ]
);

// Padding for media box
$this->add_responsive_control(
    'section_style_layout_padding_media_box',
    [
        'label' => esc_html__( 'Media Box Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-single-item-media' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
        'condition' => [
            'productive_cpt_is_show_image_or_icon' => [ 'icon', 'image' ],
        ],
    ]
);

$this->add_control(
    'section_style_layout_content_box_hr',
    [
            'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_style_layout_content_box_group_label',
    [
        'label' => esc_html__( 'Content Box', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_responsive_control(
    'section_content_layout_align',
    [
        'label' => esc_html__( 'Text 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',
                ],
        ],
        //'default' => 'center',
        'toggle' => true,
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-single-item' => 'text-align: {{VALUE}};',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_min_height_widget_box',
    [
        'label' => esc_html__( 'Minimum Height', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'rem', 'px' ],
        'range' => [
            'rem' => [
                'min' => 1,
                'max' => 50,
                'step' => 1,
            ],
            'px' => [
                'min' => 10,
                'max' => 1000,
                'step' => 10,
            ],
            'vh' => [
                'min' => 1,
                'max' => 100,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => 'px',
            'size' => 100,
        ],
        'selectors' => [
            '{{WRAPPER}} .swiper-slide .productiveminds_section-single-item-text' => 'min-height: {{SIZE}}{{UNIT}}',
            '{{WRAPPER}} .productiveminds_section-container.grid .productiveminds_section-single-item-text' => 'min-height: {{SIZE}}{{UNIT}}',
            '{{WRAPPER}} .productiveminds_section-container.list_grided .productiveminds_section-single-item-text' => 'min-height: {{SIZE}}{{UNIT}}',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'slider', 'grid', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);

// Widget Container
$this->add_control(
    'section_style_each_widget_box_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'list_righted_top_down', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);
$this->add_control(
    'section_style_each_widget_box_hr_label',
    [
        'label' => esc_html__( 'Widget Container', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'list_righted_top_down', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_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 .productiveminds_section_uno' => 'width: {{SIZE}}{{UNIT}};',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'list_righted_top_down', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_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 .productiveminds_section_uno' => 'max-width: {{SIZE}}{{UNIT}};',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'list_righted_top_down', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);

$this->add_responsive_control(
    'section_content_layout_align_box',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Container Justification', 'productive-commerce' ),
        'options' => [
        ] + productive_global_get_horizontal_css_align_options(),
        'default' => 'center',
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'list_righted_top_down', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section' => 'justify-content: {{VALUE}}; justify-items: {{VALUE}}',
        ],
    ]
);

$this->end_controls_section();




/**
 * 
 * Start:: Styles (layout)
 * 
 */
$this->start_controls_section(
    'section_style_layout',
    [
        'label' => esc_html__( 'Layout', 'productive-commerce' ),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
    ]
);

$this->add_responsive_control(
    'section_style_each_item_col_gap',
    [
        'label' => esc_html__( 'Column Gap', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'rem', 'px' ],
        'range' => [
            'rem' => [
                'min' => 0,
                'max' => 50,
                'step' => 1,
            ],
            'px' => [
                'min' => 0,
                'max' => 1000,
                'step' => 10,
            ],
        ],
        'default' => [
            'unit' => 'px',
            'size' => 20,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-container' => 'column-gap: {{SIZE}}{{UNIT}}',
        ],
	'frontend_available' => true,
    ]
);


$this->add_control(
    'section_style_layout_layout_style_1_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_style_layout_layout_style_1_group_label',
    [
        'label' => esc_html__( 'Upper Section (image, title etc)', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Background::get_type(),
    [
        'name' => 'section_style_each_item_bg_color',
        'types' => [ 'classic', 'gradient' ],
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block',
    ]
);

$this->add_control(
    'section_style_layout_margin',
    [
        'label' => esc_html__( 'Margin', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_layout_padding',
    [
        'label' => esc_html__( 'Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_layout_border_radius',
    [
        'label' => esc_html__( 'Border Radius', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ '%', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_layout_border_list_border',
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block',
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Box_Shadow::get_type(),
    [
        'name' => 'section_style_layout_box_shadow_list',
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_upper_block',
    ]
);



$this->add_control(
    'section_style_layout_layout_style_2_hr',
    [
        'type' => \Elementor\Controls_Manager::DIVIDER,
    ]
);
$this->add_control(
    'section_style_layout_layout_style_2_group_label',
    [
        'label' => esc_html__( 'Attributes Sections', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::RAW_HTML,
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Background::get_type(),
    [
        'name' => 'section_style_each_item_bg_color_sections',
        'types' => [ 'classic', 'gradient' ],
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block',
        'condition' => [
            'section_content_layout_format' => [ 'list', ],
        ],
    ]
);

$this->add_control(
    'section_style_layout_margin_sections',
    [
        'label' => esc_html__( 'Margin', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_layout_padding_sections',
    [
        'label' => esc_html__( 'Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_control(
    'section_style_layout_border_radius_sections',
    [
        'label' => esc_html__( 'Border Radius', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ '%', 'px' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_layout_border_list_border_sections',
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block',
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Box_Shadow::get_type(),
    [
        'name' => 'section_style_layout_box_shadow_list_sections',
        'selector' => '{{WRAPPER}} .productiveminds_section-container-column.compare_main_body_block',
    ]
);

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