<?php
/**
 * Elementor Accordion Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.5
 */

use \Elementor\Plugin;

class Elementor_Accordion_Widget extends \Elementor\Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve Accordion widget name.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'accordion';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Accordion widget title.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Accordion', 'endless-addons' );
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve Accordion widget icon.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'fa fa-copy';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the Accordion widget belongs to.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'endless-elements' ];
	}

	/**
	 * Register Accordion widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'default_section',
			[    
				'label' => __( 'Settings', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$this->add_control(
			'show_accordion',
			[
				'label' => __( 'Show/Hide Accordion Section', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'show' => [
						'title' => __( 'Show', 'endless-addons' ),
						'icon' => 'fa fa-check'
					],
					'hide' => [
						'title' => __( 'Hide', 'endless-addons' ),
						'icon' => 'fa fa-close'
					]
				],
				'default' => 'show',
				'toggle' => true
			]
		);

		$this->add_control(
			'select_accordion_style',
			[
				'label' => __( 'Select Accordion Style', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'style-01' => __( 'Style 01', 'endless-addons' ),
					'style-02' => __( 'Style 02', 'endless-addons' ),
					'style-03' => __( 'Style 03', 'endless-addons' ),
					'style-04' => __( 'Style 04', 'endless-addons' ),
					'style-05' => __( 'Style 05', 'endless-addons' ),
					'style-06' => __( 'Style 06', 'endless-addons' ),
					'style-07' => __( 'Style 07', 'endless-addons' )
				],
				'default' => 'style-01'
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'accordion_section',
			[
				'label' => __( 'Accordion Section', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'accordion_title',
			[
				'label' => __( 'Section Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Accordion Style 1', 'endless-addons' )
			]
		);

		$this->add_control(
			'accordion_desc',
			[
				'label' => __( 'Section Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt dolore magna aliqua. Quis ipsum suspendisse ultrices gravida.', 'endless-addons')
			]
		);

		$this->add_control(
			'accordion_featured_img',
			[
				'label' => __( 'Featured Image', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'show_label' => true,
				'condition' => [
                    'select_accordion_style' => 'style-07',
                ]
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Image_Size::get_type(),
			[
				'name' => 'thumbnail',
				'default' => 'full',
				'separator' => 'none',
				'exclude' => [
					'full',
					'custom',
					'large',
					'shop_catalog',
					'shop_single',
					'shop_thumbnail'
				],
				'condition' => [
					'select_accordion_style' => 'style-07',
				]
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name' => 'section_background',
				'label' => __( 'Background', 'plugin-domain' ),
				'types' => [ 'classic', 'gradient', 'video' ],
				'selector' => '{{WRAPPER}} .ea-accordion-area',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'accordion_single',
			[
				'label' => __( 'Accordion Content', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'single_accordion_name', [
				'label' => __( 'Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'What do we mean by business?', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'ea_title_tag',
			[
				'label' => __( 'Title Tag', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'default' => __( 'Default', 'endless-addons' ),
					'h1' => __( 'h1', 'endless-addons' ),
					'h2' => __( 'h2', 'endless-addons' ),
					'h3' => __( 'h3', 'endless-addons' ),
					'h4' => __( 'h4', 'endless-addons' ),
					'h5' => __( 'h5', 'endless-addons' ),
					'h6' => __( 'h6', 'endless-addons' )
				],
				'default' => 'default'
			]
		);

		$repeater->add_control(
			'icon_type',
			[
				'label' => __( 'Icon Type', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'general' => __( 'General', 'endless-addons' ),
					'library' => __( 'Library', 'endless-addons' ),
				],
				'default' => 'general'
			]
		);

		$repeater->add_control(
			'single_accordion_icon1', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICON,
				'default'  => 'bx bx-chevron-down',
				'show_label' => true,
				'options' => endless_addons_icons(),
				'condition' => [
                    'icon_type' => 'general'
                ]
			]
		);

		$repeater->add_control(
			'single_accordion_icon2', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICONS,
				'show_label' => true,
				'condition' => [
                    'icon_type' => 'library'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_text_type',
            [
                'label' => __('Content Type', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'content' => __('Content', 'endless-addons'),
                    'template' => __('Saved Templates', 'endless-addons'),
                ],
                'default' => 'content',
            ]
        );

		$repeater->add_control(
			'single_accordion_content', [
				'label' => __( 'Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default'  => __( 'Lorem, ipsum dolor sit amet How do you Startup? consectetur adipisicing elit. Accusamus ipsa error, excepturi, obcaecati aliquid veniam blanditiis quas voluptates maxime unde, iste minima dolores dolor perferendis facilis. How do you Startup.', 'endless-addons' ),
				'condition' => [
                    'ea_content_text_type' => 'content'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_templates',
            [
                'label' => __('Choose Template', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => ea_get_elementor_templates(),
                'condition' => [
                    'ea_content_text_type' => 'template',
                ],
            ]
        );

		$this->add_control(
			'single_accordion_left',
			[
				'label' => __( 'Single Accordion', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'list_title' => __( 'Single Accordion #1', 'endless-addons' ),
						'list_content' => __( 'Single Accordion Content', 'endless-addons' ),
					],
				
				],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'accordion_single_right',
			[
				'label' => __( 'Accordion Content Right Column', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
				'condition' => [
                    'select_accordion_style' => array('style-01', 'style-04', 'style-06'),
                ]
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'single_accordion_name', [
				'label' => __( 'Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Where should my business be involved?', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'ea_title_tag',
			[
				'label' => __( 'Title Tag', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'default' => __( 'Default', 'endless-addons' ),
					'h1' => __( 'h1', 'endless-addons' ),
					'h2' => __( 'h2', 'endless-addons' ),
					'h3' => __( 'h3', 'endless-addons' ),
					'h4' => __( 'h4', 'endless-addons' ),
					'h5' => __( 'h5', 'endless-addons' ),
					'h6' => __( 'h6', 'endless-addons' )
				],
				'default' => 'default'
			]
		);

		$repeater->add_control(
			'icon_type',
			[
				'label' => __( 'Icon Type', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'general' => __( 'General', 'endless-addons' ),
					'library' => __( 'Library', 'endless-addons' ),
				],
				'default' => 'general'
			]
		);

		$repeater->add_control(
			'single_accordion_icon1', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICON,
				'default'  => 'bx bx-chevron-down',
				'show_label' => true,
				'options' => endless_addons_icons(),
				'condition' => [
                    'icon_type' => 'general'
                ]
			]
		);

		$repeater->add_control(
			'single_accordion_icon2', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICONS,
				'show_label' => true,
				'condition' => [
                    'icon_type' => 'library'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_text_type',
            [
                'label' => __('Content Type', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'content' => __('Content', 'endless-addons'),
                    'template' => __('Saved Templates', 'endless-addons'),
                ],
                'default' => 'content',
            ]
        );

		$repeater->add_control(
			'single_accordion_content', [
				'label' => __( 'Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default'  => __( 'Lorem, ipsum dolor sit amet How do you Startup? consectetur adipisicing elit. Accusamus ipsa error, excepturi, obcaecati aliquid veniam blanditiis quas voluptates maxime unde, iste minima dolores dolor perferendis facilis. How do you Startup.', 'endless-addons' ),
				'condition' => [
                    'ea_content_text_type' => 'content'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_templates',
            [
                'label' => __('Choose Template', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => ea_get_elementor_templates(),
                'condition' => [
                    'ea_content_text_type' => 'template',
                ],
            ]
        );

		$this->add_control(
			'single_accordion_right',
			[
				'label' => __( 'Single Accordion Another', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'list_title' => __( 'Single Accordion #1', 'endless-addons' ),
						'list_content' => __( 'Single Accordion Content', 'endless-addons' ),
					],
				
				],
				'condition' => [
                    'select_accordion_style' => array('style-01', 'style-04', 'style-06'),
                ]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_style',
			[
				'label' => __( 'Section Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'section_title_color',
			[
				'label' => __( 'Section Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-accordion-area .section-title h2' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_title_typography',
                'label' => __( 'Section Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-accordion-area .section-title h2'
            ]
        );

        $this->add_control(
			'section_desc_color',
			[
				'label' => __( 'Section Description Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-accordion-area .section-title p' => 'color: {{VALUE}}'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_desc_typography',
                'label' => __( 'Section Description Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-accordion-area .section-title p'
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'accordion_style',
			[
				'label' => __( 'Accordion Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'accordion_bg_color',
			[
				'label' => __( 'Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-accordion-area, .ea-accordion-area.style-two::before' => 'background: {{VALUE}}'
                ],
                'condition' => [
                    'select_accordion_style' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-07'),
                ]
			]
		);

		$this->add_control(
			'accordion_box_bg_color',
			[
				'label' => __( 'Box Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-faq-accordion .accordion .ea-accordion-title, .ea-faq-accordion.style-two .accordion .ea-accordion-title, .ea-faq-accordion.style-three .accordion .ea-accordion-title, .ea-faq-accordion.style-four .accordion .ea-accordion-title, .ea-faq-accordion.style-five .accordion .ea-accordion-title, .ea-faq-accordion.style-six .accordion .ea-accordion-title, .ea-faq-accordion.style-seven .accordion .ea-accordion-title' => 'background: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
            'accordion_item_padding',
            [
                'label'         => esc_html__( 'Item Padding', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
            'accordion_item_margin',
            [
                'label'         => esc_html__( 'Item Margin', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'accordion_title_style',
			[
				'label' => __( 'Accordion Title Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

        $this->add_control(
			'accordion_title_color',
			[
				'label' => __( 'Accordion Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion a' => 'color: {{VALUE}}'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'accordion_title_typography',
                'label' => __( 'Accordion Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion a'
            ]
        );

        $this->add_group_control(
            \Elementor\Group_Control_Border::get_type(),
            [
                'name'     => 'accordion_box_title_border',
                'selector' => '{{WRAPPER}} .ea-faq-accordion .accordion .ea-accordion-title, .ea-faq-accordion.style-two .accordion .ea-accordion-title, .ea-faq-accordion.style-three .accordion .ea-accordion-title, .ea-faq-accordion.style-four .accordion .ea-accordion-title, .ea-faq-accordion.style-five .accordion .ea-accordion-title, .ea-faq-accordion.style-six .accordion .ea-accordion-title, .ea-faq-accordion.style-seven .accordion .ea-accordion-title',
            ]
        );

        $this->add_control(
            'accordion_title_padding',
            [
                'label'         => esc_html__( 'Title Padding', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .ea-accordion-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
            'accordion_title_margin',
            [
                'label'         => esc_html__( 'Title Margin', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .ea-accordion-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->end_controls_section();

        $this->start_controls_section(
			'accordion_content_style',
			[
				'label' => __( 'Accordion Content Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

        $this->add_control(
			'accordion_content_color',
			[
				'label' => __( 'Accordion Content Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion p' => 'color: {{VALUE}}'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'accordion_content_typography',
                'label' => __( 'Accordion Content Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion p'
            ]
        );

        $this->add_group_control(
            \Elementor\Group_Control_Border::get_type(),
            [
                'name'     => 'accordion_box_content_border',
                'selector' => '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-content',
            ]
        );

        $this->add_group_control(
            \Elementor\Group_Control_Box_Shadow::get_type(),
            [
                'name'     => 'accordion_content_box_shadow',
                'selector' => '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-content',
            ]
        );

        $this->add_control(
            'accordion_content_padding',
            [
                'label'         => esc_html__( 'Content Padding', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
            'accordion_content_margin',
            [
                'label'         => esc_html__( 'Content Margin', 'endless-addons' ),
                'type'          => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units'    => [ 'px', '%', 'em' ],
                'selectors'     => [
                    '{{WRAPPER}} .ea-accordion-area .ea-faq-accordion .accordion-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'_section_overlay_style',
			[
				'label' => __('Background Overlay', 'endless-addons'),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
                    'select_accordion_style' => array('style-01', 'style-03', 'style-04', 'style-05', 'style-06', 'style-07'),
                ]
			]
		);

		$this->start_controls_tabs('_tabs_overlay_style');

		$this->start_controls_tab(
			'_tab_overlay_normal',
			[
				'label' => __('Normal', 'endless-addons'),
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_normal',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-accordion-area, .ea-accordion-area.ea-bg-color-f0f2f9, .ea-accordion-area.ea-bg-images::before',
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'_tab_overlay_hover',
			[
				'label' => __('Hover', 'endless-addons'),
			]
		);


		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_hover',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-accordion-area:hover, .ea-accordion-area.ea-bg-color-f0f2f9:hover, .ea-accordion-area.ea-bg-images:hover::before',
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->end_controls_section();

		require plugin_dir_path( dirname( __FILE__ ) ) . 'floating/ea-accordion-floating.php';

	}

	/**
	 * Render Accordion widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function render() {

		$settings = $this->get_settings_for_display(); 

		if( $settings['show_accordion'] == 'show' ) :

			if( $settings['select_accordion_style'] == 'style-01' ) : ?>
				<!-- Start EA Accordion Design One Area -->
		        <section class="ea-accordion-area pb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
							<div class="col-lg-6">
								<div class="ea-faq-accordion">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
											<li class="accordion-item left">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
				                                	<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
							<div class="col-lg-6">
								<div class="ea-faq-accordion">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_right'] as $item ) : ?>
											<li class="accordion-item right">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design One Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-02' ) : ?>
				<!-- Start EA Accordion Design Two Area -->
		        <section class="ea-accordion-area style-two ptb-100">
		            <div class="container">
		                <div class="section-title white-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
						<div class="ea-faq-accordion style-two">
							<ul class="accordion">
								<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
									<li class="accordion-item left">
										<a class="ea-accordion-title" href="javascript:void(0)">
											<?php if( $item['icon_type'] == 'general' ) : ?>
		                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
		                                	<?php else: 
		                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
		                                	endif; ?>
											<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
										</a>
										<div class="accordion-content">
											<?php if($item['ea_content_text_type'] == 'content') : ?>
			                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
				                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
				                            	<p>
				                            		<?php if (!empty($item['ea_content_templates'])) {
										                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
										            } ?>
				                            	</p>
				                            <?php endif; ?>
										</div>
									</li>
								<?php endforeach; ?>
							</ul>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Two Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-03' ) : ?>
				<!-- Start EA Accordion Design Three Area -->
		        <section class="ea-accordion-area pb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
						<div class="ea-faq-accordion style-three">
							<ul class="accordion">
								<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
									<li class="accordion-item left">
										<a class="ea-accordion-title" href="javascript:void(0)">
											<?php if( $item['icon_type'] == 'general' ) : ?>
		                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
		                                	<?php else: 
		                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
		                                	endif; ?>
											<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
										</a>
										<div class="accordion-content">
											<?php if($item['ea_content_text_type'] == 'content') : ?>
			                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
				                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
				                            	<p>
				                            		<?php if (!empty($item['ea_content_templates'])) {
										                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
										            } ?>
				                            	</p>
				                            <?php endif; ?>
										</div>
									</li>
								<?php endforeach; ?>
							</ul>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Three Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-04' ) : ?>
				<!-- Start EA Accordion Design Four Area -->
		        <section class="ea-accordion-area ea-bg-color-f0f2f9 ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
							<div class="col-lg-6">
								<div class="ea-faq-accordion style-four">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
											<li class="accordion-item left">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
							<div class="col-lg-6">
								<div class="ea-faq-accordion style-four">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_right'] as $item ) : ?>
											<li class="accordion-item right">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Four Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-05' ) : ?>
				<!-- Start EA Accordion Design Five Area -->
		        <section class="ea-accordion-area ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
						<div class="ea-faq-accordion style-five">
							<ul class="accordion">
								<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
									<li class="accordion-item left">
										<a class="ea-accordion-title" href="javascript:void(0)">
											<?php if( $item['icon_type'] == 'general' ) : ?>
		                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
		                                	<?php else: 
		                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
		                                	endif; ?>
											<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
										</a>
										<div class="accordion-content">
											<?php if($item['ea_content_text_type'] == 'content') : ?>
			                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
				                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
				                            	<p>
				                            		<?php if (!empty($item['ea_content_templates'])) {
										                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
										            } ?>
				                            	</p>
				                            <?php endif; ?>
										</div>
									</li>
								<?php endforeach; ?>
							</ul>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Five Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-06' ) : ?>
				<!-- Start EA Accordion Design Six Area -->
		        <section class="ea-accordion-area ea-bg-images ptb-100">
		            <div class="container">
		                <div class="section-title white-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
							<div class="col-lg-6">
								<div class="ea-faq-accordion style-six">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
											<li class="accordion-item left">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
							<div class="col-lg-6">
								<div class="ea-faq-accordion style-six">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_right'] as $item ) : ?>
											<li class="accordion-item right">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Six Area -->
		    <?php elseif( $settings['select_accordion_style'] == 'style-07' ) : ?>
		        <!-- Start EA Accordion Design Six Area -->
		        <section class="ea-accordion-area style-seven bg-shape pt-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['accordion_title']); ?></h2>
			                <p><?php echo wp_kses_post($settings['accordion_desc']); ?></p>
		                </div>
		                <div class="row align-items-center">
							<div class="col-lg-6">
								<div class="ea-accordion-mg ea-mb-30 ea-elementor-floating">
		                            <?php if( ! $settings['accordion_featured_img']['url'] == '' ) : ?>  
		                            	<?php echo \Elementor\Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'accordion_featured_img' ); ?>
	                                <?php endif; ?>
		                        </div>
							</div>
							<div class="col-lg-6">
								<div class="ea-faq-accordion style-seven">
									<ul class="accordion">
										<?php foreach ( $settings['single_accordion_left'] as $item ) : ?>
											<li class="accordion-item left">
												<a class="ea-accordion-title" href="javascript:void(0)">
													<?php if( $item['icon_type'] == 'general' ) : ?>
				                                	    <i class="<?php echo wp_kses_post( $item['single_accordion_icon1'] ); ?>"></i>
				                                	<?php else: 
				                                		endad_render_icon( $item, 'icon', 'single_accordion_icon2' ); 
				                                	endif; ?>
													<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-title"><?php echo wp_kses_post($item['single_accordion_name']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>	
												</a>
												<div class="accordion-content">
													<?php if($item['ea_content_text_type'] == 'content') : ?>
					                                    <p><?php echo wp_kses_post($item['single_accordion_content']); ?></p>
						                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
						                            	<p>
						                            		<?php if (!empty($item['ea_content_templates'])) {
												                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
												            } ?>
						                            	</p>
						                            <?php endif; ?>
												</div>
											</li>
										<?php endforeach; ?>
									</ul>
								</div>
							</div>
						</div>
		            </div>
		        </section>
		        <!-- End EA Accordion Design Six Area -->
            <?php endif;

        endif;

    }

}
