/* ===== Nav CSS (统一管理) ===== */

/* 确保依赖的 CSS 变量存在 */
:root {
  --text-light: #8b929e;
  --border: #E5E9F0;
  --primary: #0066FF;
  --primary-light: #E8F0FE;
  --primary-dark: #0047CC;
  --accent: #00C2A8;
  --text-main: #1a1a2e;
  --text-sub: #5a6170;
}

/* ===== 基础 Nav ===== */
/* 默认：半透明毛玻璃，适配深色 HERO 背景 */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
/* 滚动后：实底白底，适配浅色页面内容 */
.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* 使用 grid 布局：logo | nav-links(居中) | actions */
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  height: 68px;
}

/* Logo */
.nav-logo {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: auto;
  height: 32px;
  flex-shrink: 0;
}
.nav-logo:hover .logo-icon {
  opacity: 0.85;
}
.logo-text {
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Nav Links（居中） */
.nav-links {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Nav Actions（右边） */
.nav-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Nav Item */
.nav-item {
  position: relative;
}
.nav-item > a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-item > a .arrow {
  font-size: 10px;
  transition: transform 0.25s ease;
  display: inline-block;
}
.nav-item:hover > a {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item:hover > a .arrow {
  transform: rotate(180deg);
}
.nav-item.nav-active > a {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* CTA 按钮 */
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, #0052cc 100%);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.25);
}
.nav-cta:hover {
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.4);
  transform: translateY(-1px);
}

/* ===== 下拉菜单 ===== */
.nav-dropdown {
  display: block !important;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  padding: 32px 20px 20px 20px;
  min-width: 720px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  z-index: 9999;
}
.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* 下拉分组行 */
.nav-dropdown-row {
  display: flex;
  gap: 16px;
}
/* 单分组下拉（瘦版） */
.nav-dropdown-slim {
  min-width: 240px !important;
  padding: 12px 16px;
}
.nav-dropdown-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown-group:not(:last-child) {
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.nav-dropdown-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 8px;
}
.nav-dropdown-item {
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-dropdown-viewall {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 12px;
}
.nav-dropdown-viewall .nav-dropdown-item {
  text-align: center;
  font-weight: 600;
  color: var(--primary);
}

/* ===== 透明导航态（在 HERO 区域）===== */
/* 未滚动时：白字 + 毛玻璃背景 */
.navbar:not(.scrolled) .logo-text {
  color: #fff;
}
.navbar:not(.scrolled) .nav-item > a {
  color: rgba(255, 255, 255, 0.88);
}
.navbar:not(.scrolled) .nav-item > a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.navbar:not(.scrolled) .nav-item.nav-active > a {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
/* CTA 按钮：透明底 + 白边框 */
.navbar:not(.scrolled) .nav-cta {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: none;
}
.navbar:not(.scrolled) .nav-cta:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
/* 移动端汉堡按钮：白色 */
.navbar:not(.scrolled) .nav-mobile-toggle span {
  background: #fff;
}
/* logo 图标在透明态保持不变（蓝-青渐变足够清晰） */

/* ===== 移动端切换按钮 ===== */
.nav-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
  z-index: 1001;
}
.nav-mobile-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ===== 移动端菜单 ===== */
.nav-mobile-menu {
  display: none;
  position: fixed;
  top: 68px; left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 999;
  padding: 24px;
  overflow-y: auto;
  flex-direction: column;
  gap: 4px;
}
.nav-mobile-menu.open {
  display: flex;
}
.nav-mobile-menu .nav-item {
  display: block;
}
.nav-mobile-menu .nav-item > a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 16px;
}
.nav-mobile-menu .nav-dropdown {
  display: none !important;
}
.nav-mobile-menu .nav-cta {
  margin-top: 20px;
  text-align: center;
  justify-content: center;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .nav-links,
  .nav-actions { display: none; }
  .nav-mobile-toggle { display: flex; }
  .nav-container {
    grid-template-columns: auto 1fr auto;
    padding: 0 16px;
  }
}
