.navbar-brand {
  margin-left: 15px;
  height: 90px;
  width: 180px;
  background: url('../img/logo.png') no-repeat left center;
  background-image: url('../img/logo.svg'), none;
  background-size: 180px;
  @media (max-width: 767px) {
    height: 66px;
    background: url('../img/logo-xs.png') no-repeat left center;
    background-image: url('../img/logo.svg'), none;
    background-size: 144px;
  }
}

.navbar-fixed-top {
  border-width: 0;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
  @media (max-width: @screen-xs-max) {
    position: relative;
    margin-bottom: 0;
  }
}

.navbar-toggle {
  border: none;
  margin-top: 0;
  margin-bottom: 0;
  .icon-bar {
    background-color: #fff !important
  }
}

.navbar-collapse {
  max-height: 100%;
}

.dropdown-menu {
  border-radius: 0;
  min-width: 80px;
  border: none;

  padding: 0;
  & > li {
    & > a {
      padding: 13px 20px;
      border-bottom: 1px solid @hwk-blue-light-25;
    }
    &.active > a,
    & > a:active,
    & > a:focus,
    & > a:hover {
      background-color: @hwk-blue-light-25;
      color: @hwk-blue-dark;
    }
  }
}

// --------------------- //
#main-menu {
  font-size: @font-size-small;
  margin-left: -@grid-gutter-width-half;

  & > li > a {
    &:hover {
      background-color: @hwk-blue-dark-75;
    }
  }
  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
    li {
      a {
        padding-left: 14px;
        padding-right: 14px;
      }
    }
    & > li:first-child a {
      padding-left: @grid-gutter-width-half;
    }
  }
}

header {
  background-color: @hwk-blue-light-50;
  height: 90px;
}
#logo {
  background: @hwk-blue-light-25;
  height: 90px;
  margin-left: -1000px;
  padding: 0 0 0 1000px;
  min-width: 1250px;
  width: calc(25% + 1000px);
  .navbar-brand {
    margin-left: @grid-gutter-width-half;
    @media (min-width: @screen-xl-min) {
      margin-left: @grid-gutter-width-half-xl;
    }
  }
  img {
    width: 180px;
  }
  @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {
    min-width: 1230px;
  }
  @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
    min-width: 1200px;
    width: calc(33.3333% + 1000px);
    width: -webkit-calc(33.3333% + 1000px);
    width: -moz-calc(33.3333% + 1000px);
  }
}
.header-menu {
  float: right;
  margin-top: 25px;
  & > li {
    float: left;
    font-size: 14px;
    height: 34px;
    line-height: 34px;
    padding-left: 10px;
    & > a, &.open > a {
      padding: 0;
      background: transparent;
      color: @hwk-blue-dark;
      &:active,
      &:focus,
      &:hover {
        background-color: transparent !important;
      }
    }
    &.active a {
      color:@hwk-blue-light;
      background-color: transparent !important;
    }
    &.divider {
      padding-left: 10px;
      color: @hwk-blue-dark;
      &:after {
        content: '|';
      }
    }
    &.text-hidden {
      margin-left: 6px;
    }
    .glyphicon {
      font-size: 22px;
      top: 4px;
      width: auto;
    }
    span.h4 {
      display: block;
    }
  }
  .dropdown-menu {
    font-size: 14px;
  }
}

// --------------------- //
// SUBMENU FULL SIZE
// -> needs class .submenu-full-width
//
@media (min-width: @screen-sm-min) {
  .submenu-full-width {
    .navbar-collapse {
      .nav {
        & > li.dropdown {
          position: initial;
        }
        li.dropdown {

          &.open > ul.dropdown-menu {

            width: 100vw;
            left: 0;

            padding: 40px calc((100vw - (@container-xl - @grid-gutter-width)) / 2);
            @media (min-width: @screen-lg-min) and (max-width: @screen-lg-max) {
              padding: 40px calc((100vw - (@container-lg - @grid-gutter-width)) / 2);
            }
            @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {
              padding: 40px calc((100vw - (@container-md - @grid-gutter-width)) / 2);
            }
            @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
              padding: 40px calc((100vw - (@container-sm - @grid-gutter-width)) / 2);
            }

            // ------------------------------ //
            // Solution COLUMNS
            //
            column-count: auto;
            column-width: @mega-menu-column-width;


            // submenu 2nd level
            & > li {
              // prevent submenu from flowing into next column
              display: inline-block; // working add to elemnt which you do not want to break
              min-width: @mega-menu-column-width;
              border-top: 1px solid @hwk-blue-dark;
              font-size: 16px;

              & > a {
                padding: 10px 0;
                font-weight: 600;
                border-bottom: none;

                &:active,
                &:focus,
                &:hover {
                  background-color: transparent !important;
                  color: @hwk-blue-light !important;
                }
              }
            }

            ul.dropdown-menu {
              position: relative;
              display: inline-block;
              float: none;
              box-shadow: none;
              // submenu 3rd level
              li {
                font-size: 16px;

                & > a {
                  background-color: transparent;
                  border: none;
                  padding: 10px 0;
                  &:active,
                  &:focus,
                  &:hover {
                    background-color: transparent !important;
                    color: @hwk-blue-light !important;
                  }
                }

                &:last-child {
                  margin-bottom: 20px;
                }
              }
            }
            // ------------------------------ //
          }
        }
        ul.dropdown-menu {
          li {
            &, & a {
              color: @hwk-blue-dark;
              background-color: transparent;
            }
            &.active,
            &.active > a {
              color: @hwk-blue-light;
            }

            a {
              max-width: @mega-menu-column-width;
              white-space: break-spaces;
            }
          }
        }
      }
    }
  }
}



// --------------------- //
// MAIN MENU MOBILE
//
@media (max-width: @screen-xs-max) {

  #logo {
    min-width: 100vw !important;
    max-width: 100vw;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .navbar-brand {
      margin-left: 23px; // same as logo icon height
    }
  }

  .search {
    color: @hwk-blue-dark;
    margin-right: 90px;
    margin-top: 5px;
    .glyphicon {
      font-size: 22px;
      width: auto;
    }
  }

  .container .navbar-header {
    margin-left: -@grid-gutter-width-half-xs;
    margin-right: -@grid-gutter-width-half-xs;
  }
  .navbar-collapse {
    .nav {
      li.dropdown {
        &, a {
          color: #fff;
        }
      }
    }
  }

  .navbar-default {
    .header-menu {
      margin-top: 0;
      background-color: @hwk-blue-light-50;
      margin-left: -@grid-gutter-width-half;
      padding-left: @grid-gutter-width-half;
      margin-right: -@grid-gutter-width-half;
      padding-right: @grid-gutter-width-half;
      padding-bottom: @grid-gutter-width-half;
      float: none;
      .navbar-nav {
        &, .open {
          li {
            &, a {
              color: @hwk-blue-dark;
            }

            a {
              &:active,
              &:focus,
              &:hover {
                color: @hwk-blue-dark;
              }
            }

            &.text-hidden {
              float: left;
            }
          }
        }
      }
    }
  }

  // reset all active|hover |focus
  .navbar-nav {
    li.active a,
    .open > a,
    a:active, a:hover, a:focus {
      background-color: transparent !important;
    }
    .dropdown-menu, li {
      margin-top: 0;
      margin-bottom: 0;
      padding-top: 0;
      padding-bottom: 0;
      ul {
        li {
          font-size: 16px;
          a {
            padding: 5px 15px 5px 25px;
          }
        }
      }
    }

    .hwk-open > a > .caret {
      transform: scaleY(-1);
    }
  }

  .navbar-default {

    header {
      height: @header-height-xs;
      //height: auto;
      #logo {
        padding: 0;
        margin: 0;
        height: 66px;
        width: 100%;
        img {
          width: 144px;
        }
      }
    }

    .navbar-toggle {
      position: relative;
      top: -((@header-height-xs + @header-navbar-height-xs) / 2);
      border: none;
      padding: 0;
      margin: 0;
      right: 23px + 5; // see logo margin left

      .icon-bar {
        background-color: @hwk-blue-dark !important;
      }

      &:active,
      &:focus,
      &:hover {
        background-color: transparent !important;

        .icon-bar {
          &,
          &::before,
          &::after {
            background-color: @hwk-blue-light !important;
          }
        }
      }

      // hamburger animation to cross
      transition: all 0.3s linear, background-color 0s;
      width: @hamburger-width;
      height: @hamburger-width;

      .icon-bar {
        // hide others icon bars
        display: none;
        // show pnly one
        &:last-child {
          display: block;
          margin-top: 0;
        }

        &, // middle line
        &::before, // top line
        &::after { // bottom line
          position: absolute;
          width: @hamburger-width;
          height: @hamburger-line-height;
          background-color: @hamburger-line-color;
          left: 0;
        }

        &::before {
          content: '';
          bottom: (@hamburger-width / 2)-(@hamburger-line-height * 2) - 2;
        }

        &::after {
          transition: all 0.3s linear, background-color 0s;
          content: '';
          top: (@hamburger-width / 2)-(@hamburger-line-height * 2) - 2;
        }
      }
    }

    .container .navbar-collapse {
      max-height: calc(100vh - @header-height-xs);
      position: absolute;
      width: 100%;
      top: @header-height-xs;
      background-color: @hwk-blue-dark;
      overflow-x: hidden;
      margin-left: -@grid-gutter-width-half-xs;
      margin-right: -@grid-gutter-width-half-xs;
      padding-left: @grid-gutter-width-half-xs;
      padding-right: @grid-gutter-width-half-xs;

      #main-menu {  // ul
        margin-top: 0;
        margin-bottom: 0;

        // style dropdown mobile
        .dropdown-menu {
          position: static;
          float: none;
          width: auto;
          margin-top: 0;
          background-color: transparent;
          border: 0;
          box-shadow: none;
          & > li > a {
            white-space: normal;
          }
        }
        
        .active {
          & > a {
            color: @hwk-blue-light-75 !important;
          }
        }

        // first level
        & > li {
          font-size: @font-size-base-p;
          font-weight: @font-weight-bold;
          border-top: 1px solid #fff;
          &:first-child {
            border-top: none;
          }
          & > a {
            padding-top: 16px;
            padding-bottom: 16px;
          }
          &.dropdown {
            // always hide when bs class is used
            // crazy js problems as it was automatically shown again after hiding ?
            &.open > .dropdown-menu {
              display: none;
            }
            // use hwk-open
            &.hwk-open > .dropdown-menu {
              display: block;
            }

            // second level
            & > .dropdown-menu { // ul
              background-color: @hwk-blue-light-25;
              & > li {
                border-bottom: 1px solid #fff;
                &:last-child {
                  border-bottom: none;
                }
                & > a {
                  font-size: 18px;
                  font-weight: @font-weight-bold;
                  color: @hwk-blue-dark;
                  padding: 16px 15px 16px 40px;
                }
                &.dropdown {
                  & > a::after {
                    content: '';
                    display: inline-block;
                    width: 0;
                    height: 0;
                    margin-left: 6px;
                    vertical-align: middle;
                    border-color: @hwk-blue-dark;
                    border-top: @caret-width-base dashed;
                    border-top: @caret-width-base solid ~"\9"; // IE8
                    border-right: @caret-width-base solid transparent;
                    border-left: @caret-width-base solid transparent;
                  }
                  &.hwk-open > a::after {
                    transform: scaleY(-1);
                  }

                  &.hwk-open {
                    border-bottom: none;
                  }
                  &.hwk-open >  .dropdown-menu { // ul
                    display: block;
                  }
                  // third level
                  .dropdown-menu { // ul
                    background-color: #fff;
                    & > li {
                      border-bottom: 1px solid @hwk-blue-light-25;

                      & > a {
                        font-size: 18px;
                        font-weight: @font-weight-normal;
                        color: @hwk-blue-dark;
                        padding: 16px 15px 16px 70px;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  *[data-navbar-toggle="open"] {

    & .navbar-default, &.navbar-default {
      // menu open
      .navbar-toggle:not(.closed) {
        width: @hamburger-width + (@hamburger-line-height * 2);

        .icon-bar {
          width: @hamburger-width + (@hamburger-line-height * 2);
          //top: 10px;
          top: calc(50%);
          left: 5px;
          transform: rotate(-45deg);
          // adjust properties on the after pseudo element
          &::after {
            top: 0px;
            left: 0px;
            transform: rotate(90deg);
            width: @hamburger-width + (@hamburger-line-height * 2);
          }

          // hide top line by scaling it to 0
          &::before {
            transform: scale(0);
          }
        }
      }
    }
  }
}

// --------------------- //
// 3. NAV LEVEL classic
//
#header-nav-3 {
  display: none;
  //display: flex;    // added by js
  justify-content: center;

  position: relative;
  z-index: 2;
  margin-top: -40px;
  padding-top: 30px;
  padding-bottom: 30px;
  margin-bottom: 40px;
  width: 100%;
  background: #fff;
  box-shadow: 3px 3px 6px rgba(@gray-dark, .2);

  h1, .h1 {
    font-size: @font-size-h3;
    color: @hwk-blue-dark !important;
    margin: 0;
    padding: 0;
  }
  ul {
    list-style: none;
    li {
      &, a {
        color: @hwk-blue-dark;
        font-weight: @font-weight-normal;
      }
      &.active > a,
      a:hover, a:focus, a:active {
        color: @hwk-blue-dark;
        font-weight: @font-weight-bold;
      }
    }
  }
  & > .row {
    margin-left: auto;
    margin-right: auto;
    @media (min-width: @screen-xl-min) {
      width: @container-xl;
    }
    @media (min-width: @screen-lg-min) and (max-width: @screen-lg-max) {
      width: @container-lg;
    }
    @media (min-width: @screen-md-min) and (max-width: @screen-md-max) {
      width: @container-md;
    }
    @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
      width: @container-sm;
    }
    @media (max-width: @screen-xs-max) {
      width: 100%;
    }
  }
  // not mobile | tablet
  @media (min-width: @screen-md-min) {

    #nav-level-3 {
      align-self: flex-end;
      ul {
        display: flex;
        margin: 0;
        li {
          margin: 0 0 2px 30px;
        }
      }
    }
    .col-md-12 {
      float: none;
      display: flex;
      justify-content: space-between;
      .clearfix, hr {
        position: absolute;
        display: none;
      }
    }
  }

  // mobile | tablet
  @media (max-width: @screen-sm-max) {
    margin-top: -30px;
    padding-left: @grid-gutter-width-half-xs;
    padding-right: @grid-gutter-width-half-xs;
    #nav-level-3 {
      margin-top: 20px;
      ul {
        li {
          margin-top: 10px;
          float: none;
        }
      }
    }
    hr {
      display: none;
    }
  }

  @media (max-width: @screen-xs-max) {
    top: -20px;
  }
}
// --------------------- //