@keyframes navigation-open {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes navigation-close {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.body-flow {
  overflow-x: hidden;
}

.tui-navigation {
  background-color: $color-blue-300;
  position: relative;
  z-index: 9000;
}

.tui-navigation-background {
  position: relative;
  background: $color-blue-300;
  height: $topnav-height;
  z-index: 6;
}

@include breakpoint(md) {
  .tui-navigation-background {
    margin-bottom: 0;
    z-index: 1001;
    height: 63px;
  }

  .logo-container {
    margin-top: -#{$margin-enterprise};
  }
}

.tui-top-navigation {
  @extend %flexbox-row;
  position: relative;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  height: $topnav-height;
  padding-bottom: 0;

  @include breakpoint(sm) {
    height: inherit;
    padding: 0;
  }

  a {
    outline: 0;
  }

  .logo-container {
    display: inline-block;
    flex-grow: 1;
  }

  .customer-tools-mobile {
    @extend %flexbox-row;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    height: 44px;
  }

  .users {
    .pictogram {
      height: 30px;
      width: 30px;
      vertical-align: -.4em;
      margin-right: 0;
    }

    a {
      color: $color-white;
    }

    @include breakpoint(md) {
      display: none;
    }
  }

  li {
    width: 100%;
    text-align: left;
    padding: 0;
    order: 2;

    &.search {
      order: 1;
      height: auto;
    }

    .finder-container {
      .finder-app {
        top: 30px;
        height: auto;
        border-bottom: 1px solid $color-tui-grey-25;
      }

      @media (max-width: $screen-sm-max) {
        position: relative;
        margin: 0;
        left: 0;
        top: 0;
        padding: 0;
        /* stylelint-disable max-nesting-depth */
        .finder-app {
          background: transparent;
          top: 0;
          display: block;
          opacity: 1;
          position: relative;
          padding: 0;
        }
        /* stylelint-enable */
      }
    }
  }
}

.navigation-main {
  display: none;
  margin: 0;
  padding: 0;
  z-index: 1000;
  background: $color-white;
  border-radius: $border-radius-normal;
  position: absolute;
  top: 65px;
  width: 100%;
  left: 0;
  flex-flow: column;
  transform: translateX(0);
  transition: transform .6s;
  opacity: 1;

  &.active-sub {
    transform: translateX(-100vw);
    transition: transform .6s;

    .go-back {
      display: block;

      a:before {
        content: '';
        display: none;
      }
    }
  }

  .pictogram {
    margin: -#{$margin-half} 0;
  }

  &:before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7.5px 10px;
    border-color: transparent transparent rgba($color-white, .97);
    position: absolute;
    top: -10px;
    right: 25px;
  }

  ul {
    @extend %flexbox-column;
  }

  li {
    display: inline-block;

    a {
      @include font-size(14);
      font-weight: bold;
      text-transform: uppercase;
      white-space: nowrap;
      letter-spacing: .05em;
      display: block;
      padding: $margin-normal + $margin-half $margin-normal;

      &:before {
        width: 20px;
        display: inline-block;
      }

      &:hover,
      &:active {
        background: $color-blue-100;
      }
    }

    &.go-back,
    &.mobile-only {
      display: block;
    }

    &.mobile-only.mobile-lang-switcher {
      @extend %flexbox-row;
      padding: $margin-normal $margin-normal $margin-enterprise;
      align-items: center;

      .country-flag {
        width: 24px;
        height: 24px;
      }

      a {
        padding: 0;
        margin-left: $margin-double;
        /* stylelint-disable max-nesting-depth */
        &:hover {
          background: none;
        }
        /* stylelint-enable */
      }
    }

    ul {
      position: absolute;
      left: 100vw;
      padding: 0;
      top: 0;
      width: 100%;
      display: none;
      background: $color-white;
      border-radius: 4px;

      &.active {
        @extend %flexbox-row;
      }
    }

    &.has-sub {
      > a {
        @extend %flexbox-row;
        justify-content: space-between;
        align-items: center;
        /* stylelint-disable max-nesting-depth */
        .down {
          display: none;

          @include breakpoint(md) {
            display: inline-block;
            filter: drop-shadow(0 -1px 1px rgba($color-black, .5));
            position: relative;
            top: .4em;
          }
        }

        .right {
          display: inline-block;

          @include breakpoint(md) {
            display: none;
          }
        }

        &:after {
          content: '';
          display: none;
        }
        /* stylelint-enable */
      }
    }
  }

  @include breakpoint(md) {
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-grow: 7;
    flex-flow: row;
    z-index: 7;
    text-align: right;
    position: static;
    width: auto;

    &:before {
      display: none;
    }

    li {
      $font-size: 16;
      width: auto;
      position: relative;

      &.search {
        order: 3;
        padding: 0;
        /* stylelint-disable max-nesting-depth */
        a {
          &:active,
          &:hover {
            border-bottom: 0;
          }
        }
        /* stylelint-enable */
      }

      a {
        @include font-size($font-size);
        color: $color-white;
        text-shadow: 0 1px 1px rgba($color-black, .5);
        border-bottom: 2px solid rgba($color-white, 0);
        padding: $margin-half $margin-normal $margin-normal;
        /* stylelint-disable max-nesting-depth */
        &.active,
        &:hover {
          text-decoration: none;
          border-bottom: 2px solid $color-white;
          background: transparent;
        }

        &:focus {
          text-decoration: none;
          color: $color-red-400;
        }
        /* stylelint-enable */
      }

      &.mobile-only,
      &.mobile-only.mobile-lang-switcher {
        display: none;
        /* stylelint-disable max-nesting-depth */
        &.selected {
          display: none;
        }
        /* stylelint-enable */
      }

      &.has-sub {
        /* stylelint-disable max-nesting-depth */
        a {
          align-items: baseline;
        }
        /* stylelint-enable */
      }

      ul {
        background: rgba($color-white, .95);
        position: absolute;
        top: $margin-double + $font-size;
        left: 0;
        width: auto;
        min-width: 100%;
        padding: $margin-normal 0;
        margin: 0 auto;
        display: none;
        flex-flow: column;
        border-radius: 4px;
        opacity: 1;
        /* stylelint-disable max-nesting-depth */
        &:before {
          content: '';
          height: 0;
          border: 7.5px solid transparent;
          border-bottom: 10px solid $color-white;
          border-top-width: 0;
          position: absolute;
          top: -10px;
          left: 30px;
        }

        li {
          a {
            @include font-size(14);
            font-weight: bold;
            text-transform: uppercase;
            outline: 0;
            display: block;
            padding: $margin-normal $margin-normal + $margin-half;
            color: $color-link-blue;
            text-shadow: none;
            border: 0;

            &.active,
            &:active,
            &:hover {
              text-decoration: none;
              background: $color-blue-100;
              border: 0;
            }

            &:focus {
              text-decoration: none;
              color: $color-red-400;
            }
          }
        }
        /* stylelint-enable */
      }

      &:hover {
        /* stylelint-disable max-nesting-depth */
        ul {
          display: flex;
          position: absolute;
          left: 0;
          opacity: 1;
          top: $margin-double + $font-size;
        }
        /* stylelint-enable */
      }
    }
  }
}

.hide-nav,
.show-nav {
  display: flex;
}

.hide-nav {
  animation: navigation-close .6s ease-in-out;
}

.show-nav {
  animation: navigation-open .6s ease-in-out;
}

.navigation-icon {
  display: inline-block;
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0;
  width: 44px;
  height: 44px;
  font-size: 0;
  cursor: pointer;
  background: transparent;
  order: 3;

  @include breakpoint(md) {
    display: none;
  }

  &:focus {
    outline: 0;
  }

  span {
    display: block;
    position: absolute;
    top: 20px;
    left: 11px;
    right: 11px;
    height: 4px;
    background: $color-white;
    transition: background 0s .3s;
    border-radius: $border-radius-normal;

    &::before,
    &::after {
      position: absolute;
      display: block;
      left: 0;
      width: 100%;
      height: 4px;
      background-color: $color-white;
      content: '';
      border-radius: $border-radius-normal;
    }

    &::before {
      top: -8px;
      transition: transform .3s 0s, top .3s .3s;
    }

    &::after {
      bottom: -8px;
      transition: transform .3s 0s, bottom .3s .3s;
    }
  }
}

.navigation-checkbox {
  position: absolute;
  left: -99999em;

  &:checked {
    + .navigation-icon {
      span {
        background: none;
        /* stylelint-disable max-nesting-depth */
        &::before {
          top: 0;
          transform: rotate(45deg);
          transition: top .3s 0s, transform .3s .3s;
        }

        &::after {
          bottom: 0;
          transform: rotate(-45deg);
          transition: bottom .3s 0s, transform .3s .3s;
        }
        /* stylelint-enable */
      }
    }
  }
}

.tui-navigation-overlay {
  display: block;
  position: fixed;
  top: 0;
  right: 0;
  bottom: -40px;
  left: 0;
  z-index: 1;
  background: rgba($color-black, .5);

  @include breakpoint(md) {
    display: none;
  }
}
