<?php
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
Use Elementor\Core\Schemes\Typography;
defined( 'ABSPATH' ) || exit; // Exit if accessed directly
/**
 *
 * Course Certificate widget.
 *
 * @since 1.0.0
 */
class Widgetkit_Pro_LearnDash_Course_Certificate extends Widget_Base {

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

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

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

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


	public function get_style_depends() {
        return [
            'widgetkit_pro_default',
        ];
    }

	protected function register_controls() {

		$this->start_controls_section(
			'content_style',
			[
				'label' => esc_html__( 'Content', 'widgetkit-pro' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);
	       		$this->add_control(
	                'title_heading',
	                [
	                    'label' => __( 'Title', 'widgetkit-pro' ),
	                    'type'  => Controls_Manager::HEADING,
	                    'separator' => 'before',
	                ]
	            );

				$this->add_control(
					'title_color',
					[
						'label'     => esc_html__( 'Color', 'widgetkit-pro' ),
						'type'      => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .ld-alert-certificate .ld-alert-messages' => 'color: {{VALUE}};',
						]
					]
				);
				$this->add_group_control(
					Group_Control_Typography::get_type(),
						[
							'name'     => 'title_typography',
							'label'    => esc_html__( 'Typography', 'widgetkit-pro' ),
							'selector' => '{{WRAPPER}} .ld-alert-certificate .ld-alert-messages',
						]
				);


	            $this->add_responsive_control(
	                'title_spacing',
	                    [
	                        'label'   => esc_html__( 'Spacing', 'widgetkit-pro' ),
	                        'type'    => Controls_Manager::SLIDER,
	                        'range'  => [
	                            'px' => [
	                                'min' => 0,
	                                'max' => 200,
	                            ]
	                        ],
	                        'selectors' => [
	                            '{{WRAPPER}} .ld-alert-certificate .ld-alert-messages' => 'padding-left: {{SIZE}}{{UNIT}};',
	                        ]
	                    ]
	            );


		        $this->add_control(
	                'circle_heading',
	                [
	                    'label' => __( 'Circle', 'widgetkit-pro' ),
	                    'type'  => Controls_Manager::HEADING,
	                    'separator' => 'before'
	                ]
				);
				
				$this->add_responsive_control(
	                'circle_width',
	                    [
	                        'label'   => esc_html__( 'Width', 'widgetkit-pro' ),
	                        'type'    => Controls_Manager::SLIDER,
	                        'range'  => [
	                            'px' => [
	                                'min' => 0,
	                                'max' => 100,
	                            ],
	                        ],
	                        'selectors' => [
	                            '{{WRAPPER}} .ld-alert-certificate .ld-alert-icon.ld-icon-certificate' => 'width: {{SIZE}}{{UNIT}};',
	                        ]
	                    ]
				);
				
				$this->add_responsive_control(
	                'circle_height',
	                    [
	                        'label'   => esc_html__( 'Height', 'widgetkit-pro' ),
	                        'type'    => Controls_Manager::SLIDER,
	                        'range'  => [
	                            'px' => [
	                                'min' => 0,
	                                'max' => 100,
	                            ]
	                        ],
	                        'selectors' => [
	                            '{{WRAPPER}} .ld-alert-certificate .ld-alert-icon.ld-icon-certificate' => 'height: {{SIZE}}{{UNIT}};',
	                        ],
	                    ]
	            );

				$this->add_control(
					'circle_bg_color',
					[
						'label'     => esc_html__( 'Background Color', 'widgetkit-pro' ),
						'type'      => Controls_Manager::COLOR,
						'selectors' => [
							'{{WRAPPER}} .ld-alert-certificate .ld-alert-icon.ld-icon-certificate' => 'background-color: {{VALUE}};',
						],
					]
				);
				
				$this->add_control(
	                'global_content',
	                [
	                    'label' => __( 'Global', 'widgetkit-pro' ),
	                    'type'  => Controls_Manager::HEADING,
	                    'separator' => 'before',
	                ]
	            );

				$this->add_responsive_control(
		            'content_padding',
		            [
		                'label' => esc_html__( 'Padding', 'widgetkit-pro' ),
		                'type'  => Controls_Manager::DIMENSIONS,
		                'size_units' => [ 'px', '%' ],
		                'selectors'  => [
		                    '{{WRAPPER}} .ld-alert.ld-alert-certificate' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		                ],
		            ]
				);
				
				$this->add_group_control(
					Group_Control_Border::get_type(),
					[
						'name' => 'content_border',
						'selector' => '{{WRAPPER}} .ld-alert.ld-alert-certificate',
						'separator' => 'before',
					]
				);		

		        $this->add_control(
		            'content_border_radius',
		            [
		                'label' => esc_html__( 'Border Radius', 'widgetkit-pro' ),
		                'type'  => Controls_Manager::DIMENSIONS,
		                'size_units' => [ 'px', '%' ],
		                'selectors'  => [
		                    '{{WRAPPER}} .ld-alert.ld-alert-certificate' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
		                ]
		            ]
		        );

		        $this->add_control(
	                'content_item_bg_color',
	                [
	                    'label'     => esc_html__( 'Background Color', 'widgetkit-pro' ),
	                    'type'      => Controls_Manager::COLOR,
	                    'default'   => '',
	                    'selectors' => [
	                        '{{WRAPPER}} .ld-alert.ld-alert-certificate' => 'background: {{VALUE}};',
	                    ],
	                ]
	            );

		$this->end_controls_section();
		
		$this->start_controls_section(
			'button_style',
			[
				'label' => __( 'Button', 'widgetkit-pro' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'button_typography',
				'selector' => '{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button',
			]
		);

		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'button_text_shadow',
				'selector' => '{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button',
			]
		);

		$this->start_controls_tabs( 'tabs_button_style' );

		$this->start_controls_tab(
			'tab_button_normal',
			[
				'label' => __( 'Normal', 'widgetkit-pro' ),
			]
		);

		$this->add_control(
			'button_text_color',
			[
				'label' => __( 'Text Color', 'widgetkit-pro' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button' => 'fill: {{VALUE}}; color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_background_color',
			[
				'label' => __( 'Background Color', 'widgetkit-pro' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'tab_button_hover',
			[
				'label' => __( 'Hover', 'widgetkit-pro' ),
			]
		);

		$this->add_control(
			'button_hover_color',
			[
				'label' => __( 'Text Color', 'widgetkit-pro' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button:hover' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_background_hover_color',
			[
				'label' => __( 'Background Color', 'widgetkit-pro' ),
				'type' => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button:hover' => 'background-color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'button_hover_border_color',
			[
				'label' => __( 'Border Color', 'widgetkit-pro' ),
				'type' => Controls_Manager::COLOR,
				'condition' => [
					'border_border!' => '',
				],
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button:hover' => 'border-color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'button_border',
				'selector' => '{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button',
				'separator' => 'before',
			]
		);

		$this->add_control(
			'button_border_radius',
			[
				'label' => __( 'Border Radius', 'widgetkit-pro' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'button_box_shadow',
				'selector' => '{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button',
			]
		);

		$this->add_responsive_control(
			'button_text_padding',
			[
				'label' => __( 'Padding', 'widgetkit-pro' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .ld-alert-certificate.ld-alert-success .ld-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->end_controls_section();

	}

	protected function render() {
		include( plugin_dir_path( __FILE__ ) . '../layout/learndash-course-certificate.php');
	}

}