<?php
/**
 * The header for our theme
 *
 * @package Estate Rental Listings
 */
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="https://gmpg.org/xfn/11">

    <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="site">
    <a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'estate-rental-listings' ); ?></a>

    <?php
    $estate_rental_listings_preloader_wrap = absint(get_theme_mod('estate_rental_listings_enable_preloader', 0));
    if ($estate_rental_listings_preloader_wrap === 1): ?>
        <div id="loader">
            <div class="loader-container">
                <div id="preloader" class="loader-2">
                    <div class="dot"></div>
                </div>
            </div>
        </div>
    <?php endif; ?>


    <header id="masthead" class="site-header">
        
        <div class="header-info-box" >
            <div class="container">
                <div class="flex-row">
                    <div class="header-info-left">
                        <div class="site-branding">
                            <?php
                            the_custom_logo();
                            if (is_front_page() && is_home()):
                                if (get_theme_mod('estate_rental_listings_site_title_text', true)): ?>
                                    <h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1>
                                <?php endif;
                            else:
                                if (get_theme_mod('estate_rental_listings_site_title_text', true)): ?>
                                    <p class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></p>
                                <?php endif;
                            endif;

                            $estate_rental_listings_description = get_bloginfo('description', 'display');
                            if ($estate_rental_listings_description || is_customize_preview()):
                                if (get_theme_mod('estate_rental_listings_site_tagline_text', false)): ?>
                                    <p class="site-description"><?php echo esc_html($estate_rental_listings_description); ?></p>
                                <?php endif;
                            endif; ?>
                        </div>
                    </div>
                    <div class="header-info-right">
                        <?php if (get_theme_mod('estate_rental_listings_header_info_address','Broklyn Street, London')): ?>
                            <div class="contact-info">
                                <i class="<?php echo esc_attr(get_theme_mod('estate_rental_listings_header_location_icon','fas fa-map-marker-alt')); ?>"></i>
                                <p class="main-box">
                                    <span class="main-head"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_address','Broklyn Street, London')); ?></span>
                                    <span class="contact-text"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_address_text','Visit us')); ?></span>
                                </p>
                            </div>
                        <?php endif; ?>

                        <?php if (get_theme_mod('estate_rental_listings_header_info_phone','00 123 456 7890')): ?>
                            <div class="contact-info">
                                <i class="<?php echo esc_attr(get_theme_mod('estate_rental_listings_header_phone_icon','fas fa-phone-volume')); ?>"></i>
                                <p class="main-box">
                                    <span class="main-head"><a href="tel:<?php echo esc_attr(get_theme_mod('estate_rental_listings_header_info_phone', '00 123 456 7890')); ?>"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_phone', '00 123 456 7890')); ?></a></span>
                                    <span class="contact-text"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_phone_text','Phone line')); ?></span>
                                </p>
                            </div>
                        <?php endif; ?>

                        <?php if (get_theme_mod('estate_rental_listings_header_info_email','info@example.com')): ?>
                            <div class="contact-info">
                                <i class="<?php echo esc_attr(get_theme_mod('estate_rental_listings_header_mail_icon','fas fa-at')); ?>"></i>
                                <p class="main-box">
                                    <span class="main-head"><a href="mailto:<?php echo esc_attr(get_theme_mod('estate_rental_listings_header_info_email', 'info@example.com')); ?>"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_email','info@example.com')); ?></a></span>
                                    <span class="contact-text"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_info_email_text','Email address')); ?></span>
                                </p>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>

        <?php $estate_rental_listings_has_header_image = has_header_image();

        if ($estate_rental_listings_has_header_image) {
            $estate_rental_listings_header_image_url = esc_url(get_header_image());
        } else {
            $estate_rental_listings_header_image_url = '';
        }
        ?>
        <div class="header-menu-box  <?php echo esc_attr( get_theme_mod( 'estate_rental_listings_enable_sticky_header', false ) ? 'sticky-header' : '' ); ?>" style="background-image: url('<?php echo $estate_rental_listings_header_image_url; ?>');">
            <div class="container-fluid">
                <div class="flex-row">
                    <div class="nav-menu-header-left">
                        <nav id="site-navigation" class="main-navigation">
                            <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
                                <span class="screen-reader-text"><?php esc_html_e('Primary Menu', 'estate-rental-listings'); ?></span>
                                <i class="fas fa-bars"></i>
                            </button>
                            <?php
                            wp_nav_menu(array(
                                'theme_location' => 'menu-1',
                                'menu_id'        => 'primary-menu',
                            ));
                            ?>
                        </nav>
                    </div>
                    <div class="header-search">
                        <?php if (get_theme_mod('estate_rental_listings_header_search', true) == 1): ?>
                            <div class="search-box text-center">
                              <?php if(get_theme_mod('estate_rental_listings_search_option',true) != ''){ ?>
                                <button type="button" class="search-open"><i class="fas fa-search"></i></button>
                              <?php }?>
                            </div>
                        <?php endif; ?>
                    </div>
                    <div class="nav-menu-header-right">
                        <div class="header-button">
                            <?php if (get_theme_mod('estate_rental_listings_header_button_link') || get_theme_mod('estate_rental_listings_header_button_text', 'Get A Quote')): ?>
                                <a href="<?php echo esc_url(get_theme_mod('estate_rental_listings_header_button_link')); ?>"><?php echo esc_html(get_theme_mod('estate_rental_listings_header_button_text', 'Get A Quote')); ?><i class="fas fa-arrow-right"></i></a>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="search-outer">
                      <div class="serach_inner">
                        <?php get_search_form(); ?>
                      </div>
                      <button type="button" class="search-close">X</span></button>
                    </div>
                </div>
            </div>
        </div>
    </header>
</div>