<?php

namespace Unlockafe_addons\Widgets;

use Unlockafe_addons\Traits\Utils as UnlockafeUtils;
use Unlockafe_addons\Traits\Widget_helper;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Control_Media;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Typography;
use \Elementor\Group_Control_Background;
use \Elementor\Repeater;

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

/**
 * FAQ (Accordion) Widget
 *
 * @since 1.0.0
 */
class FAQ extends Widget_Base
{

	use Widget_helper, UnlockafeUtils;

	/**
	 * Retrieve the widget name.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name()
	{
		return 'unlockafe-faq';
	}

	/**
	 * Retrieve the widget title.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title()
	{
		return __('WPRealizer - Accordion', 'unlock-addons-for-elementor');
	}

	/**
	 * Retrieve the widget icon.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon()
	{
		return 'eicon-accordion ulicon';
	}

	/**
	 * Retrieve the list of categories the widget belongs to.
	 *
	 * Used to determine where to display the widget in the editor.
	 *
	 * Note that currently Elementor supports only one category.
	 * When multiple categories passed, Elementor uses the first one.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories()
	{
		return ['unlockafe-addons'];
	}

	/**
	 * Retrieve the list of scripts the widget depended on.
	 *
	 * Used to set scripts dependencies required to run the widget.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return array Widget scripts dependencies.
	 */
	public function get_script_depends()
	{
		return [];
	}

	public function get_style_depends()
	{
		return ['unlockafe-global'];
	}

	/**
	 * Register the widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.0
	 *
	 * @access protected
	 */

	protected function register_controls()
	{
		$this->register_controls_section();
		$this->style_tab_content();
	}

	protected function register_controls_section()
	{
		// layout Panel
		$this->start_controls_section(
			'wpr_layout',
			[
				'label' => esc_html__('Design Layout', 'unlock-addons-for-elementor'),
			]
		);

		$this->add_control(
			'wpr_design_style',
			[
				'label' => esc_html__('Select Layout', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'layout-1' => esc_html__('Layout 1', 'unlock-addons-for-elementor'),
					'layout-2' => esc_html__('Layout 2', 'unlock-addons-for-elementor'),
					'layout-3' => esc_html__('Layout 3', 'unlock-addons-for-elementor'),
					'layout-4' => esc_html__('Layout 4', 'unlock-addons-for-elementor'),
					'layout-5' => esc_html__('Layout 5', 'unlock-addons-for-elementor'),
					'layout-6' => esc_html__('Layout 6', 'unlock-addons-for-elementor'),
					// 'layout-7' => esc_html__('Layout 7', 'unlock-addons-for-elementor'),
				],
				'default' => 'layout-1',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'faq_section',
			[
				'label' => esc_html__('Title & Description', 'unlock-addons-for-elementor'),
				'tab' => Controls_Manager::TAB_CONTENT,
				'condition' => [
					'wpr_design_style' => ['layout-10']
				]
			]
		);

		$this->add_control(
			'faq_subtitle',
			[
				'label' => esc_html__('Subtitle', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('Digital', 'unlock-addons-for-elementor'),
				'placeholder' => esc_html__('Your Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$this->add_control(
			'faq_title',
			[
				'label' => esc_html__('Title', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('productivity', 'unlock-addons-for-elementor'),
				'placeholder' => esc_html__('Your Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$this->add_control(
			'faq_description',
			[
				'label' => esc_html__('Description', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'default' => esc_html__('Description', 'unlock-addons-for-elementor'),
				'placeholder' => esc_html__('Your Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'wpr_design_style' => ['layout-10']
				]
			]
		);

		$this->add_control(
			'faq_title_tag',
			[
				'label' => esc_html__('Title HTML Tag', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::CHOOSE,
				'options' => [
					'h1' => [
						'title' => esc_html__('H1', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h1'
					],
					'h2' => [
						'title' => esc_html__('H2', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h2'
					],
					'h3' => [
						'title' => esc_html__('H3', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h3'
					],
					'h4' => [
						'title' => esc_html__('H4', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h4'
					],
					'h5' => [
						'title' => esc_html__('H5', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h5'
					],
					'h6' => [
						'title' => esc_html__('H6', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-editor-h6'
					]
				],
				'default' => 'h4',
				'toggle' => false,
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'_accordion',
			[
				'label' => esc_html__('Accordion', 'unlock-addons-for-elementor'),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'wpr_faq_box_bgcolor',
			[
				'label' => esc_html__('Box BG Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .faq-2__item' => 'background-color: {{VALUE}} !important',
				],
				'condition' => [
					'wpr_design_style' => 'layout-100',
				],
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'repeater_condition',
			[
				'label' => __('Field condition', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'style_1' => __('Style 1', 'unlock-addons-for-elementor'),
					'style_2' => __('Style 2', 'unlock-addons-for-elementor'),
					'style_3' => __('Style 3', 'unlock-addons-for-elementor'),
					'style_4' => __('Style 4', 'unlock-addons-for-elementor'),
					'style_5' => __('Style 5', 'unlock-addons-for-elementor'),
					'style_6' => __('Style 6', 'unlock-addons-for-elementor'),
					// 'style_7' => __('Style 7', 'unlock-addons-for-elementor'),
				],
				'default' => 'style_1',
				'frontend_available' => true,
				'style_transfer' => true,
			]
		);

		$repeater->add_control(
			'wpr_accordion_active_switch',
			[
				'label' => esc_html__('Show', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__('Show', 'unlock-addons-for-elementor'),
				'label_off' => esc_html__('Hide', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default' => '0',
			]
		);

		$repeater->add_control(
			'activate_accordion_box',
			[
				'label'        => __('Active', 'unlock-addons-for-elementor'),
				'type'         => \Elementor\Controls_Manager::SWITCHER,
				'label_on'     => __('Yes', 'unlock-addons-for-elementor'),
				'label_off'    => __('No', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default'      => 'no',
				'condition' => [
					'repeater_condition' => ['style_10'],
				]
			]
		);

		$repeater->add_control(
			'accordion_data_delay',
			[
				'label' => esc_html__('Accordion Animation Delay', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('.2s', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_1', 'style_5']
				]
			]
		);

		$repeater->add_control(
			'accordion_title',
			[
				'label' => esc_html__('Accordion Title', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('This is accordion item title', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$repeater->add_control(
			'accordion_description',
			[
				'label' => esc_html__('Description', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('intermediate'),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'default' => 'Facilis fugiat hic ipsam iusto laudantium libero maiores minima molestiae mollitia repellat rerum sunt ullam voluptates? Perferendis, suscipit.',
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_1', 'style_2', 'style_3', 'style_4', 'style_5']
				]
			]
		);

		$repeater->add_control(
			'accordion_date',
			[
				'label' => esc_html__('Date', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => 'Aug 2017 – Dec 2018',
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_50']
				]
			]
		);

		$repeater->add_control(
			'accordion_subject',
			[
				'label' => esc_html__('Subject', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => 'Nova Mobile Labs',
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_50']
				]
			]
		);

		$repeater->add_control(
			'faq_inner_logo',
			[
				'label' => esc_html__('Inner Logo', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				],
				'condition' => [
					'repeater_condition' => ['style_100']
				]
			]
		);

		$repeater->add_control(
			'faq_inner_image',
			[
				'label' => esc_html__('Inner Image', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				],
				'condition' => [
					'repeater_condition' => ['style_100']
				]
			]
		);

		$repeater->add_control(
			'faq_inner_image2',
			[
				'label' => esc_html__('Inner Image 02', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				],
				'condition' => [
					'repeater_condition' => ['style_140']
				]
			]
		);

		$repeater->add_control(
			'wpr_btn_link_switcher',
			[
				'label' => esc_html__('Button', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => esc_html__('Yes', 'unlock-addons-for-elementor'),
				'label_off' => esc_html__('No', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default' => 'no',
				'separator' => 'before',
				'condition' => [
					'repeater_condition' => ['style_100']
				]
			]
		);

		$repeater->add_control(
			'wpr_btn_text',
			[
				'label' => esc_html__('Button Text', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__('Button Text', 'unlock-addons-for-elementor'),
				'title' => esc_html__('Enter button text', 'unlock-addons-for-elementor'),
				'label_block' => false,
				'condition' => [
					'wpr_btn_link_switcher' => 'yes',
				],
			]
		);
		$repeater->add_control(
			'wpr_btn_link_type',
			[
				'label' => esc_html__('Button Link Type', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SELECT,
				'options' => [
					'1' => 'Custom Link',
					'2' => 'Internal Page',
				],
				'default' => '1',
				'condition' => [
					'wpr_btn_link_switcher' => 'yes',
				]
			]
		);
		$repeater->add_control(
			'wpr_btn_link',
			[
				'label' => esc_html__('Button Link', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::URL,
				'dynamic' => [
					'active' => true,
				],
				'placeholder' => esc_html__('https://your-link.com', 'unlock-addons-for-elementor'),
				'show_external' => true,
				'default' => [
					'url' => '#',
					'is_external' => false,
					'nofollow' => false,
				],
				'condition' => [
					'wpr_btn_link_type' => '1',
					'wpr_btn_link_switcher' => 'yes',
				]
			]
		);
		$repeater->add_control(
			'wpr_btn_page_link',
			[
				'label' => esc_html__('Select Button Link Page', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SELECT2,
				'label_block' => true,
				'options' => $this->tp_get_all_pages(),
				'condition' => [
					'wpr_btn_link_type' => '2',
					'wpr_btn_link_switcher' => 'yes',
				]
			]
		);

		$repeater->add_control(
			'accordion_number',
			[
				'label' => esc_html__('Accordion Number', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('001', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_1', 'style_200']
				]
			]
		);

		$repeater->add_control(
			'accordian_list',
			[
				'label' => esc_html__('Accordion List', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXTAREA,
				'default' => esc_html__('Accordion List', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'repeater_condition' => ['style_15']
				]
			]
		);

		$nested_repeater = new \Elementor\Repeater();

		// Add controls to the nested repeater
		$nested_repeater->add_control(
			'nested_title',
			[
				'label' => esc_html__('Position', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('Nested Item Title', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$nested_repeater->add_control(
			'nested_dep',
			[
				'label' => esc_html__('Company', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('at Envato Market', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$nested_repeater->add_control(
			'nested_date',
			[
				'label' => esc_html__('Date', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::TEXT,
				'default' => esc_html__('2021 - Present', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		// Add more nested repeater controls as needed...

		// Add the nested repeater to the main repeater
		$repeater->add_control(
			'nested_items',
			[
				'label' => esc_html__('Body Items', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $nested_repeater->get_controls(),
				'default' => [
					[
						'nested_title' => esc_html__('Front-end Developer', 'unlock-addons-for-elementor'),
					],
					[
						'nested_title' => esc_html__('Developer & Co-Founder', 'unlock-addons-for-elementor'),
					],
				],
				'title_field' => '{{{ nested_title }}}',
				// Optional: Add condition if you want this to appear only for specific styles
				'condition' => [
					'repeater_condition' => ['style_20'] // or whatever style you want
				]
			]
		);
		// End controls to the nested repeater

		$this->add_control(
			'accordions',
			[
				'label' => esc_html__('Repeater Accordion', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'separator' => 'before',
				'default' => [
					[
						'accordion_title' => esc_html__('This is accordion item title #1', 'unlock-addons-for-elementor'),
					],
					[
						'accordion_title' => esc_html__('This is accordion item title #2', 'unlock-addons-for-elementor'),
					],
					[
						'accordion_title' => esc_html__('This is accordion item title #3', 'unlock-addons-for-elementor'),
					],
					[
						'accordion_title' => esc_html__('This is accordion item title #4', 'unlock-addons-for-elementor'),
					],
				],
				'title_field' => '{{{ accordion_title }}}',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'wpr_theme_btn_button_group',
			[
				'label' => esc_html__('Theme Button', 'unlock-addons-for-elementor'),
				'tab' => Controls_Manager::TAB_CONTENT,
				'condition' => [
					'wpr_design_style' => ['layout-10']
				]
			]
		);

		$this->add_control(
			'wpr_button_type',
			[
				'label' => esc_html__('Button Style Type', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT,
				'default' => 'inline',
				'options' => [
					'inline' => esc_html__('Inline', 'unlock-addons-for-elementor'),
					'w-100 d-block' => esc_html__('Full Width', 'unlock-addons-for-elementor'),
				],

			]
		);

		$this->add_control(
			'wpr_theme_btn_button_show',
			[
				'label' => esc_html__('Show Button', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__('Show', 'unlock-addons-for-elementor'),
				'label_off' => esc_html__('Hide', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->add_control(
			'wpr_theme_btn_text',
			[
				'label' => esc_html__('Button Text', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::TEXT,
				'default' => esc_html__('Read More', 'unlock-addons-for-elementor'),
				'title' => esc_html__('Enter button text', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'wpr_theme_btn_button_show' => 'yes'
				],
			]
		);

		$this->add_control(
			'wpr_theme_btn_line_effect',
			[
				'label' => esc_html__('Line Effect', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => esc_html__('Show', 'unlock-addons-for-elementor'),
				'label_off' => esc_html__('Hide', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default' => 'no',
				'condition' => [
					'wpr_theme_btn_button_show' => 'yes',
					'wpr_design_style!' => ['layout-1', 'layout-2', 'layout-3']
				],
			]
		);

		$this->add_control(
			'wpr_theme_btn_icon_show',
			[
				'label' => esc_html__('Add Icon ?', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => esc_html__('Show', 'unlock-addons-for-elementor'),
				'label_off' => esc_html__('Hide', 'unlock-addons-for-elementor'),
				'return_value' => 'yes',
				'default' => 'no',
			]
		);

		$this->tp_single_icon_control('theme_btn', 'wpr_theme_btn_icon_show', 'yes');

		$this->add_control(
			'wpr_theme_btn_icon_position',
			[
				'label' => esc_html__('Choose Icon Position', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'left' => [
						'title' => esc_html__('Left', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-h-align-left',
					],
					'right' => [
						'title' => esc_html__('Right', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-h-align-right',
					],
				],
				'default' => 'right',
				'toggle' => true,
				'condition' => [
					'wpr_theme_btn_icon_show' => 'yes',
					'wpr_design_style' => ['layout-1', 'layout-4']
				],
			]
		);

		$this->add_control(
			'wpr_theme_btn_link_type',
			[
				'label' => esc_html__('Button Link Type', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'1' => 'Custom Link',
					'2' => 'Internal Page',
				],
				'default' => '1',
				'label_block' => true,
				'condition' => [
					'wpr_theme_btn_button_show' => 'yes'
				],
			]
		);
		$this->add_control(
			'wpr_theme_btn_link',
			[
				'label' => esc_html__('Button link', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::URL,
				'dynamic' => [
					'active' => true,
				],
				'placeholder' => esc_html__('https://your-link.com', 'unlock-addons-for-elementor'),
				'show_external' => false,
				'default' => [
					'url' => '#',
					'is_external' => false,
					'nofollow' => false,
				],
				'condition' => [
					'wpr_theme_btn_link_type' => '1',
					'wpr_theme_btn_button_show' => 'yes'
				],
				'label_block' => true,
			]
		);
		$this->add_control(
			'wpr_theme_btn_page_link',
			[
				'label' => esc_html__('Select Button Link Page', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT2,
				'label_block' => true,
				'options' => $this->tp_get_all_types_post('page'),
				'condition' => [
					'wpr_theme_btn_link_type' => '2',
					'wpr_theme_btn_button_show' => 'yes'
				]
			]
		);

		$this->add_responsive_control(
			'wpr_button_align',
			[
				'label' => esc_html__('Alignment', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::CHOOSE,
				'options' => [
					'start' => [
						'title' => esc_html__('Left', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-text-align-left',
					],
					'center' => [
						'title' => esc_html__('Center', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-text-align-center',
					],
					'end' => [
						'title' => esc_html__('Right', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-text-align-right',
					],
				],
				'default' => 'center',
				'selectors' => [
					'{{WRAPPER}} .wpr-el-theme-btn' => 'justify-content: {{VALUE}};',
				],
				'frontend_available' => true,
				'toggle' => true,
			]
		);
		$this->end_controls_section();
	}

	// style_tab_content
	protected function style_tab_content()
	{

		$this->tp_section_style_controls('faq_section', 'Section - Style', '.wpr-el-section');
		$this->tp_box_controls_style('wpr_rep_box_style', 'Accordion Box - Style', '.wpr-el-box', ['layout-1', 'layout-2', 'layout-5', 'layout-6']);

		$this->tp_basic_style_controls('faq_feature_list_title', 'Accordion Title - Style', '.wpr-el-rep-title');
		$this->tp_basic_style_controls('faq_description', 'Accordion Description - Style', '.wpr-el-rep-desc', ['layout-1', 'layout-2', 'layout-5', 'layout-6']);

		$this->tp_link_controls_style('wpr_repeater_num_style', 'Accordion Number - Style', '.accordion-wrapper-4 .accordion-item:before', ['layout-20']);
		$this->tp_link_controls_style('wpr_repeater_num_style_active', 'Accordion Number Active - Style', '.accordion-wrapper-4 .accordion-item.active:before ', ['layout-20']);

		$this->tp_basic_style_controls('faq_nes_title', 'Body Repeater Title', '.wpr-el-nes-title', ['layout-200']);
		$this->tp_basic_style_controls('faq_nes_company', 'Body Repeater Company', '.wpr-el-nes-dep', ['layout-200']);
		$this->tp_basic_style_controls('faq_nes_date', 'Body Repeater Date', '.wpr-el-nes-date', ['layout-200']);
		$this->tp_basic_style_controls('faq_nes_number', 'FAQ Number', '.wpr-el-nes-number', ['layout-400']);

		$this->start_controls_section(
			'wpr_image_style_sec',
			[
				'label' => esc_html__('Image Styles', 'unlock-addons-for-elementor'),
				'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
					'wpr_design_style' => ['layout-10']
				]
			]
		);

		$this->add_control(
			'wpr_image_style_width',
			[
				'label' => esc_html__('Width', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SLIDER,
				'size_units' => ['px', '%', 'em', 'rem', 'custom'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-image img' => 'width: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
			'wpr_image_style_height',
			[
				'label' => esc_html__('Height', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SLIDER,
				'size_units' => ['px', '%', 'em', 'rem', 'custom'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-image img' => 'height: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
			'wpr_image_object_style',
			[
				'label' => esc_html__('Object Fit', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::SELECT,
				'default' => 'cover',
				'options' => [
					'none' => esc_html__('None', 'unlock-addons-for-elementor'),
					'contain'  => esc_html__('Contain', 'unlock-addons-for-elementor'),
					'cover' => esc_html__('Cover', 'unlock-addons-for-elementor'),
					'fill' => esc_html__('fill', 'unlock-addons-for-elementor'),
				],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-image img' => 'object-fit: {{VALUE}};',
				],
			]
		);

		$this->end_controls_section();
	}


	/**
	 * Render the widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.0
	 *
	 * @access protected
	 */
	protected function render()
	{
		$settings = $this->get_settings_for_display();
		$btn_id = 'theme_btn';

?>


		<?php if ($settings['wpr_design_style'] == 'layout-2'): ?>

			<div class="accordion faq__accordion wpr-el-section" id="accordionExample">
				<?php foreach ($settings['accordions'] as $key => $item):
					$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
					$show = $item['wpr_accordion_active_switch'] ? 'show' : '';
					$collapse_id = 'collapse_' . esc_attr($this->get_id() . $key);
				?>
					<div class="accordion-item wpr-el-box">
						<h5 class="accordion-header wpr-el-rep-title">
							<button
								class="accordion-button <?php echo $collapsed; ?>"
								type="button"
								data-bs-toggle="collapse"
								data-bs-target="#<?php echo $collapse_id; ?>"
								aria-expanded="<?php echo $item['wpr_accordion_active_switch'] ? 'true' : 'false'; ?>"
								aria-controls="<?php echo $collapse_id; ?>">
								<?php echo esc_html($item['accordion_title']); ?>
							</button>
						</h5>
						<div
							id="<?php echo $collapse_id; ?>"
							class="accordion-collapse collapse <?php echo $show; ?>"
							data-bs-parent="#accordionExample">
							<div class="accordion-body wpr-el-rep-desc">
								<?php echo esc_html($item['accordion_description']); ?>
							</div>
						</div>
					</div>
				<?php endforeach; ?>
			</div>


		<?php elseif ($settings['wpr_design_style'] == 'layout-3') : ?>

			<div class="accordion faq-5__accordion" id="accordionExample">
				<div class="accordion-row">
					<?php foreach ($settings['accordions'] as $key => $item):
						$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
						$show = $item['wpr_accordion_active_switch'] ? 'show' : '';
						$collapse_id = 'collapse_' . esc_attr($this->get_id() . $key);
					?>
						<div class="accordion-item wpr-el-box">
							<h5 class="accordion-header">
								<button class="accordion-button wpr-el-rep-title <?php echo $collapsed; ?>"
									type="button"
									data-bs-toggle="collapse"
									data-bs-target="#<?php echo $collapse_id; ?>" aria-expanded="<?php echo $item['wpr_accordion_active_switch'] ? 'true' : 'false'; ?>"
									aria-controls="<?php echo $collapse_id; ?>">
									<?php echo esc_html($item['accordion_title']); ?>
								</button>
							</h5>
							<div id="<?php echo $collapse_id; ?>"
								class="accordion-collapse collapse <?php echo $show; ?>"
								data-bs-parent="#accordionExample">
								<div class="accordion-body wpr-el-rep-desc">
									<?php echo esc_html($item['accordion_description']); ?>
								</div>
							</div>
						</div>
					<?php endforeach; ?>
				</div>
			</div>


		<?php elseif ($settings['wpr_design_style'] == 'layout-4') : ?>

			<div class="accordion faq-5__accordion" id="accordionExample2">
				<div class="accordion-row">
					<?php foreach ($settings['accordions'] as $key => $item):
						$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
						$show = $item['wpr_accordion_active_switch'] ? 'show' : '';
						$collapse_id = 'collapse_' . esc_attr($this->get_id() . $key);
					?>
						<div class="accordion-item wpr-el-box">
							<h5 class="accordion-header">
								<button class="accordion-button wpr-el-rep-title <?php echo $collapsed; ?>"
									type="button"
									data-bs-toggle="collapse"
									data-bs-target="#<?php echo $collapse_id; ?>" aria-expanded="<?php echo $item['wpr_accordion_active_switch'] ? 'true' : 'false'; ?>"
									aria-controls="<?php echo $collapse_id; ?>">
									<?php echo esc_html($item['accordion_title']); ?>
								</button>
							</h5>
							<div id="<?php echo $collapse_id; ?>"
								class="accordion-collapse collapse <?php echo $show; ?>"
								data-bs-parent="#accordionExample2">
								<div class="accordion-body wpr-el-rep-desc">
									<?php echo esc_html($item['accordion_description']); ?>
								</div>
							</div>
						</div>
					<?php endforeach; ?>
				</div>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-5') : ?>

			<div class="faq-6__accordion accordion" id="accordionExample">
				<?php foreach ($settings['accordions'] as $key => $item):
					$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
					$show = $item['wpr_accordion_active_switch'] ? 'show' : '';

				?>
					<div class="accordion-item fade-anim" data-delay="<?php echo esc_attr($item['accordion_data_delay']); ?>">
						<h5 class="accordion-header">
							<button
								class="wpr-el-box accordion-button wpr-el-rep-title <?php echo esc_attr($collapsed); ?>"
								type="button"
								data-bs-toggle="collapse"
								data-bs-target="#collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
								aria-expanded="true"
								aria-controls="collapse_<?php echo esc_attr($this->get_id() . $key); ?>">
								<?php echo esc_html($item['accordion_title']); ?>
							</button>
						</h5>
						<div
							id="collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
							class="accordion-collapse collapse <?php echo esc_attr($show); ?>"
							data-bs-parent="#accordionExample">
							<div class="wpr-el-box accordion-body wpr-el-rep-desc">
								<?php echo esc_html($item['accordion_description']); ?>
							</div>
						</div>
					</div>
				<?php endforeach; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-6') : ?>


			<div class="faq-7 faq-7__accordion accordion wpr-el-section" id="accordionExample">
				<?php foreach ($settings['accordions'] as $key => $item):
					$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
					$show = $item['wpr_accordion_active_switch'] ? 'show' : '';

				?>
					<div class="wpr-el-box accordion-item fade-anim" data-delay="<?php echo esc_attr($item['accordion_data_delay']); ?>">
						<h5 class="accordion-header">
							<button
								class="accordion-button wpr-el-rep-title <?php echo esc_attr($collapsed); ?>"
								type="button"
								data-bs-toggle="collapse"
								data-bs-target="#collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
								aria-expanded="true"
								aria-controls="collapse_<?php echo esc_attr($this->get_id() . $key); ?>">
								<?php echo esc_html($item['accordion_title']); ?>
							</button>
						</h5>
						<div
							id="collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
							class="accordion-collapse collapse <?php echo esc_attr($show); ?>"
							data-bs-parent="#accordionExample">
							<div class="accordion-body wpr-el-rep-desc">
								<?php echo esc_html($item['accordion_description']); ?>
							</div>
						</div>
					</div>
				<?php endforeach; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-7') : ?>

		<?php else: ?>

			<div class="accordion work-process-2__accordion wpr-el-section" id="accordionExample">
				<?php foreach ($settings['accordions'] as $key => $item):
					$collapsed = $item['wpr_accordion_active_switch'] ? '' : 'collapsed';
					$show = $item['wpr_accordion_active_switch'] ? 'show' : '';

				?>
					<div class="accordion-item fade-anim" data-delay="<?php echo esc_attr($item['accordion_data_delay']); ?>">
						<h5 class="accordion-header">
							<button
								class="accordion-button wpr-el-rep-title <?php echo esc_attr($collapsed); ?>"
								type="button"
								data-bs-toggle="collapse"
								data-bs-target="#collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
								aria-expanded="true"
								aria-controls="collapse_<?php echo esc_attr($this->get_id() . $key); ?>">
								<em class="wpr-el-rep-number"><?php echo esc_html($item['accordion_number']); ?></em>
								<?php echo esc_html($item['accordion_title']); ?>
								<span>
									<?php echo esc_html($item['accordion_description']); ?>
								</span>
							</button>
						</h5>
						<div
							id="collapse_<?php echo esc_attr($this->get_id() . $key); ?>"
							class="accordion-collapse collapse <?php echo esc_attr($show); ?>"
							data-bs-parent="#accordionExample">
							<div class="accordion-body wpr-el-rep-desc">
								<?php echo esc_html($item['accordion_description']); ?>
							</div>
						</div>
					</div>
				<?php endforeach; ?>
			</div>


<?php endif;
	}
}


