<header class="main-header">
    <div class="<?php if( get_theme_mod( 'expert_sports_coach_sticky_header', '0')) { ?>sticky-header<?php } else { ?>close-sticky<?php } ?>">
        <div class="container">
            <div class="middle-header-area py-2">
                <div class="row">
                    <div class="col-lg-3 col-md-4 text-md-start text-center align-self-center">
                        <div class="logo mb-3 mb-md-0">
                            <?php 
                            if (has_custom_logo()) {
                                the_custom_logo();
                            } else {
                                // Check if both title and tagline settings are disabled
                                $expert_sports_coach_tagline_enabled = get_theme_mod('expert_sports_coach_tagline_setting', false);
                                $expert_sports_coach_title_enabled = get_theme_mod('expert_sports_coach_site_title_setting', true);

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

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

                                <?php
                                // Display site title if the setting is enabled
                                if ($expert_sports_coach_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-7 col-md-4 col-6 align-self-center menu-col">
                        <div class="menubox">
                            <div class="navbar-menubar responsive-menu navigation_header">
                                <div class="toggle-nav mobile-menu">
                                    <button onclick="expert_sports_coach_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-sports-coach' ); ?>">

                                        <?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_sports_coach_closeNav()">
                                            <i class="fa fa-times"></i> <!-- Close icon for the menu -->
                                        </a>
                                    </nav>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-4 col-6 text-md-end text-center align-self-center">
                        <span class="header-btn text-center text-md-end">
                            <?php
                            $expert_sports_coach_header_btn_text = get_theme_mod('expert_sports_coach_header_btn_text', 'Sign Up');
                            $expert_sports_coach_header_btn_link = get_theme_mod('expert_sports_coach_header_btn_link', '#');

                            if (!empty($expert_sports_coach_header_btn_text) && !empty($expert_sports_coach_header_btn_link)) { ?>
                                <a target="_blank" href="<?php echo esc_url($expert_sports_coach_header_btn_link); ?>" class="offer-text">
                                    <?php echo esc_html($expert_sports_coach_header_btn_text); ?>
                                </a>
                            <?php } ?>
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>