<?php

namespace Lknwp\CrowdfundingExtension\Includes\elementorFields\controls;

use Elementor\Controls_Manager;

if (! defined('ABSPATH')) {
    exit;
}

class LknwpCrowdfundingListingButtonsControl
{
    public static function getControl($input)
    {
        $input->start_controls_section(
            'button_section',
            [
                'label' => __('Buttons', 'link-nacional-wp-crowdfunding-extension'),
                'tab'   => Controls_Manager::TAB_STYLE,
            ]
        );

        // Controle de visibilidade do botão
        $input->add_control(
            'show_header_button',
            [
                'label'        => __('Show Header Button', 'link-nacional-wp-crowdfunding-extension'),
                'type'         => Controls_Manager::SWITCHER,
                'label_on'     => __('Yes', 'link-nacional-wp-crowdfunding-extension'),
                'label_off'    => __('No', 'link-nacional-wp-crowdfunding-extension'),
                'return_value' => 'yes',
                'default'      => 'yes',
            ]
        );

        $input->add_responsive_control(
            'button_header_width',
            [
                'label'      => __('Button Width (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-header-button' => 'width: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 60,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 60,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 60,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 60,
                    'unit' => '%',
                ],
                'condition'  => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        $input->add_responsive_control(
            'button_header_height',
            [
                'label'      => __('Button Height (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-header-button' => 'height: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 30,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 30,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 30,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 30,
                    'unit' => '%',
                ],
                'condition'  => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Componente de texto inicial
        $input->add_control(
            'header_button_text',
            [
                'label'       => __('Button Text', 'link-nacional-wp-crowdfunding-extension'),
                'type'        => Controls_Manager::TEXT,
                'default'     => __('View campaign', 'link-nacional-wp-crowdfunding-extension'),
                'placeholder' => __('Enter your button text', 'link-nacional-wp-crowdfunding-extension'),
                'condition'   => [
                    'show_header_button' => 'yes',
                ],
            ]
        );


        // Alinhamento do botão
        $input->add_control(
            'header_button_position',
            [
                'label'     => __('Button Position', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::CHOOSE,
                'options'   => [
                    'flex-start' => [
                        'title' => __('Left', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-left',
                    ],
                    'center'     => [
                        'title' => __('Center', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-center',
                    ],
                    'flex-end'   => [
                        'title' => __('Right', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-right',
                    ],
                ],
                'default'   => 'center',
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Tipografia (Fonte, Tamanho, Estilo, etc.)
        $input->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'      => 'header_button_typography',
                'label'     => __('Typography', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-header-button-class',
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Cor do texto
        $input->add_control(
            'header_text_color',
            [
                'label'     => __('Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#FFFFFF',
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Background do botão
        $input->add_control(
            'header_button_background_color',
            [
                'label'     => __('Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => 'transparent',
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Controle de borda
        $input->add_group_control(
            \Elementor\Group_Control_Border::get_type(),
            [
                'name' => 'header_button_border',
                'label' => __('Border', 'link-nacional-wp-crowdfunding-extension'),
                'selector' => '{{WRAPPER}} .lknwp-header-button-class',
                'fields_options' => [
                    'border' => [
                        'default' => 'solid',
                    ],
                    'width' => [
                        'default' => [
                            'top' => 2,
                            'right' => 2,
                            'bottom' => 2,
                            'left' => 2,
                        ],
                    ],
                    'color' => [
                        'default' => '#FFFFFF',
                    ],
                ],
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Controle de borda-radius
        $input->add_control(
            'header_button_border_radius',
            [
                'label'      => __('Border Radius', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::DIMENSIONS,
                'size_units' => ['px', '%'],
                'default'    => [
                    'top'    => '4',
                    'right'  => '4',
                    'bottom' => '4',
                    'left'   => '4',
                    'unit'   => 'px',
                ],
                'condition'  => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Sombra do texto
        $input->add_group_control(
            \Elementor\Group_Control_Text_Shadow::get_type(),
            [
                'name'      => 'header_button_shadow',
                'label'     => __('Text Shadow', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-header-button-class',
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'header_button_hover_text_color',
            [
                'label'     => __('Hover Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#ffffff',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-header-button-class:hover' => 'color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Controle para cor de background no estado de hover
        $input->add_control(
            'header_button_hover_background_color',
            [
                'label'     => __('Hover Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-header-button-class:hover' => 'background-color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Controle para cor da borda no estado de hover
        $input->add_control(
            'header_button_hover_border_color',
            [
                'label'     => __('Hover Border Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-header-button-class:hover' => 'border-color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'header_button_hover_transition_duration',
            [
                'label'      => __('Transition Duration (s)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'default'    => [
                    'size' => 0.3,
                ],
                'range'      => [
                    'px' => [
                        'min' => 0,
                        'max' => 5,
                        'step' => 0.1,
                    ],
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-header-button-class' => 'transition-duration: {{SIZE}}s;',
                ],
                'condition'  => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        // Controle para função de easing
        $input->add_control(
            'header_button_hover_easing_function',
            [
                'label'      => __('Easing Function', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SELECT,
                'default'    => 'ease-in-out',
                'options'    => [
                    'ease'       => __('Ease', 'link-nacional-wp-crowdfunding-extension'),
                    'linear'     => __('Linear', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in'    => __('Ease In', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-out'   => __('Ease Out', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in-out' => __('Ease In Out', 'link-nacional-wp-crowdfunding-extension'),
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-header-button-class' => 'transition-timing-function: {{VALUE}};',
                ],
                'condition'  => [
                    'show_header_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'divider_buttons',
            [
                'type' => Controls_Manager::DIVIDER,
            ]
        );

        // Controle de visibilidade do botão
        $input->add_control(
            'show_bottom_button',
            [
                'label'        => __('Show Bottom Button', 'link-nacional-wp-crowdfunding-extension'),
                'type'         => Controls_Manager::SWITCHER,
                'label_on'     => __('Yes', 'link-nacional-wp-crowdfunding-extension'),
                'label_off'    => __('No', 'link-nacional-wp-crowdfunding-extension'),
                'return_value' => 'yes',
                'default'      => 'yes',
            ]
        );

        $input->add_responsive_control(
            'button_bottom_width',
            [
                'label'      => __('Button Width (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-bottom-button' => 'width: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 100,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 100,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 100,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 100,
                    'unit' => '%',
                ],
                'condition'  => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        $input->add_responsive_control(
            'button_bottom_height',
            [
                'label'      => __('Button Height (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-bottom-button' => 'height: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 0,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 80,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 80,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 80,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 80,
                    'unit' => '%',
                ],
                'condition'  => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Componente de texto inicial
        $input->add_control(
            'bottom_button_text',
            [
                'label'       => __('Button Text', 'link-nacional-wp-crowdfunding-extension'),
                'type'        => Controls_Manager::TEXT,
                'default'     => __('View campaign', 'link-nacional-wp-crowdfunding-extension'),
                'placeholder' => __('Enter your button text', 'link-nacional-wp-crowdfunding-extension'),
                'condition'   => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );


        // Alinhamento do botão
        $input->add_control(
            'bottom_button_position',
            [
                'label'     => __('Button Position', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::CHOOSE,
                'options'   => [
                    'flex-start' => [
                        'title' => __('Left', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-left',
                    ],
                    'center'     => [
                        'title' => __('Center', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-center',
                    ],
                    'flex-end'   => [
                        'title' => __('Right', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-right',
                    ],
                ],
                'default'   => 'center',
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Tipografia (Fonte, Tamanho, Estilo, etc.)
        $input->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'      => 'bottom_button_typography',
                'label'     => __('Typography', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-bottom-button-class',
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Cor do texto
        $input->add_control(
            'bottom_text_color',
            [
                'label'     => __('Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#5d5d5d',
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Background do botão
        $input->add_control(
            'bottom_button_background_color',
            [
                'label'     => __('Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => 'transparent',
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Controle de borda
        $input->add_group_control(
            \Elementor\Group_Control_Border::get_type(),
            [
                'name' => 'bottom_button_border',
                'label' => __('Border', 'link-nacional-wp-crowdfunding-extension'),
                'selector' => '{{WRAPPER}} .lknwp-bottom-button-class',
                'fields_options' => [
                    'border' => [
                        'default' => 'solid',
                    ],
                    'width' => [
                        'default' => [
                            'top' => 2,
                            'right' => 2,
                            'bottom' => 2,
                            'left' => 2,
                        ],
                    ],
                    'color' => [
                        'default' => '#5d5d5d',
                    ],
                ],
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Controle de borda-radius
        $input->add_control(
            'bottom_button_border_radius',
            [
                'label'      => __('Border Radius', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::DIMENSIONS,
                'size_units' => ['px', '%'],
                'default'    => [
                    'top'    => '4',
                    'right'  => '4',
                    'bottom' => '4',
                    'left'   => '4',
                    'unit'   => 'px',
                ],
                'condition'  => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Sombra do texto
        $input->add_group_control(
            \Elementor\Group_Control_Text_Shadow::get_type(),
            [
                'name'      => 'bottom_button_shadow',
                'label'     => __('Text Shadow', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-bottom-button-class',
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'bottom_button_hover_text_color',
            [
                'label'     => __('Hover Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#ffffff',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-bottom-button-class:hover' => 'color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Controle para cor de background no estado de hover
        $input->add_control(
            'bottom_button_hover_background_color',
            [
                'label'     => __('Hover Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-bottom-button-class:hover' => 'background-color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Controle para cor da borda no estado de hover
        $input->add_control(
            'bottom_button_hover_border_color',
            [
                'label'     => __('Hover Border Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-bottom-button-class:hover' => 'border-color: {{VALUE}} !important;',
                ],
                'condition' => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'bottom_button_hover_transition_duration',
            [
                'label'      => __('Transition Duration (s)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'default'    => [
                    'size' => 0.3,
                ],
                'range'      => [
                    'px' => [
                        'min' => 0,
                        'max' => 5,
                        'step' => 0.1,
                    ],
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-bottom-button-class' => 'transition-duration: {{SIZE}}s;',
                ],
                'condition'  => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        // Controle para função de easing
        $input->add_control(
            'bottom_button_hover_easing_function',
            [
                'label'      => __('Easing Function', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SELECT,
                'default'    => 'ease-in-out',
                'options'    => [
                    'ease'       => __('Ease', 'link-nacional-wp-crowdfunding-extension'),
                    'linear'     => __('Linear', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in'    => __('Ease In', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-out'   => __('Ease Out', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in-out' => __('Ease In Out', 'link-nacional-wp-crowdfunding-extension'),
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-bottom-button-class' => 'transition-timing-function: {{VALUE}};',
                ],
                'condition'  => [
                    'show_bottom_button' => 'yes',
                ],
            ]
        );

        $input->add_control(
            'divider_buttons_more',
            [
                'type' => Controls_Manager::DIVIDER,
            ]
        );

        $input->add_control(
            'more_styles_heading',
            [
                'label'     => __('Load more button', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::HEADING,
            ]
        );

        $input->add_control(
            'divider_buttons_more2',
            [
                'type' => Controls_Manager::DIVIDER,
            ]
        );

        $input->add_responsive_control(
            'button_more_width',
            [
                'label'      => __('Button Width (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-more-button' => 'width: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 10,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 18,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 18,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 22,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 50,
                    'unit' => '%',
                ],
            ]
        );

        $input->add_responsive_control(
            'button_more_height',
            [
                'label'      => __('Button Height (%)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'selectors'   => [
                    '{{WRAPPER}} .lknwp-elementor-more-button' => 'height: {{SIZE}}{{UNIT}};',
                ],
                'size_units' => ['%'],
                'range'      => [
                    '%' => [
                        'min' => 60,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'default'    => [
                    'unit' => '%',
                    'size' => 70,
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
                'desktop_default' => [
                    'size' => 70,
                    'unit' => '%',
                ],
                'tablet_default' => [
                    'size' => 70,
                    'unit' => '%',
                ],
                'mobile_default' => [
                    'size' => 70,
                    'unit' => '%',
                ],
            ]
        );

        // Componente de texto inicial
        $input->add_control(
            'more_button_text',
            [
                'label'       => __('Button Text', 'link-nacional-wp-crowdfunding-extension'),
                'type'        => Controls_Manager::TEXT,
                'default'     => __('Load more', 'link-nacional-wp-crowdfunding-extension'),
                'placeholder' => __('Enter your button text', 'link-nacional-wp-crowdfunding-extension'),
            ]
        );

        // Alinhamento do botão
        $input->add_control(
            'more_button_position',
            [
                'label'     => __('Button Position', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::CHOOSE,
                'options'   => [
                    'flex-start' => [
                        'title' => __('Left', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-left',
                    ],
                    'center'     => [
                        'title' => __('Center', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-center',
                    ],
                    'flex-end'   => [
                        'title' => __('Right', 'link-nacional-wp-crowdfunding-extension'),
                        'icon'  => 'eicon-h-align-right',
                    ],
                ],
                'default'   => 'center',
            ]
        );

        // Tipografia (Fonte, Tamanho, Estilo, etc.)
        $input->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'      => 'more_button_typography',
                'label'     => __('Typography', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-more-button-class',
            ]
        );

        // Cor do texto
        $input->add_control(
            'more_text_color',
            [
                'label'     => __('Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#5d5d5d',
            ]
        );

        // Background do botão
        $input->add_control(
            'more_button_background_color',
            [
                'label'     => __('Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => 'transparent',
            ]
        );

        // Controle de borda
        $input->add_group_control(
            \Elementor\Group_Control_Border::get_type(),
            [
                'name' => 'more_button_border',
                'label' => __('Border', 'link-nacional-wp-crowdfunding-extension'),
                'selector' => '{{WRAPPER}} .lknwp-more-button-class',
                'fields_options' => [
                    'border' => [
                        'default' => 'solid',
                    ],
                    'width' => [
                        'default' => [
                            'top' => 2,
                            'right' => 2,
                            'bottom' => 2,
                            'left' => 2,
                        ],
                    ],
                    'color' => [
                        'default' => '#5d5d5d',
                    ],
                ],
            ]
        );

        // Controle de borda-radius
        $input->add_control(
            'more_button_border_radius',
            [
                'label'      => __('Border Radius', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::DIMENSIONS,
                'size_units' => ['px', '%'],
                'default'    => [
                    'top'    => '4',
                    'right'  => '4',
                    'bottom' => '4',
                    'left'   => '4',
                    'unit'   => 'px',
                ],
            ]
        );

        // Sombra do texto
        $input->add_group_control(
            \Elementor\Group_Control_Text_Shadow::get_type(),
            [
                'name'      => 'more_button_shadow',
                'label'     => __('Text Shadow', 'link-nacional-wp-crowdfunding-extension'),
                'selector'  => '{{WRAPPER}} .lknwp-more-button-class',
            ]
        );

        $input->add_control(
            'more_button_hover_text_color',
            [
                'label'     => __('Hover Text Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#ffffff',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-more-button-class:hover' => 'color: {{VALUE}} !important;',
                ],
            ]
        );

        // Controle para cor de background no estado de hover
        $input->add_control(
            'more_button_hover_background_color',
            [
                'label'     => __('Hover Background Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-more-button-class:hover' => 'background-color: {{VALUE}} !important;',
                ],
            ]
        );

        // Controle para cor da borda no estado de hover
        $input->add_control(
            'more_button_hover_border_color',
            [
                'label'     => __('Hover Border Color', 'link-nacional-wp-crowdfunding-extension'),
                'type'      => Controls_Manager::COLOR,
                'default'   => '#0073e6',
                'selectors' => [
                    '{{WRAPPER}} .lknwp-more-button-class:hover' => 'border-color: {{VALUE}} !important;',
                ],
            ]
        );

        $input->add_control(
            'more_button_hover_transition_duration',
            [
                'label'      => __('Transition Duration (s)', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SLIDER,
                'default'    => [
                    'size' => 0.3,
                ],
                'range'      => [
                    'px' => [
                        'min' => 0,
                        'max' => 5,
                        'step' => 0.1,
                    ],
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-more-button-class' => 'transition-duration: {{SIZE}}s;',
                ],
            ]
        );

        // Controle para função de easing
        $input->add_control(
            'more_button_hover_easing_function',
            [
                'label'      => __('Easing Function', 'link-nacional-wp-crowdfunding-extension'),
                'type'       => Controls_Manager::SELECT,
                'default'    => 'ease-in-out',
                'options'    => [
                    'ease'       => __('Ease', 'link-nacional-wp-crowdfunding-extension'),
                    'linear'     => __('Linear', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in'    => __('Ease In', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-out'   => __('Ease Out', 'link-nacional-wp-crowdfunding-extension'),
                    'ease-in-out' => __('Ease In Out', 'link-nacional-wp-crowdfunding-extension'),
                ],
                'selectors'  => [
                    '{{WRAPPER}} .lknwp-more-button-class' => 'transition-timing-function: {{VALUE}};',
                ],
            ]
        );

        $input->end_controls_section();

        return $input;
    }

    public static function getFields($settings)
    {
        $lkn_header_button_styles  = [];
        $lkn_header_button_container = [];
        $lkn_header_button_class = 'lknwp-header-button-class';
        $header_button_text = __('View campaign', 'link-nacional-wp-crowdfunding-extension');

        $lkn_bottom_button_styles  = [];
        $lkn_bottom_button_container = [];
        $lkn_bottom_button_class = 'lknwp-bottom-button-class';
        $bottom_button_text = __('View campaign', 'link-nacional-wp-crowdfunding-extension');

        $lkn_more_button_styles  = [];
        $lkn_more_button_container = [];
        $lkn_more_button_class = 'lknwp-more-button-class';
        $more_button_text = __('Load more', 'link-nacional-wp-crowdfunding-extension');

        if (!empty($settings['header_button_text'])) {
            $header_button_text = $settings['header_button_text'];
        }

        if (!empty($settings['bottom_button_text'])) {
            $bottom_button_text = $settings['bottom_button_text'];
        }

        if (!empty($settings['more_button_text'])) {
            $more_button_text = $settings['more_button_text'];
        }

        // Alinhamento
        if (!empty($settings['header_button_position'])) {
            $lkn_header_button_container[] = 'display: flex; justify-content: ' . $settings['header_button_position'] . ';';
        }

        // Cor do texto
        if (!empty($settings['header_text_color'])) {
            $lkn_header_button_styles[] = 'color: ' . $settings['header_text_color'] . ';';
        }

        // Cor de fundo
        if (!empty($settings['header_button_background_color'])) {
            $lkn_header_button_styles[] = 'background-color: ' . $settings['header_button_background_color'] . ';';
        }

        if (!empty($settings['header_button_border_radius'])) {
            $radius = $settings['header_button_border_radius'];
            $lkn_header_button_styles[] = sprintf(
                'border-radius: %s %s %s %s;',
                $radius['top'] . $radius['unit'],
                $radius['right'] . $radius['unit'],
                $radius['bottom'] . $radius['unit'],
                $radius['left'] . $radius['unit']
            );
        }

        ////////////////////////////

        // Alinhamento
        if (!empty($settings['bottom_button_position'])) {
            $lkn_bottom_button_container[] = 'display: flex; justify-content: ' . $settings['bottom_button_position'] . ';';
        }

        // Cor do texto
        if (!empty($settings['bottom_text_color'])) {
            $lkn_bottom_button_styles[] = 'color: ' . $settings['bottom_text_color'] . ';';
        }

        // Cor de fundo
        if (!empty($settings['bottom_button_background_color'])) {
            $lkn_bottom_button_styles[] = 'background-color: ' . $settings['bottom_button_background_color'] . ';';
        }

        if (!empty($settings['bottom_button_border_radius'])) {
            $radius = $settings['bottom_button_border_radius'];
            $lkn_bottom_button_styles[] = sprintf(
                'border-radius: %s %s %s %s;',
                $radius['top'] . $radius['unit'],
                $radius['right'] . $radius['unit'],
                $radius['bottom'] . $radius['unit'],
                $radius['left'] . $radius['unit']
            );
        }


        ///////////////////////////////////

        // Alinhamento
        if (!empty($settings['more_button_position'])) {
            $lkn_more_button_container[] = 'display: flex; justify-content: ' . $settings['more_button_position'] . ';';
        }

        // Cor do texto
        if (!empty($settings['more_text_color'])) {
            $lkn_more_button_styles[] = 'color: ' . $settings['more_text_color'] . ';';
        }

        // Cor de fundo
        if (!empty($settings['more_button_background_color'])) {
            $lkn_more_button_styles[] = 'background-color: ' . $settings['more_button_background_color'] . ';';
        }

        if (!empty($settings['more_button_border_radius'])) {
            $radius = $settings['more_button_border_radius'];
            $lkn_more_button_styles[] = sprintf(
                'border-radius: %s %s %s %s;',
                $radius['top'] . $radius['unit'],
                $radius['right'] . $radius['unit'],
                $radius['bottom'] . $radius['unit'],
                $radius['left'] . $radius['unit']
            );
        }


        $buttons_settings = [
            "lkn_header_button_styles" => $lkn_header_button_styles,
            "lkn_header_button_container" => $lkn_header_button_container,
            "lkn_header_button_class" => $lkn_header_button_class,
            "header_button_text" => $header_button_text,

            "lkn_bottom_button_styles" => $lkn_bottom_button_styles,
            "lkn_bottom_button_container" => $lkn_bottom_button_container,
            "lkn_bottom_button_class" => $lkn_bottom_button_class,
            "bottom_button_text" => $bottom_button_text,

            "lkn_more_button_styles" => $lkn_more_button_styles,
            "lkn_more_button_container" => $lkn_more_button_container,
            "lkn_more_button_class" => $lkn_more_button_class,
            "more_button_text" => $more_button_text
        ];

        return $buttons_settings;
    }
}
