<?php



use Elementor\Widget_Base;
use Elementor\Controls_Manager;

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


class Featureboxfirststkaveh extends Widget_Base{

  public function get_name(){
    return 'featureboxfirststkaveh';
  }

  public function get_title(){
    return esc_html__( 'Feature Box Style One', 'kavehTheme' );
  }

  public function get_icon(){
    return 'eicon-archive-posts';
  }

  public function get_categories(){
    return ['kavehelements'];
  }

  protected function register_controls(){
    
    $this->start_controls_section(
        'contentfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Element Content', 'kavehTheme' ),
                  'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        ]
      );

      $this->add_control(
        'title_tag_featureboxfirststkaveh',
        [
            'label'   => esc_html__('Heading Tag', 'kavehTheme'),
            'type'    => \Elementor\Controls_Manager::SELECT,
            'options' => [
                'h1'  => 'H1',
                'h2'  => 'H2',
                'h3'  => 'H3',
                'h4'  => 'H4',
                'h5'  => 'H5',
                'h6'  => 'H6',
                'span' => 'SPAN',
                'div'  => 'DIV',
                'p'    => 'P',
            ],
            'default' => 'h3',
        ]
    );


      $this->add_control(
        'wigti2featureboxfirststkaveh',
        [
          'label' => esc_html__( 'Title', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::TEXT,
          'default' => esc_html__('Order Count', 'kavehTheme'),
        ]
      );

      $this->add_control(
        'Numfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box Number Content', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::TEXT,
          'default' => '45',
        ]
      );



       $this->end_controls_section();

       $this->start_controls_section(
        'stylet_featureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box Items Style', 'kavehTheme' ),
          'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        ]
      );

      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'ftitletyt_featureboxfirststkaveh',
          'label' => esc_html__( 'Main Title Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .counter-bed-item .title span',
        ]
      ); 


      $this->add_control(
        'textbutton1colorfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Main Title Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .counter-bed-item .title' => 'color: {{VALUE}}',
          ],
        ]
      ); 


      $this->add_control(
        'twotitlecolorfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Second Title Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}}  .part-two' => 'color: {{VALUE}}!important;',
          ],
        ]
      );  

      $this->add_group_control(
        \Elementor\Group_Control_Typography::get_type(),
        [
          'name' => 'NumCircle_featureboxfirststkaveh',
          'label' => esc_html__( 'Number Typography', 'kavehTheme' ),
          'selector' => '{{WRAPPER}} .counter-bed-item .counter',
        ]
      ); 


      $this->add_control(
        'Numcirclecolorfeatureboxfirststkaveh',
        [
            'label' => esc_html__( 'Main Number Color', 'kavehTheme' ),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .counter-bed-item .counter' => 'color: {{VALUE}} !important;',
            ],
        ]
    );

      $this->add_control(
        'backgroundcolorfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Number Box Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .counter span::before' => 'background-color: {{VALUE}}',
          ],
        ]
      ); 

      $this->add_control(
        'backgroundbackcolorfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box Border Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .counter span::after' => 'background-color: {{VALUE}}',
          ],
        ]
      ); 

      $this->add_control(
        'shpecolorfeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box Bottom Shape Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .counter::after' => 'background-color: {{VALUE}}',
          ],
        ]
      ); 
      $this->end_controls_section();
      $this->start_controls_section(
        'box_stylet_featureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box General Style', 'kavehTheme' ),
          'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        ] 
        );


         $this->add_control(
        'kavehboxbackgroundcolor',
        [
          'label' => esc_html__( 'Icon Background Color', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::COLOR,
          'selectors' => [
            '{{WRAPPER}} .counter-bed-item' => 'background-color: {{VALUE}}!important;',
          ],
        ]
      ); 


        $this->add_control(
        'boxonefeatureboxfirststkaveh',
        [
          'label' => esc_html__( 'Box Border Radius', 'kavehTheme' ),
          'type' => \Elementor\Controls_Manager::DIMENSIONS,
          'size_units' => [ 'px' ],
          'selectors' => [
            '{{WRAPPER}} .counter-bed-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
          ],
        ]
      );

      $this->add_control(
        'bordercolorboxkavehfeatureboxfirststkaveh',
        [
            'label' => esc_html__('Border Color', 'kavehTheme'),
            'type' => \Elementor\Controls_Manager::COLOR,
            'selectors' => [
                '{{WRAPPER}} .counter-bed-item' => 'border: 1px solid; border-color: {{VALUE}};',

            ]
        ]
    );


// Box Shadow
$this->add_control(
  'box_shadow',
  [
      'label' => esc_html__('Box Shadow', 'kavehTheme'),
      'type' => \Elementor\Controls_Manager::BOX_SHADOW,
      'selectors' => [
          '{{WRAPPER}} .counter-bed-item' => 'box-shadow: {{VALUE}};',
      ],
  ]
);
// Padding
$this->add_control(
  'box_padding',
  [
      'label' => esc_html__('Padding', 'kavehTheme'),
      'type' => \Elementor\Controls_Manager::DIMENSIONS,
      'size_units' => ['px', '%', 'em'],
      'selectors' => [
          '{{WRAPPER}} .counter-bed-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
      ],
  ]
);

// Margin
$this->add_control(
  'box_margin',
  [
      'label' => esc_html__('Margin', 'kavehTheme'),
      'type' => \Elementor\Controls_Manager::DIMENSIONS,
      'size_units' => ['px', '%', 'em'],
      'selectors' => [
          '{{WRAPPER}} .counter-bed-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
      ],
  ]
);


$this->add_control(
  'boxheightfeatureboxfirststkaveh',
  [
    'label' => esc_html__( 'Box Height', 'kavehTheme' ),
    'type' => \Elementor\Controls_Manager::SLIDER,
    'size_units' => [ 'px' ],
    'range' => [
      'px' => [
        'min' => 0,
        'max' => 1000,
        'step' => 1,
      ],
    ],
    'selectors' => [
      '{{WRAPPER}} .counter-bed-item' => 'height: {{SIZE}}{{UNIT}};',
    ],
  ]
);


      $this->end_controls_section();
        }
        protected function render() {
          $settings = $this->get_settings_for_display();
          $clsid = $this->get_id();
          $number = isset($settings['Numfeatureboxfirststkaveh']) ? $settings['Numfeatureboxfirststkaveh'] : '45';
          ?>
          <div class="counter-bed-item d-flex flex-column text-center bg-white">
              <div class="counter position-relative text-white">
                  <span class="position-absolute top-0 end-0 w-100 h-100"></span>
                  <?php echo esc_html($number); ?>
              </div>
              <div class="title">
              <<?php echo  esc_attr($settings['title_tag_featureboxfirststkaveh']);?> class="title text-center">
                  <?php echo  esc_html($settings['wigti2featureboxfirststkaveh']); ?>
                  </<?php echo  esc_attr($settings['title_tag_featureboxfirststkaveh']); ?>>
            
              </div>
          </div>
          <?php
      }
  }
  ?>




