@use "../../../../styles/mixins";

.sidebar {
  display: flex;
  flex-direction: column;
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--mantine-color-primary-9), var(--mantine-color-secondary-9));
  color: var(--hi-color-white);
  position: relative;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
  height: 100vh;

  &.closed {
      @media (min-width: 768px) {
        display: none;
      }
  }

  .logo {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;

    a {
      display: flex;
      width: 100%;
    }
  }

  .nav {
    flex: 1 1 auto;
    overflow: auto;
    position: relative;
    padding: 8px 0 24px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;

    &:hover {
      scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    }

    &::-webkit-scrollbar {
      width: 8px;
      background: transparent;
    }

    &::-webkit-scrollbar-thumb {
      background-color: transparent;
      border-radius: 10px;
      transition: background-color 0.2s ease;
    }

    &:hover::-webkit-scrollbar-thumb {
      background-color: rgba(255, 255, 255, 0.2);
    }

    &::-webkit-scrollbar-track {
      background: transparent;
    }

    .sectionHeading {
      padding: 16px 20px 8px;
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: rgba(255, 255, 255, 0.6);
    }

    a,
    button,
    .link {
      display: flex;
      align-items: center;
      color: rgba(255, 255, 255, 0.85);
      padding: 4px 10px;
      text-decoration: none;
      margin: 3px 10px;
      border-radius: var(--hi-radius-md);
      font-size: 0.9em;
      font-weight: 500;
      transition: all 0.2s ease;
      position: relative;
      overflow: hidden;
      cursor: pointer;
      width: calc(100% - 20px);
      background: none;
      border: none;
      text-align: left;

      .navBadge {
        background: var(--hi-primary);
        color: white;
        padding: 2px 6px;
        border-radius: 12px;
        font-size: 0.75em;
        font-weight: 600;
        margin-left: auto;
      }

      &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 0;
        background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
        border-radius: 10px;
        transition: width 0.25s ease;
        z-index: -1;
      }

      &.loading {
        background-color: rgba(255, 255, 255, 0.08);
        animation: pulse 1.5s infinite;
      }

      @keyframes pulse {
        0%, 100% {
          opacity: 0.6;
        }
        50% {
          opacity: 0.3;
        }
      }

      &.linkActive {
        background: rgba(255, 255, 255, 0.12);
        color: white;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

        .linkIcon {
          color: rgba(255, 255, 255, 1);
        }
      }

      &:hover {
        background: rgba(255, 255, 255, 0.08);
        color: white;
        transform: translateY(-1px);

        &::before {
          width: 100%;
        }
      }

      svg {
        margin-right: 12px;
        min-width: 20px;
        color: rgba(255, 255, 255, 0.7);
        transition: color 0.2s ease;
      }
    }
  }

  .sidebarFooter {
    margin-top: auto;
    padding: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
  }

  @media (max-width: 767px) {
    position: fixed;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    transform: translateX(-100%);
    top: 0;
    left: 0;

    &.open {
      transform: translateX(0);
    }
  }

  .sidebarClose {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    z-index: 5;
    flex-shrink: 0;

    &:hover {
      transform: translateY(-50%) scale(1.4);
      color: white;
    }

    @media (max-width: 767px) {
      right: 16px;
      top: 28px;
      transform: none;
      
      &:hover {
        transform: scale(1.1);
      }
    }
  }
}
