<?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' => [
            'grid' => esc_html__( 'Grid', 'productive-commerce' ),
            'table' => esc_html__( 'Table', 'productive-commerce' ),
        ],
        'default' => 'grid',
    ]
);

if( productive_global_is_a_productive_theme() ) {
    $this->add_control(
        'productiveminds_woo_archives_style',
        [
            'type' => \Elementor\Controls_Manager::SELECT,
            'label' => esc_html__( 'Product Archives Style', 'productive-commerce' ),
            'options' => productive_global_get_woo_archives_style_options(),
            'default' => 'product_archive_design_01',
            'condition' => [
                'section_content_layout_format' => [ 'grid', 'slider', ],
            ],
        ]
    );
} else {
    $this->add_control(
        'productiveminds_woo_archives_style',
        [
            'label' => esc_html__( 'Product Archives Style', 'productive-commerce' ),
            'type' => \Elementor\Controls_Manager::HIDDEN,
            'default' => '',
        ]
    );
}



$this->add_control(
    'section_style_layout_cols_hr',
    [
            'type' => \Elementor\Controls_Manager::DIVIDER,
        'condition' => [
            'section_content_layout_format' => [ 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_list_media_width',
    [
        'label' => esc_html__( 'Media Column Width', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ '%', 'px' ],
        'range' => [
            '%' => [
                'min' => 5,
                'max' => 100,
                'step' => 1,
            ],
            'px' => [
                'min' => 100,
                'max' => 800,
                'step' => 10,
            ],
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-container.table .productiveminds_section-single-item' => 'grid-template-columns: clamp(80px, {{SIZE}}{{UNIT}}, 30%) minmax(calc(70% - 25px), auto);',
            '{{WRAPPER}} .productiveminds_section-container.list .productiveminds_section-container-column-content-body .productiveminds_section-single-item.media_is_on_left_side' => 'grid-template-columns: clamp(100px, {{SIZE}}{{UNIT}}, 35%) minmax(calc(65% - 25px), auto);',
            '{{WRAPPER}} .productiveminds_section-container.list_grided .productiveminds_section-container-column-content-body .productiveminds_section-single-item.media_is_on_left_side' => 'grid-template-columns: clamp(100px, {{SIZE}}{{UNIT}}, 35%) minmax(calc(65% - 25px), auto);',
            '{{WRAPPER}} .productiveminds_section-container.list .productiveminds_section-container-column-content-body .productiveminds_section-single-item.media_is_on_right_side' => 'grid-template-columns: minmax(calc(65% - 25px), auto) clamp(100px, {{SIZE}}{{UNIT}}, 35%);',
            '{{WRAPPER}} .productiveminds_section-container.list_grided .productiveminds_section-container-column-content-body .productiveminds_section-single-item.media_is_on_right_side' => 'grid-template-columns: minmax(calc(65% - 25px), auto) clamp(100px, {{SIZE}}{{UNIT}}, 35%);',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);


$this->add_responsive_control(
    'section_style_layout_list_media_spacing',
    [
        'label' => esc_html__( 'Column Gap', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => [ 'px', 'rem' ],
        'range' => [
            'px' => [
                'min' => 0,
                'max' => 200,
                'step' => 1,
            ],
            'rem' => [
                'min' => 0,
                'max' => 20.0,
                'step' => 0.1,
            ],
        ],
        'default' => [
            'unit' => 'px',
            'size' => 25,
        ],
        'selectors' => [
            '{{WRAPPER}} .productiveminds_section-container.list .productiveminds_section-single-item' => 'column-gap: {{SIZE}}{{UNIT}};',
            '{{WRAPPER}} .productiveminds_section-container.table .productiveminds_section-single-item' => 'column-gap: {{SIZE}}{{UNIT}};',
            '{{WRAPPER}} .productiveminds_section-container.list_grided .productiveminds_section-single-item' => 'column-gap: {{SIZE}}{{UNIT}};',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);

$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' ],
        ],
    ]
);

// 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_control(
    'section_content_layout_align_vertical_content',
    [
        'type' => \Elementor\Controls_Manager::SELECT,
        'label' => esc_html__( 'Content Vertical Alignment', 'productive-commerce' ),
        'options' => [
        ] + productive_global_get_vertical_css_align_options(),
        'default' => 'center',
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section.elementor .productiveminds_section-single-item-text' => 'align-content: {{VALUE}};',
        ],
    ]
);

// Padding for Content box
$this->add_responsive_control(
    'section_style_layout_padding_content_box_grid_slider',
    [
        'label' => esc_html__( 'Content Box Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container.grid .productiveminds_section-single-item-text .productiveminds_section-single-item-text-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0 {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.grid .productiveminds_section-single-item-text .the_add_it_button' => 'padding: 0 {{RIGHT}}{{UNIT}} 0 {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.grid .productiveminds_section-single-item-text .item-text-bottom' => 'padding: 0 {{RIGHT}}{{UNIT}} {{LEFT}}{{UNIT}} {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .swiper-wrapper .productiveminds_section-single-item-text .productiveminds_section-single-item-text-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0 {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .swiper-wrapper .productiveminds_section-single-item-text .the_add_it_button' => 'padding: 0 {{RIGHT}}{{UNIT}} 0 {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .swiper-wrapper .productiveminds_section-single-item-text .item-text-bottom' => 'padding: 0 {{RIGHT}}{{UNIT}} {{LEFT}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'slider', 'grid', ],
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_padding_content_box',
    [
        'label' => esc_html__( 'Content Box Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .productiveminds_section-container.list .productiveminds_section-single-item-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.table .productiveminds_section-single-item-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.list_grided .productiveminds_section-single-item-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
        'condition' => [
            'section_content_layout_format' => [ 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);

$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', 'table', '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', 'table', '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', 'table', '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', 'table', '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', 'table', '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();
// End:: Content




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

$this->add_group_control(
    \Elementor\Group_Control_Background::get_type(),
    [
        'name' => 'section_style_each_item_bg_color_slider',
        'types' => [ 'classic', 'gradient' ],
        'selector' => '{{WRAPPER}} .swiper-slide',
        'condition' => [
            'section_content_layout_format' => [ 'slider' ],
        ],
    ]
);

$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.productiveminds-standard-content-container .productiveminds_section-container-column',
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list', 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided', 'list_zigzag_left_first', 'list_zigzag_right_first' ],
        ],
    ]
);

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

$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_responsive_control(
    'section_style_each_item_row_gap',
    [
        'label' => esc_html__( 'Row 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}} .swiper-wrapper' => 'row-gap: {{SIZE}}{{UNIT}}',
            '{{WRAPPER}} .productiveminds_section-container' => 'row-gap: {{SIZE}}{{UNIT}}',
        ],
    ]
);

$this->add_responsive_control(
    'section_style_layout_padding',
    [
        'label' => esc_html__( 'Padding', 'productive-commerce' ),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => [ 'rem', 'px', '%' ],
        'selectors' => [
                '{{WRAPPER}} .swiper-slide .productiveminds_section-single-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.productiveminds-standard-content-container .productiveminds_section-single-item' => '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}} .swiper-slide' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                '{{WRAPPER}} .productiveminds_section-container.productiveminds-standard-content-container .productiveminds_section-container-column' => '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_slider',
        'selector' => '{{WRAPPER}} .swiper-slide',
        'condition' => [
            'section_content_layout_format' => 'slider',
        ],
    ]
);
$this->add_group_control(
    \Elementor\Group_Control_Box_Shadow::get_type(),
    [
        'name' => 'section_style_layout_box_shadow_slider',
        'selector' => '{{WRAPPER}} .swiper-slide',
        'condition' => [
            'section_content_layout_format' => 'slider',
        ],
    ]
);

$this->add_group_control(
    \Elementor\Group_Control_Border::get_type(),
    [
        'name' => 'section_style_layout_border_list',
        'selector' => '{{WRAPPER}} .productiveminds_section-container.productiveminds-standard-content-container .productiveminds_section-container-column',
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);
$this->add_group_control(
    \Elementor\Group_Control_Box_Shadow::get_type(),
    [
        'name' => 'section_style_layout_box_shadow_list',
        'selector' => '{{WRAPPER}} .productiveminds_section-container.productiveminds-standard-content-container .productiveminds_section-container-column',
        'condition' => [
            'section_content_layout_format' => [ 'grid', 'list_lefted_top_down', 'table', 'list_lefted_grided', 'list_righted_grided' ],
        ],
    ]
);

// End:: Content Title

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