@import '_variables';

// less than 992px
@media (max-width: ($tablet - 0.02px)) {
  .theme-mix > .toggle-sidebar-button {
    display: block;
    position: fixed;
    bottom: 0.5rem;
    left: 1rem;
    z-index: 10;
  }
}

.sidebar-mask {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
}

// less than 1200px
@media (max-width: ($desktop - 0.02px)) {
  .sidebar-open .sidebar-mask {
    display: block;
  }
}

.sidebar {
  border-right: 1px solid var(--border-color);

  .navbar-links {
    display: none;
    height: auto;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0.75rem 0.75rem 0;

    // less than 992px
    @media (max-width: ($tablet - 0.02px)) {
      & {
        display: block;
      }
    }
  }

  a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem 0;
    color: var(--text-secondary-color);
    white-space: nowrap;
    border-right: 2px solid transparent;
  }

  // less than 992px
  @media (max-width: ($tablet - 0.02px)) {
    .navbar-links-item a {
      margin-left: 0.5rem !important;
      padding-left: 0.5rem !important;
    }
  }

  .mobile-dropdown-title {
    display: block;
    margin: 0.25rem 0;
    margin-left: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    color: inherit;
    line-height: 1.5rem;

    // less than 992px
    @media (max-width: ($tablet - 0.02px)) {
      margin-left: 0.5rem;
      padding-left: 0.5rem;
    }
  }

  .sidebar-item-link-group-title,
  a.sidebar-item-link,
  a.sidebar-outbound-link {
    &:hover {
      color: var(--theme-color);
    }
  }

  a.nav-link.router-link-active,
  a.active {
    color: var(--theme-color);
  }

  .navbar-links-item {
    display: block;
    margin: 0;
    font-weight: 500;
  }

  // ------------------------------------ Sidebar Items ------------------------------------
  .sidebar-items {
    list-style: none;
    margin: 0;
    padding-left: 0;

    // less than 992px
    @media (max-width: ($tablet - 0.02px)) {
      & {
        padding-top: 0.75rem;
      }
    }
  }

  .sidebar-items-sub {
    padding-top: 0;
  }

  .sidebar-item {
    font-size: 14px;
    line-height: 1.4;

    .arrow {
      display: flex;
      justify-content: center;
      align-items: center;
      color: var(--text-secondary-color);
      width: 16px;
      height: 16px;
      text-align: center;
      cursor: pointer;
      z-index: 10;

      &:hover {
        background-color: var(--deep-bg-color);
        border-radius: 3px;

        svg {
          color: var(--theme-color);
        }
      }

      svg {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      }
    }

    .sidebar-item-text,
    .sidebar-item-group-title,
    .sidebar-item-link-group-title {
      flex: 1;
      display: inline-block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      z-index: 10;
    }

    .sidebar-item-group-title,
    .sidebar-item-link-group-title {
      font-weight: 600;
    }

    a.router-link-active {
      color: var(--theme-color);
      font-weight: 600;
      border-right: 2px solid var(--theme-color);

      &::before {
        z-index: auto;
        content: '';
        background-color: var(--deep-bg-color);
        position: absolute;
        left: -#{$sidebarWidth};
        right: 0;
        top: 0;
        bottom: 0;
        pointer-events: none;
      }
    }
  }

  .sidebar-item:not(.collapsed) {
    & > .sidebar-item-group,
    & > .sidebar-item-link-group {
      .arrow svg {
        transform: rotate(90deg);
      }
    }
  }

  .sidebar-items-sub .sidebar-item {
    padding-left: 1rem;
  }

  .collapsed ul.sidebar-items-sub {
    overflow: hidden;
    height: 0 !important;
  }
}
