<?php
/**
 * Displays main header 2
 *
 * @package Adventure Tourism
 */
?>

<?php
$adventure_tourism_sticky_header = get_theme_mod('adventure_tourism_sticky_header');
    $adventure_tourism_data_sticky = "false";
    if ($adventure_tourism_sticky_header) {
    $adventure_tourism_data_sticky = "true";
    }
?>
<div class="main-header">
	<div class="topbar">
		<div class="row me-0">
			<div class="col-lg-2 col-md-1 align-self-center">
                <div class="bar-icon text-md-start text-center">
                    <button onclick="adventure_tourism_openSidebar()"><i class="fas fa-bars"></i></button>
                    <div class="header-widgets">
                        <a href="javascript:void(0)" class="closebtn" onclick="adventure_tourism_closeSidebar()"><i class="fas fa-times"></i></a>
                        <div class="sidebar">
                            <?php if( is_active_sidebar('header-sidebar') ) : ?>
                                <?php dynamic_sidebar( 'header-sidebar' );?>
                            <?php else : ?>
                                <h4><?php esc_html_e('Add Widgets Here.', 'adventure-tourism'); ?></h4>
                            <?php endif;?>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xl-8 col-lg-6 col-md-6 align-self-center">
                <div class="phone-mail">
                    <?php if ( get_theme_mod('adventure_tourism_topbar_phone_number') != "" ) {?>
                        <p class="topbar-mail m-0"><i class="fas fa-phone-volume me-2"></i><?php echo esc_html('Call:', 'adventure-tourism'); ?> <a href="tel:<?php echo esc_attr(get_theme_mod('adventure_tourism_topbar_phone_number')); ?>"><?php echo esc_html(get_theme_mod('adventure_tourism_topbar_phone_number')); ?></a></p>  
                    <?php }?>
                    <?php if ( get_theme_mod('adventure_tourism_topbar_email_address') != "" ) {?>
                        <p class="topbar-mail m-0"><i class="fas fa-envelope me-2"></i><?php echo esc_html('Email:', 'adventure-tourism'); ?> <a href="mailto:<?php echo esc_attr(get_theme_mod('adventure_tourism_topbar_email_address')); ?>"><?php echo esc_html(get_theme_mod('adventure_tourism_topbar_email_address')); ?></a></p>  
                    <?php }?>
                </div>
            </div>
            <div class="col-xl-2 col-lg-4 col-md-5 pe-5 align-self-center">
                <div class="social-link text-md-end text-center pe-md-5">
                    <?php if(get_theme_mod('adventure_tourism_facebook_url') != ''){ ?>
                        <a href="<?php echo esc_url(get_theme_mod('adventure_tourism_facebook_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('adventure_tourism_facebook_icon') ); ?>"></i></a>
                    <?php }?>
                    <?php if(get_theme_mod('adventure_tourism_twitter_url') != ''){ ?>
                        <a href="<?php echo esc_url(get_theme_mod('adventure_tourism_twitter_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('adventure_tourism_twitter_icon') ); ?>"></i></a>
                    <?php }?>
                    <?php if(get_theme_mod('adventure_tourism_intagram_url') != ''){ ?>
                        <a href="<?php echo esc_url(get_theme_mod('adventure_tourism_intagram_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('adventure_tourism_instagram_icon') ); ?>"></i></a>
                    <?php }?>
                    <?php if(get_theme_mod('adventure_tourism_linkedin_url') != ''){ ?>
                        <a href="<?php echo esc_url(get_theme_mod('adventure_tourism_linkedin_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('adventure_tourism_linkedin_icon') ); ?>"></i></a>
                    <?php }?>
                    <?php if(get_theme_mod('adventure_tourism_pintrest_url') != ''){ ?>
                        <a href="<?php echo esc_url(get_theme_mod('adventure_tourism_pintrest_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('adventure_tourism_pinterest_icon') ); ?>"></i></a>
                    <?php }?>
                </div>
            </div>
		</div>
	</div>
	<div class="bottom-header" data-sticky="<?php echo esc_attr($adventure_tourism_data_sticky); ?>">
		<div class="container">
			<div class="row">
				<div class="col-lg-3 col-md-4 col-9">
                    <div class="navbar-logo">
                        <?php if ( has_custom_logo() ) : ?>
                            <div class="site-logo"><?php the_custom_logo(); ?></div>
                        <?php endif; ?>
                        <?php $adventure_tourism_blog_info = get_bloginfo( 'name' ); ?>
                            <?php if ( ! empty( $adventure_tourism_blog_info ) ) : ?>
                                <?php if ( is_front_page() && is_home() ) : ?>
                                    <?php if( get_theme_mod('adventure_tourism_logo_title_text',true) != ''){ ?>
                                        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                                    <?php } ?>
                                <?php else : ?>
                                    <?php if( get_theme_mod('adventure_tourism_logo_title_text',true) != ''){ ?>
                                        <p class="site-title "><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                                    <?php } ?>
                                <?php endif; ?>
                            <?php endif; ?>
                            <?php
                                $adventure_tourism_description = get_bloginfo( 'description', 'display' );
                                if ( $adventure_tourism_description || is_customize_preview() ) :
                            ?>
                            <?php if( get_theme_mod('adventure_tourism_theme_description',false) != ''){ ?>
                                <p class="site-description pb-2"><?php echo esc_html($adventure_tourism_description); ?></p>
                            <?php } ?>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-lg-7 col-md-6 col-3 align-self-center">
                	<?php get_template_part('template-parts/navigation/nav'); ?>
                </div>
                <div class="col-lg-1 col-md-1 col-6 align-self-center text-end">
		            <span class="cart_no">
		              	<?php if(class_exists('woocommerce')){ ?>
			                <?php global $woocommerce; ?>
			                <a class="cart-customlocation" href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php esc_attr_e( 'shopping cart','adventure-tourism' ); ?>"><i class="fas fa-shopping-cart"></i></a>
		              	<?php }?>
		            </span>
	          	</div>
	          	<div class="col-lg-1 col-md-1 col-6 p-0 text-md-end text-start align-self-center">
                    <?php if( get_theme_mod('adventure_tourism_search_enable',false) != false){ ?>
    		            <span class="head-search">
    		              	<span class="header-search-wrapper">
    			                <span class="search-main">
    			                    <i class="fa fa-search"></i>
    			                </span>
    			                <div class="search-form-main clearfix">
    			                  	<form method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    				                    <input type="hidden" name="post_type" value="product"> <!-- Set post type to product for WooCommerce products -->
    				                    <label>
    				                        <input type="search" class="search-field form-control" placeholder="<?php esc_attr_e('Search for products...', 'adventure-tourism'); ?>" value="<?php echo get_search_query(); ?>" name="s">
    				                    </label>
    				                    <input type="submit" class="search-submit btn btn-primary mt-3" value="Search">
    			                  	</form>
    			                </div>
    		              	</span>
    		            </span>
                    <?php }?>
	          	</div>
			</div>
		</div>
	</div>
</div>