<?php

use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Utils;

if ( ! defined( 'ABSPATH' ) )
	exit; // Exit if accessed directly

class Banae_List_Group_Controls {

	/**
	 * The main widget controls registration method
	 * 
	 * @param mixed $widget
	 * 
	 * @return void
	 */
	public static function add_register_controls( $widget ) {

		$widget->start_controls_section(
			'_section_list_group',
			[
				'label' => __( 'List Items', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$repeater = new Repeater();

		$repeater->add_control(
			'icon_type',
			[
				'label' => __( 'Media Type', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::CHOOSE,
				'default' => 'icon',
				'options' => [
					'none' => [
						'title' => __( 'None', 'banana-addons-for-elementor' ),
						'icon' => ' eicon-editor-close',
					],
					'icon' => [
						'title' => __( 'Icon', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-star',
					],
					'number' => [
						'title' => __( 'Number', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-number-field',
					],
					'image' => [
						'title' => __( 'Image', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-image',
					],
				],
				'toggle' => false,
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'icon',
			[
				'label' => __( 'Icon', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::ICONS,
				'label_block' => true,
				'default' => [
					'value' => 'fas fa-smile',
					'library' => 'regular',
				],
				'condition' => [
					'icon_type' => 'icon'
				],
			]
		);

		$repeater->add_control(
			'number',
			[
				'label' => __( 'Item Number', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::TEXT,
				'placeholder' => __( 'List Item Number', 'banana-addons-for-elementor' ),
				'default' => __( '1', 'banana-addons-for-elementor' ),
				'condition' => [
					'icon_type' => 'number'
				],
			]
		);

		$repeater->add_control(
			'image',
			[
				'label' => __( 'Image', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
				'condition' => [
					'icon_type' => 'image'
				],
				'dynamic' => [
					'active' => true,
				]
			]
		);

		$repeater->add_control(
			'title',
			[
				'label' => __( 'Title', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::TEXT,
				'label_block' => true,
				'separator' => 'before',
				'placeholder' => __( 'List Item', 'banana-addons-for-elementor' ),
				'default' => __( 'Create engaging content', 'banana-addons-for-elementor' ),
				'dynamic' => [
					'active' => true,
				]
			]
		);

		$repeater->add_control(
			'badge_text',
			[
				'label' => __( 'Badge Text', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::TEXT,
				'label_block' => true,
				'placeholder' => __( 'Type badge text', 'banana-addons-for-elementor' ),
				'dynamic' => [
					'active' => true,
				]
			]
		);

		$repeater->add_control(
			'description',
			[
				'label' => __( 'Description', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::TEXTAREA,
				'label_block' => true,
				'placeholder' => __( 'List Item Description', 'banana-addons-for-elementor' ),
				'dynamic' => [
					'active' => true,
				]
			]
		);

		$repeater->add_control(
			'direction',
			[
				'label' => __( 'Direction', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::ICONS,
				'label_block' => true,
				'default' => [
					'value' => 'fas fa-chevron-right',
					'library' => 'regular',
				]
			]
		);

		$repeater->add_control(
			'link',
			[
				'label' => __( 'Link', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::URL,
				'placeholder' => __( 'https://example.com', 'banana-addons-for-elementor' ),
				'dynamic' => [
					'active' => true,
				]
			]
		);

		$repeater->add_control(
			'custom_style',
			[
				'label' => __( 'Enable Custom Style', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Yes', 'banana-addons-for-elementor' ),
				'label_off' => __( 'No', 'banana-addons-for-elementor' ),
				'return_value' => 'yes',
				'default' => 'no',
				'separator' => 'before',
				'style_transfer' => true,
			]
		);

		$repeater->start_controls_tabs( '_tabs_icon', [
			'condition' => [
				'custom_style' => 'yes',
			],
		] );


		$repeater->start_controls_tab(
			'_tab_icon_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$repeater->add_control(
			'title_color',
			[
				'label' => __( 'Title Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-text .banae-list-title' => 'color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'description_color',
			[
				'label' => __( 'Description Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-text .banae-list-detail' => 'color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap' => 'background-color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'border_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}}' => 'border-color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'icon_visibility',
			[
				'label' => __( 'Opacity', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ '%' ],
				'range' => [
					'%' => [
						'min' => 0,
						'max' => 1,
						'step' => 0.1,
					],
				],
				'default' => [
					'unit' => '%',
					'size' => 0,
				],
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-direction' => 'opacity: {{SIZE}};',
				],
			]
		);

		$repeater->end_controls_tab();

		$repeater->start_controls_tab(
			'_tab_icon_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$repeater->add_control(
			'title_hover_color',
			[
				'label' => __( 'Title Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}}:hover .banae-text .banae-list-title' => 'color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'description_hover_color',
			[
				'label' => __( 'Description Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}}:hover .banae-text .banae-list-detail' => 'color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'background_hover_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap:hover' => 'background-color: {{VALUE}} !important',
					'{{WRAPPER}} {{CURRENT_ITEM}}:hover' => 'border-color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'border_hover_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}}:hover' => 'border-color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'icon_hover_visibility',
			[
				'label' => __( 'Opacity', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ '%' ],
				'range' => [
					'%' => [
						'min' => 0,
						'max' => 1,
					],
				],
				'default' => [
					'unit' => '%',
					'size' => 1,
				],
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}}:hover .banae-direction' => 'opacity: {{SIZE}};',
				],
			]
		);

		$repeater->end_controls_tab();
		$repeater->end_controls_tabs();

		$repeater->add_control(
			'title_heading',
			[
				'label' => __( 'Direction Arrow Style', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::HEADING,
			]
		);

		$repeater->start_controls_tabs( '_tabs_direction' );
		$repeater->start_controls_tab(
			'_tab_direction_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$repeater->add_control(
			'custom_direction_link_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap .banae-direction i' => 'color: {{VALUE}} !important',
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap .banae-direction svg' => 'fill: {{VALUE}} !important',
				],
			]
		);

		$repeater->add_control(
			'custom_direction_link_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap .banae-direction' => 'background-color: {{VALUE}} !important',
				],
			]
		);

		$repeater->end_controls_tab();

		$repeater->start_controls_tab(
			'_tab_direction_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$repeater->add_control(
			'custom_direction_hover_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap:hover .banae-direction i' => 'color: {{VALUE}} !important',
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap:hover .banae-direction svg' => 'fill: {{VALUE}} !important',
				],
			]
		);

		$repeater->add_control(
			'custom_direction_hover_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap:hover .banae-direction' => 'background-color: {{VALUE}} !important',
				],
			]
		);

		$repeater->add_control(
			'custom_direction_hover_border_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'condition' => [
					'direction_border_border!' => ''
				],
				'selectors' => [
					'{{WRAPPER}} {{CURRENT_ITEM}} .banae-item-wrap:hover .banae-direction' => 'border-color: {{VALUE}} !important',
				],
			]
		);

		$repeater->end_controls_tab();
		$repeater->end_controls_tabs();


		$widget->add_control(
			'list_item',
			[
				'show_label' => false,
				'type' => Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'title_field' => '{{{ title }}}',
				'default' => [
					[
						'title' => __( 'Create engaging content', 'banana-addons-for-elementor' ),
						'icon' => [
							'value' => 'fas fa-check',
							'library' => 'regular',
						],
					],
					[
						'title' => __( 'Develop sleek layouts', 'banana-addons-for-elementor' ),
						'icon' => [
							'value' => 'fas fa-check',
							'library' => 'regular',
						],
					],
					[
						'title' => __( 'Design stunning interfaces', 'banana-addons-for-elementor' ),
						'icon' => [
							'value' => 'fas fa-check',
							'library' => 'regular',
						],
					],
					[
						'title' => __( 'Build immersive designs', 'banana-addons-for-elementor' ),
						'icon' => [
							'value' => 'fas fa-check',
							'library' => 'regular',
						],
					],
				],
			]
		);

		$widget->end_controls_section();

		// settings
		$widget->start_controls_section(
			'_section_settings',
			[
				'label' => __( 'Settings', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$widget->add_control(
			'title_tag',
			[
				'label' => __( 'Title HTML Tag', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SELECT,
				// 'separator' => 'before',
				'options' => [
					'h1' => 'H1',
					'h2' => 'H2',
					'h3' => 'H3',
					'h4' => 'H4',
					'h5' => 'H5',
					'h6' => 'H6',
					'div' => 'div',
					'span' => 'span',
					'p' => 'p',
				],
				'default' => 'h4',
			]
		);

		$widget->add_control(
			'mode',
			[
				'label' => __( 'List Mode', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::CHOOSE,
				'label_block' => false,
				'options' => [
					'compact' => [
						'title' => __( 'Compact', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-square',
					],
					'comfy' => [
						'title' => __( 'Comfy', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-menu-bar',
					],
				],
				'toggle' => false,
				'default' => 'compact',
				'prefix_class' => 'banae-mode--',
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'direction_position',
			[
				'label' => __( 'Direction Position', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::CHOOSE,
				'label_block' => false,
				'options' => [
					'left' => [
						'title' => __( 'Left', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-h-align-left',
					],
					'right' => [
						'title' => __( 'Right', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-h-align-right',
					],
				],
				'toggle' => false,
				'prefix_class' => 'banae-direction--',
				'default' => 'right',
				'selectors_dictionary' => [
					'left' => 'flex-direction: row-reverse',
					'right' => 'flex-direction: row',
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap' => '{{VALUE}};',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'text_alignment',
			[
				'label' => __( 'Text Alignment', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::CHOOSE,
				'label_block' => false,
				'options' => [
					'left' => [
						'title' => __( 'Left', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-text-align-left',
					],
					'center' => [
						'title' => __( 'Center', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-text-align-center',
					],
					'right' => [
						'title' => __( 'Right', 'banana-addons-for-elementor' ),
						'icon' => 'eicon-text-align-right',
					]
				],
				'toggle' => true,
				'selectors' => [
					'{{WRAPPER}} .banae-text' => 'text-align: {{VALUE}};'
				],
			]
		);

		$widget->end_controls_section();

		// general style controls
		$widget->start_controls_section(
			'_section_general_style',
			[
				'label' => __( 'General', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$widget->add_responsive_control(
			'item_padding',
			[
				'label' => __( 'Padding', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .banae-item-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_responsive_control(
			'item_spacing',
			[
				'label' => __( 'Bottom Spacing', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 5,
						'max' => 200,
					]
				],
				'condition' => [
					'mode' => 'comfy'
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_control(
			'list_border_type',
			[
				'label' => __( 'Border Type', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'none' => __( 'None', 'banana-addons-for-elementor' ),
					'solid' => __( 'Solid', 'banana-addons-for-elementor' ),
					'double' => __( 'Double', 'banana-addons-for-elementor' ),
					'dotted' => __( 'Dotted', 'banana-addons-for-elementor' ),
					'dashed' => __( 'Dashed', 'banana-addons-for-elementor' ),
				],
				'default' => 'solid',
				'selectors' => [
					'{{WRAPPER}}.banae-mode--compact .banae-list-wrap' => 'border-style: {{VALUE}}',
					'{{WRAPPER}}.banae-mode--compact .banae-list-item:not(:last-child)' => 'border-bottom-style: {{VALUE}}',
					'{{WRAPPER}}.banae-mode--comfy .banae-list-item' => 'border-style: {{VALUE}}',
				],
			]
		);

		$widget->add_responsive_control(
			'list_border_width',
			[
				'label' => __( 'Width', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'default' => [
					'size' => 1,
				],
				'range' => [
					'px' => [
						'min' => 1,
						'max' => 20,
					],
				],
				'condition' => [
					'list_border_type!' => 'none',
				],
				'selectors' => [
					'{{WRAPPER}}.banae-mode--compact .banae-list-wrap' => 'border-width: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}}.banae-mode--compact .banae-list-item:not(:last-child)' => 'border-bottom-width: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}}.banae-mode--comfy .banae-list-item' => 'border-width: {{SIZE}}{{UNIT}}',
				],
			]
		);

		$widget->add_control(
			'list_border_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'condition' => [
					'list_border_type!' => 'none',
				],
				'selectors' => [
					'{{WRAPPER}}.banae-mode--compact .banae-list-wrap' => 'border-color: {{VALUE}}',
					'{{WRAPPER}}.banae-mode--compact .banae-list-item:not(:last-child)' => 'border-color: {{VALUE}}',
					'{{WRAPPER}}.banae-mode--comfy .banae-list-item' => 'border-color: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'border_radius',
			[
				'label' => __( 'Border Radius', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}}.banae-mode--compact .banae-list-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					'{{WRAPPER}}.banae-mode--comfy .banae-list-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'content_box_shadow',
				'selector' => '{{WRAPPER}}.banae-mode--compact .banae-list-wrap, {{WRAPPER}}.banae-mode--comfy .banae-list-item',
			]
		);

		$widget->start_controls_tabs( '_common_colors' );


		$widget->start_controls_tab(
			'_common_colors_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'common_title_color',
			[
				'label' => __( 'Title Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-text .banae-list-title' => 'color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_description_color',
			[
				'label' => __( 'Description Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-text .banae-list-detail' => 'color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap' => 'background-color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_border_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item' => 'border-color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->end_controls_tab();

		$widget->start_controls_tab(
			'_common_colors_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'common_title_hover_color',
			[
				'label' => __( 'Title Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item:hover .banae-text .banae-list-title' => 'color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_description_hover_color',
			[
				'label' => __( 'Description Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item:hover .banae-text .banae-list-detail' => 'color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_background_hover_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap:hover' => 'background-color: {{VALUE}}',
				],
				'style_transfer' => true,
			]
		);

		$widget->add_control(
			'common_border_hover_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item:hover' => 'border-color: {{VALUE}} !important',
				],
				'style_transfer' => true,
			]
		);

		$widget->end_controls_tab();
		$widget->end_controls_tabs();

		$widget->end_controls_section();

		// media style controls
		$widget->start_controls_section(
			'_section_icon_style',
			[
				'label' => __( 'Media Type', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$widget->add_responsive_control(
			'icon_spacing',
			[
				'label' => __( 'Spacing', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 50,
					]
				],
				'selectors' => [
					'{{WRAPPER}}.banae-direction--right .banae-list-item .banae-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}}.banae-direction--left .banae-list-item .banae-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_responsive_control(
			'icon_size',
			[
				'label' => __( 'Size', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 250,
					]
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-icon.icon' => 'font-size: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}} .banae-list-item .banae-icon.number span' => 'font-size: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}} .banae-list-item .banae-icon.image img' => 'width: {{SIZE}}{{UNIT}};'
				],
			]
		);

		$widget->add_responsive_control(
			'icon_background_spacing',
			[
				'label' => __( 'Padding', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 150,
					]
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-icon' => 'padding: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'icon_border',
				'selector' => '{{WRAPPER}} .banae-list-item .banae-icon',
			]
		);

		$widget->add_control(
			'icon_border_radius',
			[
				'label' => __( 'Border Radius', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
					'{{WRAPPER}} .banae-list-item .banae-icon.image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'icon_box_shadow',
				'selector' => '{{WRAPPER}} .banae-list-item .banae-icon',
			]
		);

		$widget->start_controls_tabs( '_tabs_icon' );
		$widget->start_controls_tab(
			'_tab_icon_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'icon_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-icon i' => 'color: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item .banae-icon svg' => 'fill: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item .banae-icon span' => 'color: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'icon_background',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-icon' => 'background: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();

		$widget->start_controls_tab(
			'_tab_icon_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'icon_hover_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item:hover .banae-icon i' => 'color: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item:hover .banae-icon svg' => 'fill: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item:hover .banae-icon span' => 'color: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'icon_hover_background',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item a:hover .banae-icon' => 'background: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'icon_hover_border',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'condition' => [
					'icon_border_border!' => ''
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item a:hover .banae-icon' => 'border-color: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();
		$widget->end_controls_tabs();

		$widget->end_controls_section();

		// title and description controls
		$widget->start_controls_section(
			'_section_text',
			[
				'label' => __( 'Title & Description', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$widget->add_control(
			'title_heading',
			[
				'label' => __( 'Title', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::HEADING,
			]
		);

		$widget->add_responsive_control(
			'title_spacing',
			[
				'label' => __( 'Bottom Spacing', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 100,
					]
				],
				'selectors' => [
					'{{WRAPPER}} .banae-text .banae-list-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'title_typography',
				'selector' => '{{WRAPPER}} .banae-text .banae-list-title',
				'global' => [
					'default' => Global_Typography::TYPOGRAPHY_TEXT,
				],
			]
		);

		$widget->start_controls_tabs( '_tabs_title' );
		$widget->start_controls_tab(
			'_tab_title_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'title_link_color',
			[
				'label' => __( 'Link Text Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item a .banae-item-wrap .banae-text .banae-list-title' => 'color: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();

		$widget->start_controls_tab(
			'_tab_title_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'title_hover_color',
			[
				'label' => __( 'Link Text Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item a:hover .banae-item-wrap .banae-text .banae-list-title' => 'color: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();
		$widget->end_controls_tabs();

		$widget->add_control(
			'description_heading',
			[
				'label' => __( 'Description', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::HEADING,
				'separator' => 'before',
			]
		);

		$widget->add_control(
			'description_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-text .banae-list-detail' => 'color: {{VALUE}}',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'description_typography',
				'selector' => '{{WRAPPER}} .banae-text .banae-list-detail',
				'global' => [
					'default' => Global_Typography::TYPOGRAPHY_TEXT,
				],
			]
		);

		$widget->end_controls_section();

		// badge style controls
		$widget->start_controls_section(
			'_section_style_badge',
			[
				'label' => __( 'Badge', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$widget->add_responsive_control(
			'badge_padding',
			[
				'label' => __( 'Padding', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .banae-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_control(
			'badge_spacing',
			[
				'label' => __( 'Spacing', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 60,
						'step' => 1,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 10,
				],
				'selectors' => [
					'{{WRAPPER}} .banae-badge' => 'margin-left: {{SIZE}}{{UNIT}} !important',
				],
			]
		);

		$widget->add_control(
			'badge_color',
			[
				'label' => __( 'Text Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-badge' => 'color: {{VALUE}};',
				],
			]
		);

		$widget->add_control(
			'badge_bg_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-badge' => 'background-color: {{VALUE}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'badge_border',
				'selector' => '{{WRAPPER}} .banae-badge',
			]
		);

		$widget->add_responsive_control(
			'badge_border_radius',
			[
				'label' => __( 'Border Radius', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .banae-badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'badge_box_shadow',
				'exclude' => [
					'box_shadow_position',
				],
				'selector' => '{{WRAPPER}} .banae-badge',
			]
		);

		$widget->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'badge_typography',
				'label' => __( 'Typography', 'banana-addons-for-elementor' ),
				'exclude' => [
					'line_height'
				],
				'default' => [
					'font_size' => [ '' ]
				],
				'selector' => '{{WRAPPER}} .banae-badge',
				'global' => [
					'default' => Global_Typography::TYPOGRAPHY_SECONDARY,
				],
			]
		);

		$widget->end_controls_section();

		// direction style controls
		$widget->start_controls_section(
			'_section_direction',
			[
				'label' => __( 'Direction', 'banana-addons-for-elementor' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$widget->add_control(
			'direction_animation',
			[
				'label' => __( 'Direction Animation', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'On', 'banana-addons-for-elementor' ),
				'label_off' => __( 'Off', 'banana-addons-for-elementor' ),
				'return_value' => 'yes',
				'default' => 'no',
			]
		);

		$widget->add_responsive_control(
			'direction_spacing',
			[
				'label' => __( 'Spacing', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 50,
					]
				],
				'selectors' => [
					'{{WRAPPER}}.banae-direction--left .banae-direction' => 'margin-right: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}}.banae-direction--right .banae-direction' => 'margin-left: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_responsive_control(
			'direction_font_size',
			[
				'label' => __( 'Size', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px', 'em' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 50,
					]
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-direction' => 'font-size: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_responsive_control(
			'direction_padding',
			[
				'label' => __( 'Padding', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 50,
					]
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-direction' => 'padding: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'direction_border',
				'selector' => '{{WRAPPER}} .banae-list-item  .banae-direction',
			]
		);

		$widget->add_control(
			'direction_border_radius',
			[
				'label' => __( 'Border Radius', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item  .banae-direction' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$widget->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'direction_box_shadow',
				'selector' => '{{WRAPPER}} .banae-list-item  .banae-direction',
			]
		);

		$widget->add_control(
			'direction_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-direction i' => 'color: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item .banae-direction svg' => 'fill: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'direction_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-direction' => 'background-color: {{VALUE}}',
				],
			]
		);

		$widget->start_controls_tabs( '_tabs_direction' );
		$widget->start_controls_tab(
			'_tab_direction_normal',
			[
				'label' => __( 'Normal', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'direction_link_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap .banae-direction i' => 'color: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item .banae-item-wrap .banae-direction svg' => 'fill: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'direction_link_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap .banae-direction' => 'background-color: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();

		$widget->start_controls_tab(
			'_tab_direction_hover',
			[
				'label' => __( 'Hover', 'banana-addons-for-elementor' ),
			]
		);

		$widget->add_control(
			'direction_hover_color',
			[
				'label' => __( 'Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap:hover .banae-direction i' => 'color: {{VALUE}}',
					'{{WRAPPER}} .banae-list-item .banae-item-wrap:hover .banae-direction svg' => 'fill: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'direction_hover_background_color',
			[
				'label' => __( 'Background Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap:hover .banae-direction' => 'background-color: {{VALUE}}',
				],
			]
		);

		$widget->add_control(
			'direction_hover_border_color',
			[
				'label' => __( 'Border Color', 'banana-addons-for-elementor' ),
				'type' => Controls_Manager::COLOR,
				'condition' => [
					'direction_border_border!' => ''
				],
				'selectors' => [
					'{{WRAPPER}} .banae-list-item .banae-item-wrap:hover .banae-direction' => 'border-color: {{VALUE}}',
				],
			]
		);

		$widget->end_controls_tab();
		$widget->end_controls_tabs();

		$widget->end_controls_section();
	}
}