<?php

if (!defined('ABSPATH')) {
	exit; // Exit if accessed directly
}

$meditest_logo = meditest_get_option('theme_logo');
$meditest_logo_id = isset($meditest_logo['id']) && !empty($meditest_logo['id']) ? $meditest_logo['id'] : '';
$meditest_logo_url = isset($meditest_logo['url']) ? $meditest_logo['url'] : '';
$meditest_logo_alt = get_post_meta($meditest_logo_id, '_wp_attachment_image_alt', true);

$meditest_header_search = meditest_get_option('search_bar_enable', true);

$meditest_header_button = meditest_get_option('header_button_enable');
$meditest_button_ele = meditest_get_option('header_button_ele');

$theme_header_sticky = meditest_get_option('theme_header_sticky', false);

?>

<header id="theme-header-one" class="theme_header__main header-style-one <?php if ($theme_header_sticky == true) {
																				echo "stick-top";
																			} else {
																				echo "stick-disable";
																			} ?>">
	<div class="theme-header-area">
		<div class="container">

			<div class="row align-items-center">
				<div class="col-lg-2 col-md-12">

					<div class="logo theme-logo">
						<?php
						if (has_custom_logo() || !empty($meditest_logo_url)) {
							if (isset($meditest_logo['url']) && !empty($meditest_logo_url)) {
						?>
								<a href="<?php echo esc_url(home_url('/')) ?>" class="logo">
									<img class="img-fluid" src="<?php echo esc_url($meditest_logo_url); ?>" alt="<?php echo esc_attr($meditest_logo_alt) ?>">
								</a>
						<?php
							} else {
								the_custom_logo();
							}
						} else {
							printf('<h1 class="text-logo"><a href="%1$s">%2$s</a></h1>', esc_url(home_url('/')), esc_html(get_bloginfo('name')));
						}
						?>
					</div>

				</div>

				<div class="col-lg-6 col-md-12 nav-design-one">
					<div class="nav-menu-wrapper">
						<div class="nav-wrapper-one">
							<div class="meditest-responsive-menu"></div>
							<div class="mainmenu">
								<?php
								wp_nav_menu(array(
									'theme_location' => 'primary',
									'container' => 'nav',
									'container_class' => 'nav-main-wrap',
									'menu_class' => 'theme-main-menu',
									'menu_id'        => 'primary-menu',
									'fallback_cb'  => 'meditest_fallback_menu',
								));
								?>

							</div>
						</div>
					</div>
				</div>

				<?php if (meditest_extra_is_activated()) { ?>
					<div class="col-lg-4 d-none d-lg-block">
						<div class="header-right-content d-flex justify-content-between">

							<?php if ($meditest_header_search == true) : ?>

								<div class="search-form-main text-right">
									<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
										<input type="text" class="hsearch-input" value="<?php echo get_search_query(); ?>" name="s" placeholder="<?php esc_attr_e('Search', 'meditest'); ?>" required />
										<button type="submit" id="searchsubmitt" class="hsearch-button"><i class="icofont-search-1"></i></button>
									</form>
								</div>

							<?php endif; ?>

							<?php if ($meditest_header_button == true) :
							?>

								<div class="navbar-action-btn text-right">
									<a href="<?php echo esc_url($meditest_button_ele['btnlink']); ?>"><?php echo wp_kses_post($meditest_button_ele['btntexts']); ?></a>
								</div>

							<?php endif; ?>


						</div>
					</div>

				<?php } ?>

			</div>
		</div>
	</div>
</header>