<?php
/**
 * Displays main header
 *
 * @package Vlog Channel
 */
?>
<?php
$vlog_channel_sticky_header = get_theme_mod('vlog_channel_sticky_header');
    $vlog_channel_data_sticky = "false";
    if ($vlog_channel_sticky_header) {
    $vlog_channel_data_sticky = "true";
    }
?>
<div class="main-header" data-sticky="<?php echo esc_attr($vlog_channel_data_sticky); ?>">
    <div class="container">
        <div class="row">
            <div class="col-lg-3 col-md-3 align-self-center">
                <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 $vlog_channel_blog_info = get_bloginfo( 'name' ); ?>
                        <?php if ( ! empty( $vlog_channel_blog_info ) ) : ?>
                            <?php if ( is_front_page() && is_home() ) : ?>
                                <?php if( get_theme_mod('vlog_channel_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('vlog_channel_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
                            $vlog_channel_description = get_bloginfo( 'description', 'display' );
                            if ( $vlog_channel_description || is_customize_preview() ) :
                        ?>
                        <?php if( get_theme_mod('vlog_channel_theme_description',false) != ''){ ?>
                            <p class="site-description pb-2"><?php echo esc_html($vlog_channel_description); ?></p>
                        <?php } ?>
                    <?php endif; ?>
                </div>
            </div>
            <div class="col-lg-6 col-md-5 align-self-center text-md-start text-center">
                <?php get_template_part('template-parts/navigation/nav'); ?>
            </div>
            <div class="col-lg-3 col-md-4 align-self-center d-flex justify-content-md-end justify-content-center">
                <?php if( get_theme_mod('vlog_channel_search_enable',false) != false){ ?>
                    <span class="head-search text-md-end text-center">
                        <span class="header-search-wrapper">
                            <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 to product for WooCommerce products -->
                                    <label>
                                        <input type="search" class="search-field form-control" placeholder="<?php esc_attr_e('Search...', 'vlog-channel'); ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s">
                                    </label>
                                    <button type="submit" class="search-submit align-self-center">
                                        <i class="fas fa-search"></i>
                                    </button>
                                </form>
                            </div>
                        </span>
                    </span>
                <?php }?>
                <button class="toggle-btn" id="toggleButton"><i class="fas fa-sun"></i></button>
            </div>
        </div>
    </div>
</div>
