/* ============================================
   导航栏样式
   核心效果：
   1. 初始透明（叠在Banner上）
   2. 鼠标悬停时：导航变实色背景，与Banner视觉分离
   3. 滚动后：导航固定变实色
   4. 离开hover且未滚动：恢复透明
============================================ */

/* ---- 导航主体 ---- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  /* 初始：完全透明 */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background 0.4s cubic-bezier(0.4,0,0.2,1),
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    padding 0.3s ease;
}

/* ---- 状态：鼠标悬停时 → 与Banner分离 ---- */
.navbar:hover,
.navbar.nav-hovered {
  background: rgba(5, 15, 35, 0.96);
  border-bottom-color: rgba(0, 180, 216, 0.2);
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ---- 状态：子页面 → 始终实色（无需悬停/滚动）---- */
.navbar.nav-solid,
.is-subpage .navbar {
  background: rgba(8, 18, 42, 0.98) !important;
  border-bottom-color: rgba(0, 180, 216, 0.15) !important;
  box-shadow: 0 2px 24px rgba(0,0,0,0.3) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ---- 状态：页面滚动后 → 固定实色 ---- */
.navbar.scrolled {
  background: rgba(8, 18, 42, 0.97);
  border-bottom-color: rgba(0, 180, 216, 0.15);
  box-shadow: 0 2px 24px rgba(0,0,0,0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ---- 内层容器 ---- */
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 40px;
  transition: height 0.3s ease;
}
.navbar.scrolled .nav-inner { height: 68px; }

/* ---- Logo ---- */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  text-decoration: none;
  padding: 7px 14px 7px 7px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: all 0.3s ease;
}
.nav-logo:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 4px 18px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

/* Logo 图标外框 */
.logo-img-wrap {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(100,180,255,0.25) 0%, rgba(150,210,255,0.12) 100%);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 5px;
  transition: all 0.3s ease;
}
.nav-logo:hover .logo-img-wrap {
  border-color: rgba(255,255,255,0.35);
  background: linear-gradient(135deg, rgba(100,180,255,0.35) 0%, rgba(150,210,255,0.18) 100%);
}
.logo-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* 分隔线 */
.logo-divider {
  width: 1px;
  height: 30px;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  margin: 0 12px;
  flex-shrink: 0;
}

/* Logo 文字 */
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  gap: 2px;
}
.logo-cn {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1.5px;
}
.logo-slogan {
  font-size: 8.5px;
  color: var(--accent);
  letter-spacing: 0.5px;
  font-family: var(--font-en);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.85;
}
.logo-en {
  display: none;
}

/* 旧版 logo-icon 保留兼容 */
.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  font-family: var(--font-en);
  letter-spacing: -1px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,85,179,0.4);
}

/* ---- 主菜单 ---- */
.nav-menu {
  flex: 1;
  display: flex;
  justify-content: center;
}
.nav-menu > ul {
  display: flex;
  gap: 0;
}

/* 一级菜单项 */
.nav-menu > ul > li { position: relative; }

.nav-menu > ul > li > a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 18px;
  height: 80px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  position: relative;
  letter-spacing: 0.3px;
}
.navbar.scrolled .nav-menu > ul > li > a { height: 68px; }

/* 底部高亮线 */
.nav-menu > ul > li > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  transform: scaleX(0);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  border-radius: 1px;
}

/* 悬停/激活状态 */
.nav-menu > ul > li:hover > a,
.nav-menu > ul > li.active > a {
  color: #fff;
}
.nav-menu > ul > li:hover > a::after,
.nav-menu > ul > li.active > a::after {
  transform: scaleX(1);
}

/* 下拉箭头 */
.nav-arrow {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--transition);
  opacity: 0.6;
}
.has-sub:hover .nav-arrow {
  transform: rotate(225deg) translateY(-2px);
  opacity: 1;
}

/* ---- 二级下拉菜单 ---- */
.sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: rgba(8,18,42,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 2px solid var(--accent);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 100;
}
.has-sub:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sub-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: all var(--transition);
}
.sub-menu li:last-child a { border-bottom: none; }
.sub-menu li a:hover {
  color: #fff;
  background: rgba(0,180,216,0.12);
  padding-left: 28px;
}
.sub-menu li a::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.sub-menu li a:hover::before { opacity: 1; }

/* ---- 右侧工具区 ---- */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- 语言切换器 ---- */
.lang-switcher-wrap {
  position: relative;
  flex-shrink: 0;
}
.lang-current-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s ease;
  height: 38px;
  font-family: var(--font);
  white-space: nowrap;
}
.lang-current-btn:hover,
.lang-switcher-wrap.open .lang-current-btn {
  background: rgba(255,255,255,0.13);
  border-color: rgba(0,180,216,0.4);
  color: #fff;
}
.lang-flag { line-height: 1; }
/* 语言标签圆角徽章 */
.lang-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #06f, #00d4d8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.lang-option .lang-badge {
  width: 28px; height: 20px;
  font-size: 11px;
}
.lang-short { font-size: 12px; font-family: var(--font-en); letter-spacing: 0.5px; }
.lang-caret {
  opacity: 0.6;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.lang-switcher-wrap.open .lang-caret { transform: rotate(180deg); opacity: 1; }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: rgba(8,18,42,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 1100;
}
.lang-switcher-wrap.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.lang-option .lang-flag .svg-icon { width: 24px; height: 16px; vertical-align: -2px; }
.lang-option:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.lang-option.active {
  background: rgba(0,85,179,0.25);
  color: #fff;
  border: 1px solid rgba(0,85,179,0.4);
}
.lang-label { flex: 1; font-weight: 500; }
.lang-check {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  margin-left: auto;
}
@media (max-width: 768px) {
  .lang-dropdown { right: -8px; min-width: 150px; }
  .lang-short { font-size: 11px; }
}

/* 搜索按钮 */
.search-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  transition: all var(--transition);
}
.search-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.search-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* 联系按钮 */
.nav-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--transition);
  border: 1px solid transparent;
  box-shadow: 0 4px 16px rgba(0,85,179,0.35);
}
.nav-contact-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,85,179,0.5);
}

/* ---- 搜索展开栏 ---- */
.search-bar {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: rgba(8,18,42,0.98);
  border-top: 1px solid rgba(0,180,216,0.2);
  padding: 20px 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.4s ease;
}
.search-bar.open {
  max-height: 100px;
  opacity: 1;
  padding: 20px 0;
}
.search-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.search-inner input {
  flex: 1;
  padding: 12px 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  font-size: 15px;
  color: #fff;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.search-inner input::placeholder { color: rgba(255,255,255,0.35); }
.search-inner input:focus { border-color: var(--accent); }
.search-inner button {
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  transition: background var(--transition);
}
.search-inner button:hover { background: var(--primary-dark); }
.close-search-btn {
  width: 40px; height: 40px;
  border-radius: 8px;
  color: rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  background: rgba(255,255,255,0.06);
}
.close-search-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ---- 汉堡按钮 ---- */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  width: 36px; height: 36px;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  transition: background 0.25s ease;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
}
/* 桌面端隐藏汉堡（nav-menu 直接显示） */
@media (min-width: 769px) {
  .menu-toggle { display: none; }
}
.menu-toggle:hover { background: rgba(255,255,255,0.12); }
.menu-toggle:active { background: rgba(255,255,255,0.18); }
.menu-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  transform-origin: center center;
}
.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ---- 遮罩层（桌面+移动通用） ---- */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 997;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-overlay.show {
  display: block;
  opacity: 1;
}

/* ---- 移动端右侧抽屉 ---- */
/* 使用 left 动画替代 transform，彻底绕过 transform 包含块 bug */
.mobile-drawer {
  display: flex;
  position: fixed;
  top: 0;
  left: 100%;
  width: 85vw;
  max-width: 320px;
  height: 100vh;          /* 回退值 */
  height: 100dvh;         /* 动态视口高度，解决手机地址栏问题 */
  background: rgba(8,18,42,0.99);
  z-index: 10001;
  flex-direction: column;
  transition: left 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
}
.mobile-drawer.open {
    left: 0 !important;
    display: flex !important;
}

/* 抽屉头部 */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 68px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.drawer-close {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 18px;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
  font-family: monospace;
}
.drawer-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.drawer-logo {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-en);
  letter-spacing: 1px;
}

/* 抽屉内容 */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}
.drawer-body ul { list-style: none; padding: 0; margin: 0; }
.drawer-body > ul > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s ease;
}
.drawer-body > ul > li > a:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
  padding-left: 28px;
}
.drawer-body > ul > li.active > a { color: var(--accent); }
.drawer-sub { background: rgba(0,0,0,0.15); display: none; }
.drawer-body > ul > li.open > .drawer-sub { display: block; }
.drawer-sub li a {
  display: block;
  padding: 10px 20px 10px 36px;
  font-size: 14px;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: all 0.2s ease;
}
.drawer-sub li a:hover { color: var(--accent); padding-left: 44px; }
.drawer-sub-arrow {
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.drawer-body > ul > li.open > a .drawer-sub-arrow {
  transform: rotate(225deg) translateY(2px);
}

/* 抽屉底部语言切换 */
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.drawer-lang { display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-lang a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: var(--font-en);
}
.drawer-lang a:hover,
.drawer-lang a.active { color: #fff; background: rgba(0,85,179,0.3); border-color: rgba(0,85,179,0.5); }

/* ---- 响应式 ---- */
@media (max-width: 1280px) {
  .nav-inner { padding: 0 32px; }
  .nav-menu > li > a { padding: 0 14px; font-size: 13px; }
}
@media (max-width: 1024px) {
  .nav-contact-btn { display: none; }
  .nav-menu > ul > li > a { padding: 0 10px; }
}
/*
 * 移动端：≤768px 才显示汉堡按钮和抽屉
 * 桌面端：≥769px 隐藏汉堡，显示水平菜单
 */
@media (max-width: 768px) {
  /* 显示汉堡按钮 */
  .menu-toggle { display: flex !important; }

  /* 隐藏桌面菜单 */
  .nav-menu { display: none !important; }

  /* 汉堡在 nav-right 最右侧 */
  .nav-right { margin-left: auto; }

  /* 导航栏高度缩小 */
  .nav-inner { padding: 0 16px; height: 68px; gap: 16px; }

  /* logo 文字精简 */
  .nav-logo { padding: 5px 10px 5px 5px; }
  .logo-img-wrap { width: 40px; height: 40px; border-radius: 8px; padding: 4px; }
  .logo-divider { height: 24px; margin: 0 8px; }
  .logo-cn { font-size: 14px; letter-spacing: 1px; }
  .logo-slogan { font-size: 7px; letter-spacing: 0.3px; }
  .logo-en { display: none !important; }
}

/* 桌面端明确隐藏移动抽屉和遮罩 */
@media (min-width: 769px) {
  .mobile-overlay { display: none !important; }
  .mobile-drawer { display: none !important; }
}

/* ============================================================
   强制显示移动端汉堡按钮（最高优先级，防止被其他CSS覆盖）
   2026-05-03 fix：首页汉堡按钮消失问题
   ============================================================ */
@media (max-width: 768px) {
  /* 强制 nav-right 容器可见 */
  header#navbar nav.nav-inner div.nav-right {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* 强制汉堡按钮可见（现在位于 nav-inner 直接子元素，不再在 nav-right 内） */
  header#navbar nav.nav-inner > button.menu-toggle#menuToggle,
  header#navbar nav.nav-inner > button.menu-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 36px !important;
    height: 36px !important;
    position: relative !important;
    z-index: 1001 !important;
    flex-direction: column !important;
    gap: 5px !important;
    padding: 6px !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 8px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
  }

  /* 强制汉堡按钮的三条线可见 */
  header#navbar nav.nav-inner > button.menu-toggle#menuToggle span,
  header#navbar nav.nav-inner > button.menu-toggle span {
    display: block !important;
    width: 20px !important;
    height: 2px !important;
    background: rgba(255,255,255,0.9) !important;
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
  }
}
