{#
<!--
#   Copyright © 2021,2022 IsardVDI S.L.
#
#   This file is part of DD
#
#   DD is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or (at your
#   option) any later version.
#
#   DD is distributed in the hope that it will be useful, but WITHOUT ANY
#   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#   FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
#   details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with DD. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
-->
#}
{% block css %}
<style>
  body {
    font-family: 'LeagueSpartan', sans-serif;
  }
  /* Header used classes */
  header#header {
    background-color: white !important;
    box-shadow: 0 2px 4px #00000014;
    border-bottom: 1px solid #262626;
    display: inline-flex;
    top: 0;
    width: 100%;
    z-index: 2000;
    height: 50px;
    position: fixed;
    box-sizing: border-box;
    justify-content: space-between;
  }

  #nextcloud {
    padding: 7px 0;
    padding-left: 86px;
    position: relative;
    height: 100%;
    box-sizing: border-box;
    opacity: 1;
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
  }

  a * {
    cursor: pointer;
  }

  a {
    border: 0;
    color: var(--color-main-text);
    text-decoration: none;
    cursor: pointer;
  }

  #theming-preview-logo,
  #header #nextcloud {
    padding-left: 64px;
  }

  #header #header-left,
  #header .header-left {
    flex: 1 0;
    white-space: nowrap;
    min-width: 0;
  }

  #header #header-right,
  #header .header-right {
    justify-content: flex-end;
    flex-shrink: 1;
  }

  #header .header-right > div,
  #header .header-right > form {
    height: 100%;
    position: relative;
  }

  /* MEGAMENÚ */
  
#header #navbar-menu-apps #menu-apps-btn #dropdownMenuAppsButton {
    cursor: pointer;
    height: 16px;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#header #navbar-menu-apps #menu-apps-btn #dropdownMenuAppsButton>svg {
    transform: scale(.5);
}

#header div#navbar-menu-apps {
    display: flex;
    align-items: center;
}

#header #navbar-menu-apps #menu-apps-btn {
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 5px;
    background-color: #f0f0f0;
    position: relative;
    left: -15px;
    top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#header #navbar-menu-apps .dropdown-menu {
    display: none;
    position: absolute;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 5px;
    box-shadow: rgb(0 0 0 / 20%) 0 3px 8px;
    margin-top: 11px;
    padding: 10px;
    max-height: 500px;
    overflow-y: scroll;
    z-index: 2000;
    background-color: white;
    top: 33px;
    right: -14px;
    left: auto;
}

#header #navbar-menu-apps .dropdown-menu ul {
    list-style: none;
    display: grid;
    flex-wrap: wrap;
    padding: 2px 2px 10px 0;
    margin-bottom: 0;
    grid-template-columns: 133px 133px;
    grid-gap: 12px 2px;
}

#header #navbar-menu-apps .dropdown-menu ul#app-admin {
    border-bottom: 1px solid #D9D9D9;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

#header #navbar-menu-apps .dropdown-menu ul#app-external {
    border-top: 1px solid #D9D9D9;
    padding-top: 20px;
    margin-top: 8px;
}

#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: start;
    text-align: center;
    color: #262626;
    text-decoration: none;
    background-color: #F0F0F0;
    margin-right: 8px;
    border-radius: 5px;
    padding: 5px;
}
#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link:hover {
    background-color: {{ data.colours.primary }};
}
#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link .icon {
    width: 40px;
    height: 40px;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-radius: 0.25rem;
}

#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link .text {
    text-align: left;
    margin-left: 0;
    height: 26px;
    max-width: 71px;
    font-size: 13px;
    line-height: 15px;
    overflow-wrap: anywhere;
    display: flex;
    align-items: center;
    position: relative;
    top: 1px;
}

#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link .icon i {
    color: {{ data.colours.primary }};
    font-size: 19px;    
}
#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link:hover .icon i {
    color: #FFF;
}
#header #navbar-menu-apps .dropdown-menu ul li.app a.app-link:hover .text {
    color: #FFF;
}

  #header #header-left,
  #header .header-left,
  #header #header-right,
  #header .header-right {
    display: inline-flex;
    align-items: center;
  }

  #navbar-menu-apps:hover #dropdownMenuApps {
    display: block;
  }

  /* AVATAR IMAGE AND DROPDOWN */
  #avatarimg {
    border-radius: 50%;
    flex-shrink: 0;
  }

  .icon {
    font-size: 26px;
    line-height: 1em;
    width: 40px;
  }

  .dropdown {
    left: -115px;
  }

  #navbar-nextcloud #user_avatar .avatardiv img {
    height: 39px;
    width: 39px;
    margin-top: 5px;
    margin-right: 10px;
  }

  /* Dropdown Content (Hidden by Default) */
  .dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 5px;
    background-color: white;
  }

  /* Links inside the dropdown */
  .dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
  }

  /* Change color of dropdown links on hover */
  .dropdown-content a:hover {
    background-color: #ddd;
  }

  /* Show the dropdown menu on hover */
  #user_avatar:hover .dropdown-content {
    display: block;
  }
  /* ScrollBar */
/* width */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

/* Track */
::-webkit-scrollbar-track {
  background: inherit;
}

/* Handle */
::-webkit-scrollbar-thumb {
  background: #D9D9D9;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #C2C2C2;
  width: 6px;
}
/* ScrollBar */
</style>
{% endblock %}
<header role="banner" id="header">
  <div id="navbar-logo" class="header-left">
    <a href="/" id="nextcloud">
      <img src="{{ data.logo }}" alt="" style="height: 39px" />
    </a>
  </div>

  <div id="navbar-nextcloud" class="header-right">
    <div id="navbar-menu-apps">
      <div id="menu-apps-btn">
        <div
          id="dropdownMenuAppsButton"
          data-toggle="dropdown"
          aria-haspopup="true"
          aria-expanded="false"
        >
        <svg id="menu-apps-icon" data-name="Menú Apps" xmlns="http://www.w3.org/2000/svg" height="48" width="48">
          <path d="M33.95 24.1q-.3 0-.55-.1-.25-.1-.5-.35l-8.55-8.55q-.25-.25-.35-.5-.1-.25-.1-.55 0-.3.1-.55.1-.25.35-.5l8.55-8.55q.25-.25.5-.35.25-.1.55-.1.3 0 .55.1.25.1.5.35L43.55 13q.25.25.35.5.1.25.1.55 0 .3-.1.55-.1.25-.35.5L35 23.65q-.25.25-.5.35-.25.1-.55.1Zm-26.45-3q-.65 0-1.075-.425Q6 20.25 6 19.6V7.55q0-.65.425-1.075Q6.85 6.05 7.5 6.05h12.05q.65 0 1.075.425.425.425.425 1.075V19.6q0 .65-.425 1.075-.425.425-1.075.425ZM28.4 42q-.65 0-1.075-.425-.425-.425-.425-1.075V28.45q0-.65.425-1.075.425-.425 1.075-.425h12.05q.65 0 1.075.425.425.425.425 1.075V40.5q0 .65-.425 1.075Q41.1 42 40.45 42ZM7.5 42q-.65 0-1.075-.425Q6 41.15 6 40.5V28.45q0-.65.425-1.075.425-.425 1.075-.425h12.05q.65 0 1.075.425.425.425.425 1.075V40.5q0 .65-.425 1.075Q20.2 42 19.55 42Z"/>
      </svg>
        </div>
        <div
          id="dropdownMenuApps"
          class="dropdown-menu dropdown-menu-right"
          aria-labelledby="dropdownMenuButton"
        >
          <ul id="app-apps">
            {% for item in data.apps_internal %}
            <li class="app {{ item.shorname }}">
              <a href="{{ item.href }}" class="app-link" target="_blank">
                <div class="icon {{ item.shorname }}">
                  <i class="{{ item.icon }}" aria-hidden="true"></i>
                </div>
                <div class="text">{{ item.name }}</div>
              </a>
            </li>
            {% endfor %}
          </ul>

          <ul id="app-external" class="external-links">
            {% for item in data.apps_external %}
            <li class="app {{ item.shorname }}">
              <a href="{{ item.href }}" class="app-link" target="_blank">
                <div class="icon {{ item.shorname }}">
                  <i class="{{ item.icon }}" aria-hidden="true"></i>
                </div>
                <div class="text">{{ item.name }}</div>
              </a>
            </li>
            {% endfor %}
          </ul>
        </div>
      </div>
    </div>
    <div id="user_avatar">
      <div id="menu-profile-btn" class="avatardiv avatardiv-shown">
        <div
          id="dropdownProfileButton"
          data-toggle="dropdown"
          aria-haspopup="true"
          aria-expanded="false"
        >
          <img
            id="avatarimg"
            alt=""
            width="32"
            height="32"
            src="{{ data.user_avatar }}"
          />
        </div>
        <div class="dropdown">
          <div class="dropdown-content">
            <a href="/logout"
              ><i class="fa fa-sign-out icon"></i
              ><span class="text">Logout</span></a
            >
          </div>
        </div>
      </div>
    </div>
    <div id="dd-logo">
      <a href="https://xnet-x.net/ca/digital-democratic/" target="_blank">
        <img
          src="{{ data.product_logo }}"
          alt=""
          style="height: 16px; margin-right: 21px; margin-top: 16px"
        />
      </a>
    </div>
  </div>
</header>
