<?php
/*
* Display Logo and contact details
*/
?>
<div class="head-box">
  <div class="main-header">
    <div class="container">
      <div class="row m-0">
        <div class="col-lg-3 col-md-3 col-12 align-self-center">
          <div class="logo">
            <?php if( has_custom_logo() ) farming_store_the_custom_logo(); ?>
            <?php if(get_theme_mod('farming_store_site_title',true) == 1){ ?>
              <?php if (is_front_page() && is_home()) : ?>
                <h1 class="text-capitalize">
                  <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a>
                </h1> 
              <?php else : ?>
                <p class="text-capitalize site-title mb-1">
                  <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a>
                </p>
              <?php endif; ?>
            <?php }?>
            <?php $farming_store_description = get_bloginfo( 'description', 'display' );
            if ( $farming_store_description || is_customize_preview() ) : ?>
              <?php if(get_theme_mod('farming_store_site_tagline',false)){ ?>
                <p class="site-description mb-0"><?php echo esc_html($farming_store_description); ?></p>
              <?php }?>
            <?php endif; ?>
          </div>
        </div>
        <div class="col-xl-9 col-lg-9 col-md-9 navigation-col align-self-center p-0">
          <div class="main-side-header">
            <div class="top-header-box mt-lg-3 mt-2">
                  <div class="top-head">
                    <div class="left contact">
                      <?php if (get_theme_mod('farming_store_mail')) : ?>
                        <p class="mb-md-0 mb-2 contact-content me-md-3 me-0">
                          <a href="mailto:<?php echo esc_attr(get_theme_mod('farming_store_mail')); ?>">
                            <i class="fas fa-envelope me-md-2 me-1"></i>
                            <?php echo esc_html(get_theme_mod('farming_store_mail')); ?>
                          </a>
                        </p>
                      <?php endif; ?>
                      <?php if (get_theme_mod('farming_store_call')) : ?>
                        <p class="mb-md-0 mb-2 contact-content call me-lg-5 me-md-3">
                          <a href="tel:<?php echo esc_attr(get_theme_mod('farming_store_call')); ?>">
                            <i class="fas fa-phone me-md-2 me-1"></i>
                            <?php echo esc_html(get_theme_mod('farming_store_call')); ?>
                          </a>
                        </p>
                      <?php endif; ?>
                    </div>
                    <div class="right contact">
                      <?php if (get_theme_mod('farming_store_time')) : ?>
                        <p class="contact-content mb-md-0 mb-2">
                          <span><i class="fas fa-clock me-2"></i><?php echo esc_html(get_theme_mod('farming_store_time')); ?></span>
                        </p>
                      <?php endif; ?>
                      <?php
                        // Dynamically build the link setting key
                        $farming_store_btn_link_key1 = 'farming_store_notification_btn_link';
                        // Fetch the link from theme mod
                        $farming_store_product_btn_link1 = get_theme_mod( $farming_store_btn_link_key1 );
                        // Only show icon if the link is not empty
                        if ( ! empty( $farming_store_product_btn_link1 ) ) : ?>
                          <a class="viewall-btn ms-lg-3 ms-3" href="<?php echo esc_url( $farming_store_product_btn_link1 ); ?>" aria-label="<?php echo esc_attr__('View notification', 'farming-store'); ?>">
                            <i class="fas fa-bell"></i>
                          </a>
                        <?php endif; ?>
                        <span class="search-bar ms-lg-3 ms-3">
                          <button type="button" class="open-search"><i class="fas fa-search"></i></button>
                        </span>
                    </div>
                    <div class="search-outer">
                      <div class="inner_searchbox w-100 h-100">
                        <?php get_search_form(); ?>
                      </div>
                      <button type="button" class="search-close"><?php esc_html_e('CLOSE', 'farming-store'); ?></button>
                    </div> 
                  </div>
            </div>
            <div class="bottom-header-box">
              <div class="row">
                <div class="col-xl-10 col-lg-9 col-md-5 col-4 align-self-center">
                  <?php get_template_part('template-parts/navigation/site-nav'); ?>
                </div>
                <div class="col-xl-2 col-lg-3 col-md-7 col-8 align-self-center">
                  <div class="header-menu-right">
                    <?php if (get_theme_mod('farming_store_header_link') || get_theme_mod('farming_store_header_button','Shop Now')) : ?>
                      <span class="header-btn">
                        <a href="<?php echo esc_url(get_theme_mod('farming_store_header_link')); ?>" class="book-appoin"><?php echo esc_html(get_theme_mod('farming_store_header_button','Shop Now')); ?><i class="fas fa-arrow-right ps-2"></i></a>
                      </span>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>