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

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

use CodexShaper\Framework\Widgets\Elementor\Modules\Button\Widgets\Button;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Background;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Text_Stroke;
use Elementor\Group_Control_Typography;
use Elementor\Utils;

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

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

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

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

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

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

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

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

	/**
	 * Register Elementor widget controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_controls() {
		// Register layout controls.
		$this->register_layout_controls();
		$this->register_Additional_layout_controls();
		// Register style controls.
		$this->register_layout_style_controls();
		$this->register_image_style_controls();
		$this->register_content_style_controls();
		$this->register_badge_style_controls();
		// Button Control Register.
		parent::register_controls();
	}

	/**
	 * Register Elementor widget layout controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_layout_controls() {
		$this->start_controls_section(
			'image_box_section_layout',
			array(
				'label' => __( 'Layout', 'codexshaper-framework' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			)
		);
		$this->add_control(
			'image',
			array(
				'label'   => esc_html__( 'Choose Image', 'codexshaper-framework' ),
				'type'    => Controls_Manager::MEDIA,
				'dynamic' => array(
					'active' => true,
				),
				'default' => array(
					'url' => Utils::get_placeholder_image_src(),
				),
			)
		);

		$this->add_control(
			'image_position',
			array(
				'label'   => esc_html__( 'Position', 'codexshaper-framework' ),
				'type'    => Controls_Manager::SELECT,
				'options' => array(
					'before'      => 'Before Content',
					'after'       => 'After Content',
					'after_title' => 'After Title',
				),
				'default' => 'before',
			)
		);

		$this->add_group_control(
			Group_Control_Image_Size::get_type(),
			array(
				'name'      => 'thumbnail',
				'default'   => 'full',
				'condition' => array(
					'image[url]!' => '',
				),
			)
		);

		$this->add_control(
			'lazy_load',
			array(
				'label' => esc_html__( 'Custom Lazy Load ', 'codexshaper-framework' ),
				'type'  => Controls_Manager::SWITCHER,
			)
		);

		$this->add_control(
			'title_text',
			array(
				'label'       => esc_html__( 'Title', 'codexshaper-framework' ),
				'type'        => Controls_Manager::TEXT,
				'dynamic'     => array(
					'active' => true,
				),
				'default'     => esc_html__( 'This is the heading', 'codexshaper-framework' ),
				'placeholder' => esc_html__( 'Enter your title', 'codexshaper-framework' ),
				'label_block' => true,
			)
		);

		$this->add_control(
			'description_text',
			array(
				'label'       => esc_html__( 'Description', 'codexshaper-framework' ),
				'type'        => Controls_Manager::WYSIWYG,
				'dynamic'     => array(
					'active' => true,
				),
				'default'     => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'codexshaper-framework' ),
				'placeholder' => esc_html__( 'Enter your description', 'codexshaper-framework' ),
				'rows'        => 10,
			)
		);

		$this->add_control(
			'link',
			array(
				'label'     => esc_html__( 'Link', 'codexshaper-framework' ),
				'type'      => Controls_Manager::URL,
				'dynamic'   => array(
					'active' => true,
				),
				'separator' => 'before',
			)
		);

		$this->add_control(
			'title_size',
			array(
				'label'   => esc_html__( 'Title HTML Tag', 'codexshaper-framework' ),
				'type'    => Controls_Manager::SELECT,
				'options' => array(
					'h1'   => 'H1',
					'h2'   => 'H2',
					'h3'   => 'H3',
					'h4'   => 'H4',
					'h5'   => 'H5',
					'h6'   => 'H6',
					'div'  => 'div',
					'span' => 'span',
					'p'    => 'p',
				),
				'default' => 'h3',
			)
		);

		$this->end_controls_section();
	}

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

		$this->add_control(
			'enable_button',
			array(
				'label'        => esc_html__( 'Enable Button', 'codexshaper-framework' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => esc_html__( 'Yes', 'codexshaper-framework' ),
				'label_off'    => esc_html__( 'No', 'codexshaper-framework' ),
				'return_value' => 'yes',
				'default'      => 'yes',
			)
		);

		$this->add_control(
			'enable_badge',
			array(
				'label'        => esc_html__( 'Show Badge', 'codexshaper-framework' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => esc_html__( 'Show', 'codexshaper-framework' ),
				'label_off'    => esc_html__( 'Hide', 'codexshaper-framework' ),
				'return_value' => 'yes',
				'default'      => 'no',
			)
		);

		$this->add_control(
			'image_box_badge_title',
			array(
				'label'       => esc_html__( 'Title', 'codexshaper-framework' ),
				'type'        => Controls_Manager::TEXT,
				'dynamic'     => array(
					'active' => true,
				),
				'default'     => esc_html__( 'BADGE', 'codexshaper-framework' ),
				'placeholder' => esc_html__( 'Type your title here', 'codexshaper-framework' ),
				'condition'   => array(
					'enable_badge' => 'yes',
				),
			)
		);

		$this->add_control(
			'image_box_badge_position',
			array(
				'label'     => esc_html__( 'Position', 'codexshaper-framework' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'top-left',
				'options'   => array(
					'top-left'      => esc_html__( 'Top Left', 'codexshaper-framework' ),
					'top-center'    => esc_html__( 'Top Center', 'codexshaper-framework' ),
					'top-right'     => esc_html__( 'Top Right', 'codexshaper-framework' ),
					'center-left'   => esc_html__( 'Center Left', 'codexshaper-framework' ),
					'center-right'  => esc_html__( 'Center Right', 'codexshaper-framework' ),
					'bottom-left'   => esc_html__( 'Bottom Left', 'codexshaper-framework' ),
					'bottom-center' => esc_html__( 'Bottom Center', 'codexshaper-framework' ),
					'bottom-right'  => esc_html__( 'Bottom Right', 'codexshaper-framework' ),
					'custom'        => esc_html__( 'Custom', 'codexshaper-framework' ),
				),
				'condition' => array(
					'enable_badge' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'badge_arrow_horizontal_position',
			array(
				'label'           => esc_html__( 'Horizontal Position', 'codexshaper-framework' ),
				'type'            => Controls_Manager::SLIDER,
				'size_units'      => array( 'px', '%' ),
				'range'           => array(
					'px' => array(
						'min'  => -1000,
						'max'  => 1000,
						'step' => 1,
					),
					'%'  => array(
						'min' => -1000,
						'max' => 1000,
					),
				),
				'desktop_default' => array(
					'size' => 0,
					'unit' => 'px',
				),
				'selectors'       => array(
					'{{WRAPPER}} .csmf--icon-box-badge.csmf--icon-box-badge' => 'left: {{SIZE}}{{UNIT}};',
				),
				'condition'       => array(
					'image_box_badge_position' => 'custom',
				),
			)
		);

		$this->add_responsive_control(
			'badge_arrow_horizontal_position_vertial',
			array(
				'label'           => esc_html__( 'Vertical Position', 'codexshaper-framework' ),
				'type'            => Controls_Manager::SLIDER,
				'size_units'      => array( 'px', '%' ),
				'range'           => array(
					'px' => array(
						'min'  => -1000,
						'max'  => 1000,
						'step' => 1,
					),
					'%'  => array(
						'min' => -1000,
						'max' => 1000,
					),
				),
				'desktop_default' => array(
					'size' => 0,
					'unit' => 'px',
				),
				'selectors'       => array(
					'{{WRAPPER}} .csmf--icon-box-badge.csmf--icon-box-badge' => 'top: {{SIZE}}{{UNIT}};',
				),
				'condition'       => array(
					'image_box_badge_position' => 'custom',
				),
			)
		);

		$this->add_control(
			'is_enable_image_link',
			array(
				'label'   => esc_html__( 'Image Link', 'codexshaper-framework' ),
				'type'    => Controls_Manager::SWITCHER,
				'default' => 'no',
			)
		);

		$this->add_control(
			'image_link',
			array(
				'label'     => __( 'Link', 'codexshaper-framework' ),
				'type'      => Controls_Manager::URL,
				'dynamic'   => array(
					'active' => true,
				),
				'default'   => array(
					'url'         => '',
					'is_external' => true,
				),
				'condition' => array(
					'is_enable_image_link' => 'yes',
				),
			)
		);

		$this->add_control(
			'is_enable_title_link',
			array(
				'label'   => esc_html__( 'Title Link', 'codexshaper-framework' ),
				'type'    => Controls_Manager::SWITCHER,
				'default' => 'no',
			)
		);

		$this->add_control(
			'title_link',
			array(
				'label'     => __( 'Link', 'codexshaper-framework' ),
				'type'      => Controls_Manager::URL,
				'dynamic'   => array(
					'active' => true,
				),
				'default'   => array(
					'url'         => '',
					'is_external' => true,
				),
				'condition' => array(
					'is_enable_title_link' => 'yes',
				),
			)
		);

		$this->end_controls_section();
	}

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

		$this->add_responsive_control(
			'position',
			array(
				'label'        => esc_html__( 'Image Position', 'codexshaper-framework' ),
				'type'         => Controls_Manager::CHOOSE,
				'default'      => 'top',
				'options'      => array(
					'left'  => array(
						'title' => esc_html__( 'Left', 'codexshaper-framework' ),
						'icon'  => 'eicon-h-align-left',
					),
					'top'   => array(
						'title' => esc_html__( 'Top', 'codexshaper-framework' ),
						'icon'  => 'eicon-v-align-top',
					),
					'right' => array(
						'title' => esc_html__( 'Right', 'codexshaper-framework' ),
						'icon'  => 'eicon-h-align-right',
					),
				),
				'prefix_class' => 'csmf--position-',
				'toggle'       => false,
				'condition'    => array(
					'image[url]!'    => '',
					'image_position' => 'before',
				),
			)
		);

		$this->add_responsive_control(
			'content_vertical_alignment',
			array(
				'label'        => esc_html__( 'Vertical Alignment', 'codexshaper-framework' ),
				'type'         => Controls_Manager::CHOOSE,
				'options'      => array(
					'top'    => array(
						'title' => esc_html__( 'Top', 'codexshaper-framework' ),
						'icon'  => 'eicon-v-align-top',
					),
					'middle' => array(
						'title' => esc_html__( 'Middle', 'codexshaper-framework' ),
						'icon'  => 'eicon-v-align-middle',
					),
					'bottom' => array(
						'title' => esc_html__( 'Bottom', 'codexshaper-framework' ),
						'icon'  => 'eicon-v-align-bottom',
					),
				),
				'default'      => 'top',
				'toggle'       => false,
				'prefix_class' => 'csmf--vertical-align-',
				'condition'    => array(
					'position!'      => 'top',
					'image_position' => 'before',
				),
			)
		);

		$this->add_responsive_control(
			'text_align',
			array(
				'label'     => esc_html__( 'Alignment', 'codexshaper-framework' ),
				'type'      => Controls_Manager::CHOOSE,
				'options'   => array(
					'left'    => array(
						'title' => esc_html__( 'Left', 'codexshaper-framework' ),
						'icon'  => 'eicon-text-align-left',
					),
					'center'  => array(
						'title' => esc_html__( 'Center', 'codexshaper-framework' ),
						'icon'  => 'eicon-text-align-center',
					),
					'right'   => array(
						'title' => esc_html__( 'Right', 'codexshaper-framework' ),
						'icon'  => 'eicon-text-align-right',
					),
					'justify' => array(
						'title' => esc_html__( 'Justified', 'codexshaper-framework' ),
						'icon'  => 'eicon-text-align-justify',
					),
				),
				'selectors' => array(
					'{{WRAPPER}} .csmf--image-box-wrapper' => 'text-align: {{VALUE}};',
				),
				'separator' => 'after',
			)
		);

		$this->add_responsive_control(
			'image_space',
			array(
				'label'      => esc_html__( 'Image Spacing', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'em', 'rem', 'vw', 'custom' ),
				'default'    => array(
					'size' => 15,
				),
				'range'      => array(
					'px' => array(
						'max' => 100,
					),
				),
				'selectors'  => array(
					'{{WRAPPER}}.csmf--position-right .csmf--image-box-img' => 'margin-left: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}}.csmf--position-left .csmf--image-box-img' => 'margin-right: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}}.csmf--position-top .csmf--image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};',
					'(mobile){{WRAPPER}} .csmf--image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				),
				'condition'  => array(
					'image[url]!' => '',
				),
			)
		);

		$this->add_responsive_control(
			'title_bottom_space',
			array(
				'label'      => esc_html__( 'Content Spacing', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', 'em', 'rem', 'custom' ),
				'range'      => array(
					'px'  => array(
						'max' => 100,
					),
					'em'  => array(
						'min' => 0,
						'max' => 10,
					),
					'rem' => array(
						'min' => 0,
						'max' => 10,
					),
				),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				),
			)
		);

		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_image_style_controls() {
		$this->start_controls_section(
			'section_style_image',
			array(
				'label'     => esc_html__( 'Image', 'codexshaper-framework' ),
				'tab'       => Controls_Manager::TAB_STYLE,
				'condition' => array(
					'image[url]!' => '',
				),
			)
		);

		$this->add_responsive_control(
			'image_wrapper_width',
			array(
				'label'      => esc_html__( 'Wrapper Width', 'codexshaper-framework' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', '%', 'custom' ),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--image-box-img' => 'width: {{SIZE}}{{UNIT}} ! important;',
				),
			)
		);

		// Tabs.
		$this->start_controls_tabs(
			'image_boxstyle_tabs'
		);

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

		$this->common_image_controls(
			'image_box',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--image-box-img .featured-image',
			)
		);

		$this->remove_control( 'image_box_transition' );

		$this->end_controls_tab();

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

		$this->common_image_controls(
			'image_box_hover',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--image-box-img .featured-image:hover',

			)
		);

		$this->add_control(
			'hover_animation',
			array(
				'label' => esc_html__( 'Hover Animation', 'codexshaper-framework' ),
				'type'  => Controls_Manager::HOVER_ANIMATION,
			)
		);

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

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

		$this->add_control(
			'heading_title',
			array(
				'label'     => esc_html__( 'Title', 'codexshaper-framework' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->common_space_controls(
			'title_space',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--image-box-title',
			)
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			array(
				'name'     => 'title_typography',
				'selector' => '{{WRAPPER}} .csmf--image-box-title',
			)
		);

		$this->add_group_control(
			Group_Control_Text_Stroke::get_type(),
			array(
				'name'     => 'title_stroke',
				'selector' => '{{WRAPPER}} .csmf--image-box-title',
			)
		);

		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			array(
				'name'     => 'title_shadow',
				'selector' => '{{WRAPPER}} .csmf--image-box-title',
			)
		);

		$this->start_controls_tabs(
			'title_style_tabs'
		);

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

		$this->add_control(
			'title_color',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => array(
					'{{WRAPPER}} .csmf--image-box-title' => 'color: {{VALUE}};',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'title_style_hover_tab',
			array(
				'label'     => esc_html__( 'Hover', 'codexshaper-framework' ),
				'condition' => array(
					'is_enable_title_link' => 'yes',
				),
			)
		);

		$this->add_control(
			'title_color_hover',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => array(
					'{{WRAPPER}} .csmf--image-box-title:hover' => 'color: {{VALUE}};',
				),
			)
		);

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

		$this->add_control(
			'heading_description',
			array(
				'label'     => esc_html__( 'Description', 'codexshaper-framework' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->common_space_controls(
			'description_space',
			options: array(
				'selector' => '{{WRAPPER}} .csmf--image-box-description',
			)
		);

		$this->add_control(
			'description_color',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => array(
					'{{WRAPPER}} .csmf--image-box-description' => 'color: {{VALUE}};',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			array(
				'name'     => 'description_typography',
				'selector' => '{{WRAPPER}} .csmf--image-box-description',
			)
		);

		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			array(
				'name'     => 'description_shadow',
				'selector' => '{{WRAPPER}} .csmf--image-box-description',
			)
		);

		$this->end_controls_section();
	}

	/**
	 * Register Elementor widget style controls.
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @access protected
	 *
	 * @return void
	 */
	protected function register_badge_style_controls() {
		$this->start_controls_section(
			'image_box_badge_style_tab',
			array(
				'label'     => esc_html__( 'Badge', 'codexshaper-framework' ),
				'tab'       => Controls_Manager::TAB_STYLE,
				'condition' => array(
					'enable_badge'           => 'yes',
					'image_box_badge_title!' => '',
				),
			)
		);

		$this->add_responsive_control(
			'image_box_badge_padding',
			array(
				'label'      => esc_html__( 'Padding', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%', 'em' ),
				'default'    => array(
					'top'    => '10',
					'right'  => '10',
					'bottom' => '10',
					'left'   => '10',
					'unit'   => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_responsive_control(
			'image_box_badge_border_radius',
			array(
				'label'      => esc_html__( 'Border Radius', 'codexshaper-framework' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px', '%', 'em' ),
				'default'    => array(
					'top'    => '0',
					'right'  => '0',
					'bottom' => '0',
					'left'   => '0',
					'unit'   => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .csmf--badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				),
			)
		);

		$this->add_control(
			'badge_text_color',
			array(
				'label'     => esc_html__( 'Color', 'codexshaper-framework' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => array(
					'{{WRAPPER}} .csmf--badge' => 'color: {{VALUE}};',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			array(
				'name'     => 'image_box_badge_background',
				'label'    => esc_html__( 'Background', 'codexshaper-framework' ),
				'types'    => array( 'classic', 'gradient' ),
				'default'  => '#FFFFFF29',
				'selector' => '{{WRAPPER}} .csmf--badge',
			)
		);

		$this->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			array(
				'name'     => 'image_box_badge_box_shadow',
				'label'    => esc_html__( 'Box Shadow', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} .csmf--badge',
			)
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			array(
				'name'     => 'image_box_badge_typography',
				'label'    => esc_html__( 'Typography', 'codexshaper-framework' ),
				'selector' => '{{WRAPPER}} .csmf--badge',
			)
		);

		$this->end_controls_section();
	}

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