// Sidebar menu
// -----------------------------------------------
// -----------------------------------------------

.sidebar-menu {
  margin-top: $base-point-grid;
  padding: 0;

  .sidebar-menu-item {
    display: flex;
    flex-direction: column;
    position: relative;

    &::before {
      content: "";
      position: absolute;
      left: 20px;
      top: 9px;
      height: 48px;
      width: 16px;
      background-image: url("../img/sidebar-bullet.svg");
      background-repeat: no-repeat;
      background-position-x: center;
      background-position-y: center;
      transition: background-position 0.1s ease;
    }

    .sub-menu {
      max-height: 0;
      transition: max-height 0.3s ease-in-out;
      overflow: hidden;
      margin-left: 26px;
      box-shadow: 1px 0 $line-separator-color inset;

      a {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 13px;
        font-size: 1rem;
        line-height: 1.2rem;
        height: auto;
        width: 80%;
        margin-left: $base-point-grid * 2;

        &.active {
          background-color: $sidebar-active-color;
        }
      }
    }

    a,
    button {
      box-sizing: border-box;
      font-family: $base-font-family;
      font-size: 1rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: $base-point-grid * 3 $base-point-grid * 2 $base-point-grid * 3 56px;
      line-height: $base-point-grid * 2;
      text-align: left;
      width: 100%;
      color: $white;

      @include links($link-color, $link-color, $link-color, $link-color);

      transition: background $base-duration $base-timing;

      &:hover {
        text-decoration: none;
      }
    }

    &.active {
      &::before {
        background-image: url("../img/sidebar-bullet-active.svg");
      }
    }

    &.open {
      .sub-menu {
        max-height: 1600px; // This will suffice for +20 entries in a submenu tops

        a {
          // Set hover color in different order just for the submenu links
          @include links($link-hover, $link-hover, $link-color, $link-color);

          &.active {
            color: $link-color;
          }
        }
      }
    }
  }
}
