<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Classic Woocommerce
 */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>

<?php if ( function_exists( 'wp_body_open' ) ) {
  wp_body_open();
} else {
  do_action( 'wp_body_open' );
} ?>

<?php if ( get_theme_mod('classic_ecommerce_preloader',false) != "") { ?>
<div id="preloader">
  <div id="status">&nbsp;</div>
</div>
<?php }?>

<a class="screen-reader-text skip-link" href="#content"><?php esc_html_e( 'Skip to content', 'classic-woocommerce' ); ?></a>

<div id="pageholder" <?php if( get_theme_mod( 'classic_ecommerce_box_layout' ) ) { echo 'class="boxlayout"'; } ?>>

<header id="header">
  <div class="container">
    <div class="row justify-content-between align-items-center py-3">
      <div class="col-lg-3 col-md-4 col-sm-12">
        <div class="logo">
          <?php if (get_theme_mod('classic_ecommerce_logo_enable', true)) { ?>
            <?php classic_ecommerce_the_custom_logo(); ?>
          <?php } ?>
          <div class="site-branding-text">
            <?php if ( get_theme_mod('classic_ecommerce_title_enable',false) != "") { ?>
              <?php if ( is_front_page() && is_home() ) : ?>
                <h1 class="site-title"><a class="text-decoration-none sub-primary-color fs-3" href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></h1>
              <?php else : ?>
                  <p class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></p>
                <?php endif; ?>
              <?php } ?>
            <?php $classic_ecommerce_description = get_bloginfo( 'description', 'display' );
            if ( $classic_ecommerce_description || is_customize_preview() ) : ?>
              <?php if ( get_theme_mod('classic_ecommerce_tagline_enable',false) != "") { ?>
              <span class="site-description primary-color"><?php echo esc_html( $classic_ecommerce_description ); ?></span>
              <?php } ?>
            <?php endif; ?>
          </div>
        </div>
      </div>
      <div class="col-lg-9 col-md-8 col-sm-12">
        <div class="search-contact row align-items-center justify-content-between ">
          <div class="col-lg-6 col-md-12 col-sm-12 col-12 mb-md-2 mb-2 mb-lg-0 mb-sm-0">
            <?php if(class_exists('woocommerce')){ ?>
              <?php get_product_search_form(); ?>
            <?php }?>
          </div>
          <div class="contact col-lg-6 col-md-12 col-sm-12 col-12 position-relative">
              <div class="row d-flex justify-content-between">
                  <div class="col-lg-6 col-md-6 col-sm-12 col-12 mb-lg-0 mb-md-0 mb-sm-0 mb-2">
                    <?php if ( get_theme_mod('classic_woocommerce_phoneno') != "") { ?> 
                      <a href="tel:<?php echo esc_html(get_theme_mod('classic_woocommerce_phoneno','classic-woocommerce')); ?>" class="w-100 d-flex align-items-center text-decoration-none">
                        <i class="fas fa-phone pe-2"></i>
                      <p class="contact-string fw-normal mb-0"><?php echo esc_html(get_theme_mod('classic_woocommerce_phoneno','classic-woocommerce')); ?></p>
                      </a>
                    <?php } ?>
                  </div>
                  <div class="col-lg-6 col-md-6 col-sm-12 col-12">
                    <?php if ( get_theme_mod('classic_woocommerce_email') != "") { ?> 
                      <a href="mailto:<?php echo esc_html(get_theme_mod('classic_woocommerce_email','info@dummymail.com','classic-woocommerce')); ?>" class="w-100 d-flex align-items-center text-decoration-none">
                      <i class="fas fa-envelope pe-2"></i>
                      <p class="contact-string fw-normal mb-0"><?php echo esc_html(get_theme_mod('classic_woocommerce_email','classic-woocommerce')); ?></p>
                      </a>
                    <?php } ?>
                  </div>
              </div>
          </div>
        </div>
      </div>
    </div>
    
    <div class="menu-box row">
      <div class="col-lg-12">
          <div class="w-100 menu-cart d-flex justify-content-between align-items-center <?php echo esc_attr(classic_ecommerce_sticky_menu()); ?>">
            <div class="w-100 d-flex align-items-center">
              <div class="toggle-nav">
                <button role="tab"><?php esc_html_e('MENU','classic-woocommerce'); ?></button>
              </div>
              <div id="mySidenav" class="nav sidenav">
                <nav id="site-navigation" class="main-nav" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu','classic-woocommerce' ); ?>">
                  <?php 
                    wp_nav_menu( array(
                      'theme_location' => 'primary',
                      'container_class' => 'main-menu' ,
                      'menu_class' => 'site-menu p-0 mb-0 list-group list-group-horizontal',
                      'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
                      'fallback_cb' => 'wp_page_menu',
                    ) );
                   ?>
                  <a href="javascript:void(0)" class="close-button"><?php esc_html_e('CLOSE','classic-woocommerce'); ?></a>
                </nav>
              </div>
            </div>
            <?php if(class_exists('woocommerce')){ ?>
              <div class="cart d-flex align-items-center">
              <a class="position-relative d-flex align-items-center justify-content-center" href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" title="<?php esc_attr_e( 'shopping cart','classic-woocommerce' ); ?>">
                <span class="position-absolute cart-count"> <?php echo esc_html(wp_kses_data( WC()->cart->get_cart_contents_count()));?></span>
                <svg class="cart-icon icon-l" width="50" height="50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>
              </a>
              </div>
            <?php }?>
        </div>
      </div>
    </div>
  </div>
</header>
