/* ============================================================
   广拓时代官网 - 导航栏（纯 CSS + main.js，SEO 静态站）
   行为与 client 中导航设计对齐，无 React 运行时
   ============================================================ */

.navbar {
  /* 与 client/src/index.css :root 一致（仅导航区使用） */
  --nav-primary: oklch(0.45 0.15 260);
  --nav-primary-foreground: oklch(0.98 0 0);
  --nav-muted-foreground: oklch(0.4 0.02 260);
  --nav-foreground: oklch(0.15 0.02 260);
  --nav-border: oklch(0.85 0.02 260 / 0.5);
  /* 子项沿用 var(--primary) 的写法，与 shadcn 一致 */
  --primary: var(--nav-primary);
  --primary-foreground: var(--nav-primary-foreground);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50; /* Layout: z-50 */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease,
    backdrop-filter 0.3s ease;
  padding: 20px 0; /* py-5 未滚动 */
  overflow: visible;
}

/* 仅导航栏：让内容更“靠外”，不影响全站其它 container */
.navbar .container {
  max-width: 1440px;
  padding-left: 8px;
  padding-right: 8px;
  overflow: visible;
}
.navbar.scrolled .container {
  max-width: 1440px;
  padding-left: 8px;
  padding-right: 8px;
}
.navbar .navbar-logo {
  margin-left: 12px;
}
/* 对齐 Layout：container flex items-center justify-between */
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  overflow: visible;
}
/* 对齐 CTA 区：flex items-center gap-4 */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem; /* gap-4 */
  flex-shrink: 0;
}
/* 滚动后：bg-white/80 backdrop-blur-md border-gray-200 py-3 shadow-sm */
.navbar.scrolled {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: rgb(229, 231, 235);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  padding: 12px 0; /* py-3 */
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 0;
}
.navbar-logo img { height: 40px; width: auto; object-fit: contain; }
.navbar-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* 与 React 一致：整段链接区为 NavigationMenu root，供 mega viewport 全宽定位 */
.nav-menu-radix {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* Nav Menu */
.navbar-menu {
  display: flex;
  align-items: center;
  gap: 4px; /* gap-1 */
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
/* 与 Layout + Radix NavigationMenu：trigger = rounded-md, h-9, px-4 py-2, hover:bg-gray-100, hover:text-primary */
.nav-item {
  position: relative;
}
/* 有下拉的项：略增大圆角，靠齐参考图「药丸」感 */
.nav-item--sub .nav-link {
  border-radius: 0.5rem;
}
.nav-link {
  position: relative;
  z-index: 1; /* 须低于 .nav-mega-viewport，避免下拉层被同排链接盖住 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px; /* h-9 */
  gap: 4px;
  padding: 8px 16px; /* py-2 px-4 */
  font-size: 18px; /* text-[18px] */
  font-weight: 500;
  color: rgb(55, 65, 81); /* text-gray-700 */
  border-radius: 6px; /* rounded-md */
  transition: color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  border: 0;
  text-decoration: none;
}
.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background-color: rgb(243, 244, 246); /* bg-gray-100 */
}
/* 带子菜单项：设计稿为浅蓝底（blue-50），与参考图「产品」态一致 */
.nav-item--sub:hover .nav-link,
.nav-item--sub.is-mega-open .nav-link {
  color: var(--primary);
  background-color: rgb(239, 246, 255);
}
.nav-item--sub.is-mega-open .nav-link .nav-arrow,
.nav-item--sub:hover .nav-link .nav-arrow {
  color: var(--primary);
}
/* 与 group-data-[state=open]:chevron: React Chevron size-3, ml-1, duration-300, rotate-180 打开时 */
.nav-link svg,
.nav-link .nav-arrow {
  display: block;
  width: 12px; /* size-3 */
  height: 12px;
  margin-left: 4px; /* ml-1 */
  flex-shrink: 0;
  color: rgb(107, 114, 128); /* 接近 muted-foreground，悬停随文字变主色 */
  stroke: currentColor;
  fill: none;
  transition: transform 300ms ease, color 0.2s ease;
}
.nav-link:hover svg,
.nav-link:hover .nav-arrow,
.nav-item:hover .nav-link svg,
.nav-item:hover .nav-link .nav-arrow {
  color: var(--primary);
}
.nav-item--sub:hover .nav-arrow,
.nav-item--sub.is-mega-open .nav-arrow {
  transform: rotate(180deg);
}

/* 桌面 CTA：与 Layout 一致 hidden md:flex → 仅 <768 隐藏 */
.navbar-desktop-cta {
  display: none;
  align-items: center;
}
@media (min-width: 768px) {
  .navbar-desktop-cta {
    display: flex;
  }
}
/* 与 Button + Layout: bg-primary hover:bg-blue-600 rounded-full px-6 h-9 shadow-lg shadow-blue-500/20 */
.navbar-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px; /* h-9 */
  padding: 0 1.5rem; /* px-6 */
  font-size: 0.875rem; /* text-sm */
  font-weight: 500;
  line-height: 1;
  color: var(--nav-primary-foreground);
  text-decoration: none;
  border-radius: 9999px; /* rounded-full */
  background: var(--nav-primary);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1),
    0 4px 14px rgba(59, 130, 246, 0.2); /* shadow-blue-500/20 近似 */
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.navbar-cta:hover {
  background: #2563eb; /* blue-600 */
  color: #fff;
}

/* 移动端全屏菜单底部主按钮，对齐 Layout 内 w-full py-6 text-lg */
.nav-mobile-cta__btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 8px;
  padding: 1.5rem 1rem; /* py-6 */
  font-size: 1.125rem; /* text-lg */
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  border-radius: 0.375rem;
  background: var(--nav-primary);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease;
}
.nav-mobile-cta__btn:hover {
  background: #2563eb;
}

/* 仅 ≤1024 的侧滑/全屏列表里需要 li；桌面横向菜单不显示 */
.nav-mobile-cta {
  display: none;
}
@media (max-width: 1024px) {
  .nav-mobile-cta {
    display: list-item;
  }
}

/* Viewport：左对齐当前 data-mega 触发项，--mega-align 由 main.js 写入 */
.nav-mega-viewport {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 200; /* 高于同区 .nav-link，与 Radix 面板浮层同层级思路 */
  padding-top: 6px;
  box-sizing: border-box;
  padding-left: var(--mega-align, 0px);
  justify-content: flex-start;
  align-items: flex-start;
  pointer-events: none;
  transform-origin: top left;
}
.nav-menu-radix.is-mega-open .nav-mega-viewport {
  display: flex;
  pointer-events: auto;
}
.nav-mega-panel {
  display: none;
  animation: navMegaIn 0.2s ease-out;
  transform-origin: top left;
}
.nav-mega-panel.is-active {
  display: block;
}
@keyframes navMegaIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
/* 与参考图：白底、大圆角(rounded-2xl)、两列、列间距大、轻阴影 */
.nav-mega-list {
  list-style: none;
  margin: 0;
  padding: 28px; /* 约 24–32px */
  display: grid;
  row-gap: 1.5rem; /* 行间距 */
  column-gap: 2.5rem; /* 两列之间 */
  width: 400px;
  max-width: min(100vw - 32px, 600px);
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 12px 40px -12px rgba(15, 23, 42, 0.12),
    0 4px 12px -4px rgba(15, 23, 42, 0.08);
  border-radius: 1rem; /* rounded-2xl 量级 */
  grid-template-columns: 1fr;
  grid-auto-flow: row;
}
@media (min-width: 768px) {
  .nav-mega-list {
    width: 500px;
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .nav-mega-list {
    width: 600px;
  }
}
/* mega 内链接块：与图中标题更醒目、行距略松 */
.nav-mega-list .dropdown-item {
  padding: 10px 10px;
  border-radius: 0.5rem;
}
.nav-mega-list .dropdown-item-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav-mega-list .dropdown-item-text {
  gap: 6px;
}
.nav-mega-list li {
  margin: 0;
  padding: 0;
  min-width: 0;
}
@media (min-width: 1025px) {
  .nav-dropdown--mobile {
    display: none !important;
  }
}
/* NavigationMenuLink：hover:bg-blue-50 hover:text-primary, rounded-md p-3, transition-colors */
.dropdown-item {
  display: block;
  align-items: flex-start;
  padding: 12px; /* p-3 */
  border-radius: 6px; /* rounded-md */
  font-size: 14px;
  color: rgb(17, 24, 39);
  transition: color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  outline: none;
}
.dropdown-item:hover {
  background: rgb(239, 246, 255); /* bg-blue-50，仅块背景，文字同 React 只强调标题 */
}
.dropdown-item:hover .dropdown-item-title {
  color: var(--primary);
}
.dropdown-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--primary);
}
.dropdown-item-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px; /* space-y-1 对齐 NavigationMenuLink */
}
.dropdown-item-title {
  font-size: 14px; /* text-sm */
  font-weight: 500; /* font-medium */
  line-height: 1; /* leading-none 近似 */
  color: #111827; /* text-gray-900 */
}
/* text-xs text-muted-foreground + line-clamp-2 + leading-snug */
.dropdown-item-desc {
  font-size: 12px; /* text-xs */
  line-height: 1.375; /* leading-snug */
  color: #64748b; /* 接近 shadcn muted-foreground / slate-500 */
  margin-top: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
p.dropdown-item-desc {
  margin: 0; /* 与 div 版一致，间距由 .dropdown-item-text gap 控制 */
}

/* Dropdown section header */
.dropdown-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px 4px;
}

/* Nav Actions */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Mobile Toggle */
.navbar-toggle {
  display: none;
  padding: 8px;
  cursor: pointer;
  margin-left: 0;
  color: rgba(17,24,39,1); /* gray-900 */
  background: transparent;
  border: none;
}
.navbar-toggle svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* Mobile Menu */
@media (max-width: 1024px) {
  .nav-mega-viewport {
    display: none !important;
    pointer-events: none !important;
  }
  .navbar-menu { display: none; }
  .navbar-actions .btn { display: none; }
  .navbar-toggle { display: flex; }
  .navbar-menu.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white);
    padding: 16px;
    overflow-y: auto;
    z-index: 999;
    gap: 4px;
    align-items: stretch;
  }
  .nav-dropdown--mobile,
  .nav-item .nav-dropdown--mobile {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: var(--bg-gray);
    display: none;
    padding: 8px;
    border-radius: var(--radius);
    margin-top: 4px;
  }
  .nav-item.mobile-expanded .nav-dropdown--mobile {
    display: block;
  }
  .nav-dropdown--mobile .dropdown-item-desc {
    display: none;
  }
  .nav-link { padding: 12px 16px; border-radius: var(--radius); }
  .navbar-actions .btn { display: inline-flex; width: 100%; justify-content: center; margin-top: 8px; }
  .navbar-actions { display: flex; flex-direction: column; width: 100%; margin-top: 8px; }
}

/* Spacer：对齐 main pt-20（5rem = 80px） */
.navbar-spacer { height: 80px; }
