/* Header样式 - 替换Tailwind类 */

/* Header容器 */
header {
  background-color: white;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Header内部容器 */
.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
  /* 让 Mega Menu 以整个 header 内容区为定位参照 */
  position: relative;
}

@media (min-width: 640px) {
  .header-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .header-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Logo区域 */
.header-logo {
  display: flex;
  align-items: center;
}

.header-logo-link {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.header-logo img {
  height: 2.5rem;
}

/* 移动端菜单按钮（默认隐藏，仅小屏显示） */
.mobile-menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: none;
  background: none;
  padding: 0;
  margin-right: 0.25rem;
  cursor: pointer;
  position: relative;
  z-index: 100;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.mobile-menu-icon,
.mobile-menu-icon::before,
.mobile-menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background-color: #4b5563;
  border-radius: 9999px;
  position: relative;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.mobile-menu-icon::before {
  top: -5px;
}

.mobile-menu-icon::after {
  top: 5px;
}

/* 导航菜单 */
.header-nav {
  display: none;
  align-items: center;
  gap: 2rem;
  flex: 1;
}

/* 大屏（>=1080px）显示顶部横向导航 */
@media (min-width: 1080px) {
  .header-nav {
    display: flex;
  }

  .mobile-menu-button {
    display: none;
  }

  .header-logo {
    position: static;
    transform: none;
  }
}

/* 小屏（<1080px）样式：Logo 居中，左侧显示菜单按钮 */
@media (max-width: 1079px) {
  .mobile-menu-button {
    display: flex;
  }

  .header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .header-container {
    justify-content: space-between;
  }
}

.header-nav-link {
  font-size: 1rem;
  color: #374151;
  font-weight: 525;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  transition: color 0.2s;
}

.header-nav-link:hover {
  color: #1d4ed8;
}

/* 产品中心下拉菜单容器 */
.products-menu-wrapper {
  /* 交由 header-container 作为定位参照，这里不再单独定位 */
  position: static;
}

/* 应用领域下拉菜单容器 */
.applications-menu-wrapper {
  /* 交由 header-container 作为定位参照，这里不再单独定位 */
  position: static;
}

/* 公司介绍下拉菜单容器 */
.company-info-menu-wrapper {
  /* 交由 header-container 作为定位参照，这里不再单独定位 */
  position: static;
}

/* Mega Menu */
.mega-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  /* 宽度与 header-container 一致 */
  width: 100%;
}

.mega-menu.show {
  display: block;
}

.mega-menu-content {
  background-color: white;
  border: 1px solid #f3f4f6;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Mega Menu 行布局 */
.mega-menu-row {
  display: flex;
  flex-direction: row;
}

/* 左侧分类 */
.mega-menu-categories {
  width: 15rem;
  background-color: #f9fafb;
  border-right: 1px solid #f3f4f6;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.category-link {
  display: block;
  padding-left: 2rem;
  padding-right: 2rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  font-size: 1rem;
  color: #374151;
  transition: all 0.2s;
  cursor: pointer;
}

.category-link:hover {
  color: #1d4ed8;
  background-color: white;
}

.category-link.active {
  color: #1d4ed8;
  background-color: white;
  border-left: 2px solid #1d4ed8;
  font-weight: 500;
}

/* 右侧子产品 */
.mega-menu-products {
  flex: 1;
  padding: 2rem;
}

/* 子产品列表使用 flex 排列 */
.sub-products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem; /* 行间距 1rem，列间距 1.5rem */
}

.sub-products-grid.hidden {
  display: none;
}

/* 子产品卡片 */
.sub-product-card {
  /* 去掉卡片背景色，保持透明 */
  background-color: transparent;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
  /* 整个子卡片整体缩小，由网格控制宽度 */
  max-width: 160px;
}

.sub-product-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sub-product-image-wrapper {
  /* 子卡片图片区域缩小为 120 x 70 */
  width: 120px;
  height: 70px;
  margin: 0 auto;
  /* 去掉底色，只显示图片本身 */
  background-color: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sub-product-image-placeholder {
  width: 100%;
  height: 100%;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 1.5rem;
}

.sub-product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.sub-product-card:hover .sub-product-image {
  transform: scale(1.05);
}

.sub-product-info {
  padding: 0.5rem;
  text-align: center;
}

.sub-product-name {
  font-size: 0.875rem;
  color: #374151;
  transition: color 0.2s;
}

.sub-product-card:hover .sub-product-name {
  color: #1d4ed8;
}

/* 应用领域弹窗网格布局 */
.applications-grid-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  padding: 2rem;
}

/* 应用领域菜单卡片 */
.application-menu-card {
  background-color: transparent;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
  max-width: 160px;
  text-decoration: none;
}

.application-menu-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.application-menu-image-wrapper {
  width: 120px;
  height: 70px;
  margin: 0 auto;
  background-color: transparent;
  overflow: hidden;
}

.application-menu-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.application-menu-card:hover .application-menu-image {
  transform: scale(1.05);
}

.application-menu-image-placeholder {
  width: 100%;
  height: 100%;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 1.5rem;
}

.application-menu-info {
  padding: 0.5rem;
  text-align: center;
}

.application-menu-name {
  font-size: 0.875rem;
  color: #374151;
  transition: color 0.2s;
  margin: 0;
}

.application-menu-card:hover .application-menu-name {
  color: #1d4ed8;
}

/* 右侧工具 */
.header-tools {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-tool-button {
  font-size: 0.875rem;
  color: #4b5563;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.header-tool-button:hover {
  color: #1d4ed8;
}

/* 语言选择下拉框 */
.language-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.language-select-wrapper i {
  font-size: 0.875rem;
  color: #4b5563;
}

.language-select {
  font-size: 0.875rem;
  color: #4b5563;
  font-weight: 500;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  padding: 0.375rem 0.75rem;
  padding-right: 2rem;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 12px;
}

.language-select:hover {
  border-color: #1d4ed8;
  color: #1d4ed8;
}

.language-select:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.language-select option {
  background-color: white;
  color: #111827;
  padding: 0.5rem;
}

.header-search-button {
  font-size: 1.125rem;
  color: #4b5563;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.header-search-button:hover {
  color: #1d4ed8;
}

/* 移动端下拉菜单，仅在小屏幕下可见 */
.mobile-menu {
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.mobile-menu-nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.mobile-menu-link {
  font-size: 1rem;
  color: #374151;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.mobile-menu-link:last-child {
  border-bottom: none;
}

/* 移动端子菜单链接 */
.mobile-menu-sub-link {
  padding-left: 1.5rem;
  font-size: 0.9375rem;
  color: #6b7280;
  font-weight: 400;
}

@media (min-width: 1080px) {
  .mobile-menu {
    display: none !important;
  }
}

