<header class="np-header np-header-color">
  <div class="np-header-content">
    <div class="np-hidden-desktop np-header-mobile-menu-nav">
      {% if current_person.signed_in? %}
        <button
          data-toggle-class="np-hidden"
          class="np-header-mobile-menu-nav-button fal fa-times np-hidden np-header-font-color"
          data-toggle-target=".np-header-mobile-avatar-menu, .np-header-mobile-menu-content, .np-main, .np-footer"></button>
        <button
          data-test="open-mobile-menu"
          data-toggle-class="np-hidden"
          class="np-header-mobile-menu-nav-button np-header-mobile-avatar-menu fal fa-bars"
          data-toggle-target=".fa-times, .np-header-mobile-menu-content, .np-main, .np-footer"></button>
      {% endif %}
    </div>
    {% if current_school.logo_url %}
      <h1 class="np-header-logo">
        <a href="{% route home %}">
          <img
            alt="{{ current_school.name }}"
            class="np-header-logo-image"
            src="{{ current_school.logo_url }}" />
        </a>
      </h1>
    {% else %}
      <a href="{% route home %}" class="np-school-name np-header-font-color">
        {{ current_school.name }}
      </a>
    {% endif %}

    <div class="np-hidden-mobile np-header-desktop-nav">
      <ul class="np-header-desktop-nav-list">

        {% for website_navigation in navigations.header_navigations_external %}
          <li class="np-header-desktop-nav-item">
            <a
              href="{{ website_navigation.path }}"
              class="np-header-desktop-nav-link np-header-font-color"
              target="_blank">
              {{ website_navigation.name }}
            </a>
          </li>
        {% endfor %}
      </ul>
    </div>

    {% if current_person.signed_in? %}
      <div class="np-hidden-mobile np-header-avatar">
        {% comment %} <button
        class="np-header-avatar-button"
        data-test="open-desktop-menu"
        data-toggle-class-on-target="np-hidden"
        data-toggle-target=".np-header-avatar-tooltip"
        data-toggle-outside>
        <img
        alt="{{ current_person.name }}"
        class="np-header-avatar-image"
        src="{{ current_person.avatar_url }}">
        </button> {% endcomment %}
        <div class="np-header-avatar-tooltip np-hidden" role="tooltip">
          <span class="np-header-avatar-tooltip-arrow-up"></span>
          <div class="np-header-avatar-tooltip-learner">
            <div class="np-header-avatar-tooltip-learner-name">
              {{ current_person.name }}
            </div>
            <div class="np-header-avatar-tooltip-learner-email">
              {{ current_person.email }}
            </div>
          </div>
          <nav class="np-header-avatar-tooltip-navigation">
            {% unless current_school.sso_active? %}
              <a class="np-header-avatar-tooltip-navigation-link" href="{% route account %}">
                {% t.profile_settings %}
              </a>
            {% endunless %}
            <a class="np-header-avatar-tooltip-navigation-link np-danger" href="{% route logout %}">
              {% t.sign_out %}
            </a>
          </nav>
        </div>
      </div>
    {% else %}
      <a
        class="np-header-sign-in np-header-desktop-nav-link np-header-font-color"
        aria-label="{% t shared.sign_in %}"
        href="{% route login %}">
        {% t shared.sign_in %}
      </div>
    {% endif %}
  </div>
</header>

<div class="np-hidden-desktop">
  <div class="np-header-mobile-menu-content np-hidden">
    {% if current_person.signed_in? %}
      <div class="np-header-mobile-menu-content-name">
        {{ current_person.name }}
      </div>
    {% endif %}
    <div class="np-header-mobile-menu-content-nav">
      {% for website_navigation in navigations.header_navigations %}
        {% unless website_navigation.name == "Dashboard" %}
          <a
            href="{{ website_navigation.path }}"
            class="np-header-mobile-menu-content-button"
            {% if website_navigation.external? %}
            target="_blank"
            {% endif %}>
            {{ website_navigation.name }}
          </a>
        {% endunless %}
      {% endfor %}
      <div class="np-header-mobile-menu-content-line"></div>
      {% comment %} {% unless current_school.sso_active? %}
      <a class="np-header-mobile-menu-content-button" href="{% route account %}">
      {% t.profile_settings %}
      </a>
      {% endunless %} {% endcomment %}
      <a class="np-header-mobile-menu-content-button np-danger" href="{% route logout %}">
        {% t.sign_out %}
      </a>
    </div>
  </div>
</div>

{% include "messages" %}

<style>

  .np-header {
    padding: 24px 16px;
    height: auto;
    z-index: 51;
  }

  .np-header-logo {
    justify-content: flex-start;
    margin: 0;
  }

  .np-header-logo-image {
    height: 50px;
    transform: rotate(-10deg);
  }

  .np-header-desktop-nav-list {
    background: #fff;
    border-radius: 30px;
    margin: 0 32px;
    padding: 0 24px;
    box-shadow: 0 0 12px rgba(10, 30, 37, 0.15);
  }

  .np-header-desktop-nav-link {
    font-weight: 700;
    font-family: 'Hind', Verdana, sans-serif;
    font-size: 16px;
    line-height: 16px;
  }

  .np-header-mobile-menu-content {
    background-color: #06083c;
    padding-top: 70px;
    top: 0;
  }

  .np-header-mobile-menu-nav-button,
  .np-header-mobile-menu-content-name {
    color: #fff;
  }

  button.fa-times {
    color: #fff;
  }

  .np-header-mobile-menu-content-button.np-danger {
    border: 2px solid #1140c0;
    color: #1140c0;
  }

  @media(min-width:768px) {

    .np-header {
      padding: 32px 16px;
    }

    .np-header-content {
      align-items: flex-start;
    }

    .np-header-logo-image {
      height: 80px;
    }
  }

  @media(min-width:1170px) {
    .np-header-logo-image {
      height: 116px;
    }
  }
</style>