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

.sidebar {
  height: 100vh;
  background: #09090B;
  padding-top: 1rem;
  position: fixed;
  width: 280px;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 999;
  color: variables.$col-white;
  border-right: 1px solid variables.$col-border-lining;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  ::-webkit-scrollbar{
    display: block !important;
    color: #555 !important;
    border-radius: 1px;
    width: 1px !important;
  }

  .admin__sidebar__logo {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 1rem;
  }

  .logoWrapper {
    width: 180px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    img {
      width: 100%;
      height: 100%;

      object-fit: contain;

      display: block;
    }
  }

  &__links {
    padding: 1.5rem 2rem 1rem 2rem;
    flex: 1;
    padding-left: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;

    /* Custom scrollbar */
    &::-webkit-scrollbar {
      width: 6px;
    }
    &::-webkit-scrollbar-track {
      background: #121212;
    }
    &::-webkit-scrollbar-thumb {
      background: #555;
      border-radius: 3px;
    }
    &::-webkit-scrollbar-thumb:hover {
      background: #FF7000;
    }

    @media only screen and (max-width: 1000px) {
      padding: 1rem;
    }
  }

  &__avatar {
    background: linear-gradient(
      to bottom right,
      rgba(255, 140, 0, 0.04),
      rgba(255, 255, 255, 0.02)
    );
    position: relative;
    cursor: pointer;
    margin: 1rem;
    border-radius: 5px;
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 0.2rem 0.7rem;

    &--avatar {
      background: #FF8C42;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0.4rem 0.5rem;
      border-radius: 5px;
      font-weight: 700;
      color: variables.$col-dark;
    }

    &--text {
      display: flex;
      flex-direction: column;
      h3 {
        font-weight: 600;
        padding-top: 0.4rem;
        color: variables.$col-white;
        font-size: .8rem;
      }
      small {
        color: variables.$col-white;
        font-weight: 500;
        font-size: 0.75rem;
        padding-bottom: 0.4rem;
        opacity: 0.7;
      }
    }
  }

  .link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.4rem 1rem;
    border-radius: 5px;
    color: variables.$col-white !important;
    font-family: variables.$font;
    font-weight: 500;
    font-size: 0.78rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    position: relative;

    .icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 5px;
      background: #1A1A1B;
      color: #71717B;
      flex-shrink: 0;
    }

    .link-text {
      display: flex;
      flex-direction: column;
      flex: 1;

      .link-label {
        font-weight: 500;
        font-size: 0.88rem;
      }

      .link-desc {
        font-size: 0.65rem;
        opacity: 0.6;
      }
    }

    &:hover {
      background: variables.$col-active-btn-bg;
    }
  }

  .active {
    @extend .link;
    background: linear-gradient(135deg, #251A0E, #23140A);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);

    .icon-active {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 5px;
      background: #512D05;
      color: #FFB800;
    }

    .active-arrow {
      margin-left: auto;
      color: #FFB800;
    }

    /* Half-height left border */
    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 25%;
      width: 4px;
      height: 50%;
      background: #FF7000;
      border-radius: 2px;
    }
  }
}

/* Mobile styles */
.hamburger {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
}

.sidebar.mobile {
  transform: translateX(-100%);
}

.sidebar.mobile.open {
  transform: translateX(0);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}


/* ===============================
   SIDEBAR SECTIONS (USER)
================================ */
.sidebar__section {
  margin-bottom: 1.1rem;

  &:not(:first-child) {
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
  }
}

.sidebar__section__title {
  display: block;
  margin: 0.6rem 0 0.4rem 0.75rem;

  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;

  color: rgba(255, 255, 255, 0.45);
}

/* Optional: highlight active section */
.sidebar__section:has(.active) .sidebar__section__title {
  color: #ffb000;
}
