.navigation-mobile {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 100%;
  max-width: 100vw;
  transition:
    left ease $transition-base-speed,
    right ease $transition-base-speed,
    width ease $transition-base-speed;

  .navigation-items {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    min-height: $navigation-mobile-height;
    padding-bottom: $navigation-mobile-bottom-offset;
    background-color: rgba(darken($gray-darker, 7%), 0.95);
    border-top: 1px solid rgba(30, 34, 38, 0.5);

    .navigation-item-image {
      max-width: 24px;
      margin-right: 3px;
      margin-left: 3px;
      vertical-align: middle;
    }

    > button {
      flex-direction: column;
    }

    > * {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      min-height: $navigation-mobile-height;
      margin-right: 0;
      padding: 0;
      border-radius: 0;
      opacity: 0.9;

      &::after {
        position: absolute;
        top: 0;
        left: 10%;
        display: none;
        width: 80%;
        height: 3px;
        background: $primary;
        border-bottom-right-radius: 2px;
        border-bottom-left-radius: 2px;
        box-shadow: 2px 0 10px rgba(darken($primary, 20%), 0.9);
        content: "";
      }

      &.active {
        opacity: 1;

        &::after {
          display: block;
        }
      }
    }
  }
}

.navigation-header {
  position: relative;
  left: 0;
  display: flex;
  justify-content: center;
  padding: 20px 15px;

  .environment-label {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;

    &.spacing-right {
      right: 230px;
    }

    .git-revision {
      cursor: pointer;
    }
  }

  .quick-search-bar {
    width: 600px;

    .form-input {
      margin-bottom: 0;
    }
  }
}

.nav-toggle {
  display: block;
  height: 43px;
  margin-right: 10px;
  padding: 0 11px;
  background-color: transparent;
  border: 1px solid transparent;
  border-color: transparent;
  border-radius: 3px;

  .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #c8c8c8;
    border-radius: 1px;
    transition: all ease 0.2s;
  }

  .top-bar {
    transform: rotate(45deg);
    transform-origin: 10% 10%;
  }

  .middle-bar {
    margin-top: 4px;
    opacity: 0;
  }

  .bottom-bar {
    margin-top: 4px;
    transform: rotate(-45deg);
    transform-origin: 10% 90%;
  }

  .update-icon {
    position: absolute;
    top: 12px;
    right: 8px;
    width: 10px;
    height: 10px;
    background-color: $warning;
    border-radius: 50%;
    transition: all ease 0.5s;
  }

  &.collapsed {
    .top-bar,
    .bottom-bar {
      transform: rotate(0);
    }

    .middle-bar {
      opacity: 1;
    }
  }
}

nav {
  position: relative;
  z-index: 1000;
  width: 300px;
  min-width: 300px;
  height: 100vh;

  .nav-container {
    position: fixed;
    width: 300px;
    height: 100%;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: rgba($gray-darker, 0.5);
    border-right: 1px solid rgba(30, 34, 38, 0.5);

    .nav-container-inner {
      position: relative;
      min-height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      > :first-child {
        padding-top: 20px;
      }

      > :last-child {
        padding-top: 30px;
        padding-bottom: 20px;
        margin-bottom: env(safe-area-inset-bottom);
      }
    }

    a {
      transition: none;
    }

    ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .logo-menu {
      min-height: 60px;

      .logo-menu-image {
        position: absolute;
        top: 10px;
        left: 20px;
        width: 40px;
      }

      .logo-menu-label {
        display: block;
        padding-top: 6px;
        padding-right: 20px;
        padding-left: 50px;
        font-family: "Orbitron", sans-serif;
      }
    }

    &.nav-container-slim {
      width: 80px;

      .logo-menu {
        > :first-child {
          min-height: 60px;
        }
      }
    }
  }

  &.nav-slim {
    width: 80px;
    min-width: 80px;
  }
}

@media (max-width: $desktop-breakpoint) {
  .navigation-header {
    right: 0;
    left: auto;
    flex-direction: row-reverse;
    transition: right ease $transition-base-speed;

    .nav-toggle {
      margin-right: 0;
      margin-left: 10px;
    }
  }

  nav {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: auto;
    margin-top: env(safe-area-inset-top);

    .nav-container {
      position: fixed;
      top: 0;
      right: -300px;
      bottom: 0;
      left: auto;
      width: 300px;
      padding-top: env(safe-area-inset-top);
      padding-left: env(safe-area-inset-left);
      transition:
        left ease $transition-base-speed,
        right ease $transition-base-speed,
        width ease $transition-base-speed;

      .nav-container-inner {
        > :first-child {
          padding-top: 5px;
        }

        > :last-child {
          padding-bottom: 10px;
        }
      }
    }
  }

  .nav-visible {
    .navigation-mobile {
      right: 300px;
    }

    .navigation-header {
      right: 300px;

      .environment-label {
        left: -280px;
      }
    }

    nav {
      .nav-container {
        right: 0;
      }
    }
  }
}

@media (max-width: 370px) {
  nav {
    .nav-container {
      right: -250px;
      width: 250px;
    }
  }

  .nav-visible {
    .navigation-mobile {
      right: 250px;
    }

    .navigation-header {
      right: 250px;

      .environment-label {
        left: -230px;
      }
    }
  }
}
