<?php
/**
 * Header Layout
 * @package Board Games
 */

$board_games_default = board_games_get_default_theme_options();

$board_games_header_section_button_text = esc_html( get_theme_mod( 'board_games_header_section_button_text',
$board_games_default['board_games_header_section_button_text'] ) );

$board_games_header_section_button_url = esc_url( get_theme_mod( 'board_games_header_section_button_url',
$board_games_default['board_games_header_section_button_url'] ) );

$board_games_sticky = get_theme_mod('board_games_sticky');

$board_games_data_sticky = "false";
if ($board_games_sticky) {
$board_games_data_sticky = "true";
}
?>

<section id="center-header" class="Stickyy <?php if( is_user_logged_in() && !isset( $wp_customize ) ){ echo "login-user";} ?>" data-sticky="<?php echo esc_attr($board_games_data_sticky); ?>">
    <div class=" header-main">
        <div class="header-right-box theme-header-areas">
            <header id="site-header" class=" site-header-layout header-layout" role="banner">
                <section id="top-header" class="top-bar">
                    <div class="wrapper header-wrapper top-box ">
                        <div class="theme-header-areas header-areas-right header-logo">
                            <div class="header-titles">
                                <?php
                                    board_games_site_logo();
                                    board_games_site_description();
                                ?>
                            </div>
                        </div>
                        <div class="theme-header-areas header-areas-right header-meta">
                            <?php get_search_form(); ?>
                        </div>
                        <div class="theme-header-areas header-areas-right header-menu">
                            <div class="site-navigation">
                                <nav class="primary-menu-wrapper" aria-label="<?php esc_attr_e('Horizontal', 'board-games'); ?>" role="navigation">
                                    <ul class="primary-menu theme-menu">
                                        <?php
                                        if (has_nav_menu('board-games-primary-menu')) {
                                            wp_nav_menu(
                                                array(
                                                    'container' => '',
                                                    'items_wrap' => '%3$s',
                                                    'theme_location' => 'board-games-primary-menu',
                                                )
                                            );
                                        } else {
                                            wp_list_pages(
                                                array(
                                                    'match_menu_classes' => true,
                                                    'show_sub_menu_icons' => true,
                                                    'title_li' => false,
                                                    'walker' => new Board_Games_Walker_Page(),
                                                )
                                            );
                                        } ?>
                                    </ul>
                                </nav>
                            </div>
                            <div class="navbar-controls twp-hide-js">
                                <button type="button" class="navbar-control navbar-control-offcanvas">
                                    <span class="navbar-control-trigger" tabindex="-1">
                                        <?php board_games_the_theme_svg('menu'); ?>
                                    </span>
                                </button>
                            </div>
                        </div>
                        <div class="theme-header-areas header-areas-right woo-box">
                            <?php if( $board_games_header_section_button_text || $board_games_header_section_button_url ){ ?>
                                <a class="header-btn" href="<?php echo esc_url( $board_games_header_section_button_url ); ?>"><?php echo esc_html( $board_games_header_section_button_text ); ?></a>
                            <?php } ?>
                            <?php if(class_exists('woocommerce')){ ?>
                                <?php if ( is_user_logged_in() ) { ?>
                                    <a class="account-area" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('My Account','board-games'); ?>"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M313.6 304c-28.7 0-42.5 16-89.6 16-47.1 0-60.8-16-89.6-16C60.2 304 0 364.2 0 438.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-25.6c0-74.2-60.2-134.4-134.4-134.4zM400 464H48v-25.6c0-47.6 38.8-86.4 86.4-86.4 14.6 0 38.3 16 89.6 16 51.7 0 74.9-16 89.6-16 47.6 0 86.4 38.8 86.4 86.4V464zM224 288c79.5 0 144-64.5 144-144S303.5 0 224 0 80 64.5 80 144s64.5 144 144 144zm0-240c52.9 0 96 43.1 96 96s-43.1 96-96 96-96-43.1-96-96 43.1-96 96-96z"/></svg><?php esc_html_e('Signout','board-games'); ?></a>
                                <?php }
                                else { ?>
                                    <a class="account-area" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','board-games'); ?>"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M313.6 304c-28.7 0-42.5 16-89.6 16-47.1 0-60.8-16-89.6-16C60.2 304 0 364.2 0 438.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-25.6c0-74.2-60.2-134.4-134.4-134.4zM400 464H48v-25.6c0-47.6 38.8-86.4 86.4-86.4 14.6 0 38.3 16 89.6 16 51.7 0 74.9-16 89.6-16 47.6 0 86.4 38.8 86.4 86.4V464zM224 288c79.5 0 144-64.5 144-144S303.5 0 224 0 80 64.5 80 144s64.5 144 144 144zm0-240c52.9 0 96 43.1 96 96s-43.1 96-96 96-96-43.1-96-96 43.1-96 96-96z"/></svg><?php esc_html_e('Signup','board-games'); ?></a>
                                <?php } ?>
                            <?php }?>
                        </div>
                    </div>
                </section>
            </header>
        </div>
    </div>
</section>