@use "mixins";
@use "variables";

.layout-sidebar {
  position: fixed;
  width: var(--sidebar-width, 225px);
  height: calc(100dvh - 6.1rem);
  z-index: 999;
  overflow-y: auto;
  user-select: none;
  top: 5rem;
  left: 1.1rem;
  transition: transform variables.$transitionDuration, left variables.$transitionDuration;
  background-color: var(--card-background);
  border: 1px solid var(--p-content-border-color);
  border-radius: variables.$borderRadius;
  padding: 0.5rem 0.8rem 0.5rem 1.35rem;
  box-shadow: 0px 3px 5px rgba(0, 0, 0, .02), 0px 0px 2px rgba(0, 0, 0, .05), 0px 1px 4px rgba(0, 0, 0, .08);
}


.layout-menu {
  margin: 0;
  padding: 0;
  list-style-type: none;

  .layout-menuitem-text {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .layout-root-menuitem {
    > .layout-menuitem-root-text {
      font-size: .857rem;
      text-transform: uppercase;
      font-weight: 700;
      color: var(--surface-900);
      margin: .75rem 0;
    }

    > a {
      display: none;
    }
  }

  a {
    user-select: none;

    &.active-menuitem {
      > .layout-submenu-toggler {
        transform: rotate(-180deg);
      }
    }
  }

  li.active-menuitem {
    > a {
      .layout-submenu-toggler {
        transform: rotate(-180deg);
      }
    }
  }

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

    a {
      display: flex;
      align-items: center;
      position: relative;
      outline: 0 none;
      color: var(--text-color);
      cursor: pointer;
      padding: 0.45rem 0.3rem 0.45rem 0.6rem;
      border-radius: variables.$borderRadius;
      transition: background-color variables.$transitionDuration, box-shadow variables.$transitionDuration;

      .layout-submenu-toggler {
        font-size: 75%;
        margin-left: auto;
        transition: transform variables.$transitionDuration;
      }

      &.active-route {
        font-weight: 700;
        color: var(--primary-color);
      }

      &:hover {
        background-color: var(--surface-hover);
      }

      &:focus {
        @include mixins.focused-inset();
      }
    }

    ul {
      overflow: hidden;
      border-radius: variables.$borderRadius;

      li {
        a {
          margin-left: 1rem;
        }

        li {
          a {
            margin-left: 2rem;
          }

          li {
            a {
              margin-left: 2.5rem;
            }

            li {
              a {
                margin-left: 3rem;
              }

              li {
                a {
                  margin-left: 3.5rem;
                }

                li {
                  a {
                    margin-left: 4rem;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
