<?php
/**
 * Template part for displaying slider section.
 *
 * @package job_seeker_resume
 */

$job_seeker_resume_static_image = get_stylesheet_directory_uri() . '/assets/images/slider-img.png';
$job_seeker_resume_slider_arrows = get_theme_mod('job_seeker_resume_slider_arrows', true);

if ($job_seeker_resume_slider_arrows) : ?>
    <section id="slider">
        <div class="container-fuild">
            <div class="slider-main">
                <div class="row m-0">
                    <div class="col-lg-7 col-md-6 slider-content-col align-self-center p-0">
                        <div class="carousel-caption">
                            <div class="inner_carousel">
                                <?php 
                                $job_seeker_resume_slider_top_heading = get_theme_mod('job_seeker_resume_slider_top_heading', '');
                                if (!empty($job_seeker_resume_slider_top_heading)) : ?>
                                    <p class="slidetop-text mt-md-4">
                                        <?php echo esc_html($job_seeker_resume_slider_top_heading); ?>
                                    </p>
                                <?php endif; ?>
                                <?php 
                                $job_seeker_resume_slider_add_heading = get_theme_mod('job_seeker_resume_slider_add_heading', '');
                                if (!empty($job_seeker_resume_slider_add_heading)) : ?>
                                    <h1 class="slider-heading">
                                        <?php echo esc_html($job_seeker_resume_slider_add_heading); ?>
                                    </h1>
                                <?php endif; ?>
                                <?php 
                                $job_seeker_resume_slider_short_heading = get_theme_mod('job_seeker_resume_slider_short_heading', '');
                                if (!empty($job_seeker_resume_slider_short_heading)) : 
                                    // Explode the heading into words
                                    $job_seeker_resume_words = explode(' ', $job_seeker_resume_slider_short_heading);
                                    
                                    // Apply class to the first two words if they exist
                                    if (count($job_seeker_resume_words) >= 2) {
                                        $job_seeker_resume_formatted_text = '<span class="bold-text">' . $job_seeker_resume_words[0] . ' ' . $job_seeker_resume_words[1] . '</span> ' . implode(' ', array_slice($job_seeker_resume_words, 2));
                                    } else {
                                        $job_seeker_resume_formatted_text = '<span class="bold-text">' . $job_seeker_resume_slider_short_heading . '</span>';
                                    }
                                ?>
                                    <p class="slidebottom-text text-capitalize mb-md-0 mt-md-0 mb-1">
                                        <?php echo wp_kses_post($job_seeker_resume_formatted_text); ?>
                                    </p>
                                <?php endif; ?>

                                <?php 
                                    $job_seeker_resume_banner_btn_link = get_theme_mod('job_seeker_resume_banner_btn_link');
                                    $job_seeker_resume_banner_btn_text = get_theme_mod('job_seeker_resume_banner_btn_text', esc_html__('Let’s talk with me', 'job-seeker-resume'));
                                    if ($job_seeker_resume_banner_btn_link) : ?>
                                        <div class="slider-btn sec mt-4">
                                            <a href="<?php echo esc_url($job_seeker_resume_banner_btn_link); ?>" class="slider-btn">
                                                <span class="pe-2"><?php echo esc_html($job_seeker_resume_banner_btn_text); ?></span><i class="fas fa-arrow-right" aria-hidden="true"></i>
                                            </a>
                                        </div>
                                <?php endif; ?>
                                <div class="contact mt-3 mt-md-4 mt-lg-5">
                                  <?php if (get_theme_mod('job_seeker_resume_banner_call')) : ?>
                                    <p class="contact-content call mb-2">
                                      <i class="fas fa-phone me-md-2 me-1"></i><span><a href="tel:<?php echo esc_attr(get_theme_mod('job_seeker_resume_banner_call')); ?>">
                                              <?php echo esc_attr(get_theme_mod('job_seeker_resume_banner_call')); ?>
                                      </a>
                                    </p>
                                  <?php endif; ?>
                                  <?php if (get_theme_mod('job_seeker_resume_banner_mail')) : ?>
                                      <p class="mb-2 contact-content ms-lg-4 ms-0">
                                          <i class="fas fa-envelope me-md-2 me-1"></i><a href="mailto:<?php echo esc_attr(get_theme_mod('job_seeker_resume_banner_mail')); ?>">
                                              <?php echo esc_attr(get_theme_mod('job_seeker_resume_banner_mail')); ?>
                                          </a>
                                      </p>
                                  <?php endif; ?>
                              </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-5 col-md-6 slider-img-col p-0">
                        <?php if( get_theme_mod( 'job_seeker_resume_banner_image_select') != '') { ?>
                            <img src="<?php echo esc_url(get_theme_mod('job_seeker_resume_banner_image_select')); ?>" alt="<?php esc_attr_e( 'Banner Image','job-seeker-resume' ); ?>" />
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
      </div>
    </section>
<?php endif; ?>