<?php
namespace ThemeAtelier\EventfulForElementor\Admin\Widgets\Options;

use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;

class EventfulForElementorStyleCarousel
{
    public static function ppfe_style_carousel($widget)
    {
        $widget->start_controls_section(
            'carouser_color_tab',
            [
                'label' => esc_html__('Carousel', 'eventful-for-elementor'),
                'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );
        $widget->add_control(
			'navigation_title',
			[
				'label' => esc_html__( 'Navigation', 'eventful-for-elementor'),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			]
		);
        $widget->start_controls_tabs('navigation_color_style');

        // Normal tab.
        $widget->start_controls_tab(
            'carousel_normal',
            array(
                'label' => esc_html__('Normal', 'eventful-for-elementor'),
            )
        );

        // Navigation color.
        $widget->add_control(
            'navigation_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'color: {{VALUE}}!important;',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'color: {{VALUE}}!important;',
                ],
            ]
        );

        // Navigation background.
        $widget->add_control(
            'navigation_background',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Background', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_PRIMARY,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'background: {{VALUE}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'background: {{VALUE}};',
                ],
            ]
        );

        // Navigation border.
        $widget->add_control(
            'navigation_border',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Border Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_PRIMARY,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'border-color: {{VALUE}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $widget->end_controls_tab();

        // Hover tab.
        $widget->start_controls_tab(
            'carousel_hover_tab',
            array(
                'label' => esc_html__('Hover', 'eventful-for-elementor'),
            )
        );

        // Navigation hover color.
        $widget->add_control(
            'navigation_hover_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next:hover i' => 'color: {{VALUE}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev:hover i' => 'color: {{VALUE}};',
                ],
            ]
        );

        // Navigation hover background.
        $widget->add_control(
            'navigation_hover_background',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Background', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next:hover' => 'background: {{VALUE}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev:hover' => 'background: {{VALUE}};',
                ],
            ]
        );

        // Navigation border.
        $widget->add_control(
            'navigation_hover_border',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Border', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next:hover' => 'border: {{VALUE}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev:hover' => 'border: {{VALUE}};',
                ],
            ]
        );

        $widget->end_controls_tabs();

        // Navigation border width.
        $widget->add_control(
            'navigation_border_width',
            [
                'type'       => \Elementor\Controls_Manager::DIMENSIONS,
                'label'      => esc_html__('Border Width', 'eventful-for-elementor'),
                'separator'  => 'before',
                'size_units' => array('px'),
                'selectors'  => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'border-style: solid; border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'border-style: solid; border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
                ],
            ]
        );

        // Navigation border radius.
        $widget->add_control(
            'navigation_border_radius',
            array(
                'label'     => esc_html__('Border Radius', 'eventful-for-elementor'),
                'type'      => \Elementor\Controls_Manager::SLIDER,
                'default'   => array(
                    'size' => 0,
                ),
                'range'     => array(
                    'px' => array(
                        'min' => 0,
                        'max' => 100,
                    ),
                ),
                'selectors' => array(
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'border-radius: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'border-radius: {{SIZE}}{{UNIT}}',
                ),
            )
        );

        // Navigation margin.
        $widget->add_responsive_control(
            'navigation_margin',
            [
                'label'      => esc_html__('Margin', 'eventful-for-elementor'),
                'type'       => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => ['px'],
                'default' => [
					'top' => 0,
					'right' => 0,
					'bottom' => 10,
					'left' => 0,
					'unit' => 'px',
					'isLinked' => false,
				],
                'selectors'  => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-next' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                    '{{WRAPPER}} .efpe-carousel-wrapper .efpe-button-prev' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $widget->add_control(
			'pagination_title',
			[
				'label' => esc_html__( 'Pagination', 'eventful-for-elementor'),
				'type' => \Elementor\Controls_Manager::HEADING,
				'separator' => 'before',
			]
		);

        // Pagination color.
        $widget->add_control(
            'pagination_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .efpe-carousel-wrapper .swiper-pagination-bullet' => 'background: {{VALUE}};',
                ],
            ]
        );
        // Pagination active color.
        $widget->add_control(
            'pagination_active_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Active Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_PRIMARY,
                ],
                'selectors' => [
                    '{{WRAPPER}} .eventful .swiper-pagination-bullets.number .swiper-pagination-bullet-active' => 'background: {{VALUE}}',
                    '{{WRAPPER}} .eventful .swiper-pagination-bullets.dots .swiper-pagination-bullet-active' => 'background: {{VALUE}}',
                ],
            ]
        );
        $widget->end_controls_section();
    }
}
