<header class="main-header">
	<div class="upper-header-aera wow fadeInDown" data-wow-delay="0.5s">
		<div class="container">
			<div class="row">
				<div class="col-lg-4 col-md-12 align-self-center">
					<div class="logo text-center text-lg-start mb-3 mb-lg-0">
						<?php 
                        if (has_custom_logo()) {
                            the_custom_logo();
                        } else {
                            // Check if both title and tagline settings are disabled
                            $led_tv_tagline_enabled = get_theme_mod('led_tv_tagline_setting', false);
                            $led_tv_title_enabled = get_theme_mod('led_tv_site_title_setting', false);

                            if (!$led_tv_tagline_enabled && !$led_tv_title_enabled) {
                                // Display the default logo
                                $led_tv_default_logo_url = get_template_directory_uri() . '/assets/images/logo.png'; // Replace with your default logo path
                                echo '<a href="' . esc_url(home_url('/')) . '">';
                                echo '<img src="' . esc_url($led_tv_default_logo_url) . '" alt="' . esc_attr(get_bloginfo('name')) . '">';
                                echo '</a>';
                            }

                            // Display tagline if the setting is enabled
                            if ($led_tv_tagline_enabled) :
                                $led_tv_site_desc = get_bloginfo('description'); ?>
                                <p class="site-description"><?php echo esc_html($led_tv_site_desc); ?></p>
                            <?php endif; ?>

                            <?php
                            // Display site title if the setting is enabled
                            if ($led_tv_title_enabled) : ?>
                                <p class="site-title">
                                    <a href="<?php echo esc_url(home_url('/')); ?>">
                                        <?php echo esc_html(get_bloginfo('name')); ?>
                                    </a>
                                </p>
                            <?php endif; ?>
                        <?php } ?>
					</div>
				</div>
				<div class="call col-lg-3 col-md-4 align-self-center mb-2 mb-md-0">
			        <?php if( get_theme_mod( 'led_tv_call_text' ) != 'PHONE NO' || get_theme_mod( 'led_tv_call' ) != '+00 123 456 7890') { ?>
			          <div class="row">
			            <div class="col-lg-3 col-md-3 col-4 align-self-center text-end text-md-start"><i class="fas fa-phone"></i></div>
			            <div class="col-lg-9 col-md-9 col-8 align-self-center">
			              <p class="infotext"><?php echo esc_html( get_theme_mod('led_tv_call_text','PHONE NO') ); ?></p>
			              <p class="simplep"><?php echo esc_html( get_theme_mod('led_tv_call','+00 123 456 7890') ); ?></p>
			            </div>
			          </div>
			        <?php } ?>
		      	</div>
		      	<div class="email col-lg-3 col-md-5 align-self-center mb-2 mb-md-0">
			        <?php if( get_theme_mod( 'led_tv_mail_text' ) != 'EMAIL ADDRESS' || get_theme_mod( 'led_tv_mail' ) != '') { ?>
			          <div class="row">
			            <div class="col-lg-3 col-md-3 col-4 align-self-center text-end text-md-start"><i class="fas fa-envelope-open"></i></div>
			            <div class="col-lg-9 col-md-9 col-8 align-self-center">
			              <p class="infotext"><?php echo esc_html( get_theme_mod('led_tv_mail_text','EMAIL ADDRESS')); ?></p>
			              <p class="simplep"><?php echo esc_html( get_theme_mod('led_tv_mail','xyz123@example.com') ); ?></p>
			            </div>
			          </div>
			        <?php } ?>
		      	</div>
		      	<div class="basket col-lg-2 col-md-3 align-self-center mb-2 mb-md-0">
			        <?php if(get_theme_mod('led_tv_cart_option',true) != ''){ ?>
			          	<?php if(class_exists('woocommerce')){ ?>
				            <div class="row">
				              	<div class="col-lg-4 col-md-4 col-4 align-self-center text-end text-md-start"><i class="fas fa-shopping-basket"></i></div>
				              	<div class="col-lg-8 col-md-8 col-8 align-self-center">
				                	<p class="cart_no infotext">
				                  	<?php global $woocommerce; ?>
				                  	<a href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" title="<?php esc_attr_e( 'shopping cart','led-tv' ); ?>"><?php esc_html_e('CART','led-tv'); ?></a>
				                	</p>
				                	<p class="cart-value simplep"><?php echo esc_sql( $woocommerce->cart->get_cart_total() ); ?></p>
				              	</div>
				            </div>
			          	<?php } ?>
			        <?php } ?>
		      	</div>
			</div>
		</div>
	</div>

	<div class="<?php if( get_theme_mod( 'led_tv_sticky_header', '0')) { ?>sticky-header<?php } else { ?>close-sticky<?php } ?>">
		<div class="middle-header-aera">
			<div class="container">
				<div class="row">
					<div class="col-lg-8 col-md-5 col-12 align-self-center">
						<!-- Main menu -->
                        <div class="navbar-menubar responsive-menu navigation_header">
                            <div class="toggle-nav mobile-menu">
                                <button onclick="led_tv_openNav()">
                                    <i class="fa fa-bars"></i> <!-- Initial hamburger icon -->
                                </button>
                            </div>
                            <div id="mySidenav" class="nav sidenav">
                                <nav id="site-navigation" class="main-navigation navbar navbar-expand-xl" aria-label="<?php esc_attr_e( 'Top Menu', 'led-tv' ); ?>">

                                    <?php 
                                        wp_nav_menu(
                                            array(
                                                'theme_location' => 'primary',
                                                'container_class' => 'main-menu clearfix',
                                                'menu_class' => 'clearfix menu',
                                                '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="closebtn mobile-menu" onclick="led_tv_closeNav()">
                                        <i class="fa fa-times"></i> <!-- Close icon for the menu -->
                                    </a>
                                </nav>
                            </div>
                        </div>
					</div>
					<div class="col-lg-3 col-md-6 col-12 text-md-start text-center align-self-center social-area my-md-0 my-3">
						<?php
							$led_tv_social_media_facebook = get_theme_mod('led_tv_social_media_facebook','#');
							$led_tv_social_media_twitter = get_theme_mod('led_tv_social_media_twitter','#');
							$led_tv_social_media_instagram = get_theme_mod('led_tv_social_media_instagram','#');
							$led_tv_social_media_linkedin = get_theme_mod('led_tv_social_media_linkedin','#');
							$led_tv_social_media_youtube = get_theme_mod('led_tv_social_media_youtube','#');
						?>
						<?php if( $led_tv_social_media_facebook != ''){?>
							<a href="<?php echo esc_url( apply_filters('led_tv_topheader', $led_tv_social_media_facebook)); ?>"><i class="fab fa-facebook-f pe-4"></i></a>
						<?php }?>
						<?php if( $led_tv_social_media_twitter != ''){?>
							<a href="<?php echo esc_url( apply_filters('led_tv_topheader', $led_tv_social_media_twitter)); ?>"><i class="fab fa-twitter pe-4"></i></a>
						<?php }?>
						<?php if( $led_tv_social_media_instagram != ''){?>
							<a href="<?php echo esc_url( apply_filters('led_tv_topheader', $led_tv_social_media_instagram)); ?>"><i class="fab fa-instagram pe-4"></i></a>
						<?php }?>
						<?php if( $led_tv_social_media_linkedin != ''){?>
							<a href="<?php echo esc_url( apply_filters('led_tv_topheader', $led_tv_social_media_linkedin)); ?>"><i class="fab fa-linkedin-in pe-4"></i></a>
						<?php }?>
						<?php if( $led_tv_social_media_youtube != ''){?>
							<a href="<?php echo esc_url( apply_filters('led_tv_topheader', $led_tv_social_media_youtube)); ?>"><i class="fab fa-youtube pe-4"></i></a>
						<?php }?>
					</div>
					<div class="col-lg-1 col-md-1 col-12 text-lg-end text-center align-self-center">
						<span class="search-bar text-center me-3">
			              <button type="button" class="open-search"><i class="fas fa-search"></i></button>
			          	</span>
					</div>
					
					<div class="search-outer">
						<div class="inner_searchbox w-100 h-100">
							<?php get_search_form(); ?>
						</div>
						<button type="button" class="search-close"><?php esc_html_e('CLOSE', 'led-tv'); ?></button>
			        </div>
				</div>
			</div>
		</div>
	</div>
</header>