<?php
/**
 * Review List Widget - Style Controls
 *
 * @package GGM_Commerce
 */

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

// $this is the GGM_Commerce_Widget_Review_List instance.

// ── Reviews Section Title ─────────────────────────────────────────────────────

$this->start_controls_section(
	'title_style_section',
	array(
		'label'     => __( 'Reviews Section Title', 'ggm-commerce' ),
		'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
		'condition' => array(
			'show_title' => 'yes',
		),
	)
);

$this->add_control(
	'title_html_tag',
	array(
		'label'   => __( 'HTML Tag', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::SELECT,
		'default' => 'h3',
		'options' => array(
			'h1'   => 'H1',
			'h2'   => 'H2',
			'h3'   => 'H3',
			'h4'   => 'H4',
			'h5'   => 'H5',
			'h6'   => 'H6',
			'div'  => 'div',
			'span' => 'span',
			'p'    => 'p',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'title_typography',
		'selector' => '{{WRAPPER}} .ggmc-reviews-title',
	)
);

$this->add_control(
	'title_color',
	array(
		'label'     => __( 'Title Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-reviews-title' => 'color: {{VALUE}};',
		),
	)
);

$this->add_responsive_control(
	'title_margin',
	array(
		'label'      => __( 'Margin', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em', '%' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-reviews-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '0',
			'right'  => '0',
			'bottom' => '24',
			'left'   => '0',
			'unit'   => 'px',
		),
	)
);

$this->end_controls_section();

// ── Rating Summary Card ───────────────────────────────────────────────────────

$this->start_controls_section(
	'summary_style_section',
	array(
		'label'     => __( 'Rating Summary Card', 'ggm-commerce' ),
		'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
		'condition' => array(
			'show_summary' => 'yes',
		),
	)
);

$this->add_control(
	'summary_layout',
	array(
		'label'                => __( 'Layout Direction', 'ggm-commerce' ),
		'type'                 => \Elementor\Controls_Manager::SELECT,
		'default'              => 'row',
		'options'              => array(
			'row'    => __( 'Horizontal (Side by Side)', 'ggm-commerce' ),
			'column' => __( 'Vertical (Stacked)', 'ggm-commerce' ),
		),
		'selectors_dictionary' => array(
			'row'    => 'flex-direction: row; align-items: flex-start;',
			'column' => 'flex-direction: column; align-items: stretch;',
		),
		'selectors'            => array(
			'{{WRAPPER}} .ggmc-rating-summary' => '{{VALUE}}',
		),
	)
);

$this->add_control(
	'summary_average_alignment',
	array(
		'label'     => __( 'Average Section Alignment', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::CHOOSE,
		'options'   => array(
			'flex-start' => array(
				'title' => __( 'Left', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-left',
			),
			'center'     => array(
				'title' => __( 'Center', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-center',
			),
			'flex-end'   => array(
				'title' => __( 'Right', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-right',
			),
		),
		'default'   => 'center',
		'selectors' => array(
			'{{WRAPPER}} .ggmc-summary-average' => 'align-items: {{VALUE}};',
		),
		'condition' => array(
			'summary_layout' => 'column',
		),
	)
);

$this->add_responsive_control(
	'summary_width',
	array(
		'label'      => __( 'Width', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( '%', 'px', 'vw' ),
		'range'      => array(
			'%'  => array(
				'min' => 10,
				'max' => 100,
			),
			'px' => array(
				'min' => 100,
				'max' => 1200,
			),
			'vw' => array(
				'min' => 10,
				'max' => 100,
			),
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-rating-summary' => 'width: {{SIZE}}{{UNIT}};',
		),
	)
);

$this->add_control(
	'summary_background',
	array(
		'label'     => __( 'Background Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-rating-summary' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Border::get_type(),
	array(
		'name'     => 'summary_border',
		'selector' => '{{WRAPPER}} .ggmc-rating-summary',
	)
);

$this->add_control(
	'summary_border_radius',
	array(
		'label'      => __( 'Border Radius', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', '%' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-rating-summary' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '8',
			'right'  => '8',
			'bottom' => '8',
			'left'   => '8',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'summary_padding',
	array(
		'label'      => __( 'Padding', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-rating-summary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '24',
			'right'  => '24',
			'bottom' => '24',
			'left'   => '24',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'summary_margin',
	array(
		'label'      => __( 'Margin', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-rating-summary' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '0',
			'right'  => '0',
			'bottom' => '24',
			'left'   => '0',
			'unit'   => 'px',
		),
	)
);

$this->add_control(
	'average_number_heading',
	array(
		'label'     => __( 'Average Rating Number', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'average_number_typography',
		'selector' => '{{WRAPPER}} .ggmc-average-number',
	)
);

$this->add_control(
	'average_number_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-average-number' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'average_stars_heading',
	array(
		'label'     => __( 'Average Stars', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_control(
	'average_star_size',
	array(
		'label'      => __( 'Star Size', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 12,
				'max' => 40,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 20,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-average-stars .ggmc-star' => 'font-size: {{SIZE}}{{UNIT}};',
		),
	)
);

$this->add_control(
	'average_star_color',
	array(
		'label'     => __( 'Star Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-average-stars .ggmc-star-full' => 'color: {{VALUE}};',
			'{{WRAPPER}} .ggmc-average-stars .ggmc-star-half' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'average_star_empty_color',
	array(
		'label'     => __( 'Empty Star Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-average-stars .ggmc-star-empty' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'total_reviews_heading',
	array(
		'label'     => __( 'Total Reviews Text', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'total_reviews_typography',
		'selector' => '{{WRAPPER}} .ggmc-total-reviews',
	)
);

$this->add_control(
	'total_reviews_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-total-reviews' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'progress_bar_heading',
	array(
		'label'     => __( 'Progress Bars', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_control(
	'progress_bar_background',
	array(
		'label'     => __( 'Bar Background', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-distribution-bar' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'progress_bar_fill',
	array(
		'label'     => __( 'Bar Fill Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-distribution-fill' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'progress_bar_height',
	array(
		'label'      => __( 'Bar Height', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 4,
				'max' => 20,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 8,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-distribution-bar'  => 'height: {{SIZE}}{{UNIT}};',
			'{{WRAPPER}} .ggmc-distribution-fill' => 'height: {{SIZE}}{{UNIT}};',
		),
	)
);

$this->add_control(
	'progress_bar_radius',
	array(
		'label'      => __( 'Bar Border Radius', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 0,
				'max' => 10,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 4,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-distribution-bar'  => 'border-radius: {{SIZE}}{{UNIT}};',
			'{{WRAPPER}} .ggmc-distribution-fill' => 'border-radius: {{SIZE}}{{UNIT}};',
		),
	)
);

$this->add_control(
	'distribution_row_spacing',
	array(
		'label'      => __( 'Row Spacing', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 0,
				'max' => 20,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 8,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-distribution-row'            => 'margin-bottom: {{SIZE}}{{UNIT}};',
			'{{WRAPPER}} .ggmc-distribution-row:last-child' => 'margin-bottom: 0;',
		),
	)
);

$this->add_control(
	'distribution_label_heading',
	array(
		'label'     => __( 'Distribution Labels', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'distribution_label_typography',
		'selector' => '{{WRAPPER}} .ggmc-distribution-label',
	)
);

$this->add_control(
	'distribution_label_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-distribution-label' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'distribution_count_heading',
	array(
		'label'     => __( 'Distribution Percentages', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'distribution_count_typography',
		'selector' => '{{WRAPPER}} .ggmc-distribution-count',
	)
);

$this->add_control(
	'distribution_count_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-distribution-count' => 'color: {{VALUE}};',
		),
	)
);

$this->end_controls_section();

// ── Review Card ───────────────────────────────────────────────────────────────

$this->start_controls_section(
	'card_style_section',
	array(
		'label' => __( 'Review Card', 'ggm-commerce' ),
		'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
	)
);

// Reviews List Layout
$this->add_control(
	'reviews_list_heading',
	array(
		'label' => __( 'Reviews List Layout', 'ggm-commerce' ),
		'type'  => \Elementor\Controls_Manager::HEADING,
	)
);

$this->add_control(
	'reviews_list_layout',
	array(
		'label'                => __( 'Layout Mode', 'ggm-commerce' ),
		'type'                 => \Elementor\Controls_Manager::SELECT,
		'default'              => 'list',
		'options'              => array(
			'list' => __( 'List (Stacked)', 'ggm-commerce' ),
			'grid' => __( 'Grid (Tiled)', 'ggm-commerce' ),
		),
		'selectors_dictionary' => array(
			'list' => 'display: block;',
			'grid' => 'display: flex; flex-wrap: wrap;',
		),
		'selectors'            => array(
			'{{WRAPPER}} .ggmc-reviews-list' => '{{VALUE}}',
		),
	)
);

$this->add_responsive_control(
	'reviews_list_column_gap',
	array(
		'label'      => __( 'Horizontal Gap (Between Columns)', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px', 'em' ),
		'range'      => array(
			'px' => array(
				'min' => 0,
				'max' => 50,
			),
			'em' => array(
				'min' => 0,
				'max' => 3,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 16,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-reviews-list' => 'column-gap: {{SIZE}}{{UNIT}};',
		),
		'condition'  => array(
			'reviews_list_layout' => 'grid',
		),
	)
);

$this->add_responsive_control(
	'reviews_list_row_gap',
	array(
		'label'      => __( 'Vertical Gap (Between Rows)', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px', 'em' ),
		'range'      => array(
			'px' => array(
				'min' => 0,
				'max' => 50,
			),
			'em' => array(
				'min' => 0,
				'max' => 3,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 16,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-reviews-list' => 'row-gap: {{SIZE}}{{UNIT}};',
		),
		'condition'  => array(
			'reviews_list_layout' => 'grid',
		),
	)
);

// Card Container
$this->add_control(
	'card_container_heading',
	array(
		'label'     => __( 'Card Container', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_responsive_control(
	'card_width',
	array(
		'label'       => __( 'Card Width', 'ggm-commerce' ),
		'type'        => \Elementor\Controls_Manager::SLIDER,
		'size_units'  => array( '%', 'px', 'vw' ),
		'range'       => array(
			'%'  => array(
				'min' => 10,
				'max' => 100,
			),
			'px' => array(
				'min' => 100,
				'max' => 1200,
			),
			'vw' => array(
				'min' => 10,
				'max' => 100,
			),
		),
		'selectors'   => array(
			'{{WRAPPER}} .ggmc-review-card' => 'width: {{SIZE}}{{UNIT}};',
		),
		'description' => __( 'Set card width for grid layout. Use % for responsive tiling (e.g., 48% for 2 columns).', 'ggm-commerce' ),
	)
);

$this->add_control(
	'card_background',
	array(
		'label'     => __( 'Background Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-card' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Border::get_type(),
	array(
		'name'     => 'card_border',
		'selector' => '{{WRAPPER}} .ggmc-review-card',
	)
);

$this->add_control(
	'card_border_radius',
	array(
		'label'      => __( 'Border Radius', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', '%' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-review-card' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '8',
			'right'  => '8',
			'bottom' => '8',
			'left'   => '8',
			'unit'   => 'px',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Box_Shadow::get_type(),
	array(
		'name'     => 'card_shadow',
		'selector' => '{{WRAPPER}} .ggmc-review-card',
	)
);

$this->add_responsive_control(
	'card_padding',
	array(
		'label'      => __( 'Padding', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-review-card' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '20',
			'right'  => '20',
			'bottom' => '20',
			'left'   => '20',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'card_spacing',
	array(
		'label'      => __( 'Spacing Between Reviews', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 0,
				'max' => 50,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 16,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-review-card' => 'margin-bottom: {{SIZE}}{{UNIT}};',
		),
		'condition'  => array(
			'reviews_list_layout' => 'list',
		),
	)
);

// Review Stars
$this->add_control(
	'review_stars_heading',
	array(
		'label'     => __( 'Review Stars', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_control(
	'star_size',
	array(
		'label'      => __( 'Star Size', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::SLIDER,
		'size_units' => array( 'px' ),
		'range'      => array(
			'px' => array(
				'min' => 10,
				'max' => 30,
			),
		),
		'default'    => array(
			'unit' => 'px',
			'size' => 16,
		),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-review-stars .ggmc-star' => 'font-size: {{SIZE}}{{UNIT}};',
		),
	)
);

$this->add_control(
	'filled_star_color',
	array(
		'label'     => __( 'Filled Star Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-card .ggmc-star-full' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'empty_star_color',
	array(
		'label'     => __( 'Empty Star Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-card .ggmc-star-empty' => 'color: {{VALUE}};',
		),
	)
);

// Verified Badge
$this->add_control(
	'verified_badge_heading',
	array(
		'label'     => __( 'Verified Badge', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
		'condition' => array(
			'show_verified_badge' => 'yes',
		),
	)
);

$this->add_control(
	'badge_background',
	array(
		'label'     => __( 'Background Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-verified-badge' => 'background-color: {{VALUE}};',
		),
		'condition' => array(
			'show_verified_badge' => 'yes',
		),
	)
);

$this->add_control(
	'badge_text_color',
	array(
		'label'     => __( 'Text Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-verified-badge' => 'color: {{VALUE}};',
		),
		'condition' => array(
			'show_verified_badge' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'      => 'badge_typography',
		'selector'  => '{{WRAPPER}} .ggmc-verified-badge',
		'condition' => array(
			'show_verified_badge' => 'yes',
		),
	)
);

// Review Text heading (parent for nested items)
$this->add_control(
	'review_text_heading',
	array(
		'label'     => __( 'Review Text', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

// Review Title
$this->add_control(
	'review_title_subheading',
	array(
		'label'     => __( 'Review Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'condition' => array(
			'show_review_title' => 'yes',
		),
	)
);

$this->add_control(
	'review_title_html_tag',
	array(
		'label'     => __( 'HTML Tag', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::SELECT,
		'default'   => 'h4',
		'options'   => array(
			'h1'   => 'H1',
			'h2'   => 'H2',
			'h3'   => 'H3',
			'h4'   => 'H4',
			'h5'   => 'H5',
			'h6'   => 'H6',
			'div'  => 'div',
			'span' => 'span',
			'p'    => 'p',
		),
		'condition' => array(
			'show_review_title' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'      => 'review_title_typography',
		'selector'  => '{{WRAPPER}} .ggmc-review-title',
		'condition' => array(
			'show_review_title' => 'yes',
		),
	)
);

$this->add_control(
	'review_title_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-title' => 'color: {{VALUE}};',
		),
		'condition' => array(
			'show_review_title' => 'yes',
		),
	)
);

$this->add_responsive_control(
	'review_title_margin',
	array(
		'label'      => __( 'Margin', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-review-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '8',
			'right'  => '0',
			'bottom' => '8',
			'left'   => '0',
			'unit'   => 'px',
		),
		'condition'  => array(
			'show_review_title' => 'yes',
		),
	)
);

// Review Content
$this->add_control(
	'review_content_subheading',
	array(
		'label'     => __( 'Review Content', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'content_typography',
		'selector' => '{{WRAPPER}} .ggmc-review-content',
	)
);

$this->add_control(
	'content_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-content' => 'color: {{VALUE}};',
		),
	)
);

// Reviewer Name
$this->add_control(
	'reviewer_name_subheading',
	array(
		'label'     => __( 'Reviewer Name', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
		'condition' => array(
			'show_reviewer_name' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'      => 'reviewer_typography',
		'selector'  => '{{WRAPPER}} .ggmc-reviewer-name',
		'condition' => array(
			'show_reviewer_name' => 'yes',
		),
	)
);

$this->add_control(
	'reviewer_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-reviewer-name' => 'color: {{VALUE}};',
		),
		'condition' => array(
			'show_reviewer_name' => 'yes',
		),
	)
);

// Review Date
$this->add_control(
	'review_date_subheading',
	array(
		'label'     => __( 'Review Date', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::HEADING,
		'separator' => 'before',
		'condition' => array(
			'show_date' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'      => 'date_typography',
		'selector'  => '{{WRAPPER}} .ggmc-review-date',
		'condition' => array(
			'show_date' => 'yes',
		),
	)
);

$this->add_control(
	'date_color',
	array(
		'label'     => __( 'Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-review-date' => 'color: {{VALUE}};',
		),
		'condition' => array(
			'show_date' => 'yes',
		),
	)
);

$this->end_controls_section();

// ── Helpful Button ────────────────────────────────────────────────────────────

$this->start_controls_section(
	'helpful_style_section',
	array(
		'label'     => __( 'Helpful Button', 'ggm-commerce' ),
		'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
		'condition' => array(
			'show_helpful' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'helpful_typography',
		'selector' => '{{WRAPPER}} .ggmc-helpful-btn',
	)
);

$this->add_control(
	'helpful_text_color',
	array(
		'label'     => __( 'Text Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-helpful-btn' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'helpful_text_color_hover',
	array(
		'label'     => __( 'Text Color (Hover)', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-helpful-btn:hover' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'helpful_background',
	array(
		'label'     => __( 'Background Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-helpful-btn' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'helpful_background_hover',
	array(
		'label'     => __( 'Background Color (Hover)', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-helpful-btn:hover' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Border::get_type(),
	array(
		'name'     => 'helpful_border',
		'selector' => '{{WRAPPER}} .ggmc-helpful-btn',
	)
);

$this->add_control(
	'helpful_border_radius',
	array(
		'label'      => __( 'Border Radius', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', '%' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-helpful-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '4',
			'right'  => '4',
			'bottom' => '4',
			'left'   => '4',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'helpful_padding',
	array(
		'label'      => __( 'Padding', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-helpful-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '6',
			'right'  => '12',
			'bottom' => '6',
			'left'   => '12',
			'unit'   => 'px',
		),
	)
);

$this->end_controls_section();

// ── Pagination ────────────────────────────────────────────────────────────────

$this->start_controls_section(
	'pagination_style_section',
	array(
		'label'     => __( 'Pagination', 'ggm-commerce' ),
		'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
		'condition' => array(
			'show_pagination' => 'yes',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Typography::get_type(),
	array(
		'name'     => 'pagination_typography',
		'selector' => '{{WRAPPER}} .ggmc-load-more-reviews',
	)
);

$this->add_control(
	'pagination_text_color',
	array(
		'label'     => __( 'Text Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-load-more-reviews' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'pagination_text_color_hover',
	array(
		'label'     => __( 'Text Color (Hover)', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-load-more-reviews:hover' => 'color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'pagination_background',
	array(
		'label'     => __( 'Background Color', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-load-more-reviews' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_control(
	'pagination_background_hover',
	array(
		'label'     => __( 'Background Color (Hover)', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::COLOR,
		'selectors' => array(
			'{{WRAPPER}} .ggmc-load-more-reviews:hover' => 'background-color: {{VALUE}};',
		),
	)
);

$this->add_group_control(
	\Elementor\Group_Control_Border::get_type(),
	array(
		'name'     => 'pagination_border',
		'selector' => '{{WRAPPER}} .ggmc-load-more-reviews',
	)
);

$this->add_control(
	'pagination_border_radius',
	array(
		'label'      => __( 'Border Radius', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', '%' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-load-more-reviews' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '6',
			'right'  => '6',
			'bottom' => '6',
			'left'   => '6',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'pagination_padding',
	array(
		'label'      => __( 'Padding', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-load-more-reviews' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '12',
			'right'  => '24',
			'bottom' => '12',
			'left'   => '24',
			'unit'   => 'px',
		),
	)
);

$this->add_responsive_control(
	'pagination_margin',
	array(
		'label'      => __( 'Margin', 'ggm-commerce' ),
		'type'       => \Elementor\Controls_Manager::DIMENSIONS,
		'size_units' => array( 'px', 'em' ),
		'selectors'  => array(
			'{{WRAPPER}} .ggmc-reviews-pagination' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		),
		'default'    => array(
			'top'    => '24',
			'right'  => '0',
			'bottom' => '0',
			'left'   => '0',
			'unit'   => 'px',
		),
	)
);

$this->add_control(
	'pagination_alignment',
	array(
		'label'     => __( 'Alignment', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::CHOOSE,
		'options'   => array(
			'left'   => array(
				'title' => __( 'Left', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-left',
			),
			'center' => array(
				'title' => __( 'Center', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-center',
			),
			'right'  => array(
				'title' => __( 'Right', 'ggm-commerce' ),
				'icon'  => 'eicon-text-align-right',
			),
		),
		'default'   => 'center',
		'selectors' => array(
			'{{WRAPPER}} .ggmc-reviews-pagination' => 'text-align: {{VALUE}};',
		),
	)
);

$this->end_controls_section();
