<?php
namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly

class Rivax_Elementor_Widgets_Dark_Mode {

    /**
     * A reference to an instance of this class.
     */
    private static $instance = null;


    public function __construct(){

        add_action( 'elementor/element/common/_section_border/after_section_end', array( $this, 'widgets_common_dark_mode' ) );
        add_action( 'elementor/element/container/section_shape_divider/after_section_end', array( $this, 'container_dark_mode' ) );

        add_action( 'elementor/element/heading/section_title_style/after_section_end', array( $this, 'heading_widget_dark_mode' ) );
        add_action( 'elementor/element/text-editor/section_style/after_section_end', array( $this, 'text_editor_widget_dark_mode' ) );
        add_action( 'elementor/element/image-box/section_style_content/after_section_end', array( $this, 'image_box_widget_dark_mode' ) );
        add_action( 'elementor/element/icon/section_style_icon/after_section_end', array( $this, 'icon_widget_dark_mode' ) );
        add_action( 'elementor/element/icon-box/section_style_content/after_section_end', array( $this, 'icon_box_widget_dark_mode' ) );
        add_action( 'elementor/element/button/section_style/after_section_end', array( $this, 'button_widget_dark_mode' ) );
        add_action( 'elementor/element/icon-list/section_text_style/after_section_end', array( $this, 'icon_list_widget_dark_mode' ) );
        add_action( 'elementor/element/counter/section_title/after_section_end', array( $this, 'counter_widget_dark_mode' ) );
        add_action( 'elementor/element/divider/section_icon_style/after_section_end', array( $this, 'divider_widget_dark_mode' ) );
        add_action( 'elementor/element/nested-accordion/section_content_style/after_section_end', array( $this, 'nested_accordion_widget_dark_mode' ) );
        add_action( 'elementor/element/nested-tabs/section_box_style/after_section_end', array( $this, 'nested_tabs_widget_dark_mode' ) );
    }


    /**
     * Returns the instance.
     *
     * @since  1.0.0
     * @access public
     * @return object
     */
    public static function get_instance() {
        // If the single instance hasn't been set, set it now.
        if ( null == self::$instance ) {
            self::$instance = new self;
        }
        return self::$instance;
    }


    public function widgets_common_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_common_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_ADVANCED,
            ]
        );

        $element->start_controls_tabs( '_tabs_bg_dark_mode' );

        $element->start_controls_tab(
            '_tab_background_normal_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => '_bg_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container',
            ]
        );

        $element->add_control(
            '_border_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();

        $element->start_controls_tab(
            '_tab_background_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => '_background_hover_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}}:hover .elementor-widget-container',
            ]
        );

        $element->add_control(
            '_border_hover_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}:hover > .elementor-widget-container' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();
        $element->end_controls_tabs();

        $element->end_controls_section();


    }


    public function container_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'section_background_heading_dark_mode',
            [
                'label'     => esc_html__( 'Background', 'newsfy' ),
                'type'      => Controls_Manager::HEADING,
            ]
        );

        $element->start_controls_tabs( 'tabs_bg_dark_mode' );

        /* Normal */
        $element->start_controls_tab(
            'tab_background_normal_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'bg_dark_mode',
                'selector' => 'html[scheme="dark"] {{WRAPPER}}',
            ]
        );

        $element->add_control(
            'border_color_dark_mode',
            [
                'label'     => esc_html__( 'border Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();

        /* Hover */
        $element->start_controls_tab(
            'tab_background_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'background_hover_dark_mode',
                'selector' => 'html[scheme="dark"] {{WRAPPER}}:hover',
            ]
        );

        $element->add_control(
            'border_color_hover_dark_mode',
            [
                'label'     => esc_html__( 'Border Color Hover', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();

        $element->end_controls_tabs();


        $element->add_control(
            'section_background_overlay_heading_dark_mode',
            [
                'label'     => esc_html__( 'Background Overlay', 'newsfy' ),
                'type'      => Controls_Manager::HEADING,
            ]
        );

        $element->start_controls_tabs( 'tabs_background_overlay_dark_mode' );

        /* Normal */
        $element->start_controls_tab(
            'tab_background_overlay_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $background_overlay_selector = 'html[scheme="dark"] {{WRAPPER}}::before';

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'background_overlay_dark_mode',
                'selector' => $background_overlay_selector,
                'fields_options' => [
                    'background' => [
                        'selectors' => [
                            // Hack to set the `::before` content in order to render it only when there is a background overlay.
                            $background_overlay_selector => '--background-overlay: \'\';',
                        ],
                    ],
                ],
            ]
        );


        $element->end_controls_tab();

        /* Hover */
        $element->start_controls_tab(
            'tab_background_overlay_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $background_overlay_hover_selector = 'html[scheme="dark"] {{WRAPPER}}:hover::before';

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'background_overlay_hover_dark_mode',
                'selector' => $background_overlay_hover_selector,
                'fields_options' => [
                    'background' => [
                        'selectors' => [
                            // Hack to set the `::before` content in order to render it only when there is a background overlay.
                            $background_overlay_hover_selector => '--background-overlay: \'\';',
                        ],
                    ],
                ],
            ]
        );

        $element->end_controls_tab();

        $element->end_controls_tabs();


        $element->add_control(
            'shape_dark_mode_heading',
            [
                'label'     => esc_html__( 'Shape Divider', 'newsfy' ),
                'type'      => Controls_Manager::HEADING,
                'separator' => 'before',
            ]
        );

        $element->add_control(
            'shape_top_color_dark_mode',
            [
                'label'     => esc_html__( 'Top Shape', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .e-con-inner > .elementor-shape-top .elementor-shape-fill' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'shape_bottom_color_dark_mode',
            [
                'label'     => esc_html__( 'Bottom Shape', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .e-con-inner > .elementor-shape-bottom .elementor-shape-fill' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function heading_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'color_dark_mode',
            [
                'label'     => esc_html__( 'Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();
    }


    public function text_editor_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'color_dark_mode',
            [
                'label'     => esc_html__( 'Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();
    }


    public function image_box_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'title_color_dark_mode',
            [
                'label'     => esc_html__( 'Title Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'description_color_dark_mode',
            [
                'label'     => esc_html__( 'Description Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function icon_box_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'primary_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Primary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon, html[scheme="dark"] {{WRAPPER}}.elementor-view-default .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}}; border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'secondary_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Secondary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'view!' => 'default',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'title_color_dark_mode',
            [
                'label'     => esc_html__( 'Title Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-box-title' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'description_color_dark_mode',
            [
                'label'     => esc_html__( 'Description Color', 'newsfy' ),
                'type'      => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-box-description' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function icon_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'primary_color_dark_mode',
            [
                'label' => esc_html__( 'Primary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon, html[scheme="dark"] {{WRAPPER}}.elementor-view-default .elementor-icon' => 'color: {{VALUE}}; border-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon, html[scheme="dark"] {{WRAPPER}}.elementor-view-default .elementor-icon svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'secondary_color_dark_mode',
            [
                'label' => esc_html__( 'Secondary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'view!' => 'default',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function button_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );


        $element->start_controls_tabs( 'tabs_button_style_dark_mode');

        $element->start_controls_tab(
            'tab_button_normal_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $element->add_control(
            'button_text_color_dark_mode',
            [
                'label' => esc_html__( 'Text Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-button' => 'fill: {{VALUE}}; color: {{VALUE}};',
                ],
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'background_dark_mode',
                'exclude' => [ 'image' ],
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} .elementor-button',
            ]
        );

        $element->add_control(
            'button_border_color_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'border_border!' => '',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-button' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();

        $element->start_controls_tab(
            'tab_button_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $element->add_control(
            'hover_color_dark_mode',
            [
                'label' => esc_html__( 'Text Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-button:hover, html[scheme="dark"] {{WRAPPER}} .elementor-button:focus' => 'color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}} .elementor-button:hover svg, html[scheme="dark"] {{WRAPPER}} .elementor-button:focus svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'button_background_hover_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} .elementor-button:hover, html[scheme="dark"] {{WRAPPER}} .elementor-button:focus',
            ]
        );

        $element->add_control(
            'button_hover_border_color_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'border_border!' => '',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-button:hover, html[scheme="dark"] {{WRAPPER}} .elementor-button:focus' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();

        $element->end_controls_tabs();

        $element->end_controls_section();


    }


    public function icon_list_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'divider_color_dark_mode',
            [
                'label' => esc_html__( 'Divider Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'condition' => [
                    'divider' => 'yes',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-item:not(:last-child):after' => 'border-color: {{VALUE}}',
                ],
            ]
        );

        $element->add_control(
            'icon_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-icon i' => 'color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-icon svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'icon_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Icon Hover', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-icon i' => 'color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-icon svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'text_color_dark_mode',
            [
                'label' => esc_html__( 'Text Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-text' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'text_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Text Hover', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-text' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function counter_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'number_color_dark_mode',
            [
                'label' => esc_html__( 'Number Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-counter-number-wrapper' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'title_color_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-counter-title' => 'color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function divider_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->add_control(
            'color_dark_mode',
            [
                'label' => esc_html__( 'Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'render_type' => 'template',
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--divider-color: {{VALUE}}',
                ],
            ]
        );

        $element->add_control(
            'text_color_dark_mode',
            [
                'label' => esc_html__( 'Text Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} .elementor-divider__text' => 'color: {{VALUE}}',
                ],
                'condition' => [
                    'look' => 'line_text',
                ],
            ]
        );

        $element->add_control(
            'primary_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Primary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon, {{WRAPPER}}.elementor-view-default .elementor-icon' => 'color: {{VALUE}}; border-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon, {{WRAPPER}}.elementor-view-default .elementor-icon svg' => 'fill: {{VALUE}};',
                ],
                'condition' => [
                    'look' => 'line_icon',
                ],
            ]
        );

        $element->add_control(
            'secondary_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Secondary Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'default' => '',
                'condition' => [
                    'look' => 'line_icon',
                    'icon_view!' => 'default',
                ],
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'color: {{VALUE}};',
                    'html[scheme="dark"] {{WRAPPER}}.elementor-view-stacked .elementor-icon svg' => 'fill: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();
    }


    public function nested_accordion_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->start_controls_tabs( 'tabs_header_dark_mode' );

        $element->start_controls_tab(
            'tab_header_normal_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item > .e-n-accordion-item-title',
            ]
        );

        $element->add_control(
            'header_border_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item > .e-n-accordion-item-title' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-title-normal-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-icon-normal-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();


        $element->start_controls_tab(
            'tab_header_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_hover_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item > .e-n-accordion-item-title:hover',
            ]
        );

        $element->add_control(
            'header_border_hover_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item > .e-n-accordion-item-title:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-title-hover-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-icon-hover-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();


        $element->start_controls_tab(
            'tab_header_active_dark_mode',
            [
                'label' => esc_html__( 'Active', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_active_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item[open] > .e-n-accordion-item-title',
            ]
        );

        $element->add_control(
            'header_border_active_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item[open] > .e-n-accordion-item-title' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_active_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-title-active-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_active_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-accordion-icon-active-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();
        $element->end_controls_tabs();

        $element->add_control(
            'content_heading_dark_mode',
            [
                'label'     => esc_html__( 'Content', 'newsfy' ),
                'type'      => Controls_Manager::HEADING,
                'separator' => 'before',
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'content_bg_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => ':where( html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item ) > .e-con',
            ]
        );

        $element->add_control(
            'content_border_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    ':where( html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-accordion > .e-n-accordion-item ) > .e-con' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


    public function nested_tabs_widget_dark_mode ( $element ) {

        $element->start_controls_section(
            'section_rivax_dark_mode',
            [
                'label' => esc_html__( 'Dark Mode', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

        $element->start_controls_tabs( 'tabs_header_dark_mode' );

        $element->start_controls_tab(
            'tab_header_normal_dark_mode',
            [
                'label' => esc_html__( 'Normal', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}} > .elementor-widget-container > .e-n-tabs > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:not( :hover )',
            ]
        );

        $element->add_control(
            'header_border_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:not( :hover )' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-tabs-title-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-tabs-icon-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();


        $element->start_controls_tab(
            'tab_header_hover_dark_mode',
            [
                'label' => esc_html__( 'Hover', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_hover_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs[data-touch-mode="false"] > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:hover',
            ]
        );

        $element->add_control(
            'header_border_hover_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs[data-touch-mode="false"] > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} [data-touch-mode="false"] .e-n-tab-title[aria-selected="false"]:hover' => '--n-tabs-title-color-hover: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_hover_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}} [data-touch-mode="false"] .e-n-tab-title[aria-selected="false"]:hover' => '--n-tabs-icon-color-hover: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();


        $element->start_controls_tab(
            'tab_header_active_dark_mode',
            [
                'label' => esc_html__( 'Active', 'newsfy' ),
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'header_bg_active_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs > .e-n-tabs-heading > .e-n-tab-title[aria-selected="true"], html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs[data-touch-mode="true"] > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:hover',
            ]
        );

        $element->add_control(
            'header_border_active_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs > .e-n-tabs-heading > .e-n-tab-title[aria-selected="true"], html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs[data-touch-mode="true"] > .e-n-tabs-heading > .e-n-tab-title[aria-selected="false"]:hover' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_color_active_dark_mode',
            [
                'label' => esc_html__( 'Title Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-tabs-title-color-active: {{VALUE}};',
                ],
            ]
        );

        $element->add_control(
            'header_icon_color_active_dark_mode',
            [
                'label' => esc_html__( 'Icon Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}' => '--n-tabs-icon-color-active: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_tab();
        $element->end_controls_tabs();

        $element->add_control(
            'content_heading_dark_mode',
            [
                'label'     => esc_html__( 'Content', 'newsfy' ),
                'type'      => Controls_Manager::HEADING,
                'separator' => 'before',
            ]
        );

        $element->add_group_control(
            Group_Control_Background::get_type(),
            [
                'name' => 'content_bg_dark_mode',
                'exclude' => [ 'image' ],
                'selector' => 'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs > .e-n-tabs-content > .e-con',
            ]
        );

        $element->add_control(
            'content_border_dark_mode',
            [
                'label' => esc_html__( 'Border Color', 'newsfy' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    'html[scheme="dark"] {{WRAPPER}}.elementor-widget-n-tabs > .elementor-widget-container > .e-n-tabs > .e-n-tabs-content > .e-con' => 'border-color: {{VALUE}};',
                ],
            ]
        );

        $element->end_controls_section();


    }


}

Rivax_Elementor_Widgets_Dark_Mode::get_instance();
