/* ========================================
   header.css - 顶部导航样式
   ======================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  transition: background 0.4s ease, box-shadow 0.4s ease;
  background: transparent;
}

.header.scrolled {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
}

/* 未滚动时悬停：淡入白色背景 */
.header:not(.scrolled):hover {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 101;
  min-height: 45px; /* 防止加载时高度跳动 */
}

.header-logo img {
  height: 45px;
  width: auto;
  /* 防止图片加载时闪现：默认隐藏 */
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  background: transparent;
  display: block;
}

/* 图片加载完成后才显示 */
.header-logo img.loaded {
  opacity: 1 !important;
  visibility: visible !important;
}

/* 主导航 */
.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  border-radius: var(--radius-sm);
  transition: color 0.4s ease, background 0.4s ease;
  white-space: nowrap;
}

.header.scrolled .nav-link {
  color: var(--text-primary);
}

/* 未滚动悬停header时：文字变黑 */
.header:not(.scrolled):hover .nav-link {
  color: var(--text-primary);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.header:not(.scrolled) .nav-link:hover,
.header:not(.scrolled) .nav-link.active {
  color: white;
  background: rgba(255,255,255,0.15);
}

/* 悬停header后，链接hover用主色 */
.header:not(.scrolled):hover .nav-link:hover,
.header:not(.scrolled):hover .nav-link.active {
  color: var(--primary);
  background: transparent;
}

.nav-arrow {
  font-size: 10px;
  transition: var(--transition);
}

.nav-item:hover .nav-arrow {
  transform: rotate(180deg);
}

/* 下拉菜单（通用小菜单） */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(10px);
  transition: var(--transition);
}

.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: white;
  border-top: 0;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.dropdown-link:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.dropdown-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(126,182,59,0.1), rgba(0,200,83,0.1));
  font-size: 16px;
  flex-shrink: 0;
}

.dropdown-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.dropdown-text span {
  font-size: 12px;
  color: var(--text-light);
}

/* ====== Mega 下拉菜单（解决方案） ====== */
.nav-mega-dropdown {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.4s cubic-bezier(0.4,0,0.2,1), visibility 0.4s ease, transform 0.4s cubic-bezier(0.4,0,0.2,1);
  z-index: 999;
}

.nav-item:hover .nav-mega-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  max-width: 98vw;
  margin: 0 auto;
  padding: 48px 40px;
  gap: 0;
  align-items: stretch;
}

/* 左侧宣传图 30% */
.mega-promo {
  flex: 0 0 28%;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  min-height: 280px;
  margin-right: 36px;
}

.mega-promo .promo-link {
  display: block;
  width: 100%;
  height: 100%;
}

.mega-promo .promo-img-wrap {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

.mega-promo .promo-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mega-promo .promo-img-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 中间分割线 */
.mega-divider {
  width: 1px;
  background: #e8e8e8;
  align-self: stretch;
  flex-shrink: 0;
}

/* 右侧 2x2 服务网格 */
.mega-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-left: 36px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 28px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 12px;
  background: #f8f9fb;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}

/* 科技感光效扫过底层 */
.mega-item::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(126,182,59,0.08) 25%, transparent 50%);
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: none;
}

.mega-item:hover::before {
  opacity: 1;
  animation: techSpin 3s linear infinite;
}

@keyframes techSpin {
  to { transform: rotate(360deg); }
}

/* 内层遮罩保持卡片内容背景 */
.mega-item::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 11px;
  background: #f8f9fb;
  z-index: 0;
  transition: background 0.4s ease;
}

.mega-item:hover::after {
  background: #fff;
}

.mega-item:hover {
  border-color: rgba(126,182,59,0.25);
  box-shadow: 0 8px 30px rgba(126,182,59,0.12), 0 0 0 1px rgba(126,182,59,0.08);
  transform: translateY(-4px);
}

.mega-item:nth-child(2n) {
  border-right-color: transparent;
}

.mega-item:nth-child(n+3) {
  border-bottom-color: transparent;
}

.mega-item .item-img-wrap {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.mega-item:hover .item-img-wrap {
  box-shadow: 0 4px 16px rgba(126,182,59,0.2);
  transform: scale(1.08);
}

.mega-item .item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease-in-out;
}

.mega-item .item-img-wrap .item-img-default {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 1;
}

.mega-item .item-img-wrap .item-img-hover {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.mega-item:hover .item-img-wrap .item-img-default {
  opacity: 0;
}

.mega-item:hover .item-img-wrap .item-img-hover {
  opacity: 1;
}

.mega-item .item-info {
  flex: 1;
  position: relative;
  z-index: 1;
}

.mega-item .item-title {
  font-size: 17px;
  font-weight: 700;
  color: rgba(34,34,34,0.75);
  margin-bottom: 8px;
  line-height: 1.3;
  transition: color 0.3s;
}

.mega-item .item-desc {
  font-size: 13px;
  color: #aaa;
  line-height: 1.5;
  transition: color 0.3s;
}

.mega-item:hover .item-title {
  color: var(--primary);
}

.mega-item:hover .item-desc {
  color: #888;
}

/* 右侧操作区 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 101;
}

.header-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.header-contact-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.header-lang {
  position: relative;
  cursor: pointer;
  padding-bottom: 10px;
  margin-bottom: -10px;
}

.header-lang-current {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  transition: color 0.4s ease, border-color 0.4s ease;
}

.header.scrolled .header-lang-current {
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.header:not(.scrolled):hover .header-lang-current {
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.header-lang-dropdown {
  position: absolute;
  top: calc(100% + -7px);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition);
}

.header-lang:hover .header-lang-dropdown,
.header-lang.open .header-lang-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lang-option {
  display: block;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.lang-option:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.lang-option.active {
  background: var(--bg-light);
  color: var(--primary);
  font-weight: 500;
}

/* 移动端菜单按钮 */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  width: 28px;
  cursor: pointer;
  z-index: 101;
}

.mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: var(--transition);
}

.header.scrolled .mobile-toggle span {
  background: var(--text-primary);
}

.header:not(.scrolled):hover .mobile-toggle span {
  background: var(--text-primary);
}

.mobile-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* 移动端覆盖层 */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 移动端菜单 */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: -320px;
  width: 320px;
  height: calc(100vh - var(--header-height));
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  z-index: 999;
  padding: 24px;
  overflow-y: auto;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.mobile-menu.active {
  left: 0;
}

.mobile-nav-item {
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.mobile-sub-menu {
  display: none;
  padding-bottom: 10px;
}

.mobile-sub-menu.active {
  display: block;
}

.mobile-sub-link {
  display: block;
  padding: 10px 0 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.mobile-sub-link:hover {
  color: var(--primary);
}

/* ====== 搜索图标 & 搜索下拉框 ====== */
.header-search {
  position: relative;
  z-index: 102;
}

.search-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  transition: color 0.4s ease, background 0.3s ease;
  padding: 0;
}

.header.scrolled .search-icon-btn,
.header:not(.scrolled):hover .search-icon-btn {
  color: var(--text-secondary);
}

.search-icon-btn:hover {
  background: rgba(126,182,59,0.12);
  color: var(--primary) !important;
}

.search-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 搜索下拉面板 */
.search-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.search-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.search-panel::before {
  content: '';
  position: absolute;
  top: -7px;
  right: 9px;
  border: 7px solid transparent;
  border-bottom-color: #fff;
  border-top: 0;
  filter: drop-shadow(0 -2px 4px rgba(0,0,0,0.06));
}

/* 搜索输入框行 */
.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 12px;
  transition: border-color 0.2s;
}

.search-input-row:focus-within {
  border-color: var(--primary);
}

.search-input-row svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #aaa;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
}

.search-input::placeholder {
  color: #bbb;
}

.search-submit-btn {
  background: var(--primary);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-submit-btn:hover {
  background: var(--primary-dark);
}

/* 热门搜索标签 */
.search-tags-label {
  font-size: 12px;
  color: #999;
  margin: 14px 0 8px;
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: #f4f6f8;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-tag:hover {
  background: rgba(126,182,59,0.1);
  color: var(--primary);
  border-color: rgba(126,182,59,0.3);
}

/* 搜索结果列表 */
.search-results {
  margin-top: 12px;
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s;
}

.search-result-item:hover {
  background: #f6f9f2;
}

.search-result-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(126,182,59,0.12), rgba(0,200,83,0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.search-result-info .result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.search-result-info .result-desc {
  font-size: 12px;
  color: #aaa;
  display: block;
  margin-top: 1px;
}

.search-result-info .result-title em {
  color: var(--primary);
  font-style: normal;
}

.search-no-result {
  font-size: 13px;
  color: #bbb;
  text-align: center;
  padding: 16px 0 6px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .header-nav,
  .header-contact-btn {
    display: none;
  }

  .header-logo img {
    height: 32px;
  }

  .mobile-toggle {
    display: flex;
  }

  .mobile-menu,
  .mobile-menu-overlay {
    display: block;
  }

  /* 移动端显示语言和搜索 */
  .header-lang,
  .header-search {
    display: flex;
  }

  .header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  /* 顺序：搜索(1) | 语言(2) | 菜单按钮(3) 从左到右 */
  .header-search {
    order: 1;
  }

  .header-lang {
    order: 2;
  }

  .mobile-toggle {
    order: 3;
  }

  .header-lang-current {
    padding: 6px 10px;
    font-size: 12px;
  }

  .search-icon-btn {
    width: 32px;
    height: 32px;
  }

  /* 搜索面板移动端样式 */
  .search-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  }

  .search-panel::before {
    display: none;
  }
}

/* 移动端媒体宣传区域 */
.mobile-media-section {
  margin-top: 24px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.mobile-media-wrapper {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #f3f4f6;
}

.mobile-media-wrapper img,
.mobile-media-wrapper video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.mobile-media-placeholder {
  width: 100%;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #9ca3af;
}

.mobile-media-placeholder i {
  font-size: 32px;
  opacity: 0.5;
}

.mobile-media-placeholder span {
  font-size: 12px;
}

.mobile-media-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
}

.mobile-media-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mobile-media-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 删除旧的移动端菜单底部商务咨询按钮样式 */
.mobile-menu-footer {
  display: none;
}

.mobile-contact-btn {
  display: none;
}
