<?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\Group_Control_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Repeater;
use \Elementor\Utils;

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

/**
 * Team Box Widget
 *
 * @since 1.0.0
 */
class Team_Box 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-team-box';
    }

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

    /**
     * Retrieve the widget icon.
     *
     * @since 1.0.0
     *
     * @access public
     *
     * @return string Widget icon.
     */
    public function get_icon()
    {
        return 'eicon-person 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', 'unlockafe-team-box-style', 'font-awesome'];
    }

    /**
     * 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'),
                ],
                'default' => 'layout-1',
            ]
        );

        $this->end_controls_section();

        // Team content section
        $this->start_controls_section(
            'wpr_team_content_section',
            [
                'label' => __('Content', 'unlock-addons-for-elementor'),
                'tab' => Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'wpr_design_style' => ['layout-3'],
                ]
            ]
        );

        $this->add_control(
            'wpr_shape_show',
            [
                'label' => esc_html__('Shape 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' => 'yes',
                'condition' => [
                    'wpr_design_style' => ['layout-3']
                ]
            ]
        );

        $this->add_control(
            'wpr_sub_title',
            [
                'label' => esc_html__('Section Sub Title', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::TEXT,
                'default' => esc_html__('Section Sub Title', 'unlock-addons-for-elementor'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'wpr_title',
            [
                'label' => esc_html__('Section Title', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::TEXTAREA,
                'default' => esc_html__('Section Title', 'unlock-addons-for-elementor'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'wpr_description',
            [
                'label' => esc_html__('Section Description', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::TEXTAREA,
                'default' => esc_html__('Description', 'unlock-addons-for-elementor'),
                'label_block' => true,
                'condition' => [
                    'wpr_design_style' => ['layout-100', 'layout-200'],
                ]
            ]
        );

        $this->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_design_style' => ['layout-3'],
                ]
            ]
        );

        // team link 
        $this->tp_render_links_controls('team_link');


        $this->end_controls_section();


        // member list
        $this->start_controls_section(
            '_section_teams',
            [
                'label' => __('Members', 'unlock-addons-for-elementor'),
                'tab' => Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'navigation_arrow_swich',
            [
                'label' => esc_html__('Enable Navigation Arrow ?', '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',
            ]
        );

        $repeater = new 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'),
                ],
                'default' => 'style_1',
                'frontend_available' => true,
                'style_transfer' => true,
            ]
        );

        $repeater->start_controls_tabs(
            '_tab_style_member_box_itemr'
        );

        $repeater->start_controls_tab(
            '_tab_member_info',
            [
                'label' => __('Information', 'unlock-addons-for-elementor'),
            ]
        );

        $repeater->add_control(
            'team_active',
            [
                '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(
            'wpr_rep_animation_delay',
            [
                'label' => esc_html__('Animation Delay', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::TEXT,
                'default' => esc_html__('0.45', 'unlock-addons-for-elementor'),
                'label_block' => true,
                'condition' => [
                    'repeater_condition' => ['style_2']
                ]
            ]
        );

        $repeater->add_control(
            'image',
            [
                'type' => Controls_Manager::MEDIA,
                'label' => __('Image', 'unlock-addons-for-elementor'),
                'default' => [
                    'url' => Utils::get_placeholder_image_src(),
                ],
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'bg_image',
            [
                'type' => Controls_Manager::MEDIA,
                'label' => __('BG Image', 'unlock-addons-for-elementor'),
                'default' => [
                    'url' => Utils::get_placeholder_image_src(),
                ],
                'dynamic' => [
                    'active' => true,
                ],
                'condition' => [
                    'repeater_condition' => ['style_30']
                ]
            ]
        );

        $repeater->add_control(
            'title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => true,
                'label' => __('Name', 'unlock-addons-for-elementor'),
                'default' => __('Member Name', 'unlock-addons-for-elementor'),
                'placeholder' => __('Type title here', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'designation',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => true,
                'show_label' => true,
                'label' => __('Designation', 'unlock-addons-for-elementor'),
                'default' => __('Web Developer', 'unlock-addons-for-elementor'),
                'placeholder' => __('Type designation here', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'wpr_title_link_type',
            [
                'label' => esc_html__('Title Link Type', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::SELECT,
                'options' => [
                    '1' => 'Custom Link',
                    '2' => 'Internal Page',
                ],
                'default' => '1',
            ]
        );

        $repeater->add_control(
            'wpr_title_custome_link',
            [
                'label' => esc_html__('Custom Url', 'unlock-addons-for-elementor'),
                'type' => 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_title_link_type' => '1',
                ]
            ]
        );
        $repeater->add_control(
            'wpr_title_page_link',
            [
                'label' => esc_html__('Internal Page', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::SELECT2,
                'label_block' => true,
                'options' => $this->tp_get_all_pages(),
                'condition' => [
                    'wpr_title_link_type' => '2',
                ]
            ]
        );

        $repeater->add_control(
            'content',
            [
                'type' => Controls_Manager::TEXTAREA,
                'label_block' => true,
                'show_label' => true,
                'label' => __('Content', 'unlock-addons-for-elementor'),
                'default' => __(' A graduate of Harvard Law School, he is renowned for  his meticulous approach and unwavering dedication.', 'unlock-addons-for-elementor'),
                'placeholder' => __('Type designation here', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ],
                'condition' => [
                    'repeater_condition' => ['style_30']
                ]
            ]
        );

        $repeater->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'single_service_icon_bgcolor',
                'label' => esc_html__('Background Color', 'unlock-addons-for-elementor'),
                'types' => ['classic', 'gradient'],
                'exclude' => ['image'],
                'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} .wpr-el-team-bg-color',
                'condition' => [
                    'repeater_condition' => ['style_1']
                ]
            ]
        );

        $repeater->end_controls_tab();

        $repeater->start_controls_tab(
            '_tab_member_links',
            [
                'label' => __('Links', 'unlock-addons-for-elementor'),
            ]
        );

        $repeater->add_control(
            'show_social',
            [
                'label' => __('Show Social Links?', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::SWITCHER,
                'label_on' => __('Yes', 'unlock-addons-for-elementor'),
                'label_off' => __('No', 'unlock-addons-for-elementor'),
                'return_value' => 'yes',
                'style_transfer' => true,
            ]
        );

        $repeater->add_control(
            'wpr_social_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => true,
                'label' => __('Social Title', 'unlock-addons-for-elementor'),
                'placeholder' => __('CONNECT', 'unlock-addons-for-elementor'),
                'default' => __('CONNECT', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ],
                'condition' => [
                    'repeater_condition' => ['style_2']
                ]
            ]
        );

        $repeater->add_control(
            'team_social_box_color',
            [
                'label' => __('Social Box BG Color', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::COLOR,
                'default' => '#FD5D39',
                'selectors' => [
                    '{{WRAPPER}} .team-box-2 .social-links' => 'background-color: {{VALUE}};',
                ],
                'condition' => [
                    'repeater_condition' => ['style_6']
                ]
            ]
        );

        $repeater->add_control(
            'web_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Website Address', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your profile link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'email_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Email', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your email link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'phone_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Phone', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your phone link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'facebook_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Facebook', 'unlock-addons-for-elementor'),
                'default' => __('#', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your facebook link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'twitter_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Twitter', 'unlock-addons-for-elementor'),
                'default' => __('#', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your twitter link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'instagram_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Instagram', 'unlock-addons-for-elementor'),
                'default' => __('#', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your instagram link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'linkedin_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('LinkedIn', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your linkedin link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'youtube_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Youtube', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your youtube link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'googleplus_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Google Plus', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your Google Plus link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'flickr_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Flickr', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your flickr link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'vimeo_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Vimeo', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your vimeo link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'behance_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Behance', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your behance link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'dribble_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Dribbble', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your dribbble link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'pinterest_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Pinterest', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your pinterest link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

        $repeater->add_control(
            'gitub_title',
            [
                'type' => Controls_Manager::TEXT,
                'label_block' => false,
                'label' => __('Github', 'unlock-addons-for-elementor'),
                'placeholder' => __('Add your github link', 'unlock-addons-for-elementor'),
                'dynamic' => [
                    'active' => true,
                ]
            ]
        );

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

        // REPEATER
        $this->add_control(
            'teams',
            [
                'show_label' => false,
                'type' => Controls_Manager::REPEATER,
                'fields' => $repeater->get_controls(),
                'title_field' => '<# print(title || "Carousel Item"); #>',
                'default' => [
                    [
                        'image' => [
                            'url' => Utils::get_placeholder_image_src(),
                        ],
                    ],
                    [
                        'image' => [
                            'url' => Utils::get_placeholder_image_src(),
                        ],
                    ],
                    [
                        'image' => [
                            'url' => Utils::get_placeholder_image_src(),
                        ],
                    ],
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Image_Size::get_type(),
            [
                'name' => 'thumbnail',
                'default' => 'medium_large',
                'separator' => 'before',
                'exclude' => [
                    'custom'
                ]
            ]
        );

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

        $this->add_responsive_control(
            'align',
            [
                'label' => __('Alignment', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::CHOOSE,
                'options' => [
                    'left' => [
                        'title' => __('Left', 'unlock-addons-for-elementor'),
                        'icon' => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => __('Center', 'unlock-addons-for-elementor'),
                        'icon' => 'eicon-text-align-center',
                    ],
                    'right' => [
                        'title' => __('Right', 'unlock-addons-for-elementor'),
                        'icon' => 'eicon-text-align-right',
                    ],
                ],
                'toggle' => true,
                'selectors' => [
                    '{{WRAPPER}} .wpr-el-item' => 'text-align: {{VALUE}};'
                ]
            ]
        );

        $this->end_controls_section();

        // colum controls
        $this->tp_columns('col', ['layout-1', 'layout-2', 'layout-3', 'layout-4', 'layout-5']);

        // animation
        $this->tp_creative_animation('layout-10');
    }

    protected function style_tab_content()
    {
        $this->tp_section_style_controls('team_section', 'Section - Style', '.wpr-el-section');

        $this->tp_basic_style_controls('team_section_subtitle', 'Section - SubTitle', '.wpr-el-subtitle', 'layout-3');
        $this->tp_basic_style_controls('team_section_title', 'Section - Title', '.wpr-el-title', 'layout-3');

        $this->tp_basic_style_controls('team_name', 'Name - Style', '.wpr-el-team-name');
        $this->tp_basic_style_controls('team_designation', 'Designation - Style', '.wpr-el-team-desi');
        $this->tp_basic_style_controls('team_thumb_text', 'Thumb Text - Style', '.wpr-el-thumb-text', '[layout-1]');
        $this->tp_basic_style_controls('team_content', 'Content - Style', '.wpr-el-team-content', '[style-10]');
        $this->tp_link_controls_style('', 'team_social', 'Social - Style', '.wpr-el-team-social');
        $this->tp_link_controls_style('wpr_team_social', 'Social - Style', '.wpr-el-team-social');

        $this->tp_link_controls_style('team_btn1_style', 'Button', '.wpr-el-btn', 'layout-3');

        $this->start_controls_section(
            '_section_style_arrow',
            [
                'label' => __('Arrow Style', 'unlock-addons-for-elementor'),
                'tab' => Controls_Manager::TAB_STYLE,
                'condition' => [
                    'navigation_arrow_swich' => 'yes',
                    'wpr_design_style' => ['style_3']

                ],
            ]
        );

        $this->add_responsive_control(
            'wpr_arrow_margin',
            [
                'label' => __('Margin', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::DIMENSIONS,
                'size_units' => ['px', '%'],
                'selectors' => [
                    '{{WRAPPER}} .wpr-el-nav-arrow-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
                ],
            ]
        );

        $this->add_control(
            'arrow_width',
            [
                'label' => esc_html__('Width', 'unlock-addons-for-elementor'),
                'type' => \Elementor\Controls_Manager::SLIDER,
                'size_units' => ['px', '%', 'em', 'rem', 'custom'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 1000,
                        'step' => 1,
                    ],
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                    ],
                ],
                'default' => [
                    'unit' => 'px',
                ],
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow, {{WRAPPER}} .wpr-el-nav-arrow' => 'width: {{SIZE}}{{UNIT}};',
                ],
            ]
        );

        $this->add_control(
            'arrow_height',
            [
                'label' => esc_html__('Height', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::SLIDER,
                'size_units' => ['px', '%', 'em', 'rem', 'custom'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 1000,
                        'step' => 1,
                    ],
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                    ],
                ],
                'default' => [
                    'unit' => 'px',
                ],
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow, {{WRAPPER}} .wpr-el-nav-arrow' => 'height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
                ],
            ]
        );

        $this->add_responsive_control(
            'arrow_border_radius',
            [
                'label' => __('Border Radius', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::DIMENSIONS,
                'size_units' => ['px', '%'],
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow, {{WRAPPER}} .wpr-el-nav-arrow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
                ],
            ]
        );

        $this->start_controls_tabs('_tabs_arrow');

        $this->start_controls_tab(
            '_tab_arrow_normal',
            [
                'label' => __('Normal', 'unlock-addons-for-elementor'),
            ]
        );

        $this->add_control(
            'arrow_color',
            [
                'label' => __('Color', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::COLOR,
                'default' => '',
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow, {{WRAPPER}} .wpr-el-nav-arrow' => 'color: {{VALUE}};',
                ],
            ]
        );

        $this->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'arrow_bg_color',
                'types' => ['classic', 'gradient'],
                'selector' => '{{WRAPPER}} .slick-arrow::after, {{WRAPPER}} .wpr-el-nav-arrow',
            ]
        );

        $this->end_controls_tab();

        $this->start_controls_tab(
            '_tab_arrow_hover',
            [
                'label' => __('Hover', 'unlock-addons-for-elementor'),
            ]
        );

        $this->add_control(
            'arrow_hover_color',
            [
                'label' => __('Text Color', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow:hover, {{WRAPPER}} .wpr-el-nav-arrow:hover' => 'color: {{VALUE}};',
                ],
            ]
        );

        $this->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'arrow_hover_bg_color',
                'types' => ['classic', 'gradient'],
                'selector' => '{{WRAPPER}} .slick-arrow:hover::after, {{WRAPPER}} .wpr-el-nav-arrow:hover',
            ]
        );

        $this->add_control(
            'arrow_hover_border_color',
            [
                'label' => __('Border Color', 'unlock-addons-for-elementor'),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'arrow_border_border!' => '',
                ],
                'selectors' => [
                    '{{WRAPPER}} .slick-arrow, {{WRAPPER}} .wpr-el-nav-arrow:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

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

        $this->end_controls_section();


        $this->start_controls_section(
            'wpr_team-img_section',
            [
                'label' => esc_html__('Image - Style', 'unlock-addons-for-elementor'),
                'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        $this->add_responsive_control(
            'wpr_team-img_w',
            [
                'type' => \Elementor\Controls_Manager::SLIDER,
                'label' => esc_html__('Image Width', 'unlock-addons-for-elementor'),
                'size_units' => ['px', '%'],
                'range' => [
                    'px' => [
                        'min' => 1,
                        'max' => 2000,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .wpr-el-team-img img' => 'min-width: {{SIZE}}{{UNIT}};',
                ],
            ]
        );
        $this->add_responsive_control(
            'wpr_team-img_h',
            [
                'type' => \Elementor\Controls_Manager::SLIDER,
                'label' => esc_html__('Image Height', 'unlock-addons-for-elementor'),
                'size_units' => ['px', '%'],
                'range' => [
                    'px' => [
                        'min' => 1,
                        'max' => 2000,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .wpr-el-team-img img' => 'min-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-team-img 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();

?>

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

            <div class="row g-4">
                <?php foreach ($settings['teams'] as $key => $item):
                    $title = $this->tp_kses($item['title']);
                    $key = $key + 1;

                    // Handle image URL and alt text
                    if (!empty($item['image']['url'])) {
                        $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                        $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                    }

                    // Reset render attributes for each iteration
                    $this->add_render_attribute('title_args', 'class', 'title');

                    // Determine link details
                    if ('2' == $item['wpr_title_link_type']) {
                        $link = get_permalink($item['wpr_title_page_link']);
                        $target = '_self';
                        $rel = 'nofollow';
                    } else {
                        $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                        $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                        $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                    }
                ?>
                    <div class="<?php echo esc_attr($this->col_show($settings)); ?>">
                        <div class="team__item fade-anim" data-delay="<?php echo esc_attr($item['wpr_rep_animation_delay']); ?>">
                            <div class="team-thumb wpr-el-team-img">
                                <?php if (!empty($wpr_team_image_url)): ?>
                                    <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>" data-speed="0.8" class="w-100" />
                                <?php endif; ?>

                                <div class="thumb-shape">
                                    <svg
                                        xmlns="http://www.w3.org/2000/svg"
                                        width="223"
                                        height="324"
                                        viewBox="0 0 223 324"
                                        fill="none">
                                        <path
                                            d="M196.869 1C175.859 79.115 137.342 145.551 32.4471 159.505C-72.448 173.46 113.735 40.6504 173.263 91.5416C219.392 130.978 98.5825 204.472 101.627 217.061C104.672 229.651 233.367 163.604 221.187 185.598C209.008 207.591 134.25 265.094 106.336 323"
                                            stroke="currentColor" />
                                    </svg>
                                </div>

                            </div>
                            <div class="team-content">
                                <?php if (!empty($item['designation'])): ?>
                                    <span class="designation wpr-el-team-desi">
                                        <?php echo $this->tp_kses($item['designation']); ?>
                                    </span>
                                <?php endif; ?>

                                <?php
                                if (!empty($link)) {
                                    $t_link = esc_attr($link);
                                    $t_target = esc_attr($target);
                                    $t_rel = esc_attr($rel);
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s><a class="wpr-el-team-name" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $t_link,
                                            $t_target,
                                            $t_rel,
                                            $title
                                        );
                                    endif;
                                } else {
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s>%3$s</%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $title
                                        );
                                    endif;
                                }
                                ?>

                                <?php if (!empty($item['show_social']) && $item['show_social'] === 'yes'): ?>
                                    <div class="social">
                                        <?php if (!empty($item['wpr_social_title'])): ?>
                                            <h6 class="social-title">
                                                <?php echo $this->tp_kses($item['wpr_social_title']); ?>
                                            </h6>
                                        <?php endif; ?>
                                        <span class="line"></span>
                                        <ul>
                                            <?php if (!empty($item['web_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                        <i class="fas fa-globe"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['phone_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['facebook_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['twitter_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['linkedin_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['instagram_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['youtube_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['googleplus_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['flickr_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['vimeo_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['behance_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['dribble_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['pinterest_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['gitub_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>

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

            $attrs = $this->tp_get_repeater_links_attr($settings, 'team_link');
            extract($attrs);

            $links_attrs = [
                'href' => $link,
                'target' => $target,
                'rel' => $rel,
            ];
        ?>

            <!--================= Team Section start =================-->
            <section class="team-5 section section-padding-top-bottom move-box-wrap wpr-el-section">
                <?php if (!empty($settings['wpr_shape_show'])): ?>
                    <span class="leap-1 move-item"></span>
                    <span class="leap-2 move-item"></span>
                    <span class="leap-3 move-item"></span>
                    <img src="<?php echo get_template_directory_uri(); ?>/assets/img/shape/team-shape-1.png" alt="shape" class="shape-1" />
                <?php endif; ?>
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <div class="section-header-5">
                                <?php if (!empty($settings['wpr_sub_title'])): ?>
                                    <span class="section-sub-title wpr-el-subtitle">
                                        <?php echo $this->tp_kses($settings['wpr_sub_title']); ?>
                                    </span>
                                <?php endif; ?>

                                <?php if (!empty($settings['wpr_title'])): ?>
                                    <h2 class="section-title large-title split-text effect-blur-fade wpr-el-title">
                                        <?php echo $this->tp_kses($settings['wpr_title']); ?>
                                    </h2>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                    <div class="row gy-4 gx-3 gx-md-4 row-padding-top">
                        <?php foreach ($settings['teams'] as $key => $item):
                            $title = $this->tp_kses($item['title']);
                            // $key = $key + 1;

                            // Handle image URL and alt text
                            if (!empty($item['image']['url'])) {
                                $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                                $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                            }

                            // Reset render attributes for each iteration
                            $this->add_render_attribute('title_args', 'class', 'title line-clamp-1');

                            // Determine link details
                            if ('2' == $item['wpr_title_link_type']) {
                                $link = get_permalink($item['wpr_title_page_link']);
                                $target = '_self';
                                $rel = 'nofollow';
                            } else {
                                $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                                $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                                $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                            }
                        ?>
                            <div class="<?php echo esc_attr($this->col_show($settings)); ?>">
                                <div class="team-5__item">
                                    <div class="item-thumb wpr-el-team-img">
                                        <?php if (!empty($wpr_team_image_url)): ?>
                                            <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>" class="w-100">

                                            <div class="thumb-shape">
                                                <svg xmlns="http://www.w3.org/2000/svg" width="100" height="44" viewBox="0 0 100 44" fill="none">
                                                    <rect opacity="0.12" x="14.2854" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect x="14.2854" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect x="57.1431" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect x="42.8569" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect opacity="0.12" x="42.8569" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect opacity="0.12" x="28.5713" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect opacity="0.12" x="71.4285" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect x="71.4285" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                                    <rect opacity="0.12" x="85.7144" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                                </svg>
                                            </div>

                                            <?php if (!empty($item['show_social'])): ?>
                                                <div class="social-share-5">
                                                    <ul class="wpr-el-team-social">
                                                        <?php if (!empty($item['web_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                                    <i class="fas fa-globe"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['phone_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['facebook_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['twitter_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['linkedin_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['instagram_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['youtube_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['googleplus_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['flickr_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['vimeo_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['behance_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['dribble_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['pinterest_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                            </li>
                                                        <?php endif; ?>
                                                        <?php if (!empty($item['gitub_title'])): ?>
                                                            <li>
                                                                <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                                </a>
                                                            </li>
                                                        <?php endif; ?>
                                                    </ul>
                                                </div>
                                            <?php endif; ?>

                                            <?php if (! empty($link)) : ?>
                                                <a href="<?php echo esc_url($link); ?>"
                                                    target="<?php echo esc_attr($target); ?>"
                                                    rel="<?php echo esc_attr($rel); ?>"
                                                    class="item-link"></a>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    </div>
                                    <div class="item-content">
                                        <?php
                                        if (!empty($link)) {
                                            $t_link = esc_attr($link);
                                            $t_target = esc_attr($target);
                                            $t_rel = esc_attr($rel);
                                            if (!empty($title)):
                                                printf(
                                                    '<%1$s %2$s><a class="wpr-el-team-name name" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                                    tag_escape($settings['wpr_title_tag']),
                                                    $this->get_render_attribute_string('title_args'),
                                                    $t_link,
                                                    $t_target,
                                                    $t_rel,
                                                    $title
                                                );
                                            endif;
                                        } else {
                                            if (!empty($title)):
                                                printf(
                                                    '<%1$s %2$s>%3$s</%1$s>',
                                                    tag_escape($settings['wpr_title_tag']),
                                                    $this->get_render_attribute_string('title_args'),
                                                    $title
                                                );
                                            endif;
                                        }
                                        ?>

                                        <?php if (!empty($item['designation'])): ?>
                                            <span class="designation wpr-el-team-desi">
                                                <?php echo $this->tp_kses($item['designation']); ?>
                                            </span>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>

                    <?php if (!empty($settings['wpr_btn_text'])) : ?>
                        <div class="row row-padding-top">
                            <div class="col-12 text-center">
                                <a class="orvio-btn10 wpr-el-btn" <?php echo tp_implode_html_attributes($links_attrs); ?>>
                                    <?php echo $this->tp_kses($settings['wpr_btn_text']); ?>
                                </a>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </section>
            <!--================= Team Section end =================-->


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


            <div class="row gy-5">
                <?php foreach ($settings['teams'] as $key => $item):
                    $title = $this->tp_kses($item['title']);
                    // $key = $key + 1;

                    // Handle image URL and alt text
                    if (!empty($item['image']['url'])) {
                        $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                        $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                    }

                    // Reset render attributes for each iteration
                    $this->add_render_attribute('title_args', 'class', 'item-title');

                    // Determine link details
                    if ('2' == $item['wpr_title_link_type']) {
                        $link = get_permalink($item['wpr_title_page_link']);
                        $target = '_self';
                        $rel = 'nofollow';
                    } else {
                        $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                        $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                        $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                    }
                ?>
                    <div class="<?php echo esc_attr($this->col_show($settings)); ?>">
                        <div class="team-6__item fade-anim" data-delay="0.45">
                            <div class="item-thumb wpr-el-team-img">
                                <?php if (!empty($wpr_team_image_url)): ?>
                                    <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>" class="w-100">
                                <?php endif; ?>

                                <div class="thumb-wrapper">
                                    <div class="item-social">
                                        <span class="thumb-shape">
                                            <svg
                                                xmlns="http://www.w3.org/2000/svg"
                                                width="74"
                                                height="74"
                                                viewBox="0 0 74 74"
                                                fill="none">
                                                <path
                                                    d="M73.5 44.2363C73.5 45.1623 72.6694 45.8675 71.7559 45.7168L45.7646 41.4209C45.314 41.3464 45.007 41.8661 45.29 42.2246L61.9844 63.3691C62.5501 64.0857 62.35 65.1372 61.5605 65.5957L49.0781 72.8428C48.2792 73.3064 47.2554 72.9445 46.9248 72.082L37.3584 47.123C37.1937 46.6933 36.5844 46.695 36.4228 47.126L27.0713 72.0674C26.7454 72.9364 25.7168 73.3047 24.9141 72.8389L12.4395 65.5957C11.65 65.1372 11.4499 64.0857 12.0156 63.3691L28.71 42.2246C28.993 41.8661 28.686 41.3464 28.2353 41.4209L2.24414 45.7168C1.33063 45.8675 0.499998 45.1623 0.499998 44.2363L0.499999 29.7637C0.499999 28.8377 1.33063 28.1325 2.24414 28.2832L28.2354 32.5791C28.686 32.6536 28.993 32.1339 28.71 31.7754L12.0156 10.6309C11.4499 9.91428 11.65 8.8628 12.4395 8.40429L24.9141 1.16113C25.7168 0.695313 26.7455 1.06358 27.0713 1.93262L36.4229 26.874C36.5844 27.305 37.1937 27.3067 37.3584 26.877L46.9248 1.91797C47.2554 1.05546 48.2793 0.693644 49.0781 1.15723L61.5605 8.4043C62.35 8.8628 62.5501 9.91428 61.9844 10.6309L45.29 31.7754C45.007 32.1339 45.314 32.6536 45.7646 32.5791L71.7559 28.2832C72.6694 28.1325 73.5 28.8377 73.5 29.7637L73.5 44.2363Z"
                                                    stroke="currentColor" />
                                            </svg>
                                        </span>

                                        <?php if (!empty($item['show_social'])): ?>
                                            <ul class="wpr-el-team-social">
                                                <?php if (!empty($item['web_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                            <i class="fas fa-globe"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['phone_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['facebook_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['twitter_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['linkedin_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['instagram_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['youtube_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['googleplus_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['flickr_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['vimeo_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['behance_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['dribble_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['pinterest_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['gitub_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                            </ul>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>

                            <div class="item-content">
                                <?php
                                if (!empty($link)) {
                                    $t_link = esc_attr($link);
                                    $t_target = esc_attr($target);
                                    $t_rel = esc_attr($rel);
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s><a class="wpr-el-team-name" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $t_link,
                                            $t_target,
                                            $t_rel,
                                            $title
                                        );
                                    endif;
                                } else {
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s>%3$s</%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $title
                                        );
                                    endif;
                                }
                                ?>

                                <?php if (!empty($item['designation'])): ?>
                                    <span class="designation wpr-el-team-desi">
                                        <?php echo $this->tp_kses($item['designation']); ?>
                                    </span>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>


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

            <div class="row g-4">
                <?php foreach ($settings['teams'] as $key => $item):
                    $title = $this->tp_kses($item['title']);
                    // $key = $key + 1;

                    // Handle image URL and alt text
                    if (!empty($item['image']['url'])) {
                        $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                        $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                    }

                    // Reset render attributes for each iteration
                    $this->add_render_attribute('title_args', 'class', 'title line-clamp-1');

                    // Determine link details
                    if ('2' == $item['wpr_title_link_type']) {
                        $link = get_permalink($item['wpr_title_page_link']);
                        $target = '_self';
                        $rel = 'nofollow';
                    } else {
                        $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                        $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                        $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                    }
                ?>
                    <div class="<?php echo esc_attr($this->col_show($settings)); ?>">
                        <div class="team-5__item">
                            <div class="item-thumb wpr-el-team-img">
                                <?php if (!empty($wpr_team_image_url)): ?>
                                    <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>" class="w-100">

                                    <div class="thumb-shape">
                                        <svg xmlns="http://www.w3.org/2000/svg" width="100" height="44" viewBox="0 0 100 44" fill="none">
                                            <rect opacity="0.12" x="14.2854" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect x="14.2854" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect x="57.1431" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect x="42.8569" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect opacity="0.12" x="42.8569" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect opacity="0.12" x="28.5713" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect opacity="0.12" x="71.4285" y="0.199219" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect x="71.4285" y="29.0352" width="14.2857" height="14.2894" fill="currentColor" />
                                            <rect opacity="0.12" x="85.7144" y="14.6172" width="14.2857" height="14.2894" fill="currentColor" />
                                        </svg>
                                    </div>

                                    <?php if (!empty($item['show_social'])): ?>
                                        <div class="social-share-5">
                                            <ul class="wpr-el-team-social">
                                                <?php if (!empty($item['web_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                            <i class="fas fa-globe"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['phone_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['facebook_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['twitter_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['linkedin_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['instagram_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['youtube_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['googleplus_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['flickr_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['vimeo_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['behance_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['dribble_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['pinterest_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                    </li>
                                                <?php endif; ?>
                                                <?php if (!empty($item['gitub_title'])): ?>
                                                    <li>
                                                        <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                        </a>
                                                    </li>
                                                <?php endif; ?>
                                            </ul>
                                        </div>
                                    <?php endif; ?>

                                    <?php if (! empty($link)) : ?>
                                        <a href="<?php echo esc_url($link); ?>"
                                            target="<?php echo esc_attr($target); ?>"
                                            rel="<?php echo esc_attr($rel); ?>"
                                            class="item-link"></a>
                                    <?php endif; ?>
                                <?php endif; ?>
                            </div>
                            <div class="item-content">
                                <?php
                                if (!empty($link)) {
                                    $t_link = esc_attr($link);
                                    $t_target = esc_attr($target);
                                    $t_rel = esc_attr($rel);
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s><a class="wpr-el-team-name name" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $t_link,
                                            $t_target,
                                            $t_rel,
                                            $title
                                        );
                                    endif;
                                } else {
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s>%3$s</%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $title
                                        );
                                    endif;
                                }
                                ?>

                                <?php if (!empty($item['designation'])): ?>
                                    <span class="designation wpr-el-team-desi">
                                        <?php echo $this->tp_kses($item['designation']); ?>
                                    </span>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>

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

            <!-- Team 02 Start -->
            <div class="team-area-2 wpr-el-section">
                <!-- <div class="team-area-2-inner section-spacing"> -->
                <div class="team-wrapper-box fade-anim">
                    <div class="team-wrapper">
                        <?php foreach ($settings['teams'] as $key => $item):
                            $title = $this->tp_kses($item['title']);
                            $key = $key + 1;

                            // Handle image URL and alt text
                            if (!empty($item['image']['url'])) {
                                $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                                $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                            }

                            // Reset render attributes for each iteration
                            $this->add_render_attribute('title_args', 'class', '');

                            // Determine link details
                            if ('2' == $item['wpr_title_link_type']) {
                                $link = get_permalink($item['wpr_title_page_link']);
                                $target = '_self';
                                $rel = 'nofollow';
                            } else {
                                $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                                $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                                $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                            }
                        ?>
                            <div class="team-box-2 fade-anim" data-delay="0.30" data-direction="right">

                                <?php if (!empty($item['show_social']) && $item['show_social'] === 'yes'): ?>
                                    <div class="social-links">
                                        <ul>
                                            <?php if (!empty($item['web_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                        <i class="fas fa-globe"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['phone_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['facebook_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['twitter_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['linkedin_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['instagram_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['youtube_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['googleplus_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['flickr_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['vimeo_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['behance_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['dribble_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['pinterest_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['gitub_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                <?php endif; ?>

                                <?php if (!empty($wpr_team_image_url)): ?>
                                    <div class="thumb wpr-el-team-img">
                                        <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>">
                                    </div>
                                <?php endif; ?>

                                <div class="content">
                                    <?php
                                    if (!empty($link)) {
                                        $t_link = esc_attr($link);
                                        $t_target = esc_attr($target);
                                        $t_rel = esc_attr($rel);
                                        if (!empty($title)):
                                            printf(
                                                '<%1$s %2$s><a class="wpr-el-team-name name" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                                tag_escape($settings['wpr_title_tag']),
                                                $this->get_render_attribute_string('title_args'),
                                                $t_link,
                                                $t_target,
                                                $t_rel,
                                                $title
                                            );
                                        endif;
                                    } else {
                                        if (!empty($title)):
                                            printf(
                                                '<%1$s %2$s>%3$s</%1$s>',
                                                tag_escape($settings['wpr_title_tag']),
                                                $this->get_render_attribute_string('title_args'),
                                                $title
                                            );
                                        endif;
                                    }
                                    ?>

                                    <?php if (!empty($item['designation'])): ?>
                                        <span class="post wpr-el-team-desi">
                                            <?php echo $this->tp_kses($item['designation']); ?>
                                        </span>
                                    <?php endif; ?>

                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
                <!-- </div> -->
            </div>
            <!-- Team 02 Start -->


        <?php else:

        ?>

            <div class="row g-4">
                <?php foreach ($settings['teams'] as $key => $item):
                    $title = $this->tp_kses($item['title']);
                    $key = $key + 1;

                    // Handle image URL and alt text
                    if (!empty($item['image']['url'])) {
                        $wpr_team_image_url = !empty($item['image']['id']) ? wp_get_attachment_image_url($item['image']['id'], $settings['thumbnail_size']) : $item['image']['url'];
                        $wpr_team_image_alt = get_post_meta($item["image"]["id"], "_wp_attachment_image_alt", true);
                    }

                    // Reset render attributes for each iteration
                    $this->add_render_attribute('title_args', 'class', '');

                    // Determine link details
                    if ('2' == $item['wpr_title_link_type']) {
                        $link = get_permalink($item['wpr_title_page_link']);
                        $target = '_self';
                        $rel = 'nofollow';
                    } else {
                        $link = !empty($item['wpr_title_custome_link']['url']) ? $item['wpr_title_custome_link']['url'] : '';
                        $target = !empty($item['wpr_title_custome_link']['is_external']) ? '_blank' : '';
                        $rel = !empty($item['wpr_title_custome_link']['nofollow']) ? 'nofollow' : '';
                    }
                ?>
                    <div class="<?php echo esc_attr($this->col_show($settings)); ?>">
                        <div class="team-2__item fade-anim" data-delay="0.3">
                            <?php if (!empty($wpr_team_image_url)): ?>
                                <div class="team-thumb wpr-el-team-img">
                                    <img src="<?php echo esc_url($wpr_team_image_url); ?>" alt="<?php echo esc_attr($wpr_team_image_alt); ?>" class="w-100" />
                                </div>
                            <?php endif; ?>

                            <div class="team-content">
                                <?php if (!empty($item['designation'])): ?>
                                    <span class="designation wpr-el-team-desi">
                                        <?php echo $this->tp_kses($item['designation']); ?>
                                    </span>
                                <?php endif; ?>

                                <?php
                                if (!empty($link)) {
                                    $t_link = esc_attr($link);
                                    $t_target = esc_attr($target);
                                    $t_rel = esc_attr($rel);
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s><a class="wpr-el-team-name title" href="%3$s" target="%4$s" rel="%5$s">%6$s</a></%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $t_link,
                                            $t_target,
                                            $t_rel,
                                            $title
                                        );
                                    endif;
                                } else {
                                    if (!empty($title)):
                                        printf(
                                            '<%1$s %2$s>%3$s</%1$s>',
                                            tag_escape($settings['wpr_title_tag']),
                                            $this->get_render_attribute_string('title_args'),
                                            $title
                                        );
                                    endif;
                                }
                                ?>

                                <?php if (!empty($item['show_social'])): ?>
                                    <div class="social">
                                        <ul class="wpr-el-team-social">
                                            <li>
                                                <a class="wpr-el-team-social" href="#">
                                                    <i class="fa-light fa-share-nodes"></i>
                                                </a>
                                            </li>
                                            <?php if (!empty($item['web_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['web_title']); ?>">
                                                        <i class="fas fa-globe"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['phone_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['phone_title']); ?>"><i class="fas fa-phone"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['facebook_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['facebook_title']); ?>"><i class="fab fa-facebook-f"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['twitter_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['twitter_title']); ?>"><i class="fab fa-twitter"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['linkedin_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['linkedin_title']); ?>"><i class="fab fa-linkedin"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['instagram_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['instagram_title']); ?>"><i class="fab fa-instagram"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['youtube_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['youtube_title']); ?>"><i class="fab fa-youtube"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['googleplus_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['googleplus_title']); ?>"><i class="fab fa-google-plus-g"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['flickr_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['flickr_title']); ?>"><i class="fab fa-flickr"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['vimeo_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['vimeo_title']); ?>"><i class="fab fa-vimeo-v"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['behance_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['behance_title']); ?>"><i class="fab fa-behance"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['dribble_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['dribble_title']); ?>"><i class="fab fa-dribbble"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['pinterest_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['pinterest_title']); ?>"><i class="fab fa-pinterest-p"></i></a>
                                                </li>
                                            <?php endif; ?>
                                            <?php if (!empty($item['gitub_title'])): ?>
                                                <li>
                                                    <a class="wpr-el-team-social" href="<?php echo esc_url($item['gitub_title']); ?>"><i class="fab fa-github"></i>
                                                    </a>
                                                </li>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>


<?php endif;
    }
}

