<?php
/**
 * The template part for Top Header
 *
 * @package VW Wholesaler 
 * @subpackage vw-wholesaler
 * @since vw-wholesaler 1.0
 */
?>

<div class="main-header <?php if( get_theme_mod( 'vw_wholesaler_sticky_header', false) == 1 || get_theme_mod( 'vw_wholesaler_stickyheader_hide_show', false) == 1) { ?> header-sticky"<?php } else { ?>close-sticky <?php } ?>">   
    <div class="topbar">
      <?php if (get_theme_mod('vw_wholesaler_hide_show_topbar_section', true) == 1 || get_theme_mod( 'vw_wholesaler_resp_topbar_hide_show', true) == 1) {  ?>
        <div class="container">
          <div class="row">
            <div class="d-flex  py-2 justify-content-center">
              <?php if(get_theme_mod('vw_wholesaler_topbar_text') != '') {?>
                <i class="<?php echo esc_attr(get_theme_mod('vw_wholesaler_topbar_icon','fa-solid fa-bullhorn')); ?>"></i><p class="topbar-text mb-0 text-capitalize text-center"><?php echo esc_html(get_theme_mod('vw_wholesaler_topbar_text')) ?></p>
              <?php }?>  
            </div>
          </div>
        </div>
      <?php }?>  
    </div>   
    <div class="menu-header py-3">
      <div class="container">
        <div class="row">
          <div class="col-xxl-3 col-xl-3 col-lg-3 col-md-3 col-sm-12 col-12 align-self-center logo-img-sec">
            <div class="logo text-start pb-0 pb-md-0">
              <?php if ( has_custom_logo() ) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
              <?php endif; ?>
              <?php $vw_wholesaler_blog_info = get_bloginfo( 'name' ); ?>
                <?php if ( ! empty( $vw_wholesaler_blog_info ) ) : ?>
                  <?php if ( is_front_page() && is_home() ) : ?>
                    <?php if( get_theme_mod('vw_wholesaler_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('vw_wholesaler_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
                  $vw_wholesaler_description = get_bloginfo( 'description', 'display' );
                  if ( $vw_wholesaler_description || is_customize_preview() ) :
                ?>
                <?php if( get_theme_mod('vw_wholesaler_tagline_hide_show',false) == 1){ ?>
                  <p class="site-description mb-0">
                    <?php echo esc_html($vw_wholesaler_description); ?>
                  </p>
                <?php } ?>
              <?php endif; ?>
            </div>
          </div>
          <div class="col-xxl-7 col-xl-7 col-lg-6 col-md-3 col-sm-12 col-12 align-self-center">
            <?php get_template_part('template-parts/header/navigation'); ?>
          </div>
          <div class="col-xxl-2 col-xl-2 col-lg-3 col-md-6 col-sm-12 col-12 align-items-center d-flex gap-3 topbar-search">
            <?php if( get_theme_mod( 'vw_wholesaler_header_search',true) == 1) { ?>
              <?php get_search_form(); ?>
            <?php }?>
            <?php if(class_exists('woocommerce')){ ?>
              <?php if ( is_user_logged_in() ) { ?>
                <a class="myaccount-icon" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vw_wholesaler_topbar_myaccount_icon','fas fa-user')); ?>"></i></a>
              <?php }
              else { ?>
                <a class="myaccount-icon" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','vw-wholesaler'); ?>"><i class="<?php echo esc_attr(get_theme_mod('vw_wholesaler_topbar_myaccount_icon','fas fa-user')); ?>"></i><span class="screen-reader-text"></span></a>
              <?php } ?>
            <?php }?>
          </div>
        </div>
      </div>
    </div>
</div>