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

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

class EventfulForElementorStyleCategory
{
    public static function ppfe_style_category_options($widget)
    {

        // Tab.
        $widget->start_controls_section(
            'section_grid_category_style',
            [
                'label' => esc_html__('Category Badge', 'eventful-for-elementor'),
                'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
                'condition' => [
                    'thumb_meta!' => 'none',
                ],
            ]
        );

        // Category typography.
        $widget->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'      => 'grid_category_style_typography',
                'global' => [
                    'default' => Global_Typography::TYPOGRAPHY_ACCENT,
                ],
                'selector'  => '{{WRAPPER}} .eventful .eventful__item .eventful__item--archive a',
            ]
        );

        $widget->start_controls_tabs('grid_category_color_style');

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

        // Category color.
        $widget->add_control(
            'grid_category_style_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_TEXT,
                ],
                'selectors' => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li a' => 'color: {{VALUE}};',
                ],
            ]
        );

        // Category background color.
        $widget->add_control(
            'grid_category_style_background_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Background Color', 'eventful-for-elementor'),
                'selectors' => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li' => 'background-color: {{VALUE}};',
                ],
            ]
        );

        // Category border color.
        $widget->add_control(
            'grid_category_style_border_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Border Color', 'eventful-for-elementor'),
                'selectors' => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $widget->end_controls_tab();

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

        // Category hover color.
        $widget->add_control(
            'grid_category_style_hover_color',
            array(
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'global' => [
                    'default' => Global_Colors::COLOR_PRIMARY,
                ],
                'selectors' => array(
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li a:hover' => 'color: {{VALUE}};',
                ),
            )
        );

        // Category hover background color.
        $widget->add_control(
            'grid_category_style_hover_background_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Background Color', 'eventful-for-elementor'),
                'selectors' => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li li:hover' => 'background-color: {{VALUE}};',
                ],
            ]
        );

        // Category hover border color.
        $widget->add_control(
            'grid_category_style_hover_border_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Border Color', 'eventful-for-elementor'),
                'selectors' => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li li:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $widget->end_controls_tab();

        $widget->end_controls_tabs();

        // Category border width.
        $widget->add_control(
            'grid_category_style_border_width',
            [
                'type'       => \Elementor\Controls_Manager::DIMENSIONS,
                'label'      => esc_html__('Border Width', 'eventful-for-elementor'),
                'separator'  => 'before',
                'size_units' => array('px'),
                'selectors'  => [
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li' => 'border-style: solid; border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
                ],
            ]
        );

        // Category border radius.
        $widget->add_control(
            'grid_category_style_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}} .eventful__item .eventful__item--archive li a' => 'border-radius: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li' => 'border-radius: {{SIZE}}{{UNIT}}',
                ),
            )
        );

        // Category button padding.
        $widget->add_responsive_control(
            'grid_category_style_button_padding',
            array(
                'label'      => esc_html__('Padding', 'eventful-for-elementor'),
                'type'       => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => array('px'),
                'selectors'  => array(
                    '{{WRAPPER}} .eventful__item .eventful__item--archive li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
                ),
            )
        );

        // Category margin.
        $widget->add_responsive_control(
            'grid_category_style_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}} .eventful__item .eventful__item--archive li a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $widget->end_controls_section();
    }
}
