<?php
/*
 * Displays the header section with logo, site title, tagline, navigation, and contact information.
 */
?>
<?php if (get_theme_mod('interior_design_studio_topbar_visibility', true)) : ?>
    <div class="topbar">
        <div class="container py-3">
            <div class="row">
                <div class="col-lg-5 col-md-4 col-12 align-self-center">
                    <div class="discount-text text-md-start text-center">
                        <?php 
                        $interior_design_studio_header_text_top = get_theme_mod('interior_design_studio_header_text_top');
                        if (!empty($interior_design_studio_header_text_top)) : ?>
                            <p class="discount-top m-md-0 my-2">
                                <i class="fas fa-bolt me-1" aria-hidden="true"></i><?php echo esc_html($interior_design_studio_header_text_top); ?>
                            </p>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="col-lg-7 col-md-8 col-12 align-self-center">
                    <div class="top-right">
                        <div class="timing">
                            <?php 
                            $interior_design_studio_opening_time = get_theme_mod('interior_design_studio_time');
                            if (!empty($interior_design_studio_opening_time)) : ?>
                                <p class="mb-md-0 mb-2 contact-content">
                                    <i class="fa-solid fa-clock me-1" aria-hidden="true"></i><?php echo esc_html($interior_design_studio_opening_time); ?>
                                </p>
                            <?php endif; ?>
                        </div>
                        <div class="main-call">
                            <?php 
                            $interior_design_studio_contact_number = get_theme_mod('interior_design_studio_call');
                            if (!empty($interior_design_studio_contact_number)) : ?>
                                <p class="mb-md-0 mb-2 ps-md-3 contact-content">
                                    <a href="tel:<?php echo esc_attr($interior_design_studio_contact_number); ?>">
                                        <i class="fas fa-phone me-1" aria-hidden="true"></i><?php echo esc_html($interior_design_studio_contact_number); ?>
                                    </a>
                                </p>
                            <?php endif; ?>
                        </div>
                        <div class="location">
                            <?php 
                            $interior_design_studio_location = get_theme_mod('interior_design_studio_location');
                            if (!empty($interior_design_studio_location)) : ?>
                                <p class="mb-md-0 mb-2 ps-md-3 contact-content">
                                    <i class="fas fa-map-marker-alt me-1" aria-hidden="true"></i><?php echo esc_html($interior_design_studio_location); ?>
                                </p>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>

<div class="headerbox py-md-2">
    <div class="container header-main">
        <div class="row">
            <!-- Logo Section -->
            <div class="col-lg-3 col-md-3 col-12 logo-col align-self-center">
                <div class="logo text-center text-md-start">
                    <?php if (has_custom_logo()) : ?>
                        <?php the_custom_logo(); ?>
                    <?php endif; ?>

                    <?php if (get_theme_mod('interior_design_studio_site_title', 1)) : ?>
                        <p class="text-capitalize mb-0">
                            <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a>
                        </p>
                    <?php endif; ?>

                    <?php
                    $interior_design_studio_site_description = get_bloginfo('description', 'display');
                    if ($interior_design_studio_site_description || is_customize_preview()) :
                        if (get_theme_mod('interior_design_studio_site_tagline', 1)) :
                            ?>
                            <p class="site-description my-1 text-capitalize"><?php echo esc_html($interior_design_studio_site_description); ?></p>
                        <?php endif; 
                    endif;
                    ?>
                </div>
            </div>

            <!-- Navigation Section -->
            <div class="col-lg-7 col-md-6 col-12 align-self-center">
                <div class="menu-search">
                    <div class="main-navhead pe-lg-3">
                        <div class="menubox">
                            <div class="menu-content">
                                <?php get_template_part('template-parts/navigation/site-nav'); ?>
                            </div>
                        </div>
                    </div>
                    <span class="search-bar">
                        <button type="button" class="open-search" aria-label="<?php esc_attr_e('Open Search', 'interior-design-studio'); ?>">
                            <i class="fas fa-search" aria-hidden="true"></i>
                        </button>
                    </span>
                </div>
            </div>

            <div class="col-lg-2 col-md-3 col-12 align-self-center">
                <?php 
                $interior_design_studio_header_link = get_theme_mod('interior_design_studio_header_link');
                $interior_design_studio_header_button = get_theme_mod('interior_design_studio_header_button', __('Book Appointment', 'interior-design-studio'));
                if (!empty($interior_design_studio_header_link) && !empty($interior_design_studio_header_button)) : ?>
                    <div class="header-btn text-md-end text-center mb-md-0 mb-3">
                        <a href="<?php echo esc_url($interior_design_studio_header_link); ?>" class="book-appoin">
                            <span class="head-btn text-capitalize"><?php echo esc_html($interior_design_studio_header_button); ?></span>
                        </a>
                    </div>
                <?php endif; ?>
            </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', 'interior-design-studio'); ?>
                </button>
            </div>
        </div>
    </div>
</div>
