<?php
/*
* Display Logo and contact details
*/
?>
<div class="main-header">
  <div class="headerbox">
    <div class="container">
      <div class="row">
        <div class="col-lg-3 col-md-4 col-12 align-self-center">
          <div class="logo">
            <?php if( has_custom_logo() ) gym_coach_the_custom_logo(); ?>
            <?php if(get_theme_mod('gym_coach_site_title',true) == 1){ ?>
              <?php if (is_front_page() && is_home()) : ?>
                <h1 class="text-capitalize">
                  <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a>
                </h1> 
              <?php else : ?>
                <p class="text-capitalize site-title mb-1">
                  <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a>
                </p>
              <?php endif; ?>
            <?php }?>
            <?php $gym_coach_description = get_bloginfo( 'description', 'display' );
            if ( $gym_coach_description || is_customize_preview() ) : ?>
              <?php if(get_theme_mod('gym_coach_site_tagline',false)){ ?>
                <p class="site-description mb-0"><?php echo esc_html($gym_coach_description); ?></p>
              <?php }?>
            <?php endif; ?>
          </div>
        </div>
        <div class="col-xl-7 col-lg-5 col-md-3 navigation-col align-self-center">
          <?php get_template_part('template-parts/navigation/site-nav'); ?>
        </div>
        <div class="col-xl-2 col-lg-3 col-md-4 btn-col align-self-center">
          <div class="middle-right-box">
            <div class="social-media text-md-end text-center">
              <?php
                $gym_coach_fb_url = get_theme_mod('gym_coach_facebook_url');
                $gym_coach_twt_url = get_theme_mod('gym_coach_twitter_url');
                $gym_coach_ins_url = get_theme_mod('gym_coach_instagram_url');
                $gym_coach_pinterest_url = get_theme_mod('gym_coach_pinterest_url');

                $gym_coach_fb_new_tab = esc_attr(get_theme_mod('gym_coach_header_fb_new_tab', 'true'));
                $gym_coach_twt_new_tab = esc_attr(get_theme_mod('gym_coach_header_twt_new_tab', 'true'));
                $gym_coach_ins_new_tab = esc_attr(get_theme_mod('gym_coach_header_ins_new_tab', 'true'));
                $gym_coach_pinterest_new_tab = esc_attr(get_theme_mod('gym_coach_pinterest_new_tab', 'true'));

                if ($gym_coach_twt_url || $gym_coach_fb_url || $gym_coach_ins_url || $gym_coach_pinterest_url) : ?>

                  <?php if ($gym_coach_fb_url) : ?>
                      <a <?php if ($gym_coach_fb_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($gym_coach_fb_url); ?>"><i class="<?php echo esc_attr(get_theme_mod('gym_coach_facebook_icon', 'fab fa-facebook-f')); ?>"></i></a>
                  <?php endif; ?>

                  <?php if ($gym_coach_twt_url) : ?>
                      <a <?php if ($gym_coach_twt_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($gym_coach_twt_url); ?>"><i class="ms-xl-3 ms-md-2 ms-3 <?php echo esc_attr(get_theme_mod('gym_coach_twitter_icon', 'fab fa-twitter')); ?>"></i></a>
                  <?php endif; ?>

                  <?php if ($gym_coach_ins_url) : ?>
                      <a <?php if ($gym_coach_ins_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($gym_coach_ins_url); ?>"><i class="ms-xl-3 ms-md-2 ms-3 <?php echo esc_attr(get_theme_mod('gym_coach_instagram_icon', 'fab fa-instagram')); ?>"></i></a>
                  <?php endif; ?>

                  <?php if ($gym_coach_pinterest_url) : ?>
                      <a <?php if ($gym_coach_pinterest_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($gym_coach_pinterest_url); ?>"><i class="ms-xl-3 ms-md-2 ms-3 ms-2 <?php echo esc_attr(get_theme_mod('gym_coach_pinterest_icon', 'fab fa-pinterest-p')); ?>"></i></a>
                  <?php endif; ?>
                  
              <?php endif; ?>
            </div>
            <span class="search-bar ms-xl-4 ms-3 ms-md-3">
              <button type="button" class="open-search"><i class="fas fa-search"></i></button>
            </span>
          </div>
          <div class="search-outer">
            <div class="inner_searchbox w-100 h-100">
                <?php get_search_form(); ?>
            </div>
            <button type="button" class="search-close"><?php esc_html_e('CLOSE', 'gym-coach'); ?></button>
          </div> 
        </div>
      </div>
    </div>
  </div>
</div>