<?php
/**
 * Template part for displaying header menu
 *
 * @package Legacy Medical Appointment
 */

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

<header id="<?php echo esc_attr($legacy_medical_appointment_page_val);?>-inner" class="elementer-menu-anchor theme-menu-wrapper full-width-menu style1 page" role="banner">
    <?php
        if(true===get_theme_mod('legacy_medical_appointment_enable_highlighted area',true) && is_front_page()){
            ?><a class="skip-link screen-reader-text" href="#content"><?php esc_html_e('skip to content','legacy-medical-appointment'); ?> </a> <?php
        }
        else{
        ?><a class="skip-link screen-reader-text" href="#main"><?php esc_html_e('skip to content','legacy-medical-appointment');?></a> <?php
    }
    ?>
    <div id="header-main" class="header-wrapper">
        <div id="topbar">
            <div class="container">
                <div class="row py-2">
                    <div class="col-lg-5 col-md-6 col-12 align-self-center">
                      <div class="tbr-text">
                           <?php
                                $legacy_medical_appointment_topbar_text = get_theme_mod( 'legacy_medical_appointment_topbar_text', '' );
                                if ( ! empty( $legacy_medical_appointment_topbar_text ) ) { ?>
                                    <p class="topbar-text text-center text-lg-start text-md-center mb-0"><?php echo esc_html( $legacy_medical_appointment_topbar_text ); ?></p>
                            <?php } ?>
                      </div>  
                    </div>
                    <div class="col-lg-4 col-md-6 col-12 align-self-center">
                        <div class="tbr-mail text-center text-lg-start text-md-center">
                            <?php $legacy_medical_appointment_topbar_email_id = get_theme_mod('legacy_medical_appointment_topbar_email_id', '' );
                            $legacy_medical_appointment_topbar_email_head = get_theme_mod('legacy_medical_appointment_topbar_email_head', '' );
                                if ( ! empty( $legacy_medical_appointment_topbar_email_id ) ) { ?>
                                    <span>
                                        <i class="bi bi-envelope-fill mail-icn"></i>
                                    </span>
                                    <span class="topbr-mail">
                                    <?php echo esc_html( $legacy_medical_appointment_topbar_email_head ); ?></span>
                                    <span class="topbr-mail-id">
                                    <?php echo esc_html( $legacy_medical_appointment_topbar_email_id ); ?></span>
                            <?php } ?>
                        </div>
                    </div>  
                    <div class="col-lg-1 col-md-4 col-4 align-self-center">
                        <?php
                            $legacy_medical_appointment_topbar_career_button_link = get_theme_mod( 'legacy_medical_appointment_topbar_career_button_link', '' );
                            if ( ! empty( $legacy_medical_appointment_topbar_career_button_link ) ) { ?>
                            <div class="topbar-button1">
                                <a href="<?php echo esc_url( $legacy_medical_appointment_topbar_career_button_link ); ?>"><?php echo esc_html('Careers','legacy-medical-appointment'); ?></a>
                            </div> 
                        <?php } ?>
                    </div>
                    <div class="col-lg-1 col-md-4 col-4 align-self-center">
                       <?php
                            $legacy_medical_appointment_topbar_service_button_link = get_theme_mod( 'legacy_medical_appointment_topbar_service_button_link', '' );
                            if ( ! empty( $legacy_medical_appointment_topbar_service_button_link ) ) { ?>
                            <div class="topbar-button2">
                                <a href="<?php echo esc_url( $legacy_medical_appointment_topbar_service_button_link ); ?>"><?php echo esc_html('Services','legacy-medical-appointment'); ?></a> 
                            </div> 
                        <?php } ?>
                    </div>
                    <div class="col-lg-1 col-md-4 col-4 align-self-center">
                        <?php
                            $legacy_medical_appointment_topbar_contact_button_link = get_theme_mod( 'legacy_medical_appointment_topbar_contact_button_link', '' );
                            if ( ! empty( $legacy_medical_appointment_topbar_contact_button_link ) ) { ?>
                            <div class="topbar-button3">
                                <a href="<?php echo esc_url( $legacy_medical_appointment_topbar_contact_button_link ); ?>"><?php echo esc_html('Contact Us','legacy-medical-appointment'); ?></a>
                            </div> 
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>        
        <?php if ( display_header_text() ) : ?>
            <div id="topbar2">
                <div class="container">
                    <div class="row py-1">
                        <div class="col-lg-5 col-md-3 col-12 align-self-center text-center text-lg-start text-md-start r8-logo">
                            <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() ) {
                                        legacy_medical_appointment_custom_logo();
                                    }

                                    // Display sticky header logo if enabled
                                    if ( get_theme_mod( 'legacy_medical_appointment_enable_logo_stickyheader', false ) ) {
                                        $legacy_medical_appointment_alt_logo = esc_url( get_theme_mod( 'legacy_medical_appointment_logo_stickyheader' ) );
                                        if ( ! empty( $legacy_medical_appointment_alt_logo ) ) {
                                            ?>
                                            <a id="logo-alt" class="logo-alt" href="<?php echo esc_url( home_url( '/' ) ); ?>">
                                                <img src="<?php echo esc_url( $legacy_medical_appointment_alt_logo ); ?>" alt="<?php esc_attr_e( 'logo', 'legacy-medical-appointment' ); ?>">
                                            </a>
                                            <?php
                                        }
                                    }

                                    // Site title and tagline settings
                                    $legacy_medical_appointment_show_title   = get_theme_mod( 'legacy_medical_appointment_display_site_title', true );
                                    $legacy_medical_appointment_show_tagline = get_theme_mod( 'legacy_medical_appointment_display_site_tagline', false );
                                    $legacy_medical_appointment_header_class = $legacy_medical_appointment_show_title ? 'site-title' : 'screen-reader-text';

                                    // Display site title
                                    if ( $legacy_medical_appointment_show_title && get_bloginfo( 'name' ) ) {
                                        if ( is_front_page() ) {
                                            ?>
                                            <h1 class="<?php echo esc_attr( $legacy_medical_appointment_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( $legacy_medical_appointment_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 ( $legacy_medical_appointment_show_tagline ) {
                                        $legacy_medical_appointment_description = get_bloginfo( 'description', 'display' );
                                        if ( $legacy_medical_appointment_description || is_customize_preview() ) {
                                            ?>
                                            <p class="site-description"><?php echo esc_html( $legacy_medical_appointment_description ); ?></p>
                                            <?php
                                        }
                                    }
                                ?>
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-5 col-12 align-self-center text-center text-lg-start text-md-start r8-adrs">
                            <div class="topbr-location-box">
                               <?php $legacy_medical_appointment_header_address = get_theme_mod('legacy_medical_appointment_header_address', '' );
                                $legacy_medical_appointment_header_address_head = get_theme_mod('legacy_medical_appointment_header_address_head', '' );
                                if ( ! empty( $legacy_medical_appointment_header_address ) ) { ?>
                                    <span class="hdr-addrs">
                                        <i class="bi bi-geo-alt-fill addrs-icn"></i>
                                    </span>
                                    <span class="hd-addrs">
                                    <?php echo esc_html( $legacy_medical_appointment_header_address_head ); ?></span>
                                    <span class="hd-addrs-no">
                                    <?php echo esc_html( $legacy_medical_appointment_header_address ); ?></span>
                                <?php } ?>
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-4 col-12 align-self-center text-lg-start text-center text-md-start ps-lg-0">
                            <?php $legacy_medical_appointment_header_phone_number = get_theme_mod('legacy_medical_appointment_header_phone_number', '' );
                                $legacy_medical_appointment_header_phone_head = get_theme_mod('legacy_medical_appointment_header_phone_head', '' );
                            if ( ! empty( $legacy_medical_appointment_header_phone_number ) ) { ?>
                                    <span class="phne-icon">
                                        <i class="bi bi-telephone-fill call-icn"></i>
                                    </span>
                                    <span class="hd-call mb-0">
                                    <?php echo esc_html( $legacy_medical_appointment_header_phone_head ); ?></span>
                                    <span class="hd-call-no mb-0">
                                    <?php echo esc_html( $legacy_medical_appointment_header_phone_number ); ?></span>
                            <?php } ?>
                        </div>                   
                    </div>
                </div>            
            </div>
        <?php endif; ?>        
        <div id="custom-header">
            <div id="content-header">
                <div class="container">
                    <div class="row py-3">                    
                        <div class="col-lg-12 col-md-12 col-12 align-self-center text-center">
                            <div class="top-menu-wrapper">
                                <div class="navigation_header">
                                    <div class="toggle-nav mobile-menu">
                                        <button onclick="legacy_medical_appointment_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', 'legacy-medical-appointment' ); ?>">
                                            <?php {
                                                wp_nav_menu(
                                                    array(
                                                        'theme_location' => 'primary',
                                                        'container_class' => 'navi clearfix navbar-nav' ,
                                                        'menu_class'     => 'menu clearfix', 
                                                        '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="legacy_medical_appointment_closeNav()"><i class="bi bi-x"></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>                
                </div>
            </div>
        </div>
    </div>    
</header>

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

<div class="content-wrap">