<?php
/**
 * The template to show mobile menu
 *
 * @package TOURIMO
 * @since TOURIMO 1.0
 */
?>
<div class="menu_mobile_overlay"></div>
<div class="menu_mobile menu_mobile_<?php echo esc_attr( tourimo_get_theme_option( 'menu_mobile_fullscreen' ) > 0 ? 'fullscreen' : 'narrow' ); ?> scheme_dark">
	<div class="menu_mobile_inner">
		<a class="menu_mobile_close theme_button_close" tabindex="0"><span class="theme_button_close_icon"></span></a>
		<?php

		// Logo
		set_query_var( 'tourimo_logo_args', array( 'type' => 'mobile' ) );
		get_template_part( apply_filters( 'tourimo_filter_get_template_part', 'templates/header-logo' ) );
		set_query_var( 'tourimo_logo_args', array() );

		// Mobile menu
		$tourimo_menu_mobile = tourimo_get_nav_menu( 'menu_mobile' );
		if ( empty( $tourimo_menu_mobile ) ) {
			$tourimo_menu_mobile = apply_filters( 'tourimo_filter_get_mobile_menu', '' );
			if ( empty( $tourimo_menu_mobile ) ) {
				$tourimo_menu_mobile = tourimo_get_nav_menu( 'menu_main' );
				if ( empty( $tourimo_menu_mobile ) ) {
					$tourimo_menu_mobile = tourimo_get_nav_menu();
				}
			}
		}
		if ( ! empty( $tourimo_menu_mobile ) ) {
			$tourimo_menu_mobile = str_replace(
				array( 'menu_main',   'id="menu-',        'sc_layouts_menu_nav', 'sc_layouts_menu ', 'sc_layouts_hide_on_mobile', 'hide_on_mobile' ),
				array( 'menu_mobile', 'id="menu_mobile-', '',                    ' ',                '',                          '' ),
				$tourimo_menu_mobile
			);
			if ( strpos( $tourimo_menu_mobile, '<nav ' ) === false ) {
				$tourimo_menu_mobile = sprintf( '<nav class="menu_mobile_nav_area" itemscope="itemscope" itemtype="%1$s//schema.org/SiteNavigationElement">%2$s</nav>', esc_attr( tourimo_get_protocol( true ) ), $tourimo_menu_mobile );
			}
			tourimo_show_layout( apply_filters( 'tourimo_filter_menu_mobile_layout', $tourimo_menu_mobile ) );
		}

		// Search field
		do_action(
			'tourimo_action_search',
			array(
				'style' => 'normal',
				'class' => 'search_mobile',
				'ajax'  => false
			)
		);

		// Social icons
		tourimo_show_layout( tourimo_get_socials_links(), '<div class="socials_mobile">', '</div>' );
		?>
	</div>
</div>
