<?php

namespace ElementPack\Modules\FeaturedExpand\Widgets;

use Elementor\Repeater;
use ElementPack\Base\Module_Base;
use Elementor\Icons_Manager;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Box_Shadow;
use ElementPack\Utils;

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

class Featured_Expand extends Module_Base
{

	public function get_name()
	{
		return 'bdt-featured-expand';
	}

	public function get_title()
	{
		return BDTEP . esc_html__('Featured Expand', 'bdthemes-element-pack');
	}

	public function get_icon()
	{
		return 'bdt-wi-featured-expand';
	}

	public function get_categories()
	{
		return ['element-pack'];
	}

	public function get_keywords()
	{
		return ['featured', 'expand'];
	}

	public function get_style_depends()
	{
		if ($this->ep_is_edit_mode()) {
			return ['ep-all-styles'];
		} else {
			return ['ep-featured-expand'];
		}
	}



	// public function get_custom_help_url()
	// {
	//     return 'https://youtu.be/nuYa-0sWFxU';
	// }

	protected function _register_controls()
	{

		$this->start_controls_section(
			'section_layout',
			[
				'label' => esc_html__('Layout', 'bdthemes-element-pack'),
			]
		);

		$repeater = new Repeater();

		$repeater->add_control(
			'feature_sub_title',
			[
				'label'       => esc_html__('Sub Title', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::TEXT,
				'dynamic'     => ['active' => true],
				'label_block' => true,
				'default'    => esc_html__('Sub Title', 'bdthemes-element-pack'),
			]
		);

		$repeater->add_control(
			'feature_title',
			[
				'label'       => esc_html__('Title', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::TEXT,
				'dynamic'     => ['active' => true],
				'label_block' => true,
				'default'    => esc_html__('Feature Expand Title', 'bdthemes-element-pack'),
			]
		);

		$repeater->add_control(
			'feature_content',
			[
				'label'      => esc_html__('Content', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::WYSIWYG,
				'dynamic'    => ['active' => true],
				'show_label' => false,
				'default'    => esc_html__('Lorem Ipsum is simply dummy text of the printing and typesetting industry. It has been the industry\'s standard dummy text.', 'bdthemes-element-pack'),
			]
		);

		$repeater->add_control(
			'feature_image',
			[
				'label'   => esc_html__('Image', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
				'dynamic' => ['active' => true],
			]
		);



		$repeater->add_control(
			'featured_link',
			[
				'label'       => esc_html__('Link', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::URL,
				'dynamic'     => ['active' => true],
				'placeholder' => 'http://your-link.com',
				'default'     => [
					'url' => '#',
				],
			]
		);

		$this->add_control(
			'featured_list',
			[
				'label' => esc_html__('Feature Items', 'bdthemes-element-pack'),
				'type' => Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'feature_sub_title'   => esc_html__('Sub Title', 'bdthemes-element-pack'),
						'feature_title'   => esc_html__('Feature Expand Title #1', 'bdthemes-element-pack'),
						'feature_content' => esc_html__('Lorem Ipsum is simply dummy text of the printing and typesetting industry. It has been the industry\'s standard dummy text.', 'bdthemes-element-pack'),
					],
					[
						'feature_sub_title'   => esc_html__('Sub Title', 'bdthemes-element-pack'),
						'feature_title'   => esc_html__('Feature Expand Title #2', 'bdthemes-element-pack'),
						'feature_content' => esc_html__('Lorem Ipsum is simply dummy text of the printing and typesetting industry. It has been the industry\'s standard dummy text.', 'bdthemes-element-pack'),
					],
					[
						'feature_sub_title'   => esc_html__('Sub Title', 'bdthemes-element-pack'),
						'feature_title'   => esc_html__('Feature Expand Title #3', 'bdthemes-element-pack'),
						'feature_content' => esc_html__('Lorem Ipsum is simply dummy text of the printing and typesetting industry. It has been the industry\'s standard dummy text.', 'bdthemes-element-pack'),
					],
				],
				'title_field' => '{{{ feature_title }}}',
			]
		);

		$this->add_control(
			'title_tags',
			[
				'label'   => __('Title HTML Tag', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SELECT,
				'default' => 'h3',
				'options' => element_pack_title_tags(),
			]
		);

		$this->add_control(
			'show_button',
			[
				'label'   => esc_html__('Show Button', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SWITCHER,
				'default' => 'yes',
			]
		);

		$this->add_control(
			'expand_event',
			[
				'label'   => __('Select Event', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SELECT,
				'default' => 'mouseover',
				'options' => [
					'click'     => __('Click', 'bdthemes-element-pack'),
					'mouseover' => __('Hover', 'bdthemes-element-pack'),
				],
			]
		);

		$this->add_control(
			'active_item',
			[
				'label'   => esc_html__('Active Item', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SWITCHER,
			]
		);

		$this->add_control(
			'active_item_number',
			[
				'label'       => __('Item Number', 'bdthemes-element-pack'),
				'description' => __('Type your item number', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::NUMBER,
				'default'	  => 1,
				'condition' => [
					'active_item' => 'yes'
				]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_content_button',
			[
				'label'     => esc_html__('Button', 'bdthemes-element-pack'),
				'condition' => [
					'show_button' => 'yes',
				],
			]
		);

		$this->add_control(
			'button_text',
			[
				'label'       => esc_html__('Button Text', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::TEXT,
				'default'     => esc_html__('Read More', 'bdthemes-element-pack'),
				'placeholder' => esc_html__('Read More', 'bdthemes-element-pack'),
			]
		);

		$this->add_control(
			'button_icon',
			[
				'label'       => esc_html__('Icon', 'bdthemes-element-pack'),
				'type'        => Controls_Manager::ICONS,
				'label_block' => false,
				'skin' => 'inline'
			]
		);

		$this->add_control(
			'icon_align',
			[
				'label'   => esc_html__('Icon Position', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SELECT,
				'default' => 'right',
				'options' => [
					'left'  => esc_html__('Left', 'bdthemes-element-pack'),
					'right' => esc_html__('Right', 'bdthemes-element-pack'),
				],
				'condition' => [
					'button_icon[value]!' => '',
				],
			]
		);

		$this->add_control(
			'icon_indent',
			[
				'label'   => esc_html__('Icon Spacing', 'bdthemes-element-pack'),
				'type'    => Controls_Manager::SLIDER,
				'default' => [
					'size' => 8,
				],
				'range' => [
					'px' => [
						'max' => 50,
					],
				],
				'condition' => [
					'button_icon[value]!' => '',
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-icon-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-icon-align-left'  => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_style_items',
			[
				'label'     => esc_html__('Items', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'content_padding',
			[
				'label'      => esc_html__('Content Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_responsive_control(
			'image_height',
			[
				'label' => esc_html__('Item Height', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 150,
						'max' => 400,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-thumb' => 'height: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}} .bdt-featured-expand ' => '--bdt-image-height: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_style_image',
			[
				'label'     => esc_html__('Image', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_responsive_control(
			'image_space',
			[
				'label' => esc_html__('Spacing', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-thumb' => 'margin-right: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
			'image_padding',
			[
				'label'      => esc_html__('Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-thumb img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_style_sub_title',
			[
				'label'     => esc_html__('Sub Title', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'sub_title_padding',
			[
				'label'      => esc_html__('Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'sub_title_typography',
				'label'    => esc_html__('Typography', 'bdthemes-element-pack'),
				'selector' => '{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title',
			]
		);

		$this->add_responsive_control(
			'sub_title_space',
			[
				'label' => esc_html__('Space', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->start_controls_tabs(
			'style_tabs_sub_title'
		);

		$this->start_controls_tab(
			'style_normal_tab_sub_title',
			[
				'label' => __('Normal', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'sub_title_color',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'sub_title_background',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'style_hover_tab_sub_title',
			[
				'label' => __('Hover', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'sub_title_color_hover',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title:hover' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'sub_title_background_hover',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-sub-title:hover' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();


		$this->end_controls_section();

		$this->start_controls_section(
			'section_style_title',
			[
				'label'     => esc_html__('Title', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'title_padding',
			[
				'label'      => esc_html__('Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'title_typography',
				'label'    => esc_html__('Typography', 'bdthemes-element-pack'),
				'selector' => '{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title',
			]
		);

		$this->add_responsive_control(
			'title_space',
			[
				'label' => esc_html__('Space', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->start_controls_tabs(
			'style_tabs_title'
		);

		$this->start_controls_tab(
			'style_normal_feature_title',
			[
				'label' => __('Normal', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'title_color',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title *' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'title_background',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title *' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'style_hover_feature_title',
			[
				'label' => __('Hover', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'title_color_hover',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title:hover *' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'title_background_hover',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-title:hover *' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();


		$this->end_controls_section();

		$this->start_controls_section(
			'section_style_text',
			[
				'label'     => esc_html__('Text', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'text_padding',
			[
				'label'      => esc_html__('Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'text_typography',
				'label'    => esc_html__('Typography', 'bdthemes-element-pack'),
				'selector' => '{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc',
			]
		);

		$this->add_responsive_control(
			'text_space',
			[
				'label' => esc_html__('Space', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::SLIDER,
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->start_controls_tabs(
			'style_tabs_text'
		);

		$this->start_controls_tab(
			'style_normal_tab_text',
			[
				'label' => __('Normal', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'text_color',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'text_background',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'style_hover_tab_text',
			[
				'label' => __('Hover', 'bdthemes-element-pack'),
			]
		);


		$this->add_control(
			'text_color_hover',
			[
				'label'     => esc_html__('Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc:hover' => 'color: {{VALUE}}; -webkit-text-stroke-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'text_background_hover',
			[
				'label'     => esc_html__('Background', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-featured-expand-desc:hover' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();


		$this->end_controls_section();
		$this->start_controls_section(
			'section_style_button',
			[
				'label'     => esc_html__('Button', 'bdthemes-element-pack'),
				'tab'       => Controls_Manager::TAB_STYLE,
				'condition' => [
					'show_button' => 'yes',
				],
			]
		);

		$this->start_controls_tabs('tabs_button_style');

		$this->start_controls_tab(
			'tab_button_normal',
			[
				'label' => esc_html__('Normal', 'bdthemes-element-pack'),
			]
		);

		$this->add_control(
			'button_text_color',
			[
				'label'     => esc_html__('Text Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link' => 'color: {{VALUE}};',
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link svg' => 'fill: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'background_color',
			[
				'label'     => esc_html__('Background Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'tab_button_hover',
			[
				'label' => esc_html__('Hover', 'bdthemes-element-pack'),
			]
		);

		$this->add_control(
			'hover_color',
			[
				'label'     => esc_html__('Text Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link:hover' => 'color: {{VALUE}};',
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link:hover svg' => 'fill: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_background_hover_color',
			[
				'label'     => esc_html__('Background Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link:hover' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_hover_border_color',
			[
				'label'     => esc_html__('Border Color', 'bdthemes-element-pack'),
				'type'      => Controls_Manager::COLOR,
				'condition' => [
					'border_border!' => '',
				],
				'selectors' => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link:hover' => 'border-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_hover_animation',
			[
				'label' => esc_html__('Animation', 'bdthemes-element-pack'),
				'type'  => Controls_Manager::HOVER_ANIMATION,
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name'        => 'button_border',
				'label'       => esc_html__('Border', 'bdthemes-element-pack'),
				'placeholder' => '1px',
				'default'     => '1px',
				'selector'    => '{{WRAPPER}} .bdt-featured-expand .bdt-button-link',
				'separator'   => 'before',
			]
		);

		$this->add_control(
			'button_border_radius',
			[
				'label'      => esc_html__('Border Radius', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name'     => 'button_box_shadow',
				'selector' => '{{WRAPPER}} .bdt-featured-expand .bdt-button-link',
			]
		);

		$this->add_control(
			'button_padding',
			[
				'label'      => esc_html__('Padding', 'bdthemes-element-pack'),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', 'em', '%'],
				'selectors'  => [
					'{{WRAPPER}} .bdt-featured-expand .bdt-button-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'button_typography',
				'label'    => esc_html__('Typography', 'bdthemes-element-pack'),
				//'scheme'   => Schemes\Typography::TYPOGRAPHY_4,
				'selector' => '{{WRAPPER}} .bdt-featured-expand .bdt-button-link',
			]
		);

		$this->end_controls_section();
	}

	public function render()
	{

		$settings = $this->get_settings_for_display();

		if ($settings['expand_event']) {
			$imageAccordionEvent = $settings['expand_event'];
		} else {
			$imageAccordionEvent = false;
		}

		$this->add_render_attribute(
			[
				'featured-expand' => [
					'class' => 'bdt-featured-expand',
					'data-settings' => [
						wp_json_encode([
							'mouseEvent' => $imageAccordionEvent,
							'activeItem' => $settings['active_item'] == 'yes' ? true : false,
							'activeItemNumber' => $settings['active_item'] == 'yes' ? $settings['active_item_number'] : false
						])
					]
				]
			]
		);


?>
		<div <?php echo ($this->get_render_attribute_string('featured-expand')); ?>>
			<ul class="bdt-featured-expand-list">
				<?php
				$total =  count($settings['featured_list']);
				$i = 0;
				foreach ($settings['featured_list'] as $item) :
					$i++;
					$active_class_add = $total == $i ? ' bdt-feature-active ' : '';
					$active_class_add = $settings['active_item'] != 'yes' ?  $active_class_add : '';
					$this->add_render_attribute(
						[
							'button-link-attr' => [
								'class' => [
									'bdt-button bdt-button-link',
									$settings['button_hover_animation'] ? 'elementor-animation-' . $settings['button_hover_animation'] : '',
								],
								'href'   => isset($item['featured_link']['url']) ? esc_url($item['featured_link']['url']) : '#',
								'target' => isset($item['featured_link']['is_external']) && $item['featured_link']['is_external'] == 'on' ? '_blank' : '_self'
							]
						],
						'',
						'',
						true
					);
					$this->add_render_attribute(
						[
							'link-attr' => [
								'href'   => isset($item['featured_link']['url']) ? esc_url($item['featured_link']['url']) : '#',
								'target' => isset($item['featured_link']['is_external']) && $item['featured_link']['is_external'] == 'on' ? '_blank' : '_self'
							]
						],
						'',
						'',
						true
					);

				?>
					<li class="bdt-featured-expand-item <?php echo esc_attr($active_class_add); ?>">
						<div class="bdt-featured-expand-card">
							<a class="bdt-featured-expand-thumb span-col-5" <?php echo $this->get_render_attribute_string('link-attr'); ?>>
								<img src="<?php echo esc_url($item['feature_image']['url']); ?>" alt="<?php echo wp_kses_post($item['feature_title']); ?>">
							</a>
							<div class="bdt-featured-expand-content-wrapper span-col-7">
								<h6 class="bdt-featured-expand-sub-title">
									<?php echo esc_html($item['feature_sub_title']); ?>
								</h6>
								<<?php echo Utils::get_valid_html_tag($settings['title_tags']); ?> class="bdt-featured-expand-title">
									<a <?php echo $this->get_render_attribute_string('link-attr'); ?>>
										<?php echo esc_html($item['feature_title']); ?>
									</a>
								</<?php echo Utils::get_valid_html_tag($settings['title_tags']); ?>>
								<div class="bdt-featured-expand-desc">
									<?php echo wp_kses_post($item['feature_content']); ?>
								</div>
								<a <?php echo $this->get_render_attribute_string('button-link-attr'); ?>>
									<?php echo esc_html($settings['button_text']); ?>

									<?php if ($settings['button_icon']['value']) : ?>
										<span class="bdt-button-icon-align-<?php echo esc_attr($settings['icon_align']); ?>">
											<?php
											Icons_Manager::render_icon($settings['button_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']);
											?>
										</span>
									<?php endif; ?>
								</a>

							</div>
						</div>
					</li>
				<?php endforeach; ?>
			</ul>
		</div>
<?php
	}
}
