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

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

class EventfulForElementorStyleMeta
{
    public static function ppfe_style_meta_options($widget)
    {
        // Meta.
        $widget->start_controls_section(
            'section_grid_meta_style',
            [
                'label'     => esc_html__('Meta', 'eventful-for-elementor'),
                'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
                'condition' => [
                    'show_meta' => 'yes',
                ],
            ]
        );

        // Meta typography.
        $widget->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'     => 'grid_meta_style_typography',
                'global' => [
                    'default' => Global_Typography::TYPOGRAPHY_ACCENT,
                ],
                'default' => [
                    'font_size' => '14px',
                ],
                'selectors' => [
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta span', 
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta a',
                ]
            ]
        );

        // Meta color.
        $widget->add_control(
            'grid_meta_style_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'default' => '#888',
                'selectors' => [
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta ul li' => 'color: {{VALUE}};',
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta ul li a' => 'color: {{VALUE}};',
                ],
            ]
        );

        // Meta margin.
        $widget->add_responsive_control(
            'grid_meta_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 .eventful__item .eventful__item--meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $widget->end_controls_section();
    }
}
