<header class="main-header">
    <?php if (get_theme_mod('vegan_cafe_restaurant_top_header', true)) : ?>
        <div class="top-head p-2 wow fadeInDown" data-wow-delay="0.5s">
            <?php 
            $vegan_cafe_restaurant_topbar_text = get_theme_mod('vegan_cafe_restaurant_topbar_text', 'Learn about Guest Favourites, the most loved homes on Explorer.');
            if (!empty($vegan_cafe_restaurant_topbar_text)) { ?>
                <p class="text-center topbar-top-text"><?php echo esc_html(sanitize_text_field($vegan_cafe_restaurant_topbar_text)); ?></p>
            <?php } ?>
        </div>
    <?php endif; ?>
    <div class="headerbox py-2 <?php if( get_theme_mod( 'vegan_cafe_restaurant_sticky_header', '0')) { ?>sticky-header<?php } else { ?>close-sticky<?php } ?>">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-4 align-self-center">
                    <div class="logo text-center text-md-start mb-md-1 mb-3">
                        <?php 
                        if (has_custom_logo()) {
                            the_custom_logo();
                        } else {
                            // Check if both title and tagline settings are disabled
                            $vegan_cafe_restaurant_tagline_enabled = get_theme_mod('vegan_cafe_restaurant_tagline_setting', false);
                            $vegan_cafe_restaurant_title_enabled = get_theme_mod('vegan_cafe_restaurant_site_title_setting', true);

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

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

                            <?php
                            // Display site title if the setting is enabled
                            if ($vegan_cafe_restaurant_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-9 col-md-8 align-self-center">
                    <div class="menu-main-col">
                        <div class="main-navhead">
                            <div class="menubox">
                                <div class="menu-content">
                                    <!-- Main menu -->
                                    <div class="navbar-menubar responsive-menu navigation_header">
                                        <div class="toggle-nav mobile-menu">
                                            <button onclick="vegan_cafe_restaurant_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', 'vegan-cafe-restaurant' ); ?>">
                                                <?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="vegan_cafe_restaurant_closeNav()">
                                                    <i class="fa-solid fa-times"></i> <!-- Close icon for the menu -->
                                                </a>
                                            </nav>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="offcanvas-div d-flex align-items-center align-self-center ms-4">
                            <?php if(get_theme_mod('vegan_cafe_restaurant_header_sidebar',true)){ ?>
                              <button type="button" data-bs-toggle="offcanvas" data-bs-target="#demo">
                                <i class="fas fa-bars"></i>
                              </button>
                              <div class="offcanvas offcanvas-end" id="demo">
                                <div class="offcanvas-header"> 
                                  <button type="button" class="btn-close" data-bs-dismiss="offcanvas"><i class="fas fa-times"></i></button>
                                </div>
                                <div class="offcanvas-body">
                                  <div class="logo text-center mb-md-1 mb-3">
                                        <?php 
                                        if (has_custom_logo()) {
                                            the_custom_logo();
                                        } else {
                                            // Check if both title and tagline settings are disabled
                                            $vegan_cafe_restaurant_tagline_enabled = get_theme_mod('vegan_cafe_restaurant_tagline_setting', false);
                                            $vegan_cafe_restaurant_title_enabled = get_theme_mod('vegan_cafe_restaurant_site_title_setting', true);

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

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

                                            <?php
                                            // Display site title if the setting is enabled
                                            if ($vegan_cafe_restaurant_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 class="social-media mt-3">
                                    <?php                 
                                      $vegan_cafe_restaurant_header_fb_new_tab = esc_attr(get_theme_mod('vegan_cafe_restaurant_header_fb_new_tab','true'));
                                      $vegan_cafe_restaurant_header_twt_new_tab = esc_attr(get_theme_mod('vegan_cafe_restaurant_header_twt_new_tab','true'));
                                      $vegan_cafe_restaurant_header_ins_new_tab = esc_attr(get_theme_mod('vegan_cafe_restaurant_header_ins_new_tab','true'));
                                      $vegan_cafe_restaurant_header_ut_new_tab = esc_attr(get_theme_mod('vegan_cafe_restaurant_header_ut_new_tab','true'));
                                      $vegan_cafe_restaurant_header_pint_new_tab = esc_attr(get_theme_mod('vegan_cafe_restaurant_header_pint_new_tab','true'));
                                      ?>
                                    <?php if( get_theme_mod( 'vegan_cafe_restaurant_facebook_url' ) != '#') { ?>
                                      <a <?php if($vegan_cafe_restaurant_header_fb_new_tab != false ) { ?>target="_blank" <?php } ?>href="<?php echo esc_url( get_theme_mod( 'vegan_cafe_restaurant_facebook_url','#' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vegan_cafe_restaurant_facebook_icon','fab fa-facebook-f')); ?>"></i></a>
                                    <?php } ?>
                                    <?php if( get_theme_mod( 'vegan_cafe_restaurant_twitter_url' ) != '#') { ?>
                                      <a <?php if($vegan_cafe_restaurant_header_twt_new_tab != false ) { ?>target="_blank" <?php } ?>href="<?php echo esc_url( get_theme_mod( 'vegan_cafe_restaurant_twitter_url','#' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vegan_cafe_restaurant_twitter_icon','fab fa-twitter')); ?>"></i></a>
                                    <?php } ?>
                                    <?php if( get_theme_mod( 'vegan_cafe_restaurant_instagram_url' ) != '#') { ?>
                                      <a <?php if($vegan_cafe_restaurant_header_ins_new_tab != false ) { ?>target="_blank" <?php } ?>href="<?php echo esc_url( get_theme_mod( 'vegan_cafe_restaurant_instagram_url','#' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vegan_cafe_restaurant_instagram_icon','fab fa-instagram')); ?>"></i></a>
                                    <?php } ?>
                                    <?php if( get_theme_mod( 'vegan_cafe_restaurant_youtube_url' ) != '#') { ?>
                                      <a <?php if($vegan_cafe_restaurant_header_ut_new_tab != false ) { ?>target="_blank" <?php } ?>href="<?php echo esc_url( get_theme_mod( 'vegan_cafe_restaurant_youtube_url','#' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vegan_cafe_restaurant_youtube_icon','fab fa-youtube')); ?>"></i></a>
                                    <?php } ?>
                                    <?php if( get_theme_mod( 'vegan_cafe_restaurant_pint_url' ) != '#') { ?>
                                      <a <?php if($vegan_cafe_restaurant_header_pint_new_tab != false ) { ?>target="_blank" <?php } ?>href="<?php echo esc_url( get_theme_mod( 'vegan_cafe_restaurant_pint_url','#' ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('vegan_cafe_restaurant_pinterest_icon','fab fa-pinterest')); ?>"></i></a>
                                    <?php } ?>
                                  </div>
                                  <div class="search_inner">
                                  <?php get_search_form(); ?>
                                </div>
                                </div>
                              </div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
 <div class="clearfix"></div>
</header>