// Dropdown Menu (2 levels)
// (specific to this architecture)

$menu-background-color: $menu-background-color;
$menu-background-color-hovered: $menu-background-color-hovered;
$menu-background-color-current: $menu-background-color-current;
$menu-font-color: $menu-font-color;
$menu-font-color-hovered: $menu-font-color-hovered;
$menu-dropdown-background-color: $menu-dropdown-background-color;
$menu-dropdown-background-color-hovered: $menu-dropdown-background-color-hovered;
$menu-dropdown-background-color-current: $menu-dropdown-background-color-current;
$menu-dropdown-font-color: $menu-dropdown-font-color;
$menu-dropdown-font-color-hovered: $menu-dropdown-font-color-hovered;
$menu-dropdown-font-color-current: $menu-dropdown-font-color-current;

$menu-font-size: 14px;

$menu-item-height: 50px;
$submenu-item-height: 30px;


#menu-container {
  @include flex;
  flex-direction: column;
  position: relative;
  background-color: $menu-background-color;
  margin: 0 0 1em;
}

#menu-container:after {
  content: ""; /* empty but necessary */
  position: absolute;
  background-color: $menu-background-color;
  height: 100%;
  left: -50vw;
  width: 150vw;
  z-index: -1;
}

#menu {
  @include flex;
  flex-direction: row;
  flex-wrap: wrap;
  list-style: none;

  width: 100%;
  padding: 0;
  margin: 0;
  align-items: center;
}

#menu li {
  @include flex;
  height: 100%;
}

#menu li.active {
  background-color: $menu-background-color-current;
}

#menu li a {
  @include flex;
  flex-direction: row;
  align-items: center;

  padding: 12px;
  height: $menu-item-height - 24px;

  color: $menu-font-color;
  font-size: $menu-font-size;
  text-align: center;
  text-decoration: none;
}

#menu li.active a {
  color: $menu-font-color-hovered;
}

#menu li.dropdown-displayed a {
  color: $menu-font-color-hovered;
}

#menu li a:hover {
  text-decoration: none;
  color: $menu-font-color-hovered;
}

#menu .menu-label {
  width: 100%;
}

#menu .caret {
  margin-left: 5px;
}

#menu .dropdown.dropdown-displayed {
  background-color: $menu-background-color-hovered;
  color: $menu-font-color-hovered;
}

#menu .dropdown-menu {
  min-width: 180px;
  white-space: nowrap;

  background-color: $menu-dropdown-background-color;
  box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}

#menu .dropdown-menu li {
  width: 100%;
  padding: 0;
}

#menu .dropdown-menu li:hover {
  background-color: $menu-dropdown-background-color-hovered;
}

#menu .dropdown-menu li:hover a {
  color: $menu-dropdown-font-color-hovered;
}

#menu .dropdown-menu li.active {
  background-color: $menu-dropdown-background-color-current;
}

#menu .dropdown-menu li.active > a {
  color: $menu-dropdown-font-color-current;
}

#menu .dropdown-menu a {
  height: $menu-font-size;
  padding: (($submenu-item-height - $menu-font-size) / 2) 12px;
  width: 100%;

  color: $menu-dropdown-font-color;
  font-size: $menu-font-size;
}

/* The sticky class is added to the navbar with JS when it reaches its scroll position */
#menu-container.sticky {
  position: fixed;
  top: 0;
  z-index: 9999;
  //max-width: 60vw;
}

// Prepare responsive behavior
#menu-container .toggle-menu {
  display: none;
  color: $menu-dropdown-font-color;
  background-color: $menu-dropdown-background-color;
  padding: 12px;
  margin: 4px 20px 4px 4px;
  align-self: flex-end;
  border-radius: 5px;
  font-size: 32px;
}

#menu-container .toggle-dropdown {
  display: none;
  color: $menu-dropdown-font-color;
  background-color: $menu-dropdown-background-color;
  font-size: 18px;
  height: 32px;
  margin: 0;
}
