/* 侧边栏导航样式 */

/* 侧边栏容器 */
.nav-sidebar {
  position: fixed;
  top: 0;
  right: -320px; /* 默认隐藏在屏幕右侧 */
  width: 320px;
  height: 100vh;
  background-color: #ffffff;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.3s ease;
  overflow-y: auto;
}

/* 侧边栏激活状态 */
.nav-sidebar.active {
  right: 0;
}

/* 侧边栏内容 */
.nav-sidebar-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 侧边栏头部 */
.nav-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-sidebar-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #242424;
}

/* 侧边栏关闭按钮 */
.nav-sidebar-close {
  cursor: pointer;
}

/* 侧边栏菜单 */
.nav-sidebar-menu {
  padding: 20px 0;
  flex-grow: 1;
}

/* 侧边栏菜单项 */
.nav-sidebar-item {
  padding: 0 20px;
  margin-bottom: 8px;
}

.nav-sidebar-item a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #242424;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.nav-sidebar-item a:hover {
  background-color: #f8f9fa;
  color: #007bff;
  text-decoration: none;
}

.nav-sidebar-item i {
  margin-right: 12px;
  font-size: 1.4rem;
  width: 24px;
  text-align: center;
}

/* 主内容区域偏移 */
main.active {
  transform: translateX(-20px);
  transition: transform 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .nav-sidebar {
    width: 280px;
    right: -280px;
  }
}

/* 遮罩层 */
.nav-sidebar::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: -1;
}

.nav-sidebar.active::before {
  opacity: 1;
  visibility: visible;
}