@import '../../Pages/MainLayout/themes.scss';

.sidebar {
  flex: 1 0 18rem;
  max-width: 18rem;
  display: flex;
  flex-flow: column nowrap;
  transition: all 0.33s ease;
  @include themify($themes) {
    color: themed('textColor');
    background-color: themed('backgroundColor');
    border-right: themed('borderBottom');

    color: themed('textColorSidebar');
    background-color: themed('backgroundColorSidebar');
    border-right: themed('borderColorSidebar');

    color: themed('customSidebarTxtColor');
    background-color: themed('customSidebarColor');
    border-right: themed('customSidebarColor');
  }

  .links-container {
    height: 100%;
    margin-top: 5rem;
  }

  @at-root {
    @media screen and (min-width: 768px) {
      .fixed-sidebar {
        .sidebar {
          position: fixed;
          top: 0;
          left: 0;
          height: 100%;
          &.expanded {
            width: 18rem;
            overflow-y: auto;
            &::-webkit-scrollbar {
              display: none;
            }
          }
          &.collapsed {
            width: 4rem;
            overflow-y: hidden;
          }
        }
        &.scrolled {
          .sidebar {
            z-index: 120;
          }
        }
        &.on-top {
          .sidebar {
            z-index: 100;
          }
        }
      }
      .fixed-navbar {
        .sidebar {
          z-index: 100;
        }
      }
      .on-top .sidebar {
        z-index: 100;
      }
    }
  }
  @media screen and (max-width: 767px) {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    min-height: 100%;
    width: 16rem;
    z-index: 110;
    overflow-y: auto;
    transform: translateX(0) translateY(0) scaleX(1) scaleY(1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &.collapsed {
      transform: translateX(-16rem) translateY(0) scaleX(1) scaleY(1);
    }
  }

  .submenu {
    @media (min-width: 768px) {
      > ul {
        transition: opacity 0.33s ease;
      }
    }
  }
  &.expanded {
    .submenu {
      > ul {
        opacity: 1;
      }
    }
  }
  &.collapsed {
    flex: 0 0 5em;
    .submenu {
      > ul {
        @media (min-width: 768px) {
          opacity: 0;
        }
        @media (max-width: 767px) {
          opacity: 1;
        }
      }
    }
    .logo {
      width: 4rem;
      a {
        svg {
          height: 28px;
          width: 28px;
        }
        span {
          max-width: 0;
          visibility: hidden;
          opacity: 0;
        }
      }
    }
  }
  .logo {
    position: fixed;
    z-index: 110;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    min-height: 5rem;
    width: 100%;
    white-space: nowrap;
    padding-left: 2rem;
    max-width: 16rem;
    flex: 0;
    transition: all 330ms cubic-bezier(0, 0, 0.2, 1);

    @include themify($themes) {
      background-color: themed('backgroundColor');
      border-bottom: themed('borderBottom');
      border-right: themed('borderBottom');

      border-right: themed('borderColorSidebar');
      background-color: themed('backgroundColorSidebar');
      border-bottom: themed('borderColorSidebar');

      background-color: themed('customSidebarColor');
      border-right: themed('customSidebarColor');
      border-bottom: themed('customSidebarColor');
    }

    a {
      img {
        position: relative;
        height: 28px;
      }
      span {
        transition: all 0.15s ease-in-out;
        margin-right: 0;
        margin-left: 8px;
      }
    }
  }
  ul {
    margin: 0;
    padding: 0;
  }
  .li {
    transition: all 0.33s ease;
    width: 100%;
    margin: 0;
    list-style-type: none;
    font-size: 1rem;
    position: relative;
    @include themify($themes) {
      color: themed('textColor');
      background-color: themed('backgroundColor');

      color: themed('textColorSidebar');
      background-color: themed('backgroundColorSidebar');

      color: themed('customSidebarTxtColor');
      background-color: themed('customSidebarColor');
    }
  }
  > ul:last-child {
    margin-top: 4rem;
    margin-bottom: 30px;
  }
  $selector: 'ul';
  @for $i from 1 to 4 {
    $selector: $selector + ' ul';
    #{$selector} {
      width: 0;
      height: 0;
      overflow: hidden;
    }
    #{$selector} li {
      > a,
      > div {
        padding-left: calc(#{$i}* 10px - 4px);
      }
    }
  }
}
