<?php if ( get_header_image() ) : ?>
	<a href="<?php echo esc_url( home_url( '/' ) ); ?>" id="custom-header" rel="home">
		<img src="<?php esc_url(header_image()); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr(get_bloginfo( 'title' )); ?>">
	</a>	
<?php endif;  ?>

<!-- Header Area -->

	<?php 
		// header
		$topheadefblink = esc_attr(get_theme_mod('tophead_fblink','#'));
		$topheadeinstalink = esc_attr(get_theme_mod('tophead_instalink','#'));
		$topheadeyoutubelink = esc_attr(get_theme_mod('tophead_youtubelink','#'));
		$tophead_tiktoklink = esc_attr(get_theme_mod('tophead_tiktoklink','#'));

		$topheader_btntext = esc_attr(get_theme_mod('topheader_btntext','ORDER ONLINE'));
		$topheader_btntextlink = esc_attr(get_theme_mod('topheader_btntextlink','#'));
		$stickyheader = esc_attr(freshfoodrestaurant_sticky_menu());
		
	?>

<div class="main">
    <header class="main-header site-header <?php echo esc_attr(freshfoodrestaurant_sticky_menu()); ?>">
		<div class="header-section">
			<div class="h-sectionbx">
				<div class="tophead">
					<div class="container">
						<div class="socialicon">
							<?php if ($topheadefblink) { ?>
								<a href="<?php echo apply_filters('freshfoodrestaurant_header', $tophead_fblink); ?>">
									<i class="fa-brands fa-facebook-f"></i>
								</a>
							<?php } ?>
							<?php if ($topheadeinstalink) { ?>
								<a href="<?php echo apply_filters('freshfoodrestaurant_header', $tophead_instalink); ?>">
									<i class="fa-brands fa-instagram"></i>
								</a>
							<?php } ?>
							<?php if ($topheadeyoutubelink) { ?>
								<a href="<?php echo apply_filters('freshfoodrestaurant_header', $tophead_youtubelink); ?>">
									<i class="fa-brands fa-youtube"></i>
								</a>
							<?php } ?>
							<?php if ($tophead_tiktoklink) { ?>
								<a href="<?php echo apply_filters('freshfoodrestaurant_header', $tophead_tiktoklink); ?>">
									<i class="fa-brands fa-tiktok"></i>
								</a>
							<?php } ?>
						</div>
					</div>
				</div>
				<div class="container pd-0">
					<div class="btmmhead ">
						<div class=" row mr-0">
							<div class="lbxot ">
								<div class="logobx">
									<div class="site-logo">
										<?php
										if(has_custom_logo())
											{	
												the_custom_logo();
											}
											else { 
											?>
											<a class="site-title" href="<?php echo esc_url( home_url( '/' ) ); ?>">
												
												<?php 
													echo esc_html(bloginfo('name'));
												?>
											</a>	
											<div class="box-info">
												<?php
													$freshfoodrestaurant_site_desc = get_bloginfo( 'description');
													if ($freshfoodrestaurant_site_desc) : ?>
														<p class="site-description"><?php echo esc_html($freshfoodrestaurant_site_desc); ?></p>
												<?php endif; ?>
											</div>
										<?php 						
											}
										?>
									</div>
								</div>
							</div>
							<div class="m-mbx">
								<div class="bottomhead">
									<div class=" row mr-0">
										<div class="col-lg-8 col-md-3 col-sm-3 col-3 menusbx">
											<div class="menus">
												<nav class="navbar navbar-expand-lg navbaroffcanvase">
												<div class="navbar-menubar">
													<!-- Small Divice Menu-->
													<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-menu"  aria-label="<?php echo esc_attr_e('Toggle navigation','fresh-food-restaurant'); ?>"> 
														<i class="fa fa-bars"></i>
													</button>
													<div class="collapse navbar-collapse navbar-menu">
														<button class="navbar-toggler navbar-toggler-close" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-menu"  aria-label="<?php echo esc_attr_e('Toggle navigation','fresh-food-restaurant'); ?>"> 
															<i class="fa fa-times"></i>
														</button> 
														<?php 
															wp_nav_menu( 
																array(  
																	'theme_location' => 'primary_menu',
																	'container'  => '',
																	'container_id'    => '',
																	'menu_class' => 'navbar-nav main-nav',
																	'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
																	'walker' => new WP_Bootstrap_Navwalker()
																	) 
																);
														?>
													</div>
												</div>
												</nav>
											</div>
										</div>
										<div class="col-lg-4 col-md-9 col-sm-9 col-9 wclit">
											<?php if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { ?>
												<li>
													<a class="acc" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>">
														<i class="fa-regular fa-user"></i>
													</a>
												</li>
												<li>
													<a class="h-cart" href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" >
														<i class="fa-solid fa-bag-shopping"></i>
														<?php 
															
															$count = WC()->cart->cart_contents_count;
															$cart_url = wc_get_cart_url();
															if ( $count > 0 ) {
															?>
																<span><?php echo esc_html( $count ); ?></span>
															<?php 
															}
															else {
																?>
																<span><?php echo esc_html_e('0','fresh-food-restaurant'); ?></span>
																<?php 
															}
															
														?>
													</a>
												</li>
											<?php } ?>

											<?php if ($topheader_btntext) { ?>
												<div class="hbtn">
													<a class="contactus" href="<?php echo apply_filters('freshfoodrestaurant_header', $topheader_btntextlink); ?>">
														<?php echo apply_filters('freshfoodrestaurant_header', $topheader_btntext); ?>
														<i class="fa-solid fa-angle-down"></i>
													</a> 
												</div>
											<?php } ?>
										</div>
									</div>
									<div class="clearfix"></div>
								</div>
							</div>
							<div class="extbx"> </div>
						</div>
					</div>
				</div>
			</div>
		</div>

    </header>
	<div class="clearfix"></div>

</div>
