<?php if ($this['widgets']->count('toolbar-l + toolbar-r + search')) : ?>
<div id="tm-toolbar" class="tm-toolbar">
  <div class="uk-container uk-container-center uk-clearfix">

    <?php if ($this['widgets']->count('toolbar-l')) : ?>
    <div class="uk-float-left"><?php echo $this['widgets']->render('toolbar-l'); ?></div>
    <?php endif; ?>

    <?php if ($this['widgets']->count('search')) : ?>
    <div class="uk-float-right uk-hidden-small"><?php echo $this['widgets']->render('search'); ?></div>
    <?php endif; ?>

    <?php if ($this['widgets']->count('toolbar-r')) : ?>
    <div class="uk-float-right"><?php echo $this['widgets']->render('toolbar-r'); ?></div>
    <?php endif; ?>

  </div>
</div>
<?php endif; ?>

<div class="tm-header-container tm-header-full-width" <?php if ($this['config']->get('sticky_mainbar')) echo 'data-uk-sticky'; if ($this['config']->get('sticky_on_scrollup')) echo '="{showup: true, animation: \'uk-animation-slide-top\'}"' ?>>
  
  <?php if ($this['widgets']->count('minibar')) : ?>
  <div class="tm-minibar">
      <?php echo $this['widgets']->render('minibar'); ?>
  </div>
  <?php endif; ?>

  <div class="<?php if ($this['widgets']->count('call-action')) : ?>tm-header-call<?php endif; ?>">
  <div class="tm-header uk-flex uk-flex-middle">

      <?php if ($this['widgets']->count('logo')) : ?>
      <a class="tm-logo uk-hidden-small" href="<?php echo $this['config']->get('site_url'); ?>"><?php echo $this['widgets']->render('logo'); ?></a>
      <?php endif; ?>

      <?php if ($this['widgets']->count('logo-small')) : ?>
      <a class="tm-logo-small uk-visible-small" href="<?php echo $this['config']->get('site_url'); ?>"><?php echo $this['widgets']->render('logo-small'); ?></a>
      <?php endif; ?>

      <?php if ($this['widgets']->count('menu + mega-menu + headerbar + offcanvas + call-action')) : ?>  
      <div class="uk-flex uk-flex-middle uk-flex-item-1 uk-flex-right">
          
        <?php if ($this['widgets']->count('menu + mega-menu')) : ?>
        <div class="uk-hidden-small">
            <nav class="tm-navbar uk-navbar">
            <?php if ($this['widgets']->count('mega-menu')) : ?>
            <jdoc:include type="modules" name="mega-menu" title="Mega Menu" />
            <?php else : ?>
            <?php echo $this['widgets']->render('menu'); ?>
            <?php endif; ?>
            </nav>
        </div>
        <?php endif; ?>

        <?php if ($this['widgets']->count('headerbar')) : ?>
        <div class="tm-headerbar">
            <?php echo $this['widgets']->render('headerbar'); ?>
        </div>
        <?php endif; ?>

        <?php if ($this['widgets']->count('offcanvas')) : ?>
        <a href="#offcanvas" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas></a>
        <?php endif; ?>

        <?php if ($this['widgets']->count('call-action')) : ?>
        <div class="tm-call-action uk-hidden-small uk-flex uk-flex-middle">
            <?php echo $this['widgets']->render('call-action'); ?>
        </div>
        <?php endif; ?>

      </div>
      <?php endif; ?>
  </div>
  </div>
</div>