<!--Top Header Start-->
<?php if(of_get_option('hide_header') != true): ; ?>
<div class="top-header  d-none d-sm-block d-lg-block d-md-block">
	<!-- <div class="container-fluid"> -->
		<div class="header-content">
			<div class="row">
				<!-- left side -->
				<div class="float-start info-ebid col-sm-6 col-md-7 col-lg-6 col-xs-6">
					<ul>
						<li><a href="<?php echo esc_url( of_get_option('top_header_one_link') ); ?>"><i class="<?php echo 'fa '.of_get_option('top_header_item_one_icon') ?>"></i><span><?php echo of_get_option('top_header_one_text'); ?></span></a></li>
						<li><a href="<?php echo esc_url( of_get_option('top_header_two_link') ); ?>"><i class="<?php echo 'fa '.of_get_option('top_header_two_item_icon') ?>"></i><span><?php echo of_get_option('top_header_two_text'); ?></span></a></li>
					</ul>
				</div>
				<!-- left side END -->
				<!-- right side -->
				<div class="float-end info-ebid col-sm-6 col-md-5 col-lg-6 col-xs-6">
					<ul class="float-end">
						<li><a href="<?php echo esc_url( of_get_option('top_header_three_link') ); ?>"><i class="<?php echo 'fa '. of_get_option('top_header_three_item'); ?>"></i><span><?php echo of_get_option('top_header_three_text'); ?></span> </a></li>

						<li><a href="<?php echo esc_url( of_get_option('top_header_four_link') ); ?>"><i class="<?php echo 'fa '.of_get_option('top_header_four_item') ?>"></i><span><?php echo of_get_option('top_header_four_text'); ?></span></a></li>

					</ul>

				</div>
				<!-- right side END-->

			</div>

		</div> <!-- .row -->

	<!-- </div> --> <!-- .container-fluid --> 
	
</div>
<?php endif;?>

<!---top Header End--->

<!-- secondary header  start-->
<div id="header-default">

	<!-- button visible on small devices -->

	<div class="header-mid-section d-flex align-items-center ">  
		<!--Logo Portion-->
		<div class="col-md-3 col-sm-6 col-lg-2 col-xs-12 logo-layout col-6 mobile-none">

		 	<div id="logo-one">

				<?php 
					if ( of_get_option('site_logo') == '') {
						?>
							<h1 class="site-title site-title-left"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
						<?php 
					} 
					else{
						?> 
							<a href="<?php echo esc_url(get_home_url()); ?>"> <img src="<?php echo esc_url(of_get_option('site_logo')); ?>" alt="" ></a>
						<?php
				 	}
				?>

			</div>
		
		</div>
		<!-- .Logo--> 

		<!-- category button container -->
		<div class="col-md-3 col-sm-6 col-lg-2 col-xs-12 logo-layout col-6 mobile-none">

			<div class="product-search-category text-center d-flex justify-content-center">

				<!-- <div class="dropdown"> -->
				  <button class="button-primary" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-th mx-1" aria-hidden="true"></i><?php esc_html_e('Categories', 'menda'); ?></button>
				  <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
				  	<?php
				  		$args = array(
					         'taxonomy'     => 'product_cat',
					         'orderby'      => 'name',
					         'show_count'   => 0,
					         'pad_counts'   => 0,
					         'hierarchical' => 1,
					         'title_li'     => '',
					         'hide_empty'   => 0
					  	);
				
						$all_categories = get_categories( $args );

						if( is_array( $all_categories ) ){
							foreach( $all_categories as $category ):

								echo sprintf('<li><a class="dropdown-item" href="%s">%s</a></li>', esc_url( home_url().'/product-category/'.$category->slug.'/' ) , esc_attr( $category->name ) );

							endforeach; 
						}
				  	?>
				  </ul>
				<!-- </div> -->

			</div>

		</div>
		<!-- category button container END-->

		<!-- search  form container-->
		<div class="col-md-3 col-sm-6 col-lg-6 col-xs-12 lay-serch mobile-none">

			<div class="product-search-custome">

				<form method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/'  ) ); ?>">
					<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'menda' ); ?></label>
					<input name="s" type="search" class="search-field" placeholder="<?php esc_attr_e( 'What do you want to search&hellip;', 'menda', ); ?>" value="<?php echo get_search_query(); ?>"  />

					<input type="hidden" name="post_type" value="product" />

				</form>   

			</div>	

		</div>
		<!-- search  form container END-->


		<!--Add to cart Portion-->
		<div class="col-md-3 col-sm-12 col-lg-2 col-xs-12 col-10 mobile-none">
			
			<div class="header-right-content text-center d-flex justify-content-center">


				<?php 

				if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){ 
					?>
						<ul class="ebid-woocommerce-minicart">
							<li class="ebid-cart-icon">
								<a  href="<?php echo esc_url(wc_get_cart_url()); ?>">
									<button type="button" class="button"><i class="fa <?php echo of_get_option( 'mid_header_one_item' ); ?>" aria-hidden="true"></i></button>
						 		</a>

						 		<div class="widget woocommerce widget_shopping_cart">
									<div class="widget_shopping_cart_content"><?php woocommerce_mini_cart(); ?></div>
								</div>
								
							</li>
						</ul>

						<?php
							if ( !is_user_logged_in()) {
								?>
							<a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>"><button type="button" class="button btn-cart-login"><?php esc_html_e( 'Login' , 'menda'); ?></button></a>
								<?php
							}
							else{
								?>
							<a href="<?php echo esc_url(wc_logout_url()); ?>"><button type="button" class="button btn-cart-login"><?php esc_html_e( 'Logout' , 'menda'); ?></button></a>
								<?php
							}
						?>  

					<?php 
				} 
				?>

			</div>

		</div> 
		<!--Add to cart Portion end -->
 
	</div>
    <div class="clearfix"></div>	
	<header id="masthead" class="site-header ">
		<div class="site-header-main">
			<div id="header-menu-one" class="header-menu-one">
			 <div class="">
		  	<?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
			<button id="menu-toggle" class="menu-toggle cd-secondary-nav-trigger">
				<span class="sr-only"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
		        <div class="clearfix"></div>
				<div id="site-header-menu" class="site-header-menu">
					<?php if ( has_nav_menu( 'primary' ) ) : ?>
						<div id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'menda' ); ?>">
							<?php
								wp_nav_menu( array(
									'theme_location' => 'primary',
									'menu_class'     => 'primary-menu',
								) );
							?>
						</div><!-- .main-navigation -->
						<div class="close-menu text-center">X</div>
					<?php endif; ?>
				</div><!-- .site-header-menu -->
			<?php endif; ?>
		
			</div>
			</div> <!-- .col-md-612 -->
		</div><!-- .site-header-main -->

	</header><!-- .site-header -->
	<!-- nav menu END -->
 </div>
 
<!--- mobile header start here  ---> 

<div class="container-fluid mobile-header mobile-block">
		<div class="col-6">
	    	<div class="logo-layout">
				<div id="logo-one">
					<?php 
						if ( of_get_option('site_logo') == '') {
							?>
								<h1 class="site-title site-title-left"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
							<?php 
						} 
						else{
							?> 
								<a href="<?php echo esc_url(get_home_url()); ?>"> <img src="<?php echo esc_url(of_get_option('site_logo')); ?>" alt="" ></a>
							<?php
						}
					?>

				</div>
		    </div>
		</div>
	<!--- mobile search here --->	
	 	<div class="col-12 lay-serch">
			<div class="product-search-custome">
				<form method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/'  ) ); ?>">
					<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'menda' ); ?></label>
					<input name="s" type="search" class="search-field" placeholder="<?php esc_attr_e( 'What do you want to search&hellip;', 'menda' ); ?>" value="<?php echo get_search_query(); ?>"  />

					<input type="hidden" name="post_type" value="product" />

				</form>   
			</div>	
		 </div>
		<div class="clearfix"></div>
	<!--- mobile search here --->	
		
		<div class="row mobile-header-bottom">
    	<div class="col-6">
			<div class="header-right-content  d-flex">


				<?php 

				if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){ 
					?>
						<a  href="<?php echo esc_url(wc_get_cart_url()); ?>" >
							<button type="button" class="button"><i class="fa <?php echo of_get_option( 'mid_header_one_item' ); ?>" aria-hidden="true"></i></button>
				 		</a>

					<?php 

					if ( !is_user_logged_in()) {
							?>
						<a href="<?php echo esc_url(get_permalink( get_option('woocommerce_myaccount_page_id') )); ?>"><button type="button" class="button btn-cart-login"><?php esc_html_e( 'Login' , 'menda'); ?></button></a>
							<?php
						}
						else{
							?>
						<a href="<?php echo esc_url(wc_logout_url()); ?>"><button type="button" class="button btn-cart-login"><?php esc_html_e( 'Logout' , 'menda'); ?></button></a>
							<?php
						}
				} 
				?>


			</div>
		</div>
	    <div class="logo-layout col-6">
			<div class="product-search-category text-end">
					<!-- <div class="dropdown"> -->
					  <button class="button-primary" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-th" aria-hidden="true"></i>Categories</button>
					  <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
						<?php 
							if( is_array( $all_categories ) ){
								foreach( $all_categories as $category ):

									echo sprintf('<li><a class="dropdown-item" href="%s">%s</a></li>', esc_url( home_url().'/product-category/'.$category->slug.'/' ) , esc_attr( $category->name ) );

								endforeach; 
							}
						?>
					  </ul>
					<!-- </div> -->
			</div>
			</div>
		</div>
</div>
<!--- mobile header end here  ---> 
