<?php
$text_section_content = estana_get_options('nbcore_header_text_section');
$social_section_content = (estana_get_options('nbcore_header_facebook') || estana_get_options('nbcore_header_twitter') || estana_get_options('nbcore_header_linkedin') || estana_get_options('nbcore_header_instagram') || estana_get_options('nbcore_header_blog') || estana_get_options('nbcore_header_pinterest') || estana_get_options('nbcore_header_ggplus'));
?>
<?php if($social_section_content || $text_section_content || is_active_sidebar('header-top-1') || is_active_sidebar('header-top-2') || get_header_image()): ?>
	<div class="top-section-wrap">
		<div class="container">
			<div class="top-section">
				<?php if($social_section_content || is_active_sidebar('header-top-1')): ?>
					<div class="flex-section">
						<?php dynamic_sidebar('header-top-1');
						if($social_section_content): ?>
							<div class="socials-section">
								<?php estana_social_section(); ?>
							</div>
						<?php endif; ?>
					</div>
				<?php endif; ?>
				<?php if ( get_header_image() ) :
					$custom_header_sizes = apply_filters( 'estana_custom_header_sizes', '(max-width: 576px) 100vw, 1140px' );
					?>
					<div class="flex-section header-image">
						<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
							<img src="<?php header_image(); ?>" srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_custom_header()->attachment_id ) ); ?>" sizes="<?php echo esc_attr( $custom_header_sizes ); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
						</a>
					</div><!-- .header-image -->
				<?php endif; // End header image check. ?>
				<?php if($text_section_content || is_active_sidebar('header-top-2')) : ?>
					<div class="flex-section">
						<?php dynamic_sidebar('header-top-2'); ?>
						<?php echo ($text_section_content ? ('<div class="text-section">' . $text_section_content . '</div>') : ''); ?>
					</div>
				<?php endif; ?>
			</div>
		</div>
	</div>
<?php endif; ?>
<div class="middle-section-wrap">
    <div class="container">
        <div class="middle-section">
            <div class="flex-section logo-section">
                <?php estana_get_site_logo(); ?>
            </div>
            <div class="flex-section main-menu-section">
                <?php estana_main_nav(); ?>
            </div>
            <div class="flex-section icon-header-wrap">
				<div class="search-section">
					<?php estana_search_section(true); ?>
				</div>
				<?php estana_header_woo_section(false); ?>
            </div>
        </div>
    </div>
</div>