<?php
/*
* Display Logo and contact details
*/
?>

<?php if (get_theme_mod('home_interior_decor_top_header', true)) : ?>
    <div class="topbar py-md-0 py-3">
      <div class="container">
        <div class="row">
          <div class="col-lg-9 col-md-10 align-self-center">
            <div class="top-text">
              <?php if (get_theme_mod('home_interior_decor_topbar_text') !== '') : ?>
                <p class="mb-0 pe-lg-5 pe-md-2 pe-0"><?php echo esc_html(get_theme_mod('home_interior_decor_topbar_text', '')); ?></p>
              <?php endif; ?>
              <div class="top-header mb-md-0 mb-2 ps-lg-5 ps-md-2 ps-0">
                <?php if (get_theme_mod('home_interior_decor_delivery_text') !== '') : ?>
                  <span class="mb-0"><?php echo esc_html(get_theme_mod('home_interior_decor_delivery_text', '')); ?></span>
                <?php endif; ?>
                <?php if (!empty(get_theme_mod('home_interior_decor_order_return_link')) || !empty(get_theme_mod('home_interior_decor_order_return_text'))) : ?>
                  <span class="return-btn">
                    <a href="<?php echo esc_url(get_theme_mod('home_interior_decor_order_return_link', '')); ?>">
                      <?php if (!empty(get_theme_mod('home_interior_decor_order_return_text'))) : ?>
                        <?php echo esc_html(get_theme_mod('home_interior_decor_order_return_text', '')); ?>
                      <?php endif; ?>
                    </a>
                  </span>
                <?php endif; ?>
              </div>
            </div>
          </div>
          <div class="col-lg-3 col-md-2 align-self-center">
            <div class="social-media text-md-end text-center">
                <?php
                $home_interior_decor_facebook_url = get_theme_mod('home_interior_decor_facebook_url');
                $home_interior_decor_ins_url = get_theme_mod('home_interior_decor_instagram_url');
                $home_interior_decor_linkedin_url = get_theme_mod('home_interior_decor_linkedin_url');
                $home_interior_decor_twt_url = get_theme_mod('home_interior_decor_twitter_url');
                $home_interior_decor_youtube_url = get_theme_mod('home_interior_decor_youtube_url');

                $home_interior_decor_facebook_new_tab = esc_attr(get_theme_mod('home_interior_decor_facebook_new_tab', 'true'));
                $home_interior_decor_ins_new_tab = esc_attr(get_theme_mod('home_interior_decor_header_ins_new_tab', 'true'));
                $home_interior_decor_linkedin_new_tab = esc_attr(get_theme_mod('home_interior_decor_header_linkedin_new_tab', 'true'));
                $home_interior_decor_twt_new_tab = esc_attr(get_theme_mod('home_interior_decor_header_twt_new_tab', 'true'));
                $home_interior_decor_youtube_new_tab = esc_attr(get_theme_mod('home_interior_decor_youtube_new_tab', 'true'));

                if ($home_interior_decor_facebook_url || $home_interior_decor_ins_url || $home_interior_decor_linkedin_url || $home_interior_decor_twt_url || $home_interior_decor_youtube_url) : ?>

                    <?php if ($home_interior_decor_facebook_url) : ?>
                        <a <?php if ($home_interior_decor_facebook_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($home_interior_decor_facebook_url); ?>"><i class="me-lg-3 me-2  <?php echo esc_attr(get_theme_mod('home_interior_decor_facebook_icon', 'fab fa-facebook')); ?>"></i></a>
                    <?php endif; ?>
                    
                    <?php if ($home_interior_decor_ins_url) : ?>
                        <a <?php if ($home_interior_decor_ins_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($home_interior_decor_ins_url); ?>"><i class="me-lg-3 me-2  <?php echo esc_attr(get_theme_mod('home_interior_decor_instagram_icon', 'fab fa-instagram')); ?>"></i></a>
                    <?php endif; ?>

                    <?php if ($home_interior_decor_linkedin_url) : ?>
                        <a <?php if ($home_interior_decor_linkedin_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($home_interior_decor_linkedin_url); ?>"><i class="me-lg-3 me-2 <?php echo esc_attr(get_theme_mod('home_interior_decor_linkedin_icon', 'fab fa-linkedin')); ?>"></i></a>
                    <?php endif; ?>
                    
                    <?php if ($home_interior_decor_twt_url) : ?>
                        <a <?php if ($home_interior_decor_twt_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($home_interior_decor_twt_url); ?>"><i class="me-lg-3 me-2 <?php echo esc_attr(get_theme_mod('home_interior_decor_twitter_icon', 'fab fa-twitter')); ?>"></i></a>
                    <?php endif; ?>

                    <?php if ($home_interior_decor_youtube_url) : ?>
                        <a <?php if ($home_interior_decor_youtube_new_tab != false) : ?>target="_blank" <?php endif; ?>href="<?php echo esc_url($home_interior_decor_youtube_url); ?>"><i class="<?php echo esc_attr(get_theme_mod('home_interior_decor_youtube_icon', 'fab fa-youtube')); ?>"></i></a>
                    <?php endif; ?>
                    
                <?php endif; ?>
            </div>
          </div>
        </div>
      </div>
    </div>
<?php endif; ?>

<div class="headerbox">
  <div class="container">
    <div class="row">
      <div class="col-lg-3 col-md-3 align-self-md-center">
        <div class="logo">
          <?php if( has_custom_logo() ) home_interior_decor_the_custom_logo(); ?>
          <?php if(get_theme_mod('home_interior_decor_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 $home_interior_decor_description = get_bloginfo( 'description', 'display' );
          if ( $home_interior_decor_description || is_customize_preview() ) : ?>
            <?php if(get_theme_mod('home_interior_decor_site_tagline',false)){ ?>
              <p class="site-description"><?php echo esc_html($home_interior_decor_description); ?></p>
            <?php }?>
          <?php endif; ?>
        </div>
      </div>
      <div class="col-lg-5 col-md-5 align-self-center">
        <?php if (class_exists('WooCommerce')): ?> 
          <div class="product-search">
            <form method="get" class="woocommerce-product-search" action="<?php echo esc_url(home_url('/')); ?>">
                <label for="product-search-field" class="screen-reader-text"><?php esc_html_e('Search for:', 'home-interior-decor'); ?></label>
                
                <!-- Search Icon -->
                <button type="submit" class="search-icon">
                    <i class="fas fa-search" aria-hidden="true"></i>
                </button>
                
                <!-- Input Field -->
                <input type="search" id="product-search-field" class="search-field" 
                    placeholder="<?php esc_attr_e('Search For Product...', 'home-interior-decor'); ?>" 
                    value="<?php echo esc_attr(get_search_query()); ?>" name="s" />
                <input type="hidden" name="post_type" value="product" />
                
                <!-- Submit Button -->
                <button type="submit" class="search-button">
                    <?php esc_html_e('SEARCH', 'home-interior-decor'); ?>
                </button>
            </form>
          </div>
        <?php endif; ?>
      </div>
      <div class="header-details col-lg-4 col-md-4 align-self-center">
        <p class="mb-0">
          <?php if (class_exists('woocommerce')) : ?>
              <div class="user-acc">
                  <i class="far fa-user pe-lg-2 pe-md-1 pe-2"></i>
                  <div class="user-text pe-lg-3">
                    <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" aria-label="<?php esc_attr_e('My Account', 'home-interior-decor'); ?>">
                        <span class="login-text"><?php esc_html_e('My Account', 'home-interior-decor'); ?></span>
                    </a>
                    <div class="user-wishlist">
                        <?php if (is_user_logged_in()) : ?>
                            <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" aria-label="<?php esc_attr_e('User', 'home-interior-decor'); ?>">
                                <span class="user-text"><?php esc_html_e('User', 'home-interior-decor'); ?></span>
                            </a>
                            
                            <span class="separator"><?php echo esc_html__(' / ', 'home-interior-decor'); ?></span>
                            
                            <a href="<?php echo esc_url(get_permalink(get_option('yith_wcwl_wishlist_page_id'))); ?>" aria-label="<?php esc_attr_e('Wishlist', 'home-interior-decor'); ?>">
                                <span class="wishlist-text"><?php esc_html_e('Wishlist', 'home-interior-decor'); ?></span>
                            </a>
                        <?php else : ?>
                            <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" aria-label="<?php esc_attr_e('Login/Register', 'home-interior-decor'); ?>">
                                <span class="login-text"><?php esc_html_e('Login/Register', 'home-interior-decor'); ?></span>
                            </a>
                        <?php endif; ?>
                    </div>
                  </div>
              </div>
          <?php endif; ?>
        </p>
        <?php if (class_exists('woocommerce')) : ?>
          <?php if (get_theme_mod('home_interior_decor_support_option') != '') : ?>
              <p class="mb-0">
                  <a href="<?php echo esc_url(get_theme_mod('home_interior_decor_support_option')); ?>" aria-label="<?php esc_attr_e('Support', 'home-interior-decor'); ?>">
                      <i class="fas fa-headphones"></i>
                  </a>
              </p>
          <?php endif; ?>
        <?php endif; ?>

        <?php if (class_exists('woocommerce')) : ?>
            <?php if (get_theme_mod('home_interior_decor_like_option') != '') : ?>
                <p class="mb-0">
                    <a href="<?php echo esc_url(get_theme_mod('home_interior_decor_like_option')); ?>" aria-label="<?php esc_attr_e('Wishlist', 'home-interior-decor'); ?>">
                        <i class="far fa-heart"></i>
                    </a>
                </p>
            <?php endif; ?>

            <?php if (class_exists('YITH_WCWL')) : ?>
                <p class="mb-0">
                  <a href="<?php echo esc_url(YITH_WCWL()->get_wishlist_url()); ?>" aria-label="<?php esc_attr_e('Wishlist', 'home-interior-decor'); ?>">
                      <i class="fas fa-heart"></i>
                  </a>
                </p>
            <?php endif; ?>
        <?php endif; ?>

        <p class="mb-0">
          <?php if (class_exists('woocommerce')) : ?>
            <span class="product-cart">
              <a href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php esc_attr_e('Shopping Cart', 'home-interior-decor'); ?>" aria-label="<?php esc_attr_e('My Cart', 'home-interior-decor'); ?>">
                  <i class="fas fa-shopping-basket"></i>
                <?php 
                $home_interior_decor_cart_count = WC()->cart->get_cart_contents_count(); 
                if ($home_interior_decor_cart_count > 0) : ?>
                    <span class="cart-count"><?php echo esc_html($home_interior_decor_cart_count); ?></span>
                <?php endif; ?>
              </a>
            </span>
          <?php endif; ?>
        </p>
      </div>
    </div>
  </div>
</div>