@import '../../../styles/variables.scss';

.sidebar-mobile-trigger {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 34;
  min-width: 98px;
  min-height: 46px;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(12, 69, 96, 0.96), rgba(28, 135, 162, 0.94));
  color: #f7fcff;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 16px 30px rgba(7, 28, 45, 0.24);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(7, 23, 35, 0.4);
  backdrop-filter: blur(4px);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 224px;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.9rem 1rem;
  background:
    linear-gradient(180deg, rgba(12, 39, 60, 0.96) 0%, rgba(16, 63, 85, 0.94) 100%),
    $primary-color;
  color: #eef8ff;
  box-shadow: 18px 0 42px rgba(8, 30, 49, 0.18);
  backdrop-filter: blur(18px);
  transition: width 0.28s ease, transform 0.28s ease;

  &.collapsed {
    width: 88px;

    .brand-copy,
    .sidebar__section,
    .menu__copy {
      display: none;
    }

    .menu a,
    .logout-btn {
      justify-content: center;
    }

    .sidebar__footer {
      align-items: center;
    }
  }
}

.sidebar__mobile-close {
  margin-left: auto;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #eff9ff;
  font-weight: 700;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.4rem 1rem;
  margin-bottom: 0.4rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e9f8fb 0%, #79d7d4 100%);
  color: #12405a;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 24px rgba(14, 36, 51, 0.25);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;

  strong {
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    letter-spacing: -0.03em;
  }

  span {
    color: rgba(229, 244, 252, 0.72);
    font-size: 0.82rem;
  }
}

.sidebar__section {
  padding: 0.55rem 0.55rem 0.9rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(226, 242, 250, 0.54);
  font-weight: 800;
}

.menu-scrollable {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.menu a,
.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 0.75rem;
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
  color: #eff9ff;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.menu a:hover,
.menu a.active,
.logout-btn:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.menu__badge {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.11);
  color: #f7fcff;
  font-family: 'Sora', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.menu__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;

  strong {
    font-size: 0.94rem;
    font-weight: 700;
  }

  small {
    color: rgba(226, 242, 250, 0.66);
    font-size: 0.77rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.8rem;
}

.logout-btn {
  border: 0;
  cursor: pointer;
}

.toggle-btn-modern {
  align-self: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #effbff 0%, #c6edf2 100%);
  color: #13455d;
  box-shadow: 0 12px 22px rgba(7, 28, 45, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;

  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(7, 28, 45, 0.28);
  }

  span {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    width: min(82vw, 320px);
    transform: translateX(-100%);
    box-shadow: 18px 0 42px rgba(8, 30, 49, 0.28);

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

  .sidebar__section,
  .menu__copy {
    display: flex !important;
  }

  .sidebar__footer {
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  }

  .menu a,
  .logout-btn {
    justify-content: flex-start;
  }

  .toggle-btn-modern {
    display: none;
  }
}

@media (min-width: 1101px) {
  .sidebar-mobile-trigger,
  .sidebar-backdrop,
  .sidebar__mobile-close {
    display: none;
  }
}

@media (max-width: 720px) {
  .sidebar-mobile-trigger {
    top: 0.85rem;
    left: 0.85rem;
  }

  .sidebar {
    width: min(88vw, 320px);
    padding: 0.9rem 0.8rem 1rem;
  }

  .brand-copy strong {
    font-size: 0.94rem;
  }
}
