$mobile-menu-breakpoint: md;

.sidemenu {
  position: fixed;
  display: flex;
  flex-flow: column;
  flex-direction: column;
  width: $side-menu-width;
  z-index: $zindex-sidemenu;

  a:focus {
    text-decoration: none;
  }

  .sidemenu__logo_small_breakpoint {
    display: none;
  }

  .sidemenu__close {
    display: none;
  }

  @include media-breakpoint-up($mobile-menu-breakpoint) {
    background: $side-menu-bg;
    height: auto;
    position: relative;
    z-index: $zindex-sidemenu;
  }
}

// body class that hides sidemenu
.sidemenu-hidden {
  .sidemenu {
    display: none;
  }
}

.sidemenu__top {
  padding-top: 40px;
  flex-grow: 1;
}

.sidemenu__bottom {
  padding-bottom: $spacer;
}

.sidemenu__top,
.sidemenu__bottom {
  display: none;

  @include media-breakpoint-up($mobile-menu-breakpoint) {
    display: block;
  }
}

.sidemenu-item {
  position: relative;
  @include left-brand-border();

  @include media-breakpoint-up($mobile-menu-breakpoint) {
    &.active,
    &:hover {
      background-color: $side-menu-item-hover-bg;
      @include left-brand-border-gradient();

      .dropdown-menu {
        border: none;
        margin: 0;
        display: block;
        opacity: 0;
        top: 0px;
        // important to overlap it otherwise it can be hidden
        // again by the mouse getting outside the hover space
        left: $side-menu-width - 2px;
        @include animation('dropdown-anim 150ms ease-in-out 100ms forwards');
        z-index: $zindex-sidemenu;
      }
    }
  }
}

.dropup.sidemenu-item:hover .dropdown-menu {
  top: auto !important;
}

.sidemenu-link {
  color: $side-menu-icon-color !important;
  line-height: 42px;
  padding: 0px 10px 0px 10px;
  display: block;
  position: relative;
  font-size: 16px;
  border: 1px solid transparent;
  text-align: center;

  img {
    border-radius: 50%;
    width: 28px;
    height: 28px;
    box-shadow: 0 0 14px 2px rgba(255, 255, 255, 0.05);
  }
}

@include keyframes(dropdown-anim) {
  0% {
    opacity: 0;
    //transform: translate3d(-5%,0,0);
  }
  100% {
    opacity: 1;
    //transform: translate3d(0,0,0);
  }
}

.icon-circle {
  width: 35px;
  height: 35px;
  display: inline-block;
  position: relative;

  img {
    position: relative;
  }
}

.side-menu-header {
  padding: 10px 10px 10px 20px;
  white-space: nowrap;
  background-color: $side-menu-item-hover-bg;
  font-size: 17px;
  color: $side-menu-header-color;
}

.side-menu-header-link {
  color: $side-menu-header-color !important;
  border: none !important;
  padding: 0 !important;
}

.dropdown-menu--sidemenu > li > .side-menu-header-link:hover {
  color: #fff !important;
  background-color: $side-menu-item-hover-bg !important;
}

.sidemenu-subtitle {
  padding: $space-sm $space-md $space-sm;
  font-size: $font-size-sm;
  color: $text-color-weak;
  border-bottom: 1px solid $dropdownDividerBottom;
  margin-bottom: $space-xs;
  white-space: nowrap;
}

li.sidemenu-org-switcher {
  border-bottom: 1px solid $dropdownDividerBottom;
}

.sidemenu-org-switcher__org-name {
  font-size: $font-size-base;
}

.sidemenu-org-switcher__org-current {
  font-size: $font-size-xs;
  color: $text-color-weak;
  position: relative;
  top: -2px;
}

.sidemenu-org-switcher__switch {
  font-size: $font-size-sm;
  padding-left: $space-lg;
  display: flex;
  align-items: center;
  > i.fa.fa-random {
    margin-right: $space-xs;
    top: 1px;
  }
}

.sidemenu__logo {
  display: block;
  padding: 6px 14px 6px 9px;
  min-height: $navbarHeight;
  position: relative;
  height: $navbarHeight - 1px;

  &:hover {
    background: lightOrDark($gray33, $gray25);
  }

  img {
    width: 26px;
    position: relative;
    top: 5px;
    left: 8px;
  }
}

@include media-breakpoint-down(sm) {
  .sidemenu-open--xs {
    li {
      font-size: $font-size-md;
    }

    .sidemenu {
      width: 100%;
      background: $side-menu-bg-mobile;
      height: auto;
      box-shadow: $side-menu-shadow;
      position: relative;
      z-index: $zindex-sidemenu;
    }

    .sidemenu__close {
      display: block;
      font-size: $font-size-md;
      position: relative;
      top: -3px;
    }

    .sidemenu__top,
    .sidemenu__bottom {
      display: block;
    }
    .sidemenu-item {
      border-right: 2px solid transparent;
    }
  }

  .sidemenu {
    .sidemenu__logo {
      display: none;
    }

    .sidemenu__logo_small_breakpoint {
      padding: 13px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: baseline;
      cursor: pointer;

      .fa-bars {
        font-size: 25px;
      }
    }

    .sidemenu__top {
      padding-top: 0;
    }

    .side-menu-header {
      padding-left: 10px;
    }

    .sidemenu-link {
      text-align: left;
    }

    .sidemenu-icon {
      display: none;
    }

    .dropdown-menu--sidemenu {
      display: block;
      position: unset;
      width: 100%;
      float: none;
      margin-bottom: $space-sm;

      > li > a {
        padding-left: 15px;
      }
    }

    .sidemenu__bottom {
      .dropdown-menu--sidemenu {
        display: flex;
        flex-direction: column-reverse;
      }
    }
  }
}
