<?php
/**
 * Banner Section
 * 
 * @package artist_painter
 */

$artist_painter_slider = get_theme_mod( 'artist_painter_slider_setting', false );
$artist_painter_banner_background = get_theme_mod('artist_painter_slider_background_image');
$artist_painter_svg_image = file_get_contents(get_template_directory_uri() . '/images/brush.svg');
$artist_painter_slider_button_url  = get_theme_mod( 'artist_painter_slider_btn_url' );
$artist_painter_slider_button_text = get_theme_mod( 'artist_painter_button_text', __( 'Explore Gallery', 'artist-painter' ) );
?>
<?php if ( $artist_painter_slider ) { ?>
  <div class="banner-main wow bounceInDown delay-1000" data-wow-duration="2s">
    <div class="test">
      <div class="banner-image">
        <div class="bg-image">
          <img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/images/background.png' ); ?>" alt="<?php esc_attr_e('Background Image', 'artist-painter'); ?>" class="background-image">
        </div>
        <img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/images/border.png' ); ?>" alt="<?php esc_attr_e('Decorative Border', 'artist-painter'); ?>" class="banner-border-image">
        <div class="banner-img position-absolute">
          <?php 
            $artist_painter_banner_background = get_theme_mod('artist_painter_slider_background_image');
            $artist_painter_default_image_url = get_template_directory_uri() . '/images/default-header.png';

            if ( ! empty( $artist_painter_banner_background ) ) {
                // Convert attachment ID to URL
                $artist_painter_banner_background_url = wp_get_attachment_url( $artist_painter_banner_background );
          ?>
          <img src="<?php echo esc_url( $artist_painter_banner_background_url ); ?>" alt="<?php esc_attr_e('Banner Image', 'artist-painter'); ?>"/>
          <?php } else { ?>
              <img src="<?php echo esc_url( $artist_painter_default_image_url ); ?>" alt="<?php esc_attr_e('Default Banner', 'artist-painter'); ?>"/>
          <?php } ?>
        </div>
        <div class="banner-info position-absolute">
          <div class="container">    
            <div class="row">
              <div class="col-lg-5 col-md-5 col-12">
                <div class="justify-content-center align-items-center banner-content">
                  <div class="banner_box">
                    <span class="brush-bg"><?php echo $artist_painter_svg_image; ?></span>
                    <?php if ( get_theme_mod('artist_painter_slider_text_extra') ) : ?>
                      <span class="slider-extra-title"><?php echo esc_html(get_theme_mod('artist_painter_slider_text_extra')); ?></span>
                    <?php endif; ?>
                    <?php if ( get_theme_mod('artist_painter_slider_banner_heading') ) : ?>
                      <h3><?php echo esc_html(get_theme_mod('artist_painter_slider_banner_heading')); ?></h3>
                    <?php endif; ?>
                    <?php if ( get_theme_mod('artist_painter_slider_banner_content') ) : ?>
                      <p><?php echo esc_html(get_theme_mod('artist_painter_slider_banner_content')); ?></p>
                    <?php endif; ?>

                    <div class="slide-btn-green">
                      <?php if ($artist_painter_slider_button_text ) : ?>
                        <a href="<?php echo esc_url( $artist_painter_slider_button_url ); ?>">
                            <?php echo esc_html( $artist_painter_slider_button_text ); ?>
                        </a>
                      <?php endif; ?>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php } ?>