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

<!-- Header -->
<header class="main-header">
    <!-- Top Bar -->
    <div class="top-bar">
        <div class="container">
            <div class="top-bar-content">
                <div class="top-bar-left">
                    <a href="tel:+593987645140" class="top-bar-link">
                        <i class="fas fa-phone"></i> +593 98 764 5140
                    </a>
                    <a href="mailto:info@rutarentacar.com" class="top-bar-link">
                        <i class="fas fa-envelope"></i> info@rutarentacar.com
                    </a>
                </div>
                <div class="top-bar-right">
                    <a href="#" class="social-link"><i class="fab fa-facebook-f"></i></a>
                    <a href="#" class="social-link"><i class="fab fa-instagram"></i></a>
                    <a href="#" class="social-link"><i class="fab fa-whatsapp"></i></a>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Navigation -->
    <nav class="main-nav">
        <div class="container">
            <div class="nav-wrapper">
                <!-- Logo -->
                <div class="logo-wrapper">
                    <a href="<?php echo esc_url(home_url('/')); ?>" class="logo-link">
                        <img src="<?php echo get_template_directory_uri(); ?>/images/logo-ruta-web.png" 
                             alt="<?php bloginfo('name'); ?>" 
                             class="site-logo">
                    </a>
                </div>

                <!-- Mobile Menu Toggle -->
                <button class="mobile-menu-toggle" aria-label="Toggle menu">
                    <span></span>
                    <span></span>
                    <span></span>
                </button>

                <!-- Navigation Menu -->
                <div class="nav-menu">
                    <?php
                    wp_nav_menu(array(
                        'theme_location' => 'primary',
                        'menu_class' => 'nav-list',
                        'container' => false,
                        'fallback_cb' => 'rentcar_fallback_menu',
                    ));
                    ?>
                    
                    <!-- CTA Button -->
                    <div class="nav-cta">
                        <a href="<?php echo esc_url(home_url('/contacto')); ?>" class="btn-primary btn-nav">
                            <i class="fas fa-calendar-check"></i> Reservar Ahora
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </nav>
</header>

<?php
// Menú fallback si no hay menú asignado
function rentcar_fallback_menu() {
    echo '<ul class="nav-list">';
    echo '<li><a href="' . esc_url(home_url('/')) . '">Inicio</a></li>';
    echo '<li><a href="' . esc_url(home_url('/nosotros')) . '">Nosotros</a></li>';
    echo '<li><a href="' . esc_url(home_url('/vehiculos')) . '">Vehículos</a></li>';
    echo '<li><a href="' . esc_url(home_url('/seguros')) . '">Seguros</a></li>';
    echo '<li><a href="' . esc_url(home_url('/contacto')) . '">Contacto</a></li>';
    echo '</ul>';
}
?>
