/* ============================================================
   导航栏组件样式 - header.css（精简版）
   结构：基础布局 → 桌面端组件 → 移动端响应式
   ============================================================ */

/* ========== 1. 基础布局 ========== */
.nav-shadow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #fff;
  z-index: 9999;
  box-shadow: 0 1px 8px rgba(52, 52, 52, 0.08);
}

.nav-shadow .nav-header {
  width: 100%;
  margin: 0;
  padding: 0 40px;
  box-sizing: border-box;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  /* 左右两端对齐 */
  height: 72px;
}

/* 左侧区域 — 自适应宽度 */
.nav-shadow .nav-header .nav-left {
  display: flex;
  align-items: center;
  height: 72px;
  flex: 0 1 auto;
  /* 可缩小，不主动放大 */
}

/* 导航菜单项（桌面端） */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: 32px;
}

/* 导航项 — 仅在 .nav-menu 内生效，防止全局污染 */
.nav-menu .nav-item {
  padding: 0 4px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  height: 72px;
  line-height: 72px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s;
}

/* 悬停高亮 + JS激活高亮（严格限定作用域） */
.nav-menu .nav-item:hover,
.nav-menu .nav-item.nav-item-active {
  color: #1677FF;
}

/* 底部指示条（仅限导航菜单内的项） */
.nav-menu .nav-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  right: 50%;
  height: 2px;
  background: #1677FF;
  border-radius: 2px;
  transition: left 0.2s, right 0.2s;
}

.nav-menu .nav-item:hover::after,
.nav-menu .nav-item.nav-item-active::after {
  left: 0;
  right: 0;
}

/* 关键修复：阻止 hover 状态穿透到兄弟元素 */
.nav-item-wrap,
.nav-item-direct {
  /* 将每个导航项包裹在独立的 BFC 中 */
  display: inline-block;
  position: relative;
}

/* 右侧区域（桌面端） — 自适应居右 */
.nav-shadow .nav-header .nav-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 72px;
}

/* ========== 2. 搜索框 ========== */
.nav-search-wrap {
  width: 200px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 0;
}

.nav-link-doc,
.console-link {
  display: flex;
  align-items: center;
}

.nav-search-box {
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  border: 1px solid #E6EAED;
  border-radius: 18px;
  background: #F7F8FA;
  overflow: visible;
  transition: all 0.2s;
}

.nav-search-box:focus-within {
  border-color: #FF6739;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 103, 57, 0.12);
}

.nav-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  color: #aaa;
  padding-left: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  padding: 0 10px 0 4px;
  font-size: 13px;
  min-width: 0;
}

/* 搜索建议 */
.nav-search-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #E6EAED;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-top: 4px;
  z-index: 10000;
  display: none;
}

.nav-search-suggest.active {
  display: block;
}

.nav-search-suggest-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.nav-search-suggest-item:hover {
  background: rgba(255, 103, 57, 0.06);
  color: #FF6739;
}

.suggest-icon {
  margin-right: 8px;
  color: #999;
  flex-shrink: 0;
}

/* ========== 3. 登录/注册按钮 ========== */
.no-login {
  display: inline-flex !important;
  align-items: center;
  height: 72px;
  gap: 8px;
  margin-left: 16px !important;
  flex-shrink: 0;
}

/* 分割线 */
.nav-divider {
  width: 1px;
  height: 14px;
  background: #E6EAED;
  margin: 0 16px;
  flex-shrink: 0;
}

.nav-btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  padding: 0 16px;
  background: transparent;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-btn-login:hover {
  color: #1677FF;
}

.nav-btn-register-full {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 72px; /* 撑满导航栏 */
  padding: 0 32px;
  background: #1677FF;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
  gap: 8px;
  margin-left: 12px;
}

.nav-btn-register-full .icon-gift {
  transition: transform 0.3s ease;
}

.nav-btn-register-full:hover {
  background: #0056d2;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.1);
}

.nav-btn-register-full:hover .icon-gift {
  transform: scale(1.15) rotate(-10deg);
}

/* 移除右侧导航的 padding，让注册按钮能靠到最右侧边缘 */
.nav-shadow .nav-header {
  padding-right: 0 !important;
}

/* ========== 4. 下拉面板（Mega Menu）========== */
/* 注意：显示/隐藏由 JS 内联 style 控制，此处仅定义基础外观 */
.nav-cont {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 10000;
  display: none; /* 默认隐藏，由 JS 控制显示 */
}

.nav-cont[style*="display: block"] {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* 导航项包裹器 — 用于 <a> 标签内的 .nav-item */
.nav-item-wrap {
  display: inline-block;
  text-decoration: none;
  height: 72px;
  line-height: 72px;
  position: relative;
}

/* 仅影响包裹器内的直接子元素 .nav-item */
.nav-item-wrap>.nav-item {
  color: #333;
  transition: color 0.2s;
}

.nav-item-wrap>.nav-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  right: 50%;
  height: 2px;
  background: #1677FF;
  border-radius: 2px;
  transition: left 0.2s, right 0.2s;
}

.nav-item-wrap:hover>.nav-item,
.nav-item-wrap>.nav-item.nav-item-active {
  color: #1677FF;
}

.nav-item-wrap:hover>.nav-item::after,
.nav-item-wrap>.nav-item.nav-item-active::after {
  left: 0;
  right: 0;
}

/* 直接导航项（无 <a> 包裹）— 与 nav-item-wrap 统一 BFC 隔离 */
.nav-item-direct {
  display: inline-block;
}

/* 面板项 — 默认隐藏，由 JS 通过 style.display 控制 */
.nav-cont-menu {
  padding: 24px 40px;
  display: none; /* 默认隐藏，由 JS 控制显示 */
}

.nav-cont-menu[style*="display:block"] {
  animation: navFadeInUp 0.22s ease both;
}

@keyframes navFadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-cont-menu.active {
  display: block !important;
}

.mega-layout {
  display: flex;
  gap: 32px;
}

.nav-item-first {
  flex: 0 0 300px;
  padding: 32px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 240px;
}

.nav-item-first:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(22, 119, 255, 0.12);
}

.nav-item-first img {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}

.nav-item-first .title {
  font-size: 20px;
  font-weight: 700;
  color: #1677FF;
}

.nav-item-first .desc {
  font-size: 14px;
  color: #4e5969;
  line-height: 1.7;
}

.nav-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 20px;
  align-content: start;
}

/* ========== 5. 用户下拉菜单 ========== */
.nav-header .login-in {
  padding: 0 20px 0 24px;
  position: relative;
}

.login-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: -20px;
  width: 320px;
  padding-top: 8px;
  z-index: 10001;
}

.login-menu-inner {
  background: #fff;
  border: 1px solid #E0EAFF;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(22, 119, 255, 0.13), 0 2px 10px rgba(0, 0, 0, 0.07);
  position: relative;
}

.login-menu-inner::before {
  content: '';
  position: absolute;
  top: -7px;
  right: 28px;
  width: 13px;
  height: 13px;
  background: #EBF3FF;
  border-left: 1px solid #E0EAFF;
  border-top: 1px solid #E0EAFF;
  transform: rotate(45deg);
}

.nav-header .login-in:hover .login-menu {
  display: block;
}

.lm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
  background: linear-gradient(135deg, #EBF3FF, #F5F9FF);
  border-bottom: 1px solid #E8EFF7;
}

.lm-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #1677FF;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lm-username {
  font-size: 15px;
  font-weight: 600;
}

.lm-cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
}

.lm-cert-no {
  background: rgba(250, 140, 22, 0.1);
  color: #FA8C16;
}

.lm-cert-yes {
  background: rgba(82, 196, 26, 0.1);
  color: #52C41A;
}

.lm-list {
  padding: 8px 0;
}

.lm-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 18px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
  cursor: pointer;
}

.lm-item:hover {
  background: #F0F7FF;
  color: #1677FF;
}

.lm-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #F2F5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lm-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 10px;
  font-size: 14px;
  color: #aaa;
  cursor: pointer;
}

.lm-logout:hover {
  color: #FF4D4F;
}

/* ========== 6. 移动端组件 ========== */
.mobile-header-right {
  display: none;
  align-items: stretch; /* 允许子项撑满高度 */
  gap: 0; /* 移除间距以实现无缝贴合 */
  margin-left: auto;
  flex-shrink: 0;
  height: 56px; /* 与移动端导航栏高度一致 */
}

.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 5px;
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-btn-register {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: #1677FF;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 !important; /* 强制直角 */
  white-space: nowrap;
  height: 100%; /* 撑满父容器高度 */
  transition: all 0.3s;
}

.mobile-btn-register:hover {
  background: #4096ff;
}

/* 移动端侧边栏抽屉 - 桌面端默认彻底隐藏 */
.mobile-menu-overlay,
.mobile-menu-drawer {
  display: none;
}

@media (max-width: 992px) {
  .mobile-menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-menu-drawer {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw; /* 改为全宽铺满 */
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 99999;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }
}

.mobile-menu-drawer.active {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-title {
  font-size: 17px;
  font-weight: 600;
}

.mobile-menu-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent; /* 移除背景圆圈 */
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.mobile-menu-close:hover {
  color: #1677FF;
}

.mobile-menu-body {
  flex: 1;
  overflow: hidden; /* 由内部容器处理滚动 */
  display: flex;
  padding: 0;
}

/* 左侧 Tab 区域 */
.mobile-menu-tabs {
  width: 35%;
  background: #f7f8fa;
  height: 100%;
  display: flex;
  flex-direction: column; /* 垂直排列 */
  border-right: 1px solid #f0f0f0;
}

.mobile-tab-list {
  flex: 1;
  overflow-y: auto;
}

.mobile-menu-footer {
  padding: 16px 12px;
  border-top: 1px solid #eee;
  background: #f2f3f5;
}

.mobile-tab-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #fff;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  color: #1677FF;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.mobile-tab-login-btn:active {
  background: #f0f7ff;
  transform: scale(0.98);
}

.mobile-tab-item {
  padding: 18px 16px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-tab-item.active {
  background: #fff;
  color: #1677FF;
  font-weight: 600;
}

.mobile-tab-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 4px;
  background: #1677FF;
  border-radius: 0 4px 4px 0;
}

/* 右侧内容面板区域 */
.mobile-menu-panels {
  width: 65%;
  background: #fff;
  height: 100%;
  overflow-y: auto;
}

.mobile-panel {
  display: none;
  padding: 16px;
}

.mobile-panel.active {
  display: block;
}

/* 面板内容美化 */
.mobile-panel-header {
  margin-bottom: 20px;
}

.mobile-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.mobile-panel-desc {
  font-size: 12px;
  color: #86909c;
}

/* 二级菜单分类标签 */
.mobile-sub-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.mobile-cat-tag {
  padding: 6px 16px;
  background: #fff;
  border: 1px solid #e5e6eb;
  border-radius: 20px;
  font-size: 13px;
  color: #4e5969;
}

.mobile-cat-tag.active {
  background: #1677FF;
  color: #fff;
  border-color: #1677FF;
}

/* 产品卡片设计 */
.mobile-product-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-product-card {
  display: block;
  padding: 16px;
  background: #f9fbff;
  border: 1px solid #eef3ff;
  border-radius: 12px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.mobile-product-card .name {
  font-size: 15px;
  font-weight: 600;
  color: #1d2129;
  margin-bottom: 4px;
  display: block;
}

.mobile-product-card .desc {
  font-size: 12px;
  color: #86909c;
  display: block;
}

.mobile-product-card.featured::after {
  content: '精选';
  position: absolute;
  top: 0;
  right: 0;
  background: #ff4d4f;
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-bottom-left-radius: 8px;
}

.mobile-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
}

.mobile-footer-btn-login {
  display: block;
  text-align: center;
  padding: 12px;
  background: #f8f9fa;
  color: #1677FF;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
}

body.mobile-menu-open {
  overflow: hidden;
}

/* ========== 7. 移动端响应式（992px断点）========== */
@media (max-width: 992px) {

  /* 隐藏桌面端元素 — 使用ID选择器确保最高优先级 */
  #navMenu,
  .nav-shadow .nav-header .nav-right,
  .nav-shadow .nav-cont,
  .nav-shadow .nav-header .no-login,
  .nav-shadow .nav-header .login-in {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -99999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* 显示移动端按钮区 */
  .mobile-header-right {
    display: flex !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
  }

  /* 导航栏容器 */
  .nav-shadow .nav-header {
    height: 56px !important;
    padding: 0 0 0 16px !important; /* 移除右侧 padding，让注册按钮贴边 */
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  /* 左侧：Logo紧凑布局 */
  .nav-shadow .nav-header>.nav-left {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: calc(100% - 110px) !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
    overflow: hidden !important;
  }

  /* Logo图片尺寸限制 */
  .nav-shadow .nav-header>.nav-left img {
    max-width: 130px !important;
    max-height: 36px !important;
    width: auto !important;
    height: auto !important;
  }

  /* 右侧：按钮区 */
  .nav-shadow .nav-header>.mobile-header-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
  }

  /* 毛玻璃效果 */
  .nav-shadow {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px);
  }
}