<?php
/**
 * Social_Icons Widget file
 *
 * @category   Widget
 * @package    CodexShaper_Framework
 * @author     CodexShaper <info@codexshaper.com>
 * @license    https://www.gnu.org/licenses/gpl-2.0.html
 * @link       https://codexshaper.com
 * @since      1.0.0
 */

namespace CodexShaper\Framework\Widgets\Elementor\Modules\SocialIcons\Widgets;

use CodexShaper\Framework\Foundation\Elementor\Widget;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Icons_Manager;
use Elementor\Repeater;

// Exit if access directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit();
}

/**
 * Social_Icons widget class
 *
 * @category   Class
 * @package    CodexShaper_Framework
 * @author     CodexShaper <info@codexshaper.com>
 * @license    https://www.gnu.org/licenses/gpl-2.0.html
 * @link       https://codexshaper.com
 * @since      1.0.0
 */
class Social_Icons extends Widget {

	/**
	 * Get widget name.
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'csmf--social-icons';
	}

	/**
	 * Get widget title.
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Social Icons', 'codexshaper-framework' );
	}

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

	/**
	 * Get widget keywords.
	 *
	 * @return array Widget keywords.
	 */
	public function get_keywords() {
		return array( 'Social Icons', 'CodexShaper', 'CodexShaper Framework', 'CSMF' );
	}

	/**
	 * Get widget categories.
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return array( 'csmf--widget' );
	}

	/**
	 * Get style dependencies.
	 *
	 * Retrieve the list of style dependencies the widget requires.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return array Widget style dependencies.
	 */
	public function get_style_depends(): array {
		return array( 'csmf--social-icons' );
	}

	/**
	 * Register Elementor widget controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_controls() {
		// Register layout controls.
		$this->register_layout_controls();
		// Register style controls.
		$this->register_style_controls();
		$this->register_style_controls_social_item_title();
		$this->register_style_controls_social_item_icon();
		$this->register_style_controls_social_item();
	}

	/**
	 * Register Elementor widget layout controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_layout_controls() {
		$this->start_controls_section(
			'section_layout',
			array(
				'label' => __( 'Layout', 'codexshaper-framework' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			)
		);

		$repeater = new Repeater();

		$repeater->add_control(
			'text',
			array(
				'label' => esc_html__( 'Custom Label', 'codexshaper-framework' ),
				'type'  => Controls_Manager::TEXT,
			)
		);

		$repeater->add_control(
			'share_icon',
			array(
				'label' => esc_html__( 'Share Icon', 'codexshaper-framework' ),
				'type'  => Controls_Manager::ICONS,
			)
		);

		$repeater->add_control(
			'social_link',
			array(
				'label'       => esc_html__( 'Social Url', 'codexshaper-framework' ),
				'type'        => Controls_Manager::URL,
				'options'     => array( 'url', 'is_external', 'nofollow' ),
				'default'     => array(
					'url'         => '',
					'is_external' => true,
					'nofollow'    => true,
				),
				'label_block' => true,
			)
		);

		// Start tab for content.
		$repeater->start_controls_tabs(
			'csmf_socialmedia_tabs'
		);

		// Start normal tab.
		$repeater->start_controls_tab(
			'csmf_socialmedia_normal',
			array(
				'label' => esc_html__( 'Normal', 'codexshaper-framework' ),
			)
		);

		// Set social icon color.
		$repeater->add_responsive_control(
			'csmf_socialmedia_icon_color',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '#222222',
				'selectors' => array(
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link' => 'color: {{VALUE}};',
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link svg path' => 'stroke: {{VALUE}}; fill: {{VALUE}};',
				),
			)
		);

		// Set social icon background color.
		$repeater->add_responsive_control(
			'csmf_socialmedia_icon_bg_color',
			array(
				'label'     => esc_html__( 'Background Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'selectors' => array(
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link' => 'background-color: {{VALUE}};',
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link .csmf--social-share-item-icon' => 'background-color: {{VALUE}};',
				),
			)
		);

		$repeater->add_group_control(
			Group_Control_Border::get_type(),
			array(
				'name'     => 'csmf_socialmedia_border',
				'label'    => esc_html__( 'Border', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link',
			)
		);

		$repeater->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			array(
				'name'     => 'csmf_socialmedia_icon_normal_text_shadow',
				'label'    => esc_html__( 'Text Shadow', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link',
			)
		);

		$repeater->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			array(
				'name'     => 'csmf_socialmedai_list_box_shadow',
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link',
			)
		);

		$repeater->end_controls_tab();
		// End normal tab.

		// Start hover tab.
		$repeater->start_controls_tab(
			'csmf_socialmedia_hover',
			array(
				'label' => esc_html__( 'Hover', 'codexshaper-framework' ),
			)
		);

		// Set social icon color.
		$repeater->add_responsive_control(
			'csmf_socialmedia_icon_hover_color',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'selectors' => array(
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover' => 'color: {{VALUE}};',
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover svg path'   => 'stroke: {{VALUE}}; fill: {{VALUE}};',
				),
			)
		);

		// Set social icon background color.
		$repeater->add_responsive_control(
			'csmf_socialmedia_icon_hover_bg_color',
			array(
				'label'     => esc_html__( 'Background Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '#3b5998',
				'selectors' => array(
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover' => 'background-color: {{VALUE}};',
					'{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover .csmf--social-share-item-icon' => 'background-color: {{VALUE}};',
				),
			)
		);

		$repeater->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			array(
				'name'     => 'csmf_socialmedia_icon_hover_text_shadow',
				'label'    => esc_html__( 'Text Shadow', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover',
			)
		);

		$repeater->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			array(
				'name'     => 'csmf_socialmedai_list_box_shadow_hover',
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover',
			)
		);

		$repeater->add_group_control(
			Group_Control_Border::get_type(),
			array(
				'name'     => 'csmf_socialmedia_border_hover',
				'label'    => esc_html__( 'Border', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} {{CURRENT_ITEM}}.social_link:hover',
			)
		);

		$repeater->end_controls_tab();
		// End hover tab.

		$repeater->end_controls_tabs();

		$this->add_control(
			'share_buttons',
			array(
				'type'        => Controls_Manager::REPEATER,
				'fields'      => $repeater->get_controls(),
				'title_field' => '{{{ text }}}',
				'default'     => array(
					array(
						'text'                             => 'Facebook',
						'share_icon'                       => array(
							'value'   => 'fab fa-facebook',
							'library' => 'fa-brands',
						),
						'social_link'                      => array(
							'url'         => 'https://facebook.com',
							'is_external' => true,
							'nofollow'    => true,
						),
						'csmf_socialmedia_icon_bg_color'    => '#1877f2',
						'csmf_socialmedia_icon_hover_color' => '#ffffff',
						'csmf_socialmedia_icon_hover_bg_color' => '#165db7',
					),
					array(
						'text'                             => 'Twitter',
						'share_icon'                       => array(
							'value'   => 'fab fa-twitter',
							'library' => 'fa-brands',
						),
						'social_link'                      => array(
							'url'         => 'https://twitter.com',
							'is_external' => true,
							'nofollow'    => true,
						),
						'csmf_socialmedia_icon_bg_color'    => '#1DA1F2',
						'csmf_socialmedia_icon_hover_color' => '#ffffff',
						'csmf_socialmedia_icon_hover_bg_color' => '#0d8bd9',
					),
					array(
						'text'                             => 'LinkedIn',
						'share_icon'                       => array(
							'value'   => 'fab fa-linkedin',
							'library' => 'fa-brands',
						),
						'social_link'                      => array(
							'url'         => 'https://linkedin.com',
							'is_external' => true,
							'nofollow'    => true,
						),
						'csmf_socialmedia_icon_bg_color'    => '#0077b5',
						'csmf_socialmedia_icon_hover_color' => '#ffffff',
						'csmf_socialmedia_icon_hover_bg_color' => '#005582',
					),
				),
			)
		);

		$this->add_control(
			'view',
			array(
				'label'        => esc_html__( 'View', 'codexshaper-framework' ),
				'type'         => Controls_Manager::SELECT,
				'label_block'  => false,
				'options'      => array(
					'icon-text' => 'Icon & Text',
					'icon'      => 'Icon',
					'text'      => 'Text',
				),
				'default'      => 'icon-text',
				'separator'    => 'before',
				'prefix_class' => 'csmf--share-btns-view-',
				'render_type'  => 'template',
			)
		);

		$this->add_control(
			'show_label',
			array(
				'label'     => esc_html__( 'Show label', 'codexshaper-framework' ),
				'type'      => Controls_Manager::SWITCHER,
				'default'   => 'yes',
				'condition' => array(
					'view' => 'icon-text',
				),
			)
		);

		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_style_controls() {
		$this->start_controls_section(
			'section_style',
			array(
				'label' => __( 'Layout Style', 'codexshaper-framework' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			)
		);

		$this->common_space_controls(
			'social_items_space',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--social-share-wrapper',
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'      => 'social_items_background',
				'types'     => array( 'classic', 'gradient' ),
				'separator' => 'after',
				'selector'  => '{{WRAPPER}} .csmf--social-share-wrapper',
			)
		);

		$this->add_group_control(
			Group_Control_Border::get_type(),
			array(
				'name'     => 'social_items_border',
				'selector' => '{{WRAPPER}} .csmf--social-share-wrapper',
			)
		);

		$this->add_responsive_control(
			'social_items_border_radius',
			array(
				'label'      => esc_html__( 'Radius', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'separator'  => 'before',
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_responsive_control(
			'share_items_position',
			array(
				'label'     => esc_html__( 'Items Position', 'codexshaper-framework' ),
				'type'      => Controls_Manager::CHOOSE,
				'options'   => array(
					'row'    => array(
						'title' => esc_html__( 'Left', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-left',
					),
					'column' => array(
						'title' => esc_html__( 'Top', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-up',
					),
				),
				'selectors' => array(
					'{{WRAPPER}} .csmf--social-share-content-wrapper' => 'flex-direction: {{VALUE}};',
				),
			)
		);

		$this->add_responsive_control(
			'share_icon_position',
			array(
				'label'     => esc_html__( 'Icon Position', 'codexshaper-framework' ),
				'type'      => Controls_Manager::CHOOSE,
				'options'   => array(
					'row'            => array(
						'title' => esc_html__( 'Left', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-left',
					),
					'row-reverse'    => array(
						'title' => esc_html__( 'Right', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-right',
					),
					'column'         => array(
						'title' => esc_html__( 'Top', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-up',
					),
					'column-reverse' => array(
						'title' => esc_html__( 'Bottom', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-down',
					),
				),
				'selectors' => array(
					'{{WRAPPER}} .csmf--social-share-item' => 'flex-direction: {{VALUE}};',
				),

				'condition' => array(
					'view' => 'icon-text',
				),
			)
		);

		$this->add_responsive_control(
			'social_items_gap',
			array(
				'label'      => esc_html__( 'Items Gap', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-content-wrapper' => 'gap: {{SIZE}}{{UNIT}};',
				),
			)
		);

		$this->add_responsive_control(
			'social_inner_item_gap',
			array(
				'label'      => esc_html__( 'Inner Item Gap', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-item' => 'gap: {{SIZE}}{{UNIT}};',
				),
				'condition'  => array(
					'view' => 'icon-text',
				),
			)
		);

		$this->add_control(
			'share_title_heading',
			array(
				'label'     => esc_html__( 'Heading Title', 'codexshaper-framework' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
				'condition' => array(
					'title!' => '',
				),
			),
		);

		$this->add_responsive_control(
			'share_title_padding',
			array(
				'label'      => esc_html__( 'Padding', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'separator'  => 'before',
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
				'condition'  => array(
					'title!' => '',
				),
			)
		);

		$this->add_responsive_control(
			'share_title_position',
			array(
				'label'     => esc_html__( 'Position', 'codexshaper-framework' ),
				'type'      => Controls_Manager::CHOOSE,
				'options'   => array(
					'row'            => array(
						'title' => esc_html__( 'Left', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-left',
					),
					'row-reverse'    => array(
						'title' => esc_html__( 'Right', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-right',
					),
					'column'         => array(
						'title' => esc_html__( 'Top', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-up',
					),
					'column-reverse' => array(
						'title' => esc_html__( 'Bottom', 'codexshaper-framework' ),
						'icon'  => 'eicon-arrow-down',
					),
				),
				'selectors' => array(
					'{{WRAPPER}} .csmf--social-share-wrapper' => 'flex-direction: {{VALUE}};',
				),
				'condition' => array(
					'title!' => '',
				),
			)
		);

		$this->add_responsive_control(
			'social_heading_title_gap',
			array(
				'label'      => esc_html__( 'Gap', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-wrapper' => 'gap: {{SIZE}}{{UNIT}};',
				),
				'condition'  => array(
					'title!' => '',
				),
			)
		);

		$this->start_controls_tabs(
			'share_title_style_tabs'
		);

		$this->start_controls_tab(
			'share_title_style_normal_tab',
			array(
				'label'     => esc_html__( 'Normal', 'codexshaper-framework' ),
				'condition' => array(
					'title!' => '',
				),
			)
		);

		$this->common_text_controls(
			'share_title_text',
			options: array(
				'selector'   => '{{WRAPPER}} .csmf--social-share-title',
				'conditions' => array(
					'title!' => '',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'share_title_style_hover_tab',
			array(
				'label'     => esc_html__( 'Hover', 'codexshaper-framework' ),
				'condition' => array(
					'title!' => '',
				),
			)
		);

		$this->common_text_controls(
			'share_title_text_hover',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--social-share-title',
			)
		);

		$this->end_controls_tab();
		$this->end_controls_tabs();
		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget title style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_style_controls_social_item_title() {

		$this->start_controls_section(
			'social_title_section_style',
			array(
				'label'     => __( 'Social Title', 'codexshaper-framework' ),
				'tab'       => Controls_Manager::TAB_STYLE,
				'condition' => array(
					'view' => array( 'icon-text', 'text' ),
				),
			)
		);

		$this->add_responsive_control(
			'social_title_padding',
			array(
				'label'      => esc_html__( 'Padding', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'separator'  => 'before',
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-item-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Border::get_type(),
			array(
				'name'     => 'social_title_border',
				'selector' => '{{WRAPPER}} .csmf--social-share-item-title',
			)
		);

		$this->add_responsive_control(
			'social_title_border_radius',
			array(
				'label'      => esc_html__( 'Border Radius', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'separator'  => 'before',
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-item-title' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',

				),
			)
		);

		// tabs.
		$this->start_controls_tabs(
			'social_title_style_tabs'
		);

		$this->start_controls_tab(
			'social_title_style_normal_tab',
			array(
				'label' => esc_html__( 'Normal', 'codexshaper-framework' ),
			)
		);

		$this->common_text_controls(
			'social_item_title',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--social-share-item-title',
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'      => 'social_title_background',
				'types'     => array( 'classic', 'gradient' ),
				'separator' => 'after',
				'selector'  => '{{WRAPPER}} .csmf--social-share-item-title',
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'social_title_style_hover_tab',
			array(
				'label' => esc_html__( 'Hover', 'codexshaper-framework' ),
			)
		);

		$this->common_text_controls(
			'social_item_title_hover',
			options: array(
				'selector' => '{{WRAPPER}} .social_link:hover .csmf--social-share-item-title',
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'      => 'social_title_background_hover',
				'types'     => array( 'classic', 'gradient' ),
				'separator' => 'after',
				'selector'  => '{{WRAPPER}} .social_link:hover .csmf--social-share-item-title:hover',
			)
		);

		$this->end_controls_tab();
		$this->end_controls_tabs();
		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget icon style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_style_controls_social_item_icon() {

		$this->start_controls_section(
			'social_icon_section_style',
			array(
				'label'     => __( 'Social Icon', 'codexshaper-framework' ),
				'tab'       => Controls_Manager::TAB_STYLE,
				'condition' => array(
					'view' => array( 'icon-text', 'icon' ),
				),
			)
		);

		$this->add_control(
			'social_icon_bg_size',
			array(
				'label'      => esc_html__( 'Background Width', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-item-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Border::get_type(),
			array(
				'name'     => 'social_icon_border',
				'selector' => '{{WRAPPER}} .csmf--social-share-item-icon',
			)
		);

		$this->add_responsive_control(
			'social_icon_border_radius',
			array(
				'label'      => esc_html__( 'Border Radius', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'separator'  => 'before',
				'size_units' => array( 'px', '%', 'em', 'rem', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--social-share-item-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->start_controls_tabs(
			'social_icon_style_tabs'
		);

		$this->start_controls_tab(
			'social_icon_style_normal_tab',
			array(
				'label' => esc_html__( 'Normal', 'codexshaper-framework' ),
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'      => 'social_icon_background',
				'types'     => array( 'classic', 'gradient' ),
				'separator' => 'after',
				'selector'  => '{{WRAPPER}} .csmf--social-share-item-icon',
			)
		);

		$this->common_icon_controls(
			'social_icon',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--social-share-item-icon',
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'social_icon_style_hover_tab',
			array(
				'label' => esc_html__( 'Hover', 'codexshaper-framework' ),
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'      => 'social_icon_background_hover',
				'types'     => array( 'classic', 'gradient' ),
				'separator' => 'after',
				'selector'  => '{{WRAPPER}} .social_link:hover .csmf--social-share-item-icon',
			)
		);

		$this->common_icon_controls(
			'social_icon_hover',
			options: array(
				'selector' => '{{WRAPPER}} .social_link:hover .csmf--social-share-item-icon',
			)
		);

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

		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget icon style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_style_controls_social_item() {
		$this->start_controls_section(
			'social_item_section_style',
			array(
				'label' => __( 'Item', 'codexshaper-framework' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			)
		);

		$this->start_controls_tabs(
			'item_style_tabs'
		);

		$this->start_controls_tab(
			'item_style_normal_tab',
			array(
				'label' => esc_html__( 'Normal', 'codexshaper-framework' ),
			)
		);

		$this->common_layout_controls(
			'item_layout',
			options: array(
				'selector' => '{{WRAPPER}} .social_link',
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'item_style_hover_tab',
			array(
				'label' => esc_html__( 'Hover', 'codexshaper-framework' ),
			)
		);

		$this->common_layout_controls(
			'item_layout_hover',
			options: array(
				'selector' => '{{WRAPPER}} .social_link:hover',
			)
		);

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

		$this->end_controls_section();
	}

	/**
	 * Render Elementor widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.0
	 * @access protected
	 *
	 * @return void
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();
		$instance = $this;
		csmf_view( 'social-icons.content', compact( 'settings', 'instance' ) );
	}

	/**
	 * Render icon.
	 *
	 * @param array $share_icon icon array.
	 * @since 1.0.0
	 * @access private
	 * @return mixed icon Html.
	 */
	public function maybe_render_icon( $share_icon ) {
		if ( $share_icon && ! empty( $share_icon['value'] ) ) {
			return Icons_Manager::try_get_icon_html(
				$share_icon,
				array(
					'aria-hidden' => 'true',
					'class'       => 'share-icon',
				)
			);
		}
	}
}
