<?php
/**
 * The template part for Top Header
 *
 * @package Reseller Store 
 * @subpackage reseller-store
 * @since reseller-store 1.0
 */
?>

<div class="main-header <?php if( get_theme_mod( 'reseller_store_sticky_header', false) == 1 || get_theme_mod( 'reseller_store_stickyheader_hide_show', false) == 1) { ?> header-sticky"<?php } else { ?>close-sticky <?php } ?>">
  <div class="container main-header-container">
    <div class="row">
      <div class="col-xl-2 col-md-2 col-sm-12  align-self-center logo-img-sec p-0">
        <div class="logo text-center text-md-center pb-0 pb-md-0">
          <?php if ( has_custom_logo() ) : ?>
            <div class="site-logo"><?php the_custom_logo(); ?></div>
          <?php endif; ?>
          <?php $reseller_store_blog_info = get_bloginfo( 'name' ); ?>
            <?php if ( ! empty( $reseller_store_blog_info ) ) : ?>
              <?php if ( is_front_page() && is_home() ) : ?>
                <?php if( get_theme_mod('reseller_store_logo_title_hide_show',true) == 1){ ?>
                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                <?php } ?>
              <?php else : ?>
                <?php if( get_theme_mod('reseller_store_logo_title_hide_show',true) == 1){ ?>
                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                <?php } ?>
              <?php endif; ?>
            <?php endif; ?>
            <?php
              $reseller_store_description = get_bloginfo( 'description', 'display' );
              if ( $reseller_store_description || is_customize_preview() ) :
            ?>
            <?php if( get_theme_mod('reseller_store_tagline_hide_show',false) == 1){ ?>
              <p class="site-description mb-0">
                <?php echo esc_html($reseller_store_description); ?>
              </p>
            <?php } ?>
          <?php endif; ?>
        </div>
      </div>
      <div class="col-xl-10 col-md-10 header-sec-top">
        <div class="row">
          <div class="col-xl-12">
            <div class="row">
              <div class="col-xl-2 col-lg-2 col-md-3 col-sm-3 col-5 mt-lg-0 mt-md-0 mt-sm-0 mt-3 text-lg-start text-md-start text-sm-start text-center align-self-center">
                <?php if(get_theme_mod('reseller_store_phone_number') != '' || get_theme_mod('reseller_store_phone_icon') != '' ){ ?>
                  <span class="phone-number"><i class="<?php echo esc_attr(get_theme_mod('reseller_store_phone_icon','fa-solid fa-phone')); ?> me-2"></i><a href="tel:<?php echo esc_attr( get_theme_mod('reseller_store_phone_number','') ); ?>"><?php echo esc_html(get_theme_mod('reseller_store_phone_number',''));?></a></span>
                <?php }?>
              </div>
              <div class="col-xl-6 col-lg-5 col-md-4 col-sm-3 col-7 mt-lg-0 mt-md-0 mt-sm-0 mt-3 text-lg-start text-md-start text-center align-self-center p-sm-0">
                <span class="text-lg-start text-md-start text-center email-box">
                  <?php if(get_theme_mod('reseller_store_email_address') != '' || get_theme_mod('reseller_store_mail_icon') != ''){ ?>
                    <span class="adress"><i class="<?php echo esc_attr(get_theme_mod('reseller_store_mail_icon','fa-solid fa-envelope')); ?> me-2"></i> <a href="mailto:<?php echo esc_attr(get_theme_mod('reseller_store_email_address',''));?>"><?php echo esc_html(get_theme_mod('reseller_store_email_address',''));?></a></span>
                  <?php }?>
                </span>
              </div>
              <div class="col-xl-2 col-lg-3 col-md-3 col-sm-3 col-5 mt-lg-0 mt-md-0 text-lg-end text-md-end text-sm-start text-start align-self-center">
                <?php if(class_exists('woocommerce')){ ?>
                  <div class="order-track position-relative d-flex justify-content-end align-items-center">
                    <p class="topbar-text mb-0">
                     <?php echo esc_html(get_theme_mod('reseller_store_topbar_track_text'));?>
                     <span class="screen-reader-text"><?php esc_html_e( 'Track Order','reseller-store');?></span>
                    </p>
                    <div class="order-track-hover text-left">
                      <?php echo do_shortcode('[woocommerce_order_tracking]','reseller-store'); ?>
                    </div>
                  </div>
                <?php }?>
              </div>
              <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2 col-3 mt-lg-0 mt-md-0 mt-0 text-lg-end text-md-end text-sm-start text-center align-self-center currency">
                <?php if( get_theme_mod( 'reseller_store_show_hide_currency_settings', true) == 1) { ?>
                <?php if(class_exists('woocommerce')){ ?>
                  <div class="currency-box d-md-inline-block">
                    <?php echo do_shortcode( '[woocommerce_currency_switcher_drop_down_box]' );?>
                  </div>
                <?php } }?>
              </div>
              <div class="col-xl-1 col-lg-1 col-md-1 col-sm-1 col-4 mt-lg-0 mt-md-0 mt-0 text-xl-end text-lg-end text-md-end text-sm-start text-start align-self-center gtranslate p-0">
                <?php if( class_exists( 'GTranslate' ) ) { ?>
                  <div class="translate-lang position-relative d-md-inline-block">
                    <?php echo do_shortcode( '[gtranslate]' );?>
                  </div>
                <?php }?>
              </div>
            </div>
          </div>
          <div class="col-xl-12 align-self-center ">
            <div class="row top-header-sec ">
              <div class="col-xl-2 col-lg-2 col-md-4 col-sm-4 col-6 align-self-center">
                <?php if(class_exists('woocommerce')){ ?>
                  <div class=" position-relative">
                    <button class="product-btn text-lg-start text-md-start text-center"><i class="fas fa-bars"></i><?php esc_html_e('Categories','reseller-store'); ?></button>
                      <div class="product-cat">
                        <?php
                          $args = array(
                            'orderby'    => 'title',
                            'order'      => 'ASC',
                            'hide_empty' => 0,
                            'parent'  => 0
                          );
                          $reseller_store_product_categories = get_terms( 'product_cat', $args );
                          $reseller_store_count = count($reseller_store_product_categories);
                          if ( $reseller_store_count > 0 ){
                              foreach ( $reseller_store_product_categories as $reseller_store_product_category ) {
                                $product_cat_id = $reseller_store_product_category->term_id;
                                $cat_link = get_category_link( $product_cat_id );
                                if ($reseller_store_product_category->category_parent == 0) { ?>
                              <li class="drp_dwn_menu"><a href="<?php echo esc_url(get_term_link( $reseller_store_product_category ) ); ?>">
                              <?php
                            }
                            echo esc_html( $reseller_store_product_category->name ); ?></a><i class="fas fa-chevron-right"></i></li>
                        <?php } } ?>
                      </div>
                  </div>
                <?php }?>
              </div>
              <div class="col-xl-8 col-lg-8 col-md-4 col-sm-4 col-3 align-self-center">
                <?php get_template_part('template-parts/header/navigation'); ?>
              </div>
              <div class="col-xl-2 col-lg-2 col-md-4 col-sm-4 col-3 align-self-center d-flex justify-content-end gap-3 p-0">
              <?php if(class_exists('woocommerce')){ ?>
                <div class="search-box">
                  <span><a href="#"><i class='<?php echo esc_attr(get_theme_mod('reseller_store_search_open_icon','fas fa-search')); ?>'></i></a></span>
                </div>
              <div class="serach_outer" style="display:none;">
                  <div class="closepop"><a href="#maincontent"><i class="<?php echo esc_attr(get_theme_mod('reseller_store_search_close_icon','fa-solid fa-xmark')); ?>"></i></a></div>
                    <div class="serach_inner">
                      <?php get_product_search_form(); ?>
                    </div>
                  <?php }?>
              </div>
                <!-- wishlist -->
                <span class="cart_no">
                  <div class="wishlist">
                    <?php if(class_exists('woocommerce')){ ?>
                      <?php if(defined('YITH_WCWL')){ ?>
                        <a class="wishlist_view" href="<?php echo YITH_WCWL()->get_wishlist_url(); ?>" title="<?php esc_attr_e('Wishlist','reseller-store'); ?>"><i class="<?php echo esc_attr(get_theme_mod('reseller_store_heart_icon','far fa-heart')); ?> me-2"></i>
                        </a>
                      <?php }?>
                    <?php }?>
                  </div>
                </span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>