@import "../1-Helpers/variables";
@import "../1-Helpers/mixins";
@import "../2-Tools/transitions";

.sidenav-trigger {
  cursor: pointer;
  width: max-content;
}

.sidenav-container {
  display: flex;
  background-color: inherit;

  .main-content {
    flex: 1;
    background-color: inherit;
  }
}

.sidenav {
  width: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 999;
  position: relative;
  background-color: inherit;
  transition: $transition-fast-out;

  // background: white;
  @include themify {
    background: themed("sidenavBackground");
  }

  @include tablet-and-down {
    position: absolute;
    top: 0;
  }

  @include laptop-and-up {
    width: 90px;
  }

  .sidenav-trigger {
    position: absolute;
    top: 5px;
    right: 50%;
    transform: translateX(50%);
    transition: inherit;
    z-index: 1;
    width: 28px;
    height: 28px;

    @include themify {
      background-color: themed("sidenavTriggerBackground");
    }

    i.material-icons {
      font-size: 18px;

      @include themify {
        color: themed("sidenavTrigger");
      }
    }
  }

  header {
    text-align: center;
    padding: 0.5rem 0;
    opacity: 0;

    .title {
      text-transform: uppercase;
      font-size: $text-lg;
    }
  }

  main {
    ul {
      li {
        transition: $transition-fast-out;
        cursor: pointer;
        padding: 0 18px;
        border-radius: 5px;
        width: 60px;
        margin: 5px auto;
        display: flex;
        align-items: center;
        line-height: 54px;

        &:not(.divider) {
          height: 44px;
        }

        span {
          line-height: inherit;
          flex: 1;
          display: none;
        }

        a {
          display: flex;
          align-items: center;
          color: inherit;
          width: 100%;
        }

        .material-icons {
          margin-right: 10px;
        }

        &.active {
          color: white;

          @include themify {
            background-color: themed("sidenavActiveBackground");
          }
        }

        &:hover:not(.active):not(.subheader) {
          @include themify {
            background-color: themed("sidenavHover");
          }
        }

        &.subheader {
          color: $grey-light-1;
          cursor: default;
          height: 24px;
          padding-left: 0;
          padding-right: 0;
          // display: flex;
          // justify-content: center;
        }
      }
    }
  }

  &.primary {
    background: $primary-color;
    color: white;

    .sidenav-trigger i.material-icons {
      color: white;
    }

    li {
      &.subheader {
        color: $grey-light-3;
      }
      &:hover {
        &:not(li.subheader),
        &:not(li.active) {
          background: #ffffff29 !important;
        }
      }
      &.divider {
        background: #ffffff69;
      }
    }
  }

  &.active {
    width: 80%;

    @include laptop-and-up {
      width: 300px;
    }

    .sidenav-trigger {
      right: 5px;
      transform: translateX(0);

      i.material-icons {
        transform: rotate(180deg);
      }
    }

    header {
      opacity: 1;
    }

    li {
      width: 90%;
      padding: 0 20px;

      @include laptop-and-up {
        width: 80%;
      }

      span {
        display: block;
      }

      &.subheader {
        padding-left: 20px;
        padding-right: 20px;
      }
    }
  }
}
