<?php
/**
 * Template part for displaying header menu
 *
 * @package Lawyer Consultant
 */

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

?>

<header id="<?php echo esc_attr($page_val);?>-inner" class="elementer-menu-anchor theme-menu-wrapper full-width-menu style1 page" role="banner">
    <?php
        if(true===get_theme_mod('lawyer_consultant_enable_highlighted area',true) && is_front_page()){
            ?><a class="skip-link screen-reader-text" href="#content"><?php esc_html_e('skip to content','lawyer-consultant'); ?> </a> <?php
        }
        else{
        ?><a class="skip-link screen-reader-text" href="#main"><?php esc_html_e('skip to content','lawyer-consultant');?></a> <?php
    }
    ?>

<div class="header-upper">
    <div class="container">
        <div class="row">
            <div class="col-lg-6 col-md-4 align-self-center">
            </div>
            <div class="col-lg-3 col-md-3 align-self-center text-md-end text-center">
                <div class="follow-us">
                    <?php
                        $lawyer_consultant_social_media1_heading = get_theme_mod( 'lawyer_consultant_social_media1_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media1_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media1_heading ); ?>"><i class="bi bi-facebook me-2"></i></a>
                    <?php } ?>
                    <?php
                        $lawyer_consultant_social_media2_heading = get_theme_mod( 'lawyer_consultant_social_media2_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media2_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media2_heading ); ?>"><i class="bi bi-instagram me-2"></i></a>
                    <?php } ?>
                    <?php
                        $lawyer_consultant_social_media3_heading = get_theme_mod( 'lawyer_consultant_social_media3_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media3_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media3_heading ); ?>"><i class="bi bi-twitter-x me-2"></i></a>
                    <?php } ?>
                    <?php
                        $lawyer_consultant_social_media4_heading = get_theme_mod( 'lawyer_consultant_social_media4_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media4_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media4_heading ); ?>"><i class="bi bi-youtube me-2"></i></a>
                    <?php } ?>
                    <?php
                        $lawyer_consultant_social_media5_heading = get_theme_mod( 'lawyer_consultant_social_media5_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media5_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media5_heading ); ?>"><i class="bi bi-pinterest me-2"></i></a>
                    <?php } ?>
                    <?php
                        $lawyer_consultant_social_media6_heading = get_theme_mod( 'lawyer_consultant_social_media6_heading', '' );
                        if ( ! empty( $lawyer_consultant_social_media6_heading ) ) { ?>
                        <a href="<?php echo esc_url( $lawyer_consultant_social_media6_heading ); ?>"><i class="bi bi-linkedin me-2"></i></a>
                    <?php } ?>
                </div>
            </div>
            <div class="col-lg-3 col-md-5 align-self-center text-md-end text-center">
                <?php
                    $lawyer_consultant_header_register_link = get_theme_mod( 'lawyer_consultant_header_register_link', '' );
                    $lawyer_consultant_header_login_link = get_theme_mod( 'lawyer_consultant_header_login_link', '' );
                    if ( ! empty( $lawyer_consultant_header_register_link ) || ! empty( $lawyer_consultant_header_login_link ) ) { ?>
                        <a class="register" href="<?php echo esc_url( $lawyer_consultant_header_register_link ); ?>"><?php esc_html_e('REGISTER','lawyer-consultant'); ?></a>
                        <a class="login" href="<?php echo esc_url( $lawyer_consultant_header_login_link ); ?>"><?php esc_html_e('LOGIN','lawyer-consultant'); ?></a>
                <?php } ?>
            </div>
        </div>
    </div>
</div>

<div id="custom-header">
    <?php if ( display_header_text() ) : ?>
    <div id="header-main" class="header-wrapper">
        <div class="container">
            <div class="row">
                <div class="col-lg-3 col-md-8 col-8 align-self-center">
                    <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() ) {
                                lawyer_consultant_custom_logo();
                            }

                            // Display sticky header logo if enabled
                            if ( get_theme_mod( 'lawyer_consultant_enable_logo_stickyheader', false ) ) {
                                $lawyer_consultant_alt_logo = esc_url( get_theme_mod( 'lawyer_consultant_logo_stickyheader' ) );
                                if ( ! empty( $lawyer_consultant_alt_logo ) ) {
                                    ?>
                                    <a id="logo-alt" class="logo-alt" href="<?php echo esc_url( home_url( '/' ) ); ?>">
                                        <img src="<?php echo esc_url( $lawyer_consultant_alt_logo ); ?>" alt="<?php esc_attr_e( 'logo', 'lawyer-consultant' ); ?>">
                                    </a>
                                    <?php
                                }
                            }

                            // Site title and tagline settings
                            $lawyer_consultant_logo_show_title   = get_theme_mod( 'lawyer_consultant_display_site_title', true );
                            $lawyer_consultant_logo_show_tagline = get_theme_mod( 'lawyer_consultant_display_site_tagline', false );
                            $lawyer_consultant_logo_header_class = $lawyer_consultant_logo_show_title ? 'site-title' : 'screen-reader-text';

                            // Display site title
                            if ( $lawyer_consultant_logo_show_title && get_bloginfo( 'name' ) ) {
                                if ( is_front_page() ) {
                                    ?>
                                    <h1 class="<?php echo esc_attr( $lawyer_consultant_logo_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( $lawyer_consultant_logo_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 ( $lawyer_consultant_logo_show_tagline ) {
                                $lawyer_consultant_logo_description = get_bloginfo( 'description', 'display' );
                                if ( $lawyer_consultant_logo_description || is_customize_preview() ) {
                                    ?>
                                    <p class="site-description"><?php echo esc_html( $lawyer_consultant_logo_description ); ?></p>
                                    <?php
                                }
                            }
                        ?>
                    </div>
                </div>
                <div class="col-lg-8 col-md-2 col-2 align-self-center">
                    <div class="top-menu-wrapper">
                        <div class="navigation_header">
                        <div class="toggle-nav mobile-menu">
                            <button onclick="lawyer_consultant_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', 'lawyer-consultant' ); ?>">
                                <?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="lawyer_consultant_closeNav()"><i class="bi bi-x"></i></a>
                        </div>
                    </div>
                    </div>
                </div>
                <div class="col-lg-1 col-md-2 col-2 align-self-center">
                    <div class="offcanvas-div d-flex">
                        <button type="button" data-bs-toggle="offcanvas" data-bs-target="#demo">
                            <i class="bi bi-filter-left"></i>
                        </button>
                        <div class="offcanvas offcanvas-start" id="demo">
                            <div class="offcanvas-header"> 
                                <button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
                            </div>
                            <div class="offcanvas-body">
                                <div class="logo <?php echo (has_custom_logo() ? 'has-logo' : 'no-logo'); ?>" itemscope itemtype="https://schema.org/Organization">
                                    <?php 
                                        if (has_custom_logo()) :
                                            lawyer_consultant_custom_logo();
                                        endif;
                                    ?>
                                    <?php 
                                        if ( get_theme_mod( 'lawyer_consultant_enable_logo_stickyheader', false )) :
                                            $lawyer_consultant_alt_logo=esc_url(get_theme_mod( 'lawyer_consultant_logo_stickyheader' ));
                                            if(!empty($lawyer_consultant_alt_logo)) :
                                                ?>
                                                    <a id="logo-alt" class="logo-alt" href="<?php echo esc_url(home_url( '/' )); ?>"><img src="<?php echo esc_url( get_theme_mod( 'lawyer_consultant_logo_stickyheader' ) ); ?>" alt="<?php esc_attr_e( 'logo', 'lawyer-consultant' ); ?>"></a>
                                                <?php
                                            endif;
                                        endif;
                                    ?>
                                    <?php
                                        $lawyer_consultant_show_title   = ( true === get_theme_mod( 'lawyer_consultant_display_site_title_tagline', true ) );
                                        $lawyer_consultant_header_class = $lawyer_consultant_show_title ? 'site-title' : 'screen-reader-text';
                                        if(!empty(get_bloginfo( 'name' ))) {
                                            if ( is_front_page() ) {
                                                ?>
                                                    <h1 class="<?php echo esc_attr( $lawyer_consultant_header_class ); ?>">
                                                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php esc_html(bloginfo( 'name' )); ?></a>
                                                    </h1>

                                                <?php

                                                if(true === get_theme_mod( 'lawyer_consultant_display_site_title_tagline', true )) {
                                                    $lawyer_consultant_description = esc_html(get_bloginfo( 'description', 'display' ));
                                                    if ( $lawyer_consultant_description || is_customize_preview() ) { 
                                                        ?>
                                                            <p class="site-description"><?php echo $lawyer_consultant_description; ?></p>
                                                        <?php
                                                    }
                                                }
                                            }
                                            else {
                                                ?>
                                                    <p class="<?php echo esc_attr( $lawyer_consultant_header_class ); ?>">
                                                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php esc_html(bloginfo( 'name' )); ?></a>
                                                    </p>
                                                <?php

                                                if(true === get_theme_mod( 'lawyer_consultant_display_site_title_tagline', true )) {
                                                    $lawyer_consultant_description = esc_html(get_bloginfo( 'description', 'display' ));
                                                    if ( $lawyer_consultant_description || is_customize_preview() ) { 
                                                        ?>
                                                            <p class="site-description"><?php echo $lawyer_consultant_description; ?></p>
                                                        <?php 
                                                    }
                                                }
                                            }
                                        }
                                    ?>
                                </div>
                                <div id="sidebar-wrapper">
                                    <?php dynamic_sidebar('home-sidebar'); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>
</div>    
</header>

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

<div class="content-wrap">