/* ============================================================
   sidebar.css — 左侧固定导航 + 弹窗
   ============================================================ */

.sidebar {
  width: 240px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(15, 18, 24, 0.95);
  border-right: 1px solid rgba(212, 184, 122, 0.15);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: visible;
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  margin-bottom: 2.5rem;
  text-align: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  position: relative;
  width: 100%;
}

.sidebar-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: 8px;
  transition: 0.3s;
  display: block;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--gold);
  background: rgba(212, 184, 122, 0.08);
}

/* 返回主页 */
.sidebar-nav a.back-link {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  padding-left: 0;
  color: var(--dim);
}
.sidebar-nav a.back-link:hover {
  background: transparent;
  color: var(--gold);
  transform: translateX(-4px);
}

/* ============ 弹窗 ============ */
.nav-popover {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  margin-left: 10px;
  background: rgba(20, 24, 32, 0.98);
  border: 1px solid rgba(212, 184, 122, 0.3);
  border-radius: 12px;
  padding: 0.6rem;
  min-width: 160px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-popover::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(20, 24, 32, 0.98);
  border-left: 1px solid rgba(212, 184, 122, 0.3);
  border-bottom: 1px solid rgba(212, 184, 122, 0.3);
}
.nav-item:hover .nav-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.nav-popover .sub-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: 0.2s;
  display: block;
  white-space: nowrap;
}
.nav-popover .sub-link:hover,
.nav-popover .sub-link.active {
  color: var(--gold);
  background: rgba(212, 184, 122, 0.1);
  padding-left: 16px;
}

/* ============ 响应式：移动端横向导航 ============ */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem 1.5rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid rgba(212, 184, 122, 0.15);
  }
  .sidebar-brand { margin-bottom: 0; }

  .sidebar-nav {
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
  }
  .sidebar-nav a,
  .nav-item > a {
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .sidebar-nav a.back-link {
    margin-bottom: 0;
    border-bottom: none;
    padding-left: 10px;
  }

  /* 移动端隐藏弹窗 */
  .nav-popover { display: none !important; }
}