<?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);
$theme_header_sticky = meditest_get_option('theme_header_sticky', true);
$meditest_button_shop_signin = meditest_get_option('header_button_shop_signin');

?>

<header id="theme-header-two" 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-7 col-md-12 nav-design-one">
					<div class="nav-menu-wrapper text-right">
						<div class="container 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>

				<div class="col-lg-3">
					<div class="header-right-content">

						<?php if ($meditest_header_search == true) : ?>
							<div class="search-container">
								<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
									<input type="text" class="search expandright" id="searchright" value="<?php echo get_search_query(); ?>" name="s" placeholder="<?php esc_attr_e('Search...', 'meditest'); ?>" required />
									<button class="nav_two_search searchbutton" for="searchright"><i class="ri-search-line"></i></button>
								</form>
							</div>
						<?php endif; ?>

						<?php
						if (function_exists('meditest_woocommerce_header_cart')) {
							meditest_woocommerce_header_cart();
						}
						if($meditest_button_shop_signin){

                        ?>
						<div class="header-shop-signin-button d-none d-lg-block">
							<a href="<?php echo esc_url($meditest_button_shop_signin['signinbtnlink']); ?>"><?php echo wp_kses_post($meditest_button_shop_signin['signinbtntexts']); ?></a>
						</div>
                        <?php
                        }
                        ?>
					</div>
				</div>

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