/* =========================================
   VARIABLES (USING YOUR DESIGN SYSTEM)
========================================= */

$primary: #5e3817;
$primary-2: #7a4b20;

$primary-light: rgba(122, 75, 32, 0.08);
$primary-soft: rgba(122, 75, 32, 0.12);
$primary-soft-strong: rgba(122, 75, 32, 0.18);
$primary-border: rgba(122, 75, 32, 0.25);
$primary-muted: rgba(122, 75, 32, 0.6);

$border-light: rgba(0, 0, 0, 0.06);
$text-dark: #1a1a1a;
$text-muted: #6b6b6b;
$bg-soft: #faf8f6;

/* ===============================
   OVERLAY
=============================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;

  &.fadeIn {
    opacity: 1;
    pointer-events: auto;
  }

  &.fadeOut {
    opacity: 0;
    pointer-events: none;
  }
}

/* ===============================
   MOBILE SIDEBAR
=============================== */
.mobileSidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden; // 🔥 important
  transition: transform 0.3s ease;

  &.slideIn {
    transform: translateX(0%);
  }

  &.slideOut {
    transform: translateX(-100%);
  }

  /* ===============================
     ADMIN HEADER
  =============================== */
  &__admin {
    padding: 1rem;
    border-bottom: 1px solid $border-light;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;

    h3 {
      font-size: 0.88rem;
      font-weight: 600;
      color: $primary;
    }

    small {
      font-size: 0.65rem;
      font-weight: 500;
      color: $primary-muted;
    }
  }

  /* ===============================
     LINKS CONTAINER
  =============================== */
  &__links {
    flex: 1; // 🔥 takes remaining space
    overflow-y: auto;
    padding: 1rem 0.5rem;

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-track {
      background: $bg-soft;
    }

    &::-webkit-scrollbar-thumb {
      background: $primary-muted;
      border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb:hover {
      background: $primary;
    }
  }

  /* ===============================
     SECTIONS
  =============================== */
  &__section {
    margin-bottom: 1.1rem;

    &:not(:first-child) {
      padding-top: 0.5rem;
      border-top: 1px dashed $primary-light;
    }

    &__title {
      display: block;
      margin: 0.5rem 0 0.35rem 0.75rem;
      font-size: 0.62rem;
      font-weight: 600;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: $primary-muted;
    }
  }

  /* ===============================
     LINKS
  =============================== */
  .link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    color: $text-dark;
    position: relative;
    transition: all 0.25s ease;

    &:hover {
      background: $primary-light;
      transform: translateX(3px);

      .icon {
        background: $primary-soft;
        color: $primary;
      }

      .link-label {
        color: $primary;
      }

      .link-desc {
        color: $primary-muted;
        opacity: 1;
      }
    }
  }

  /* ===============================
     ACTIVE LINK
  =============================== */
  .active {
    @extend .link;

    background: linear-gradient(
      135deg,
      $primary-soft-strong,
      $primary-light
    );

    box-shadow: 0 8px 20px rgba(122, 75, 32, 0.12);
    border: 1px solid $primary-border;

    &::before {
      content: "";
      position: absolute;
      left: 0;
      top: 25%;
      width: 4px;
      height: 50%;
      background: linear-gradient(to bottom, $primary, $primary-2);
      border-radius: 3px;
    }

    .icon-active {
      background: linear-gradient(135deg, $primary, $primary-2);
      color: #ffffff;
      box-shadow: 0 6px 14px rgba(122, 75, 32, 0.25);
    }

    .active-arrow {
      color: $primary;
    }

    .link-label {
      color: $primary;
      font-weight: 600;
    }

    .link-desc {
      font-size: 0.77rem;
      color: $text-muted;
      transition: all 0.25s ease;
      font-weight: 500 !important;
      opacity: .85;
    }
  }

  /* ===============================
     ICONS
  =============================== */
  .icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: $bg-soft;
    color: $primary-muted;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
  }

  .icon-active {
    @extend .icon;
    background: linear-gradient(135deg, $primary, $primary-2);
    color: #ffffff;
  }

  /* ===============================
     TEXT
  =============================== */
  .link-text {
    display: flex;
    flex-direction: column;
    flex: 1;

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

    .link-desc {
      font-size: 0.77rem;
      color: $text-muted;
      transition: all 0.25s ease;
      font-weight: 500 !important;
      opacity: .85;
    }
  }

  .active-arrow {
    margin-left: auto;
  }

  /* ===============================
     FOOTER (🔥 FIXED PROPERLY)
  =============================== */
  &__footer {
    margin-top: auto; // 🔥 pushes to bottom
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid $border-light;
    background: $bg-soft;
    flex-shrink: 0;

    &__avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, $primary, $primary-2);
      color: #ffffff;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    &__text {
      display: flex;
      flex-direction: column;

      h4 {
        font-size: 0.85rem;
        font-weight: 600;
        color: $text-dark;
      }

      small {
        font-size: 0.7rem;
        color: $text-muted;
      }
    }
  }
}