<?php
/**
 * Displays main header
 *
 * @package VR Games
 */
?>

<div class="main-header text-center text-md-start">
    <div class="container">
    	<div class="row">
    		<div class="col-xl-3 col-lg-3 col-md-5 col-sm-5 logo-box align-self-center">
                <div class="navbar-brand ">
                    <?php if ( has_custom_logo() ) : ?>
                        <div class="site-logo"><?php the_custom_logo(); ?></div>
                    <?php endif; ?>
                    <?php $vr_games_blog_info = get_bloginfo( 'name' ); ?>
                        <?php if ( ! empty( $vr_games_blog_info ) ) : ?>
                            <?php if ( is_front_page() && is_home() ) : ?>
                                <?php if( get_theme_mod('vr_games_logo_title_text',true) != ''){ ?>
                                    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                                <?php } ?>
                            <?php else : ?>
                                <?php if( get_theme_mod('vr_games_logo_title_text',true) != ''){ ?>
                                    <p class="site-title "><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                                <?php } ?>
                            <?php endif; ?>
                        <?php endif; ?>
                        <?php
                            $vr_games_description = get_bloginfo( 'description', 'display' );
                            if ( $vr_games_description || is_customize_preview() ) :
                        ?>
                        <?php if( get_theme_mod('vr_games_theme_description',false) != ''){ ?>
                            <p class="site-description pb-2"><?php echo esc_html($vr_games_description); ?></p>
                        <?php } ?>
                    <?php endif; ?>
                </div>
            </div>
	    	<div class="col-xl-6 col-lg-6 col-md-2 col-sm-2 align-self-center nav-box">
	            <div class="header-box">
	                <?php get_template_part('template-parts/navigation/nav'); ?>
	            </div>
	        </div>
			<div class="col-xl-3 col-lg-3 col-md-5 col-sm-5 meta-box align-self-center text-lg-end">
	            <?php if (get_theme_mod('vr_games_header_search_setting', true) != '') { ?>
                    <span class="head-search">
                        <span class="header-search-wrapper">
                            <span class="search-main">
                                <i class="fa fa-search"></i>
                            </span>
                            <div class="search-form-main clearfix">
                                <form method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
                                    <label>
                                        <input type="search" class="search-field form-control" placeholder="Search for products..." value="<?php echo get_search_query(); ?>" name="s">
                                    </label>
                                    <input type="submit" class="search-submit btn btn-primary mt-3" value="Search">
                                </form>
                            </div>
                        </span>
                    </span>
                <?php } ?>
                <span class="cart_no">
                    <?php if(class_exists('woocommerce')){ ?>
                        <?php global $woocommerce; ?>
                        <a class="cart-customlocation" href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php esc_attr_e( 'shopping cart','vr-games' ); ?>"><i class="fas fa-shopping-bag"></i><span class="cart-value"><?php echo sprintf ( esc_html( '%d', '%d', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?></span></a>
                    <?php }?>
                </span>
            	<?php if(class_exists('woocommerce')){ ?>
                    <span class="user-account ms-3">
                        <?php if ( is_user_logged_in() ) { ?>
                            <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('My Account','vr-games'); ?>"><i class="fas fa-user me-2"></i></a>
                        <?php }
                        else { ?>
                            <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','vr-games'); ?>"><i class="fas fa-sign-in-alt me-2"></i></a>
                        <?php } ?>
                    </span>
                <?php }?>
	        </div>
        </div>
    </div>
</div>
