<?php
/**
 * The header for our theme
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package cleaning_services_agent
 */
$cleaning_services_agent_header_button_label = get_theme_mod( 'cleaning_services_agent_header_button_label_', '' );
$cleaning_services_agent_header_button_link  = get_theme_mod( 'cleaning_services_agent_header_button_link_', '' );
$cleaning_services_agent_top_header_phone_number = get_theme_mod( 'cleaning_services_agent_top_header_phone_number', '' );
$cleaning_services_agent_top_header_email_id = get_theme_mod( 'cleaning_services_agent_top_header_email_id', '' );

$cleaning_services_agent_menu_text_color = get_theme_mod('cleaning_services_agent_menu_text_color', ''); 
$cleaning_services_agent_sub_menu_text_color = get_theme_mod('cleaning_services_agent_sub_menu_text_color', ''); 

?>
<!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(get_theme_mod('cleaning_services_agent_website_layout', false) ? 'site-boxed--layout' : ''); ?>>
<?php wp_body_open(); ?>
<div id="page" class="site asterthemes-site-wrapper">
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'cleaning-services-agent' ); ?></a>
    <?php if (get_theme_mod('cleaning_services_agent_enable_preloader', false)) : ?>
        <div id="loader" class="<?php echo esc_attr(get_theme_mod('cleaning_services_agent_preloader_style', 'style1')); ?>">
            <div class="loader-container">
                <div id="preloader">
                    <?php 
                    $cleaning_services_agent_preloader_style = get_theme_mod('cleaning_services_agent_preloader_style', 'style1');
                    if ($cleaning_services_agent_preloader_style === 'style1') : ?>
                        <!-- STYLE 1 -->
                        <img src="<?php echo esc_url(get_template_directory_uri() . '/resource/loader.gif'); ?>" alt="<?php esc_attr_e('Loading...', 'cleaning-services-agent'); ?>">
                    <?php elseif ($cleaning_services_agent_preloader_style === 'style2') : ?>
                        <!-- STYLE 2 -->
                        <div class="dot"></div>
                    <?php elseif ($cleaning_services_agent_preloader_style === 'style3') : ?>
                        <!-- STYLE 3 -->
                        <div class="bars">
                            <div class="bar"></div>
                            <div class="bar"></div>
                            <div class="bar"></div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    <?php endif; ?>
<header id="masthead" class="site-header">
    <?php if ( get_theme_mod( 'cleaning_services_agent_enable_topbar', true ) === true ) {
        ?>
        <div class="top-header-part">
            <div class="asterthemes-wrapper">
                <div class="top-header-part-wrapper">
                    <div class="top-header-left-part">
                        <?php if ( ! empty( $cleaning_services_agent_top_header_phone_number ) ) { ?>
                            <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--!Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M497.4 361.8l-112-48a24 24 0 0 0 -28 6.9l-49.6 60.6A370.7 370.7 0 0 1 130.6 204.1l60.6-49.6a23.9 23.9 0 0 0 6.9-28l-48-112A24.2 24.2 0 0 0 122.6 .6l-104 24A24 24 0 0 0 0 48c0 256.5 207.9 464 464 464a24 24 0 0 0 23.4-18.6l24-104a24.3 24.3 0 0 0 -14-27.6z"/></svg><span><a href="tel:<?php echo esc_html( $cleaning_services_agent_top_header_phone_number ); ?>"><?php echo esc_html( $cleaning_services_agent_top_header_phone_number ); ?></a></span> 
                       <?php } ?>
                    </div>
                    <div class="top-header-left-part">
                        <?php if ( ! empty( $cleaning_services_agent_top_header_email_id ) ) { ?>
                            <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--!Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M464 64H48C21.5 64 0 85.5 0 112v288c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zm0 48v40.8c-22.4 18.3-58.2 46.7-134.6 106.5-16.8 13.2-50.2 45.1-73.4 44.7-23.2 .4-56.6-31.5-73.4-44.7C106.2 199.5 70.4 171.1 48 152.8V112h416zM48 400V214.4c22.9 18.3 55.4 43.9 104.9 82.6 21.9 17.2 60.1 55.2 103.1 55 42.7 .2 80.5-37.2 103.1-54.9 49.5-38.8 82-64.4 104.9-82.7V400H48z"/></svg><span>
                                <a href="mailto:<?php echo esc_html( $cleaning_services_agent_top_header_email_id ); ?>"><?php echo esc_html( $cleaning_services_agent_top_header_email_id ); ?></a>
                            </span>
                        <?php } ?>
                    </div>
                    
                    <div class="top-top-header-left-part">
                        <div class="socail-search">
                            <div class="social-icons">
                                <?php
                                if ( has_nav_menu( 'social' ) ) {
                                    wp_nav_menu(
                                        array(
                                            'menu_class'     => 'menu social-links',
                                            'link_before'    => '<span class="screen-reader-text">',
                                            'link_after'     => '</span>',
                                            'theme_location' => 'social',
                                        )
                                    );
                                }
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php } ?>
    <div class="header-main-wrapper">
        <div class="bottom-header-outer-wrapper <?php echo esc_attr( get_theme_mod( 'cleaning_services_agent_enable_sticky_header', false ) ? 'sticky-header' : '' ); ?>">
            <div class="bottom-header-part">
                <div class="asterthemes-wrapper">
                    <div class="bottom-header-part-wrapper hello ">
                        <div class="bottom-header-middle-part">
                            <div class="site-branding">
                                <?php
                                // Check if the 'Enable Site Logo' setting is true.
                                if ( get_theme_mod( 'cleaning_services_agent_enable_site_logo', false ) ) {
                                    if ( has_custom_logo() ) { ?>
                                        <div class="site-logo">
                                            <?php the_custom_logo(); ?>
                                        </div>
                                    <?php } else { ?>
                                        <div class="site-logo">
                                            <!-- Fallback logo if no custom logo is set -->
                                            <a href="<?php echo esc_url(home_url('/')); ?>" rel="home">
                                                <img src="<?php echo esc_url(get_template_directory_uri() . '/resource/img/logo.png'); ?>" alt="<?php bloginfo('name'); ?>">
                                            </a>
                                        </div>
                                    <?php }
                                } ?>
                                <div class="site-identity">
                                        <?php
                                            if ( get_theme_mod( 'cleaning_services_agent_enable_site_title_setting', true ) ) {
                                                // Get the site title
                                                $cleaning_services_agent_site_title = get_bloginfo( 'name' );
                                                
                                                // Explode the title into words and extract the last one
                                                $cleaning_services_agent_title_parts = explode(' ', $cleaning_services_agent_site_title);
                                                $cleaning_services_agent_last_word = array_pop($cleaning_services_agent_title_parts);
                                                $cleaning_services_agent_title_without_last_word = implode(' ', $cleaning_services_agent_title_parts);

                                                if ( is_front_page() && is_home() ) :
                                                    ?>
                                                    <h1 class="site-title">
                                                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
                                                            <?php echo $cleaning_services_agent_title_without_last_word . ' <span class="yellow-text">' . $cleaning_services_agent_last_word . '</span>'; ?>
                                                        </a>
                                                    </h1>
                                                    <?php
                                                else :
                                                    ?>
                                                    <p class="site-title">
                                                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
                                                            <?php echo $cleaning_services_agent_title_without_last_word . ' <span class="yellow-text">' . $cleaning_services_agent_last_word . '</span>'; ?>
                                                        </a>
                                                    </p>
                                                    <?php
                                                endif;
                                            }

                                        if ( get_theme_mod( 'cleaning_services_agent_enable_tagline_setting', false ) ) :
                                            $cleaning_services_agent_description = get_bloginfo( 'description', 'display' );

                                            if ( $cleaning_services_agent_description || is_customize_preview() ) :
                                                ?>
                                            <p class="site-description">
                                                <?php
                                                echo esc_html( $cleaning_services_agent_description ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 
                                                ?>
                                            </p>
                                                <?php
                                            endif;
                                                ?>
                                        <?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <div class="bottom-header-left-part">
                            <div class="navigation-part">
                                <nav id="site-navigation" class="main-navigation">
                                    <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </button>
                                    <div class="main-navigation-links">
                                        <?php
                                            wp_nav_menu(
                                                array(
                                                    'theme_location' => 'primary',
                                                )
                                            );
                                        ?>
                                    </div>
                                    <style>
                                        /* Main Menu Links */
                                        .main-navigation ul li a, .menu a {
                                            color: <?php echo esc_attr($cleaning_services_agent_menu_text_color); ?>;
                                        }

                                        /* Submenu Links */
                                        .main-navigation ul.children a, 
                                        .home .main-navigation ul.children a, 
                                        .main-navigation ul.menu li .sub-menu a, 
                                        .home .main-navigation ul ul a {
                                            color: <?php echo esc_attr($cleaning_services_agent_sub_menu_text_color); ?>;
                                        }

                                    </style>
                                </nav>
                            </div>
                        </div>
                        <div class="bottom-header-right-part">
                            <?php
                                $cleaning_services_agent_enable_header_search_section = get_theme_mod( 'cleaning_services_agent_enable_header_search_section', true );
                                if ( $cleaning_services_agent_enable_header_search_section ) : ?>
                                <span class="search-main">
                                  <span class="btn">
                                    <i class="fa fa-search" aria-hidden="true"></i>
                                  </span>
                                  <div class="form">
                                    <form method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
                                        <label>
                                            <span class="screen-reader-text"><?php echo esc_html( 'Search for:', 'label', 'cleaning-services-agent' ); ?></span>
                                            <input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search...', 'placeholder', 'cleaning-services-agent' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
                                        </label>
                                        <button type="submit" class="search-submit"><span class="screen-reader-text"><?php echo esc_html( 'Search', 'submit button', 'cleaning-services-agent' ); ?></span></button>
                                    </form>
                                  </div>
                                </span>
                            <?php endif; ?>
                            <?php if ( ! empty( $cleaning_services_agent_header_button_label ) ) { ?>
                                <div class="header-btn">
                                    <a href="<?php echo esc_url( $cleaning_services_agent_header_button_link ); ?>" class="asterthemes-button"><?php echo esc_html( $cleaning_services_agent_header_button_label ); ?></a>
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>
<?php
if ( ! is_front_page() || is_home() ) {
	if ( is_front_page() ) {
		require get_template_directory() . '/sections/sections.php';
		cleaning_services_agent_homepage_sections();

	}
	?>
    <?php
        if (!is_front_page() || is_home()) {
            get_template_part('page-header');
        }
    ?>
	<div id="content" class="site-content">
		<div class="asterthemes-wrapper">
			<div class="asterthemes-page">
			<?php } ?>