<?php
/**
 * Displays main header
 *
 * @package Holiday Travel Cruise
 */
?>
<?php
$holiday_travel_cruise_sticky_header = get_theme_mod('holiday_travel_cruise_sticky_header');
    $holiday_travel_cruise_data_sticky = "false";
    if ($holiday_travel_cruise_sticky_header) {
    $holiday_travel_cruise_data_sticky = "true";
    }
?>
<div class="main-header" data-sticky="<?php echo esc_attr($holiday_travel_cruise_data_sticky); ?>">
    <div class="container">
        <div class="header-content">
            <div class="row">
                <div class="col-lg-3 col-md-4 align-self-center pe-md-0">
                    <div class="navbar-logo text-md-start text-center">
                        <?php if ( has_custom_logo() ) : ?>
                            <div class="site-logo"><?php the_custom_logo(); ?></div>
                        <?php endif; ?>
                        <?php $holiday_travel_cruise_blog_info = get_bloginfo( 'name' ); ?>
                            <?php if ( ! empty( $holiday_travel_cruise_blog_info ) ) : ?>
                                <?php if ( is_front_page() && is_home() ) : ?>
                                    <?php if( get_theme_mod('holiday_travel_cruise_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('holiday_travel_cruise_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
                                $holiday_travel_cruise_description = get_bloginfo( 'description', 'display' );
                                if ( $holiday_travel_cruise_description || is_customize_preview() ) :
                            ?>
                            <?php if( get_theme_mod('holiday_travel_cruise_theme_description',false) != ''){ ?>
                                <p class="site-description pb-2"><?php echo esc_html($holiday_travel_cruise_description); ?></p>
                            <?php } ?>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-lg-7 col-md-4 align-self-center text-md-start text-center">
                    <?php get_template_part('template-parts/navigation/nav'); ?>
                </div>
                <div class="col-lg-2 col-md-4 align-self-center d-flex justify-content-md-end justify-content-center search-bar">
                    <?php if (get_theme_mod('holiday_travel_cruise_header_search_setting', false) != false) { ?>
                        <span class="head-search align-self-center">
                            <span class="header-search-wrapper">
                                <a href="#" class="search-main">
                                    <i class="fa fa-search"></i>
                                </a>
                                <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="post"> <!-- Set post type for search results -->
                                        <label>
                                            <input type="search" class="search-field form-control" placeholder="Search 
                                            ..." value="<?php echo esc_attr( 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 class="bar-icon">
                        <button onclick="holiday_travel_cruise_openSidebar()"><i class="fas fa-bars"></i></button>
                        <div class="header-widgets">
                            <a href="javascript:void(0)" class="closebtn" onclick="holiday_travel_cruise_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.', 'holiday-travel-cruise'); ?></h4>
                                <?php endif;?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
