<header class="main-header">
	<div class="container">
		<?php if (get_theme_mod('expert_digital_agency_display_topbar', true)) : ?>
            <div class="upper-header-aera py-md-2 py-lg-3 wow fadeInDown" data-wow-delay="0.5s">
                <div class="row">
                    <div class="col-lg-9 col-md-7 col-12 contactbox my-2 my-md-0 align-self-center text-center text-md-start">
                        <?php if ($expert_digital_agency_location = get_theme_mod('expert_digital_agency_topheader_location','121 King Street, Melbourne, Australia')) : ?>
                            <p class="mb-0 location-text">
                                <i class="fas fa-map-marker-alt pe-2"></i>
                                <?php echo esc_html(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_location)); ?>
                            </p>
                        <?php endif; ?>
                    </div>
                    <div class="col-lg-3 col-md-5 col-12 contactbox align-self-center text-center text-md-end mb-md-0 mb-3">
                        <?php if ($expert_digital_agency_phone = get_theme_mod('expert_digital_agency_call','+00 123 456 7890')) : ?>
                            <span class="call">
                                <a class="phn py-md-2" href="tel:<?php echo esc_url($expert_digital_agency_phone); ?>">
                                    <i class="fas fa-phone-alt me-2"></i><?php echo esc_html($expert_digital_agency_phone); ?>
                                </a>
                            </span>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        <?php endif; ?>

		<div class="middle-header-aera py-lg-2 py-md-1 py-2 px-3 wow fadeInUp" data-wow-delay="0.5s">
			<div class="row">
				<div class="col-lg-6 col-md-3 col-12 text-md-start text-center align-self-center mb-lg-0 mb-3">
				    <div class="logo">
						<?php 
						if (has_custom_logo()) {
							the_custom_logo();
						} else {
							// Check if both title and tagline settings are disabled
							$expert_digital_agency_tagline_enabled = get_theme_mod('expert_digital_agency_tagline_setting', false);
							$expert_digital_agency_title_enabled = get_theme_mod('expert_digital_agency_site_title_setting', false);

							if (!$expert_digital_agency_tagline_enabled && !$expert_digital_agency_title_enabled) {
								// Display the default logo
								$expert_digital_agency_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($expert_digital_agency_default_logo_url) . '" alt="' . esc_attr(get_bloginfo('name')) . '">';
								echo '</a>';
							}

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

							<?php
							// Display site title if the setting is enabled
							if ($expert_digital_agency_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="col-lg-3 col-md-4 col-12 email-col text-md-start text-center align-self-center mb-lg-0 mb-3">
				    <?php
				    $expert_digital_agency_topheader_email_text = get_theme_mod('expert_digital_agency_topheader_email_text', 'EMAIL');
				    $expert_digital_agency_topheader_email = get_theme_mod('expert_digital_agency_topheader_email', 'xyz123@example.com');
				    ?>
				    <?php if (!empty($expert_digital_agency_topheader_email_text) || !empty($expert_digital_agency_topheader_email)) : ?>
				        <div class="row email">
				            <div class="col-lg-3 col-md-3 col-3 align-self-center text-md-end">
				                <i class="fas fa-envelope-open-text pe-md-2 pe-lg-0"></i>
				            </div>
				            <div class="col-lg-9 col-md-9 col-9 align-self-center text-start px-md-0">
				                <p class="mb-0 offer-text text-uppercase">
				                    <?php echo esc_html(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_topheader_email_text)); ?>
				                </p>
				                <p class="mb-0 mail-field">
				                    <a href="mailto:<?php echo esc_attr(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_topheader_email)); ?>">
				                        <?php echo esc_html(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_topheader_email)); ?>
				                    </a>
				                </p>
				            </div>
				        </div>
				    <?php endif; ?>
				</div>
				<div class="col-lg-3 col-md-5 col-12 text-md-end text-center align-self-center d-md-flex mb-lg-0 mb-3 justify-content-md-end">
				    <span class="header-btn text-center pe-lg-5 pe-md-2">
				        <?php 
				        $expert_digital_agency_header_btn_text = get_theme_mod('expert_digital_agency_header_btn_text', 'REQUEST A FREE QUOTE');
				        $expert_digital_agency_header_btn_link = get_theme_mod('expert_digital_agency_header_btn_link', '#');

				        if (!empty($expert_digital_agency_header_btn_text) && !empty($expert_digital_agency_header_btn_link)) { ?>
				            <a href="<?php echo esc_url(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_header_btn_link)); ?>" class="offer-text">
				                <?php echo esc_html(apply_filters('expert_digital_agency_topheader', $expert_digital_agency_header_btn_text)); ?>
				            </a>
				        <?php } ?>
				    </span>
				    <span class="search-bar text-md-end">
				        <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', 'expert-digital-agency'); ?></button>
		        </div> 
			</div>
		</div>
		<div class="<?php if( get_theme_mod( 'expert_digital_agency_sticky_header', '0')) { ?>sticky-header<?php } else { ?>close-sticky<?php } ?>">
			<div class="row menu-main m-lg-0 my-2">
				<div class="col-lg-8 col-md-6 col-3 align-self-center menu-col px-lg-0">
					<div class="menubox">
						<!-- Main menu -->
						<div class="navbar-menubar responsive-menu navigation_header">
							<div class="toggle-nav mobile-menu">
								<button onclick="expert_digital_agency_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', 'expert-digital-agency' ); ?>">

									<?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="expert_digital_agency_closeNav()">
										<i class="fa fa-times"></i> <!-- Close icon for the menu -->
									</a>
								</nav>
							</div>
						</div>
					</div>
				</div>

				<div class="col-lg-4 col-md-6 col-9 social-col align-self-center px-lg-0">
					<div class="text-lg-end text-md-center text-center align-self-center social-area mb-md-0 ps-lg-2">
						<?php
							$expert_digital_agency_social_media_facebook = get_theme_mod('expert_digital_agency_social_media_facebook','#');
							$expert_digital_agency_social_media_twitter = get_theme_mod('expert_digital_agency_social_media_twitter','#');
							$expert_digital_agency_social_media_instagram = get_theme_mod('expert_digital_agency_social_media_instagram','#');
							$expert_digital_agency_social_media_linkedin = get_theme_mod('expert_digital_agency_social_media_linkedin','#');
							$expert_digital_agency_social_media_pinterest = get_theme_mod('expert_digital_agency_social_media_pinterest','#');
							$expert_digital_agency_social_media_youtube = get_theme_mod('expert_digital_agency_social_media_youtube','#');
						?>
						<?php if( $expert_digital_agency_social_media_facebook != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_facebook)); ?>"><i class="fab fa-facebook-f"></i></a>
						<?php }?>
						<?php if( $expert_digital_agency_social_media_twitter != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_twitter)); ?>"><i class="fab fa-twitter"></i></a>
						<?php }?>
						<?php if( $expert_digital_agency_social_media_instagram != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_instagram)); ?>"><i class="fab fa-instagram"></i></a>
						<?php }?>
						<?php if( $expert_digital_agency_social_media_linkedin != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_linkedin)); ?>"><i class="fab fa-linkedin"></i></a>
						<?php }?>
						<?php if( $expert_digital_agency_social_media_pinterest != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_pinterest)); ?>"><i class="fab fa-pinterest-p"></i></a>
						<?php }?>
						<?php if( $expert_digital_agency_social_media_youtube != ''){?>
							<a href="<?php echo esc_url( apply_filters('expert_digital_agency_topheader', $expert_digital_agency_social_media_youtube)); ?>"><i class="fab fa-youtube"></i></a>
						<?php }?>
					</div>
				</div>
			</div>
		</div>
	</div>

</header>