<header class="main-header wow fadeInDown" data-wow-delay="0.5s">
    <div class="<?php if( get_theme_mod( 'expert_business_advisor_sticky_header', '0')) { ?>sticky-header<?php } else { ?>close-sticky<?php } ?>">
        <div class="middle-header-area py-md-3 py-2">
            <div class="container">
                <div class="row">
                    <!-- Logo Section -->
                    <div class="col-xl-3 col-lg-3 col-md-4 logo-col text-md-start text-center align-self-center">
                        <div class="logo">
                            <?php 
                            if (has_custom_logo()) {
                                the_custom_logo();
                            } else {
                                // Check if both title and tagline settings are disabled
                                $expert_business_advisor_tagline_enabled = get_theme_mod('expert_business_advisor_tagline_setting', false);
                                $expert_business_advisor_title_enabled = get_theme_mod('expert_business_advisor_site_title_setting', true);

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

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

                                <?php
                                // Display site title if the setting is enabled
                                if ($expert_business_advisor_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>
                    
                    <!-- Menu Section -->
                    <div class="col-xl-7 col-lg-6 col-md-4 col-12 menu-col align-self-center">
                        <div class="menubox">
                            <!-- Main menu -->
                            <div class="navbar-menubar responsive-menu navigation_header">
                                <div class="toggle-nav mobile-menu">
                                    <button onclick="expert_business_advisor_openNav()">
                                        <i class="fa-solid 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-business-advisor' ); ?>">

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

                    <!-- Call Section -->
                    <div class="call col-xl-2 col-lg-3 col-md-4 align-self-center mb-2 mb-md-0">
                        <?php 
                        $expert_business_advisor_call_number = get_theme_mod('expert_business_advisor_call','+1800-123-456');

                        if (!empty($expert_business_advisor_call_number)) : ?>
                            <div class="phone-text">
                                <i class="fas fa-phone-volume"></i>
                                <a href="tel:<?php echo esc_attr($expert_business_advisor_call_number); ?>">
                                    <?php echo esc_html($expert_business_advisor_call_number); ?>
                                </a>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>