<?php
/**
 * Site Header Template Part
 *
 * @package HomeProz
 */

?>
<header id="masthead" class="site-header">
    <div class="header-container container">
        <div class="header-inner">
            <!-- Logo -->
            <div class="site-branding">
                <?php if (has_custom_logo()) : ?>
                    <?php the_custom_logo(); ?>
                <?php else : ?>
                    <a href="<?php echo esc_url(home_url('/')); ?>" class="site-title-link">
                        <span class="site-title"><?php bloginfo('name'); ?></span>
                    </a>
                <?php endif; ?>
            </div>

            <!-- Desktop Navigation -->
            <nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e('Primary Menu', 'homeproz'); ?>">
                <?php
                wp_nav_menu(array(
                    'theme_location' => 'primary',
                    'menu_id'        => 'primary-menu',
                    'menu_class'     => 'nav-menu',
                    'container'      => false,
                    'fallback_cb'    => 'homeproz_fallback_menu',
                ));
                ?>
            </nav>

            <!-- Mobile Menu Toggle -->
            <button class="menu-toggle" aria-controls="mobile-menu" aria-expanded="false">
                <span class="menu-toggle-icon">
                    <span class="bar"></span>
                    <span class="bar"></span>
                    <span class="bar"></span>
                </span>
                <span class="sr-only"><?php esc_html_e('Menu', 'homeproz'); ?></span>
            </button>

            <!-- Header CTA -->
            <div class="header-cta">
                <a href="tel:<?php echo esc_attr(preg_replace('/[^0-9]/', '', homeproz_get_option('phone'))); ?>" class="header-phone">
                    <?php echo esc_html(homeproz_get_option('phone')); ?>
                </a>
            </div>
        </div>
    </div>

    <!-- Mobile Navigation -->
    <nav id="mobile-menu" class="mobile-navigation" aria-label="<?php esc_attr_e('Mobile Menu', 'homeproz'); ?>">
        <?php
        wp_nav_menu(array(
            'theme_location' => 'primary',
            'menu_id'        => 'mobile-menu-list',
            'menu_class'     => 'mobile-nav-menu',
            'container'      => false,
            'fallback_cb'    => 'homeproz_fallback_menu',
        ));
        ?>
        <div class="mobile-menu-cta">
            <a href="tel:<?php echo esc_attr(preg_replace('/[^0-9]/', '', homeproz_get_option('phone'))); ?>" class="btn btn-primary">
                Call <?php echo esc_html(homeproz_get_option('phone')); ?>
            </a>
        </div>
    </nav>
</header>
