<!doctype html>
<html lang="{{ current_language }}">
<head>
  {% include "head_meta.html" %}
  {% block head_meta %}{% endblock %}
  {{ dynamic_head | safe }}

  <title>{% block title %}{{app_name}}{% endblock %}</title>
  <meta name="description" content=" {% block description %} {% endblock %} ">
  <style>
    html,
    body {
      height: 100%;

    }
    body {
    font-family: {{ font.name }}
    }
    .logo {
      max-height: 6rem;
      max-width: 50vw;
    }
    .header-row {
      z-index: 1;
      background-color: {{ primary_color }};
      height: min-content;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    #main-row {
      position: relative;
      flex-grow: 1;
      z-index: 0;
    }

    .left-panel-contents {
      padding: 16px;
    }

    .left-panel {
      background-color: {{ secondary_color }};
    }

    #left-panel {
      background-color: {{ secondary_color }};
      position: absolute;
      height: 100%;
      max-width: 80vw;
      overflow-y: auto;
      color: white;
    }

    .offcanvas-lg.offcanvas-start {
      top: auto;
      width: auto;
    }

    #filter-form form > div {
      padding-bottom: 1rem;
    }

    #filter-form form div > span {
      font-weight: bold;
      padding-bottom: 0.5rem;
    }

    .dropdown-menu {
      z-index: 1;
    }
    .btn {
      padding: 0;
    }

    .btn-close {
      opacity: 1;
    }
    i.fi {
      margin: 0 0.5em;
    }
  </style>
</head>
<body>
{% block body_meta %}
{% include "body_meta.html" %}
{% endblock %}
<div class="container-fluid d-flex flex-column h-100 g-0">
  <div class="row header-row bg-light g-0">
    <nav class="navbar navbar-expand-lg navbar-light p-3" id="mainNav">
      {% if self.left_panel() %}
      <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#left-panel" aria-label="Toggle left panel">
        <i class="fas fa-sliders-h"></i>
      </button>
      {% endif %}
      <a class="navbar-brand" href="/">{% if logo_url %}<img src="{{ logo_url }}" alt="{{ app_name }} logo" class="logo">{% else %}{{_(app_name)}}{% endif %}</a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
              aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
        <i class="fas fa-bars"></i>
      </button>
      <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav">
          {% for menu_item in menu_items %}
          <li class="nav-item">
            <a class="nav-link" href={{menu_item.url}} >{{_(menu_item.name)}}</a>
          </li>
          {% endfor %}
        </ul>
        <ul class="navbar-nav ms-auto">
          <li class="nav-item dropdown">
            <div id="language-dropdown" class="btn-group">
              <button type="button" class="nav-link dropdown-toggle btn btn-link" id="languages-menu" role="button"
                      data-bs-toggle="dropdown" aria-expanded="false">
                <i class="fi fi-{{ current_flag }}"></i>
              </button>
              <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="languages-menu">
                {% for lg,items in languages.items() %}
                <a class="dropdown-item" href={{url_for('change_language', lang=lg, _external=True)}}>
                  <i class="fi fi-{{ items['flag'] }} "></i>{{ items['name'] }}</a>
                {% endfor %}
              </ul>
            </div>
          </li>
        </ul>
      </div>
    </nav>
  </div>
  {% block header %}{% endblock %}

  <div class="row g-0" id="main-row">
    {% if self.left_panel() %}
    <div class="col-lg-2 left-panel" >
      <div id="left-panel" class="left-panel offcanvas-lg offcanvas-start" aria-modal="true" role="dialog">
        <div class="offcanvas-body d-flex">
          <div class="left-panel-contents">
            {% block left_panel %}{% endblock %}
          </div>
          <div class="offcanvas-header justify-content-between align-items-start">
            <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" data-bs-target="#left-panel" ></button>
          </div>

        </div>
      </div>

    </div>
    {% endif %}
    <div class="h-100   {% if self.left_panel() %} col-lg-10 {% else %} col-lg-12 {% endif %}">
      <main class="h-100">
        {% block content %}{% endblock %}
      </main>
    </div>
  </div>

</div>
</body>
</html>
