<?php

// Button
use Elementor\Controls_Manager;

add_action('elementor/element/button/section_style/after_section_end', function ($element, $args) {

    $element->update_control(
        'background_color',
        [
            'global' => [
                'default' => '',
            ],
        ]
    );
}, 10, 2);

add_action('elementor/element/button/section_style/before_section_end', function ($element, $args) {
    $element->add_control(
        'button_icon_color',
        [
            'label'     => esc_html__('Icon Color', 'pakrco'),
            'type'      => Controls_Manager::COLOR,
            'default'   => '',
            'selectors' => [
                '{{WRAPPER}} .elementor-button .elementor-button-icon' => 'fill: {{VALUE}}; color: {{VALUE}};',
            ],
            'condition' => [
                'selected_icon[value]!' => '',
            ],
        ]
    );
}, 10, 2);

add_action('elementor/element/button/section_button/before_section_end', function ($element, $args) {
    $element->add_control(
        'button_style_theme',
        [
            'label'        => esc_html__('Theme Style', 'pakrco'),
            'type'         => Controls_Manager::SWITCHER,
            'default'      => '',
            'prefix_class' => 'button-style-pakrco-',
        ]
    );
    $element->add_control(
        'button_decor_color',
        [
            'label' => esc_html__( 'Decor Color', 'pakrco' ),
            'type' => Controls_Manager::COLOR,
            'selectors'  => [
                '{{WRAPPER}} .elementor-button:after'  => 'border-color: {{VALUE}}'
            ],
            'condition' => [
                'button_style_theme!'  => ''
            ]
        ]
    );
    $element->add_control(
        'button_decor_color_hover',
        [
            'label' => esc_html__( 'Decor Color Hover', 'pakrco' ),
            'type' => Controls_Manager::COLOR,
            'selectors'  => [
                '{{WRAPPER}} .elementor-button:hover:after'  => 'border-color: {{VALUE}}'
            ],
            'condition' => [
                'button_style_theme!'  => ''
            ]
        ]
    );

}, 10, 2);
