<?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_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\Group_Control_Image_Size;

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


/**
 * Heading Widget
 *
 * @since 1.0.0
 */
class Heading 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-heading';
	}

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

	/**
	 * Retrieve the widget icon.
	 *
	 * @since 1.0.0
	 *
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon()
	{
		return 'eicon-heading 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_content_controls();
		$this->register_style_controls();
	}

	protected function register_content_controls()
	{

		// 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'),
					'layout-8' => esc_html__('Layout 8', 'unlock-addons-for-elementor'),
					'layout-9' => esc_html__('Layout 9', 'unlock-addons-for-elementor'),
					'layout-10' => esc_html__('Layout 10', 'unlock-addons-for-elementor'),
					'layout-11' => esc_html__('Layout 11', 'unlock-addons-for-elementor'),
					'layout-12' => esc_html__('Layout 12', 'unlock-addons-for-elementor'),
					'layout-13' => esc_html__('Layout 13', 'unlock-addons-for-elementor'),
					'layout-14' => esc_html__('Layout 14', 'unlock-addons-for-elementor'),
					'layout-15' => esc_html__('Layout 15', 'unlock-addons-for-elementor'),
					'layout-16' => esc_html__('Layout 16', 'unlock-addons-for-elementor'),
					'layout-17' => esc_html__('Layout 17', 'unlock-addons-for-elementor'),
				],
				'default' => 'layout-1',
			]
		);

		$this->end_controls_section();

		// Title/Content
		$this->start_controls_section(
			'wpr_section_heading_settings',
			[
				'label' => __('Section Heading', 'unlock-addons-for-elementor'),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'wpr_subtitle_border_active_switch',
			[
				'label' => esc_html__('Subtitle Border', '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',
				'condition' => [
					'wpr_design_style' => ['layout-100']
				]
			]
		);

		$this->add_control(
			'heading_image',
			[
				'label' => esc_html__('Heading Image', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
				'condition' => [
					'wpr_design_style' => ['layout-100']
				]
			]
		);

		$this->add_control(
			'wpr_heading_subtitle',
			[
				'label' => esc_html__('Sub Title', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('basic'),
				'type' => Controls_Manager::TEXT,
				'default' => 'Sub Title',
				'placeholder' => esc_html__('Type Before Heading Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'wpr_design_style!' => ['layout-4', 'layout-5', 'layout-7', 'layout-15']
				]
			]
		);

		$this->add_control(
			'wpr_heading_title',
			[
				'label' => esc_html__('Title', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('intermediate'),
				'type' => Controls_Manager::TEXTAREA,
				'default' => 'Your Section Title',
				'placeholder' => esc_html__('Type Heading Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
			]
		);

		$this->add_control(
			'wpr_heading_title2',
			[
				'label' => esc_html__('Title 2', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('basic'),
				'type' => Controls_Manager::TEXT,
				'default' => 'Design',
				'placeholder' => esc_html__('Type Before Heading Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'wpr_design_style' => ['layout-15']
				]
			]
		);

		$this->add_control(
			'wpr_marquee_text',
			[
				'label' => esc_html__('Marquee Text', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('basic'),
				'type' => Controls_Manager::TEXT,
				'default' => 'CREATIVE DESIGN AGENCY',
				'placeholder' => esc_html__('Type Marquee Text', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition' => [
					'wpr_design_style' => ['layout-15']
				]
			]
		);

		$this->add_control(
			'wpr_title_active_letter_color',
			[
				'label' => esc_html__('Active Letter Text Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .title-stretch .letter.active' => 'color: {{VALUE}};',
				],
				'condition'   => ['wpr_design_style'   => ['layout-100']],
			]
		);

		$this->add_control(
			'wpr_heading_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' => 'h2',
				'toggle' => false,
			],
		);

		$this->add_control(
			'wpr_heading_anim_img',
			[
				'label' => esc_html__('Choose Image', 'unlock-addons-for-elementor'),
				'type' => \Elementor\Controls_Manager::MEDIA,
				'default' => [
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				],
				'condition'   => ['wpr_design_style'   => ['layout-100']],
			]
		);

		$this->add_control(
			'wpr_heading_description',
			[
				'label' => esc_html__('Description', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('intermediate'),
				'type' => Controls_Manager::TEXTAREA,
				'default' => 'There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration.',
				'placeholder' => esc_html__('Type section description here', 'unlock-addons-for-elementor'),
				'condition' => [
					'wpr_design_style' => ['layout-1', 'layout-2', 'layout-6', 'layout-7', 'layout-11', 'layout-12', 'layout-13', 'layout-16', 'layout-17']
				]
			]
		);

		$this->add_control(
			'wpr_heading_mail',
			[
				'label' => esc_html__('Mail', 'unlock-addons-for-elementor'),
				'description' => $this->tp_get_allowed_html_desc('basic'),
				'type' => Controls_Manager::TEXT,
				'default' => 'hello@orvio.com',
				'placeholder' => esc_html__('Type your email', 'unlock-addons-for-elementor'),
				'label_block' => true,
				'condition'   => ['wpr_design_style'   => ['layout-100']],
			]
		);

		$this->add_responsive_control(
			'wpr_heading_align',
			[
				'label' => esc_html__('Alignment', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::CHOOSE,
				'options' => [
					'left' => [
						'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',
					],
					'right' => [
						'title' => esc_html__('Right', 'unlock-addons-for-elementor'),
						'icon' => 'eicon-text-align-right',
					],
				],
				'default' => 'left',
				'toggle' => true,
				'selectors' => [
					'{{WRAPPER}} .wpr-align-box' => 'text-align: {{VALUE}};',
				],
				'condition'   => ['wpr_design_style!'   => ['layout-100']],
			]
		);
		$this->end_controls_section();

		// animation
		$this->tp_creative_animation(['layout-100']);
	}


	protected function register_style_controls()
	{
		// Style Tab Content
		$this->start_controls_section(
			'wpr_heading_area_styling',
			[
				'label' => __('Section - Style', 'unlock-addons-for-elementor'),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			[
				'name' => 'wpr_heading_area_background',
				'label' => esc_html__('Background', 'unlock-addons-for-elementor'),
				'types' => ['classic', 'gradient'],
				'selector' => '{{WRAPPER}} .wpr-el-section',
			]
		);
		$this->add_responsive_control(
			'wpr_heading__area_padding',
			[
				'label' => esc_html__('Padding', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-section' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading__area_margin',
			[
				'label' => esc_html__('Margin', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading__area_border_radius',
			[
				'label' => esc_html__('Border Radius', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
				],
				'separator' => 'before',
			]
		);
		$this->add_group_control(
			\Elementor\Group_Control_Border::get_type(),
			[
				'name' => 'name',
				'label' => esc_html__('label', 'unlock-addons-for-elementor'),
				'selector' => '{{WRAPPER}} .wpr-el-section',
			]
		);
		$this->end_controls_section();

		// Heading Title Style Tab

		$this->start_controls_section(
			'wpr_heading_title_style_settings',
			[
				'label' => __('Section - Title', 'unlock-addons-for-elementor'),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

		$this->start_controls_tabs('wpr_heading_title_tabs');

		// Normal Tab
		$this->start_controls_tab(
			'wpr_heading_title_normal_tab',
			[
				'label' => esc_html__('Normal', 'unlock-addons-for-elementor'),
			]
		);

		$this->add_control(
			'wpr_heading_title_normal_color',
			[
				'label' => esc_html__('Text Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-title' => 'color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		// Hover Tab
		$this->start_controls_tab(
			'wpr_heading_title_hover_tab',
			[
				'label' => esc_html__('Hover', 'unlock-addons-for-elementor'),
			]
		);

		$this->add_control(
			'wpr_heading_title_hover_color',
			[
				'label' => esc_html__('Hover Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-title:hover' => 'color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->add_control(
			'wpr_heading_title_tab_hover_transition',
			[
				'label' => esc_html__('Transition Duration', 'elementor') . ' (s)',
				'type' => Controls_Manager::SLIDER,
				'range' => [
					'' => [ // Use empty string for units like seconds
						'min' => 0,
						'max' => 10,
						'step' => 0.1,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-title' => 'transition: all {{SIZE}}s ease-in-out; -webkit-transition: all {{SIZE}}s ease-in-out;',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'wpr_heading_title_typography',
				'label' => esc_html__('Typography', 'unlock-addons-for-elementor'),
				'selector' => '{{WRAPPER}} .wpr-el-title',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_title_padding',
			[
				'label' => esc_html__('Padding', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_title_margin',
			[
				'label' => esc_html__('Margin', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->end_controls_section();

		// Heading Sub - Title Style Tab
		$this->start_controls_section(
			'wpr_heading_subtitle_style_settings',
			[
				'label' => __('Section - Subtitle', 'unlock-addons-for-elementor'),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'wpr_heading_subtitle_normal_color',
			[
				'label' => esc_html__('Text Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'wpr_heading_subtitle_before_color',
			[
				'label' => esc_html__('Subtitle Before Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .heading_style-11 .section-subtitle::before, {{WRAPPER}} .wpr-el-subtitle::before' => 'background-color: {{VALUE}};',
				],
				'condition'   => ['wpr_design_style'   => ['layout-11', 'layout-12', 'layout-13']],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'wpr_heading_subtitle_typography',
				'label' => esc_html__('Typography', 'unlock-addons-for-elementor'),
				'selector' => '{{WRAPPER}} .wpr-el-subtitle',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_subtitle_padding',
			[
				'label' => esc_html__('Padding', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_subtitle_margin',
			[
				'label' => esc_html__('Margin', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		// Border Width
		$this->add_responsive_control(
			'wpr_heading_subtitle_border_width',
			[
				'label' => esc_html__('Border Width', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle-border' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
				'condition'   => ['wpr_design_style'   => ['layout-4', 'layout-10', 'layout-16']],
			]
		);

		// Border Style
		$this->add_control(
			'wpr_heading_subtitle_border_style',
			[
				'label' => esc_html__('Border Style', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::SELECT,
				'options' => [
					'none' => esc_html__('None', 'unlock-addons-for-elementor'),
					'solid' => esc_html__('Solid', 'unlock-addons-for-elementor'),
					'dashed' => esc_html__('Dashed', 'unlock-addons-for-elementor'),
					'dotted' => esc_html__('Dotted', 'unlock-addons-for-elementor'),
					'double' => esc_html__('Double', 'unlock-addons-for-elementor'),
					'groove' => esc_html__('Groove', 'unlock-addons-for-elementor'),
					'ridge' => esc_html__('Ridge', 'unlock-addons-for-elementor'),
					'inset' => esc_html__('Inset', 'unlock-addons-for-elementor'),
					'outset' => esc_html__('Outset', 'unlock-addons-for-elementor'),
				],
				'default' => 'none',
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle-border' => 'border-style: {{VALUE}};',
				],
				'condition'   => ['wpr_design_style'   => ['layout-4', 'layout-10']],
			]
		);

		// Border Color
		$this->add_control(
			'wpr_heading_subtitle_border_color',
			[
				'label' => esc_html__('Border Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-subtitle-border' => 'border-color: {{VALUE}};',
				],
			]
		);


		$this->end_controls_section();

		// Heading Sub - Title Style Tab

		$this->start_controls_section(
			'wpr_heading_content_style_settings',
			[
				'label' => __('Section - Content', 'unlock-addons-for-elementor'),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'wpr_heading_desc_normal_color',
			[
				'label' => esc_html__('Text Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-content' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'wpr_heading_desc_typography',
				'label' => esc_html__('Typography', 'unlock-addons-for-elementor'),
				'selector' => '{{WRAPPER}} .wpr-el-content',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_desc_padding',
			[
				'label' => esc_html__('Padding', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_desc_margin',
			[
				'label' => esc_html__('Margin', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->add_responsive_control(
			'wpr_heading_desc_width',
			[
				'type' => \Elementor\Controls_Manager::SLIDER,
				'label' => esc_html__('Content Width', 'unlock-addons-for-elementor'),
				'size_units' => ['%', 'custom'],
				'default' => [
					'size' => '100',
					'unit' => '%',
				],
				'range' => [
					'%' => [
						'min' => 10,
						'max' => 100,
					],
				],
				'devices' => ['desktop', 'tablet', 'mobile'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-content' => 'max-width: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
			'wpr_heading_desc_auto_center',
			[
				'label' => esc_html__('Auto center', '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',
			]
		);

		$this->end_controls_section();

		// Heading Sub - Title Style Tab
		$this->start_controls_section(
			'wpr_heading_mail_style_settings',
			[
				'label' => __('Section - Email', 'unlock-addons-for-elementor'),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition' => [
					'wpr_design_style' => ['layout-10']
				]
			]
		);

		$this->add_control(
			'wpr_heading_mail_normal_color',
			[
				'label' => esc_html__('Text Color', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .wpr-el-mail' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'wpr_heading_mail_typography',
				'label' => esc_html__('Typography', 'unlock-addons-for-elementor'),
				'selector' => '{{WRAPPER}} .wpr-el-mail',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_mail_padding',
			[
				'label' => esc_html__('Padding', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-mail' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'wpr_heading_mail_margin',
			[
				'label' => esc_html__('Margin', 'unlock-addons-for-elementor'),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => ['px', '%', 'em'],
				'selectors' => [
					'{{WRAPPER}} .wpr-el-mail' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$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();
		$content_auto_center = ($settings['wpr_heading_desc_auto_center'] == 'yes') ? 'mx-auto' : false;
?>

		<?php if ($settings['wpr_design_style'] == 'layout-2'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title section-title orvio_title_anim');
		?>

			<div class="section-header v2 wpr-align-box wpr-el-section">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title orvio_title_anim wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="orvio_title_anim wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-3'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title section-title tp_text_invert');
		?>

			<div class="section-header introduction__header">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])): ?>
					<?php if (!empty($settings['wpr_heading_title'])):
						printf(
							'<%1$s %2$s>%3$s</%1$s>',
							tag_escape($settings['wpr_heading_title_tag']),
							$this->get_render_attribute_string('title_args'),
							$this->tp_kses($settings['wpr_heading_title'])
						);
					endif; ?>
					<span class="has-line"></span>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-4'):
			$this->add_render_attribute('title_args', 'class', 'title orvio_title_anim wpr-el-title');

			// $subtitle_border = $settings['wpr_subtitle_border_active_switch'] ? 'subtitle-border-bottom' : '';
		?>

			<div class="team__header wpr-el-section">
				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-5'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title');
		?>

			<?php if (!empty($settings['wpr_heading_title'])): ?>
				<div class="brands__content">
					<span class="info wpr-el-title">
						<?php echo $this->tp_kses($settings['wpr_heading_title']); ?>
					</span>
				</div>
			<?php endif; ?>

		<?php elseif ($settings['wpr_design_style'] == 'layout-6'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title section-title');
		?>

			<div class="section-header v2 wpr-align-box wpr-el-section">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-7'):
			$animation = $this->tp_animation_show($settings);
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title section-title');
		?>

			<div class="section-header wpr-align-box wpr-el-section">
				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-8'):
			$animation = $this->tp_animation_show($settings);
			$this->add_render_attribute('title_args', 'class', 'section-title orvio_title_anim wpr-el-title');
		?>
			<div class="section-header wpr-align-box">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title orvio_title_anim wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-9'):
			$this->add_render_attribute('title_args', 'class', 'section-title v2 split-text effect-blur-fade wpr-el-title ');
		?>

			<div class="section-header-5 wpr-align-box">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title v2 wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>
			</div>


		<?php elseif ($settings['wpr_design_style'] == 'layout-10'):
			$this->add_render_attribute('title_args', 'class', 'section-title large-title split-text effect-blur-fade wpr-el-title');
		?>

			<div class="work-6__section-header section-header-5">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>
			</div>

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

			$this->add_render_attribute('title_args', 'class', 'section-title orvio_title_anim wpr-el-title');
		?>


			<div class="section-header corporate-sec-header wpr-el-section wpr-align-box">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle d-inline-flex">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

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

			$this->add_render_attribute('title_args', 'class', 'section-title orvio_title_anim wpr-el-title');
		?>

			<div class="wpr-el-section wpr-align-box section-header corporate-sec-header">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle d-inline-flex">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-13'):
			$this->add_render_attribute('title_args', 'class', 'section-title orvio_title_anim wpr-el-title');
		?>

		<div class="modern-agency">
			<div class="wpr-el-section wpr-align-box section-header v2 service-8__header">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="wpr-el-subtitle section-highlight orvio_title_anim"><?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?></span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content orvio_title_anim">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>
		</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-14'):
			$this->add_render_attribute('title_args', 'class', 'section-title wpr-el-title');
		?>

            <div class="best-sells__header section-header v4 wpr-el-section wpr-align-box">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
				<span class="section-sub-title wpr-el-subtitle">
					<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
				</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>            
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-15'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title');
		?>

			<div class="section-title-wrapper hero2_heading">
				<div class="title-wrapper">
					<h1 class="section-title typewriter-text fade-anim wpr-el-title" data-text='["<?php echo $this->tp_kses($settings['wpr_heading_title']); ?>", "<?php echo $this->tp_kses($settings['wpr_heading_title2']); ?>"]'></h1>
				</div>

				<?php if (!empty($settings['wpr_marquee_text'])): ?>
				<div class="subtitle-wrapper">
					<span class="section-subtitle fade-anim" data-direction="bottom" data-delay="0.75">
						<span class="marquee">
							<span class="wpr-el-subtitle"><?php echo $this->tp_kses($settings['wpr_marquee_text']); ?></span>
							<span class="wpr-el-subtitle"><?php echo $this->tp_kses($settings['wpr_marquee_text']); ?></span>
						</span>
					</span>
				</div>
				<?php endif; ?>
			</div>

		<?php elseif ($settings['wpr_design_style'] == 'layout-16'):
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title');
		?>

		<div class="modern-header-style">
			<div class="section-header wpr-el-section">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
				<div class="subtitle-wrapper wpr-el-subtitle-border fade-anim">
					<span class="section-subtitle subtitle-no-before wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				</div>
				<?php endif; ?>
				<div class="section-title-wrapper section-title-wrapper_grid fade-anim">
					<div class="title-wrapper">
						<?php if (!empty($settings['wpr_heading_title'])):
							printf(
								'<%1$s %2$s>%3$s</%1$s>',
								tag_escape($settings['wpr_heading_title_tag']),
								$this->get_render_attribute_string('title_args'),
								$this->tp_kses($settings['wpr_heading_title'])
							);
						endif; ?>
					</div>

					<?php if (!empty($settings['wpr_heading_description'])): ?>
					<div class="text-wrapper">
						<p class="text wpr-el-content"><?php echo $this->tp_kses($settings['wpr_heading_description']); ?></p>
					</div>
					<?php endif; ?>
				</div>
			</div>
		</div>

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

			$this->add_render_attribute('title_args', 'class', 'section-title wpr-el-title');
		?>

		<div class="section-content heading_style-17">
			<div class="section-title-wrapper">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
				<div class="subtitle-wrapper">
					<span class="section-subtitle char-anim wpr-el-subtitle" data-delay="0.60">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				</div>
				<?php endif; ?>
				<div class="title-wrapper fade-anim" data-delay="0.75">
					<?php if (!empty($settings['wpr_heading_title'])):
						printf(
							'<%1$s %2$s>%3$s</%1$s>',
							tag_escape($settings['wpr_heading_title_tag']),
							$this->get_render_attribute_string('title_args'),
							$this->tp_kses($settings['wpr_heading_title'])
						);
					endif; ?>
				</div>
			</div>
			<?php if (!empty($settings['wpr_heading_description'])): ?>
			<div class="text-wrapper fade-anim" data-delay="0.90">
				<p class="text wpr-el-content">
					<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
				</p>
			</div>
			<?php endif; ?>
		</div>


		<?php else:
			$this->add_render_attribute('title_args', 'class', 'wpr-el-title section-title tp_text_invert');
		?>

			<div class="section-header v2 about-2__content right-content wpr-align-box wpr-el-section">
				<?php if (!empty($settings['wpr_heading_subtitle'])): ?>
					<span class="section-sub-title wpr-el-subtitle">
						<?php echo $this->tp_kses($settings['wpr_heading_subtitle']); ?>
					</span>
				<?php endif; ?>

				<?php if (!empty($settings['wpr_heading_title'])):
					printf(
						'<%1$s %2$s>%3$s</%1$s>',
						tag_escape($settings['wpr_heading_title_tag']),
						$this->get_render_attribute_string('title_args'),
						$this->tp_kses($settings['wpr_heading_title'])
					);
				endif; ?>

				<?php if (!empty($settings['wpr_heading_description'])): ?>
					<p class="wpr-el-content">
						<?php echo $this->tp_kses($settings['wpr_heading_description']); ?>
					</p>
				<?php endif; ?>
			</div>

<?php endif;
	}
}


