<?php
/**
 * Template part for displaying header menu
 *
 * @package Creamy Bakery
 */

?>
<?php
    $creamy_bakery_page_val= is_front_page() ? 'home':'page' ;

?>

<header id="<?php echo esc_attr($creamy_bakery_page_val);?>-inner" class="elementer-menu-anchor theme-menu-wrapper full-width-menu style1 page" role="banner">
    <?php
        if(true===get_theme_mod('creamy_bakery_enable_highlighted area',true) && is_front_page()){
            ?><a class="skip-link screen-reader-text" href="#content"><?php esc_html_e('skip to content','creamy-bakery'); ?> </a> <?php
        }
        else{
        ?><a class="skip-link screen-reader-text" href="#main"><?php esc_html_e('skip to content','creamy-bakery');?></a> <?php
    }
    ?>
    <div id="header-main" class="header-wrapper">
        <div id="topbar">
            <div class="container">
                <div class="row py-1">
                    <div class="col-lg-2 col-md-6 col-12 align-self-center text-center text-lg-start text-md-center ri8-call">
                        <?php $creamy_bakery_topbar_phone_number = get_theme_mod('creamy_bakery_topbar_phone_number', '' );
                            if ( ! empty( $creamy_bakery_topbar_phone_number ) ) { ?>
                                <span class="phne-icon">
                                    <i class="bi bi-telephone-fill call-icn"></i>
                                </span>
                                <span class="tbr-call-no mb-0">
                                <?php echo esc_html( $creamy_bakery_topbar_phone_number ); ?></span>
                        <?php } ?>                  
                    </div>
                    <div class="col-lg-2 col-md-6 col-12 align-self-center text-center text-lg-start text-md-center ri8-mail">
                        <?php $creamy_bakery_topbar_email_id = get_theme_mod('creamy_bakery_topbar_email_id', '' );
                                if ( ! empty( $creamy_bakery_topbar_email_id ) ) { ?>
                                <span>
                                    <i class="bi bi-envelope mail-icn"></i>
                                </span>
                                <span class="topbr-mail-id">
                                <?php echo esc_html( $creamy_bakery_topbar_email_id ); ?></span>
                        <?php } ?>                     
                    </div>
                    <div class="col-lg-6 col-md-6 col-12 align-self-center text-lg-end text-center text-md-center ri8-soco pe-lg-0">
                        <div class="follow-us">
                            <?php
                                $creamy_bakery_social_media1_heading = get_theme_mod( 'creamy_bakery_social_media1_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media1_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media1_heading ); ?>"><i class="bi bi-facebook me-4"></i></a>
                            <?php } ?>
                            <?php
                                $creamy_bakery_social_media2_heading = get_theme_mod( 'creamy_bakery_social_media2_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media2_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media2_heading ); ?>"><i class="bi bi-instagram me-4"></i></a>
                            <?php } ?>
                            <?php
                                $creamy_bakery_social_media3_heading = get_theme_mod( 'creamy_bakery_social_media3_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media3_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media3_heading ); ?>"><i class="bi bi-twitter-x me-4"></i></a>
                            <?php } ?>
                            <?php
                                $creamy_bakery_social_media4_heading = get_theme_mod( 'creamy_bakery_social_media4_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media4_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media4_heading ); ?>"><i class="bi bi-youtube me-4"></i></a>
                            <?php } ?>
                            <?php
                                $creamy_bakery_social_media5_heading = get_theme_mod( 'creamy_bakery_social_media5_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media5_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media5_heading ); ?>"><i class="bi bi-pinterest me-4"></i></a>
                            <?php } ?>
                            <?php
                                $creamy_bakery_social_media6_heading = get_theme_mod( 'creamy_bakery_social_media6_heading', '' );
                                if ( ! empty( $creamy_bakery_social_media6_heading ) ) { ?>
                                <a href="<?php echo esc_url( $creamy_bakery_social_media6_heading ); ?>"><i class="bi bi-linkedin"></i></a>
                            <?php } ?>
                        </div> 
                    </div>                    
                    <div class="col-lg-2 col-md-6 col-12 align-self-center text-lg-end text-center text-md-center ri8-tp-btn">
                        <span class="tbr-cart">
                            <?php creamy_bakery_custom_woocommerce_cart_icon(); ?>
                        </span>
                       <?php
                            $creamy_bakery_topbar_reserve_button_link = get_theme_mod( 'creamy_bakery_topbar_reserve_button_link', '' );
                            if ( ! empty( $creamy_bakery_topbar_reserve_button_link ) ) { ?>
                            <span class="topbar-button text-center">
                                <a href="<?php echo esc_url( $creamy_bakery_topbar_reserve_button_link ); ?>" class="py-2 px-3"><?php echo esc_html('RESERVATION','creamy-bakery'); ?></a>
                            </span> 
                        <?php } ?> 
                    </div>
                </div>
            </div>
        </div>
        <div id="custom-header">
            <?php if ( display_header_text() ) : ?>
            <div id="content-header">
                <div class="container">
                    <div class="row py-1">
                        <div class="col-lg-3 col-md-6 col-10 align-self-center text-center text-lg-start text-md-start">
                            <div class="logo <?php echo (has_custom_logo() ? 'has-logo' : 'no-logo'); ?>" itemscope itemtype="https://schema.org/Organization">
                                <?php 
                                    // Display custom logo if available
                                    if ( has_custom_logo() ) {
                                        creamy_bakery_custom_logo();
                                    }

                                    // Display sticky header logo if enabled
                                    if ( get_theme_mod( 'creamy_bakery_enable_logo_stickyheader', false ) ) {
                                        $creamy_bakery_alt_logo = esc_url( get_theme_mod( 'creamy_bakery_logo_stickyheader' ) );
                                        if ( ! empty( $creamy_bakery_alt_logo ) ) {
                                            ?>
                                            <a id="logo-alt" class="logo-alt" href="<?php echo esc_url( home_url( '/' ) ); ?>">
                                                <img src="<?php echo esc_url( $creamy_bakery_alt_logo ); ?>" alt="<?php esc_attr_e( 'logo', 'creamy-bakery' ); ?>">
                                            </a>
                                            <?php
                                        }
                                    }

                                    // Site title and tagline settings
                                    $creamy_bakery_show_title   = get_theme_mod( 'creamy_bakery_display_site_title', true );
                                    $creamy_bakery_show_tagline = get_theme_mod( 'creamy_bakery_display_site_tagline', false );
                                    $creamy_bakery_header_class = $creamy_bakery_show_title ? 'site-title' : 'screen-reader-text';

                                    // Display site title
                                    if ( $creamy_bakery_show_title && get_bloginfo( 'name' ) ) {
                                        if ( is_front_page() ) {
                                            ?>
                                            <h1 class="<?php echo esc_attr( $creamy_bakery_header_class ); ?>">
                                                <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>
                                            </h1>
                                            <?php
                                        } else {
                                            ?>
                                            <p class="<?php echo esc_attr( $creamy_bakery_header_class ); ?>">
                                                <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>
                                            </p>
                                            <?php
                                        }
                                    }

                                    // Display tagline
                                    if ( $creamy_bakery_show_tagline ) {
                                        $creamy_bakery_description = get_bloginfo( 'description', 'display' );
                                        if ( $creamy_bakery_description || is_customize_preview() ) {
                                            ?>
                                            <p class="site-description"><?php echo esc_html( $creamy_bakery_description ); ?></p>
                                            <?php
                                        }
                                    }
                                ?>
                            </div>
                        </div>
                        <div class="col-lg-9 col-md-6 col-2 align-self-center text-end">
                           <div class="top-menu-wrapper">
                                <div class="navigation_header">
                                    <div class="toggle-nav mobile-menu">
                                        <button onclick="creamy_bakery_openNav()"><i class="bi bi-list"></i></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', 'creamy-bakery' ); ?>">
                                            <?php {
                                                    wp_nav_menu(
                                                        array(
                                                            'theme_location' => 'primary',
                                                            'container_class' => 'navi navbar-nav' ,
                                                            'menu_class'     => 'menu', 
                                                            'items_wrap'     => '<ul id="%1$s" class="%2$s">%3$s</ul>',
                                                            'fallback_cb' => 'wp_page_menu',
                                                        )
                                                    );
                                                } ?>
                                        </nav>
                                        <a href="javascript:void(0)" class="closebtn mobile-menu" onclick="creamy_bakery_closeNav()"><i class="bi bi-x"></i></a>
                                    </div>
                                </div>
                            </div> 
                        </div>
                    </div>
                </div>            
            </div>
         <?php endif; ?>
        </div>
    </div>    
</header>

<div class="clearfix"></div>
<div id="content" class="elementor-menu-anchor"></div>

<div class="content-wrap">