<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>

<!-- Top Bar -->
<div class="top-bar">
    <div class="container">
        <div class="top-bar-content">
            <div class="contact-info">
                <span><i class="fas fa-phone"></i> <?php echo esc_html(get_theme_mod('contact_phone', '+1 836 483 384')); ?></span>
                <span><i class="fas fa-envelope"></i> <?php echo esc_html(get_theme_mod('contact_email', 'info@travel.com')); ?></span>
            </div>
            <div class="social-links">
                <?php if (get_theme_mod('social_twitter')) : ?>
                    <a href="<?php echo esc_url(get_theme_mod('social_twitter')); ?>" target="_blank"><i class="fab fa-twitter"></i></a>
                <?php endif; ?>
                <?php if (get_theme_mod('social_facebook')) : ?>
                    <a href="<?php echo esc_url(get_theme_mod('social_facebook')); ?>" target="_blank"><i class="fab fa-facebook-f"></i></a>
                <?php endif; ?>
                <?php if (get_theme_mod('social_instagram')) : ?>
                    <a href="<?php echo esc_url(get_theme_mod('social_instagram')); ?>" target="_blank"><i class="fab fa-instagram"></i></a>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>

<!-- Header -->
<header class="header">
    <div class="container">
        <div class="header-content">
            <div class="logo">
                <?php if (has_custom_logo()) : ?>
                    <?php the_custom_logo(); ?>
                <?php else : ?>
                    <a href="<?php echo esc_url(home_url('/')); ?>">
                        <span class="logo-icon"><i class="fas fa-mountain"></i></span>
                        <span class="logo-text"><?php bloginfo('name'); ?><span><?php _e('Mountain', 'travel-mountain'); ?></span></span>
                    </a>
                <?php endif; ?>
            </div>
            
            <nav class="main-nav">
                <?php
                wp_nav_menu(array(
                    'theme_location' => 'primary',
                    'container' => false,
                    'menu_class' => 'nav-list',
                    'fallback_cb' => 'travel_mountain_default_menu'
                ));
                ?>
            </nav>
            
            <?php
            // Get contact page URL
            $contact_page = get_page_by_path('contact');
            $contact_url = $contact_page ? get_permalink($contact_page->ID) : home_url('/contact');
            ?>
            <a href="<?php echo esc_url($contact_url); ?>" class="header-quote-btn">
                <i class="fas fa-paper-plane"></i>
                <?php _e('Get a Quote', 'travel-mountain'); ?>
            </a>
            
            <button class="mobile-menu-btn">
                <span></span>
                <span></span>
                <span></span>
            </button>
        </div>
    </div>
</header>

<?php
// Default menu if no menu is set
function travel_mountain_default_menu() {
    // Get contact page URL
    $contact_page = get_page_by_path('contact');
    $contact_url = $contact_page ? get_permalink($contact_page->ID) : home_url('/contact');
    ?>
    <ul class="nav-list">
        <li class="nav-item"><a href="<?php echo esc_url(home_url('/')); ?>"><?php _e('Home', 'travel-mountain'); ?></a></li>
        <li class="nav-item"><a href="<?php echo esc_url(home_url('/packages')); ?>"><?php _e('Travel', 'travel-mountain'); ?></a></li>
        <li class="nav-item"><a href="<?php echo esc_url(home_url('/about')); ?>"><?php _e('About', 'travel-mountain'); ?></a></li>
        <li class="nav-item"><a href="<?php echo esc_url(home_url('/blog')); ?>"><?php _e('Blog', 'travel-mountain'); ?></a></li>
        <li class="nav-item"><a href="<?php echo esc_url($contact_url); ?>"><?php _e('Contact Us', 'travel-mountain'); ?></a></li>
    </ul>
    <?php
}
?>

