<?php
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Group_Control_Typography;
Use Elementor\Core\Schemes\Typography;
use Elementor\Group_Control_Border;
use Elementor\Utils;
use Elementor\Group_Control_Box_Shadow;


if (!defined('ABSPATH')) exit; 

class Widgetkit_Pro_Sensei_Course_List extends Widget_Base
{
    public $sensei_core = 'sensei-lms/sensei-lms.php';

    public function get_name()
    {
        return 'widgetkit-pro-sensei-course';
    }

    public function get_title()
    {
        return __('Sensei Course List', 'widgetkit-pro');
    }

    public function get_icon()
    {
        return 'eicon-post-content';
    }

    public function get_categories()
    {
        return ['widgetkit_pro'];
    }

    /**
	 * A list of style that the widgets is depended in
	 **/
	public function get_style_depends() {
        return [
            'widgetkit_bs',
            'fontawesome',
            'widgetkit_pro_default',
        ];
    }
	/**
	 * A list of scripts that the widgets is depended in
	 **/
	public function get_script_depends() {
		return [ 
			'layout',
		 ];
	}

	protected function register_controls() {

        $cat_names = array();

        if(apply_filters('wkpro_check_plugin', $this->sensei_core) && class_exists('Sensei_Main')):
            $terms = get_terms(array(
                'post_type' => 'course',
                'taxonomy' => 'course-category',
                'hide_empty' => true,
            ));
            foreach ($terms as $t):
                $cat_names[$t->slug] = $t->name;
            endforeach;
        endif;

#   region Query        
        /**
         * Query
         */
		$this->start_controls_section(
			'section_query',
			[
				'label' => __( 'Query', 'widgetkit-pro' ),
			]
		);
            $this->add_control(
                'cat_dynamic_multiple_id',
                [
                    'label' => __('Select Category', 'widgetkit-pro'),
                    'type' => Controls_Manager::SELECT2,
                    'options' => $cat_names,
                    'multiple' => true,
                ]
            );
            $this->add_control(
                'order',
                [
                    'label' => __('Order', 'widgetkit-pro'),
                    'type' => Controls_Manager::SELECT,
                    'default' => 'ASC',
                    'options' => [
                        'ASC' => __('Ascending', 'widgetkit-pro'),
                        'DESC' => __('Descending', 'widgetkit-pro'),
                    ],
                ]
            );
            $this->add_control(
                'orderby',
                [
                    'label' => __('Order By', 'widgetkit-pro'),
                    'type' => Controls_Manager::SELECT,
                    'default' => 'date',
                    'options' => [
                        'title' => __('Title', 'widgetkit-pro'),
                        'name' => __('Name', 'widgetkit-pro'),
                        'date' => __('Date', 'widgetkit-pro'),
                        'rand' => __('Random', 'widgetkit-pro'),
                    ],
                ]
            );  
            $this->add_control(
                'post_num_to_show',
                [
                    'label' => __('Course to Show', 'widgetkit-pro'),
                    'type' => Controls_Manager::NUMBER,
                    'default' => 6,
                    'min' => 1,
                    'max' => 50,
                    'step' => 1,
                ]
            );
        $this->end_controls_section();
#   endregion         

#   region layout 
        /**
         * Layout
         */
        $this->start_controls_section(
            'section_layout',
            [
                'label' => __( 'Layout', 'widgetkit-pro' ),
            ]
        );
            $this->add_control(
                'posts_column',
                [
                    'label' => __('Columns', 'widgetkit-pro'),
                    'type' => Controls_Manager::SELECT,
                    'default' => '4',
                    'options' => [
                        '2' => __('6 Columns', 'widgetkit-pro'),
                        '3' => __('4 Columns', 'widgetkit-pro'),
                        '4' => __('3 Columns', 'widgetkit-pro'),
                        '6' => __('2 Columns', 'widgetkit-pro'),
                        '12' => __('1 Columns', 'widgetkit-pro'),
                    ],
                ]
            );
        $this->end_controls_section();    
#   endregion

#   region title & description        
        /**
         * Title & description
         */
        $this->start_controls_section(
            'section_title_description',
            [
                'label' => __( 'Title & Description', 'widgetkit-pro' ),
            ]
        );
            $this->add_control(
                'show_description',
                [
                    'label' => __( 'Description', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
            $this->add_control(
                'excerpt_desc_word',
                [
                    'label' => __('Word Count', 'widgetkit-pro'),
                    'type' => Controls_Manager::NUMBER,
                    'default' => 7,
                    'min' => 1,
                    'max' => 50,
                    'step' => 1,
                    'condition' => [
                        'show_description' => 'yes'
                    ]
                ]
            );
        $this->end_controls_section();
#   endregion 

#   region meta        
        /**
         * Meta
         */
        $this->start_controls_section(
        'section_meta',
        [
            'label' => __( 'Meta', 'widgetkit-pro' ),
        ]
        );
            $this->add_control(
                'sensei_instructor',
                [
                    'label' => __( 'Instructor', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
            $this->add_control(
                'show_meta',
                [
                    'label' => __( 'Category', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
            $this->add_control(
                'show_lesson',
                [
                    'label' => __( 'Lesson', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
            $this->add_control(
                'read_more_button',
                [
                    'label' => __( 'Enroll Button', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
        $this->end_controls_section();
#   endregion         

        
#   region Title & description style

        $this->start_controls_section(
            'section_wapper_style',
            [
                'label' => __('Title & Description', 'widgetkit-pro'),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        /**
         * Title
         */
        $this->add_control(
            'style_heading_title',
            [
            'label' => __( 'Title', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __('Typography', 'widgetkit-pro'),
                'name' => 'title_typography',
                'selector' => '{{WRAPPER}} .widgetkit-sensei-courses .sensei_course_list .wkp-entry-header a',
            ]
        );

        $this->start_controls_tabs('title_style_tabs');
            /**
             * Normal
             */
            $this->start_controls_tab(
                'title_style_normal_tab',
                [
                    'label' => __('Normal', 'widgetkit-pro'),
                ]
            );
                $this->add_control(
                    'title_color',
                    [
                        'label' => __('Color', 'widgetkit-pro'),
                        'type' => Controls_Manager::COLOR,
                        'default' => '',
                        'selectors' => [
                            '{{WRAPPER}} .widgetkit-sensei-courses .sensei_course_list .wkp-entry-header a' => 'color: {{VALUE}}',
                        ],
                    ]
                );
            $this->end_controls_tab(); 
            /**
             * hover
             */
            $this->start_controls_tab(
                'title_style_hover_tab',
                [
                    'label' => __('Hover', 'widgetkit-pro'),
                ]
            );
                $this->add_control(
                    'title_hover_color',
                    [
                        'label' => __('Color', 'widgetkit-pro'),
                        'type' => Controls_Manager::COLOR,
                        'default' => '',
                        'selectors' => [
                            '{{WRAPPER}} .widgetkit-sensei-courses .sensei_course_list .wkp-entry-header:hover a' => 'color: {{VALUE}}',
                        ],
                    ]
                );
            $this->end_controls_tab(); // Hover Tab end
        $this->end_controls_tabs();
        $this->add_responsive_control(
            'title_spacing_bottom',
            [
                'label' => __( 'Spacing Bottom', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 100,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .widgetkit-sensei-courses  .wkp-entry-header' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ]
        );
        /**
         * Content
         */
        $this->add_control(
            'style_heading_description',
            [
            'label' => __( 'Description', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );
            $this->add_control(
                'content_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .wkp-entry-content' => 'color: {{VALUE}};',
                    ],
                ]
            );
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'label' => __('Typography', 'widgetkit-pro'),
                    'name' => 'content_typography',
                    'selector' => '{{WRAPPER}} .widgetkit-sensei-courses .wkp-entry-content',
                ]
            );
            $this->add_responsive_control(
                'desc_spacing_bottom',
                [
                    'label' => __( 'Spacing Bottom', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SLIDER,
                    'range' => [
                        'px' => [
                            'min' => 0,
                            'max' => 100,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses  .wkp-entry-content' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                    ],
                ]
            );
            
        $this->end_controls_section();
#   endregion 

#   region category style
        /**
         * Category
         */
        $this->start_controls_section(
            'section_meta_style',
            [
                'label' => __( 'Category', 'widgetkit-pro' ),
                 'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'label' => __('Typography', 'widgetkit-pro'),
                    'name' => 'meta_typography',
                    'selector' => '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li',
                ]
            );
            $this->add_control(
                'meta_text_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li' => 'color: {{VALUE}};',
                    ],
                ]
            );
            $this->add_control(
                'meta_background_color',
                [
                    'label' => __('Background', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#e2e2e2',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li' => 'background: {{VALUE}};',
                    ],
                ]
            );
            $this->add_control(
                'meta_spacing_bottom',
                [
                    'label' => __( 'Spacing Bottom', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SLIDER,
                    'range' => [
                        'px' => [
                            'min' => 0,
                            'max' => 100,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses  .post-cat ul' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                    ],
                    'separator' => 'before',
                ]
            );
            $this->add_group_control(
                Group_Control_Border::get_type(), 
                [
                    'name'          => 'meta-border',
                    'selector'      => '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li',
                ]
            );
            $this->add_control(
                'meta_border_radius',
                [
                    'label' => __( 'Border Radius', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SLIDER,
                    'default' => [
                        'size' =>3,
                    ],
                    'range' => [
                        'px' => [
                            'min' => 0,
                            'max' => 100,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses  .post-cat ul li' => 'border-radius: {{SIZE}}{{UNIT}};',
                    ],
                ]
            );
            $this->add_responsive_control(
                'single_course_meta_padding',
                [
                    'label' => esc_html__( 'Padding', 'widgetkit-pro' ),
                    'type'  => Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px'],
                    'selectors'  => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                    'default' => [
                        'top' => '0',
                        'right' => '5',
                        'bottom' => '0',
                        'left' => '5',
                        'unit' => 'px',
                        'isLinked' => false,
                    ],
                ]
            );
            $this->add_responsive_control(
                'single_course_meta_margin',
                [
                    'label' => esc_html__( 'Margin', 'widgetkit-pro' ),
                    'type'  => Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px'],
                    'selectors'  => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .post-cat ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
        $this->end_controls_section();
#   endregion

#   region lesson style
        /**
         * lesson
         */
        $this->start_controls_section(
            'section_wapper_lesson_style',
            [
                'label' => __('Lesson', 'widgetkit-pro'),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
            $this->add_control(
                'lesson_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll' => 'color: {{VALUE}};',
                    ],
                ]
            );
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'label' => __('Typography', 'widgetkit-pro'),
                    'name' => 'lesson_typography',
                    'selector' => '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll ',
                ]
            );
            $this->add_control(
                'style_heading_lesson_icon',
                [
                'label' => __( 'Icon', 'widgetkit-pro' ),
                'type' => Controls_Manager::HEADING,
                'separator' => 'before',
                ]
            );
            $this->add_control(
                'sensei_lesson_add_custom_icon',
                [
                    'label' => __( 'Custom Icon', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => '',
                    'label_on' => __( 'Show', 'widgetkit-pro' ),
                    'label_off' => __( 'Hide', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );
            $this->add_control(
                'sensei_lesson_icon',
                [
                    'label' => esc_html__( 'Icon', 'widgetkit-for-elementor' ),
                    'type'              => Controls_Manager::ICONS,
                    'default'    =>  [
                        'value'     => 'fas fa-play-circle',
                        'library'   => 'fa-solid',
                    ],
                    'label_block'   => true,
                    'condition' => [
                        'sensei_lesson_add_custom_icon' => 'yes'
                    ],
                ]
            );
            $this->add_control(
                'lesson_icon_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll i' => 'color: {{VALUE}};',
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll svg' => 'color: {{VALUE}};',
                    ],
                ]
            );
            $this->add_control(
                'sensei_lesson_icon_width',
                [
                    'label'   => esc_html__( 'Icon Size', 'widgetkit-for-elementor' ),
                    'type'    => Controls_Manager::SLIDER,
                    'range'  => [
                        'px' => [
                            'min' => 0,
                            'max' => 200,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll i' => 'font-size: {{SIZE}}{{UNIT}};',
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll svg' => 'width: {{SIZE}}{{UNIT}};',
                    ],
                    // 'condition' => [
                    //     'sensei_lesson_add_custom_icon' => 'yes'
                    // ]
                ]
            );
            $this->add_control(
                'sensei_lesson_icon_spacing_right',
                [
                    'label'   => esc_html__( 'Icon Spacing', 'widgetkit-for-elementor' ),
                    'type'    => Controls_Manager::SLIDER,
                    'range'  => [
                        'px' => [
                            'min' => 0,
                            'max' => 200,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll i' => 'margin-right: {{SIZE}}{{UNIT}};',
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll svg' => 'margin-right: {{SIZE}}{{UNIT}};',
                    ],
                    // 'condition' => [
                    //     'sensei_lesson_add_custom_icon' => 'yes'
                    // ]
                ]
            );
        $this->end_controls_section();
#   endregion 

#   region Enroll button style
        $this->start_controls_section(
            'section_button_style',
            [
                'label' => __( 'Enroll Button', 'widgetkit-pro' ),
                 'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
            /**
             * Button
             */
            $this->add_group_control(
                Group_Control_Typography::get_type(),
                [
                    'label' => __('Typography', 'widgetkit-pro'),
                    'name' => 'button_typography',
                    'selector' => '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn',
                ]
            );
            $this->add_control(
                'single_color_enroll_btn',
                [
                    'label' => __( 'Enable Single Color', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => 'yes',
                    'label_on' => __( 'Yes', 'widgetkit-pro' ),
                    'label_off' => __( 'No', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                ]
            );

            $this->start_controls_tabs('button_style_tabs');

            $this->start_controls_tab(
                'button_style_normal_tab',
                [
                    'label' => __('Normal', 'widgetkit-pro'),
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );

            $this->add_control(
                'button_text_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#fff',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn a' => 'color: {{VALUE}} !important ;',
                    ],
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );

            $this->add_control(
                'button_bg_color',
                [
                    'label' => __('Background', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#EEB90E',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn' => 'background-color: {{VALUE}} !important ;',
                    ],
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );
            $this->add_group_control(
                Group_Control_Border::get_type(), 
                [
                    'name'          => 'btn-border',
                    'selector'      => '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn',
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );

            $this->end_controls_tab(); // Normal Tab end

            $this->start_controls_tab(
                'button_style_hover_tab',
                [
                    'label' => __('Hover', 'widgetkit-pro'),
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );
            $this->add_control(
                'button_hover_text_color',
                [
                    'label' => __('Color', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn:hover a' => 'color: {{VALUE}} !important ;',
                    ],
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );
            $this->add_control(
                'button_hover_background_color',
                [
                    'label' => __('Background', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '',
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn:hover' => 'background: {{VALUE}} !important ;',
                    ],
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );
            $this->add_group_control(
                Group_Control_Border::get_type(), 
                [
                    'name'          => 'btn-border-hover',
                    'selector'      => '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn:hover',
                    'condition' => [
                        'single_color_enroll_btn' => 'yes'
                    ]
                ]
            );

            $this->end_controls_tab(); // Hover Tab end

            $this->end_controls_tabs();

            $this->add_control(
                'padding_hr',
                [
                'type' => \Elementor\Controls_Manager::DIVIDER,
                ]
            );
            // $this->add_control(
            //     'button-border-width',
            //     [
            //         'label'   => esc_html__( 'Border Width', 'widgetkit-pro' ),
            //         'type'    => Controls_Manager::SLIDER,
            //         'default' => [
            //             'size' =>2,
            //         ],
            //         'range'  => [
            //             'px' => [
            //                 'min' => 0,
            //                 'max' => 50,
            //             ],
            //         ],
            //         'selectors' => [
            //             '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn' => 'border-width: {{SIZE}}{{UNIT}};',
            //         ],
            //     ]
            // );
            $this->add_control(
                'button-border-radius',
                [
                    'label'   => esc_html__( 'Radius', 'widgetkit-pro' ),
                    'type'    => Controls_Manager::SLIDER,
                    'default' => [
                        'size' => '3'
                    ],
                    'range'  => [
                        'px' => [
                            'min' => 0,
                            'max' => 200,
                        ],
                    ],
                    'selectors' => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn' => 'border-radius: {{SIZE}}{{UNIT}};',
                    ],
                ]
            );
            $this->add_responsive_control(
                'single_course_btn_padding',
                [
                    'label' => esc_html__( 'Padding', 'widgetkit-pro' ),
                    'type'  => Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px'],
                    'selectors'  => [
                        '{{WRAPPER}} .widgetkit-sensei-courses .sensei-enroll-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                    'default' => [
                        'top' => '7',
                        'right' => '20',
                        'bottom' => '7',
                        'left' => '20',
                        'unit' => 'px',
                        'isLinked' => false,
                    ],
                ]
            );

        $this->end_controls_section();
#   endregion 

#   region global option style 
        /**
         * Global option
         */
        $this->start_controls_section(
            'section_single_course_style',
            [
                'label' => __( 'Global Option', 'widgetkit-pro' ),
                 'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
            $this->add_control(
                'single_course_background',
                [
                    'label' => __('Background', 'widgetkit-pro'),
                    'type' => Controls_Manager::COLOR,
                    'default' => '',
                    'selectors' => [
                        '{{WRAPPER}} .sensei_course_list .sensei-single-course' => 'Background: {{VALUE}};',
                    ],
                ]
            );
            
            $this->add_group_control(
                Group_Control_Border::get_type(), 
                [
                'name'          => 'Border',
                'selector'      => '{{WRAPPER}} .sensei_course_list .sensei-single-course',
                ]
            );
            $this->add_control(
                'enable_box_shadow',
                [
                    'label' => __( 'Custom Box Shadow', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SWITCHER,
                    'default' => '',
                    'label_on' => __( 'Yes', 'widgetkit-pro' ),
                    'label_off' => __( 'No', 'widgetkit-pro' ),
                    'return_value' => 'yes',
                    
                ]
            );
            // $this->add_control(
            //     'title_box_shadow',
            //     [
            //         'label' => __( 'Box Shadow', 'widgetkit-pro' ),
            //         'type' => Controls_Manager::BOX_SHADOW,
            //         'selectors' => [
            //         '{{WRAPPER}} .sensei_course_list .sensei-single-course' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}};',
            //         ],
            //         'condition' => [
            //             'enable_box_shadow' => 'yes',
            //         ],
            //     ]
            // );
            $this->add_group_control(
                Group_Control_Box_Shadow::get_type(),
                [
                    'name'    => 'title_box_shadow',
                    'label'     => esc_html__( 'Normal Box Shadow', 'widgetkit-pro' ),
                    'selector' => '{{WRAPPER}} .sensei_course_list .sensei-single-course',
                    'condition' => [
                        'enable_box_shadow' => 'yes',
                    ],
                ]
            );
    
            $this->add_group_control(
                Group_Control_Box_Shadow::get_type(),
                [
                    'name'    => 'layout_hover_box_shadow',
                    'label'     => esc_html__( 'Hover Box Shadow', 'widgetkit-pro' ),
                    'selector' => '{{WRAPPER}} .sensei_course_list .sensei-single-course:hover',
                    'condition' => [
                        'enable_box_shadow' => 'yes',
                    ],
                ]
            );
            $this->add_responsive_control(
                'single_course_padding',
                [
                    'label' => esc_html__( 'Padding', 'widgetkit-pro' ),
                    'type'  => Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px'],
                    'selectors'  => [
                        '{{WRAPPER}} .sensei_course_list .course-content-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                    'default' => [
                        'top' => '30',
                        'right' => '30',
                        'bottom' => '30',
                        'left' => '30',
                        'unit' => 'px',
                        'isLinked' => true,
                    ],
                ]
            );
            $this->add_responsive_control(
                'layout_border_radius',
                [
                    'label' => esc_html__( 'Radius', 'widgetkit-pro' ),
                    'type'  => Controls_Manager::DIMENSIONS,
                    'size_units' => [ 'px', '%'],
                    'selectors'  => [
                        '{{WRAPPER}} .sensei_course_list .sensei-single-course' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    ],
                ]
            );
        $this->end_controls_section();
#   endregion         

	}

    protected function render()
    {
    ?>
        <div 
            id="sensei-course-list-<?php echo $this->get_id(); ?>" 
            class="sensei-course-list-element sensei-course-list-<?php echo $this->get_id(); ?>"
        >
            <?php include( plugin_dir_path( __FILE__ ) . '../layout/sensei-course-list.php'); ?>
        </div>
    <?php
    }

    protected function _content_template()
    {
    }

}
