/*头部导航栏样式*/
/* CSS优化：合并重复规则，减少选择器复杂度，提升性能 */
:root {
    --primary-color: #ffb600;
    --primary-light: #ffd166;
    --primary-dark: #e6a400;
    --bg-dark: #1a1a1a;
    --bg-light: #ffffff;
    --bg-lighter: #f8f9fa;
    --text-dark: #333;
    --text-medium: #666;
    --text-light: #fff;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow-light: 0 2px 5px rgba(0,0,0,0.1);
    --shadow-medium: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-heavy: 0 15px 30px rgba(0,0,0,0.15);
    --transition-default: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: 0.2s ease;
    --nav-height: 120px;
    --content-max-width: 1800px;
}

/* 基础重置 - 优化选择器性能 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    overflow-x: hidden;
    padding-top: var(--nav-height);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-default);
}

ul { list-style: none; }
button { background: none; border: none; cursor: pointer; }

/* 隐藏下拉箭头 */
.dropdown-toggle::after { display: none !important; }

/* 头部导航结构 */
.header-harting {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    width: 100%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* 联系信息栏 - 关键修改：使用伪元素让背景延伸到屏幕边缘 */
.top-contact-bar {
    position: relative;
    height: 40px;
    color: var(--text-light);
    font-size: 14px;
    /* 移除背景色，由伪元素控制 */
}

/* 伪元素：让黑色背景延伸到屏幕边缘 */
.top-contact-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background-color: var(--bg-dark);
    z-index: -1;
}

.contact-info-container {
    position: relative;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 clamp(20px, 8vw, 150px);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(15px, 2vw, 30px);
}

.contact-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
}

.contact-info-item:hover { color: var(--primary-color); }
.contact-info-icon { color: var(--primary-color); font-size: 14px; }

/* 主导航栏 */
.main-nav-bar {
    background-color: var(--bg-light);
    box-shadow: var(--shadow-light);
    height: 80px;
}

.main-navigation {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 clamp(20px, 8vw, 150px);
    display: flex;
    align-items: center;
    height: 100%;
}

/* Logo区域 */
.logo-section {
    display: flex;
    align-items: center;
    margin-right: clamp(20px, 3vw, 50px);
    height: 100%;
    flex-shrink: 0;
}

.logo-harting {
    width: clamp(140px, 15vw, 210px);
    height: clamp(35px, 4vw, 60px);
    display: flex;
    align-items: center;
    transition: transform var(--transition-default);
}

.logo-harting:hover { transform: scale(1.03); }
.logo-harting img { max-height: 100%; max-width: 100%; object-fit: contain; }

/* 导航菜单 */
.nav-container { flex: 1; height: 100%; }

.nav-menu-harting {
    display: flex;
    align-items: center;
    gap: clamp(2px, 0.5vw, 5px);
    height: 100%;
}

/* 修改：所有有下拉菜单的导航项都使用静态定位，以便全屏菜单定位 */
.nav-item-harting.has-dropdown {
    position: static;
    height: 100%;
    display: flex;
    align-items: center;
}

/* 原来的普通导航项样式 */
.nav-item-harting {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link-harting {
    padding: 12px clamp(12px, 1.2vw, 20px);
    display: flex;
    align-items: center;
    height: 100%;
    font-weight: 500;
    font-size: clamp(14px, 1vw, 16px);
    color: var(--text-dark);
    transition: all var(--transition-default);
    border-radius: 0px; /* 修改：圆角改为0 */
    white-space: nowrap;
}

.nav-link-harting:hover,
.nav-link-harting.active { color: var(--primary-color); }
.nav-link-harting:hover { background-color: rgba(0, 0, 0, 0.05); }

/* 产品中心全屏水平平铺布局 */
.category-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100vw;
    /* 关键修改1：将渐变背景改为纯白色 */
    background: #ffffff;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px);
    transition: all var(--transition-default);
    z-index: 1002;
    /* 关键修改：移除上边框线 */
    border-top: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    /* 关键修改：移除阴影效果 */
    box-shadow: none;
}

.category-mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 70vh;
    padding: 25px 0;
}

.mega-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    /* 关键修改：减小左右内边距，增加可用宽度 */
    padding: 0 clamp(10px, 4vw, 80px);
}

/* 产品中心增强样式 - 动态列数卡片式布局 */
/* 产品中心增强样式 - 横向滚动布局（超过8个自动滑） */
.mega-columns {
  display: flex;
  flex-wrap: nowrap;       /* 强制不换行 */
  gap: 15px;
  max-width: 1400px;
  margin: 0 auto;
  padding-bottom: 8px;     /* 给滚动条留空间 */
  
  /* 横向滚动核心 */
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  
  /* 隐藏滚动条但保留功能 */
  scrollbar-width: none; /* Firefox */
}
.mega-columns::-webkit-scrollbar {
  height: 0; /* Chrome/Safari */
}

/* 每个分类列固定最小宽度，保证布局不乱 */
.mega-column {
  min-width: 160px;    /* 可根据你需求调宽度 */
  flex: 0 0 auto;      /* 不缩小、不增长、固定宽度 */
  background-color: transparent;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  border: none;
}

/* 二级分类头部 - 增强 */
.mega-header {
    font-weight: 500;
    font-size: clamp(13px, 0.9vw, 15px);
    color: var(--text-dark);
    padding: 12px 15px;
    margin: 0 0 8px 0; /* 增加底部间距 */
    border-bottom: 1px solid var(--border-color); /* ========== 关键修改2：二级分类下加分隔线 ========== */
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: transparent; /* 移除背景色 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mega-header a {
    color: var(--text-dark);
    transition: color var(--transition-fast);
    display: block;
    flex: 1;
}

.mega-header a:hover {
    color: var(--primary-color);
}

/* 添加分类图标指示器 - 关键修改2：启用并美化箭头图标 */
.mega-header-icon {
    display: inline-block; /* 显示箭头图标 */
    color: #999; /* 箭头默认颜色 */
    font-size: 12px; /* 箭头大小 */
    margin-left: 8px; /* 与文字的间距 */
    transition: color var(--transition-fast); /* 过渡效果 */
}

/* 鼠标悬停时箭头变色 */
.mega-header:hover .mega-header-icon {
    color: var(--primary-color);
}

/* 三级分类链接区域 - 增强 */
.mega-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

/* ========== 关键修改3：三级分类左侧黑色小圆点 ========== */
.mega-links a {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--text-medium);
    font-size: clamp(13px, 0.75vw, 13px);
    padding: 4px 15px; /* 调整内边距更舒适 */
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    padding-left: 26px; /* 给左边圆点留出空间 */
}

/* 左侧黑色小圆点 */
.mega-links a::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: #666; /* 黑色圆点 */
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.9;
    display: block;
}

/* 清空原有右侧箭头 */
.mega-links a::after {
    display: none;
}

/* 悬停效果优化 */
.mega-links a:hover {
    color: var(--primary-dark);
    background-color: transparent; /* 移除悬停背景色 */
}

/* 隐藏“查看全部”按钮 */
.mega-view-all {
    display: none !important;
}

/* 修改：其他导航分类的二级菜单 - 全屏图片网格布局（内间距优化） */
.other-category-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100vw;
    /* 关键修改3：其他分类菜单背景也改为纯白色 */
    background: #ffffff;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px);
    transition: all var(--transition-default);
    z-index: 1002;
    /* 关键修改：移除上边框线 */
    border-top: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    /* 关键修改：移除阴影效果 */
    box-shadow: none;
}

.other-category-mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 70vh;
    /* 减少容器内间距 */
    padding: 15px 0;
}

/* 优化：减少容器内间距 */
.other-mega-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    /* 减少左右内间距 */
    padding: 0 clamp(15px, 5vw, 80px);
}

/* 其他分类网格布局样式 - 优化内间距 */
.other-mega-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    /* 减少网格间距 */
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 网格项样式 - 优化内间距 */
.other-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-dark);
    transition: all var(--transition-default);
    border-radius: 0px; /* 修改：圆角改为0 */
    overflow: hidden;
    background-color: var(--bg-light);
    box-shadow: var(--shadow-light);
    /* 减少内间距 */
    padding: 10px;
    border: 1px solid transparent;
    height: 100%;
}

.other-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-light);
}

/* 图片容器样式 - 优化尺寸 */
.other-grid-image {
    width: 100%;
    /* 减小图片容器高度 */
    height: 90px;
    overflow: hidden;
    border-radius: 0px; /* 修改：圆角改为0 */
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-lighter);
}

.other-grid-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-default);
}

.other-grid-item:hover .other-grid-image img {
    transform: scale(1.05);
}

/* 分类标题样式 - 优化字体大小和间距 */
.other-grid-title {
    font-weight: 500;
    font-size: clamp(12px, 0.8vw, 14px);
    text-align: center;
    line-height: 1.3;
    color: var(--text-dark);
    transition: color var(--transition-default);
    /* 确保标题不会过长 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.6em;
}

.other-grid-item:hover .other-grid-title {
    color: var(--primary-color);
}

/* 默认图片样式 */
.other-grid-image .default-img {
    width: 50px;
    height: 50px;
    opacity: 0.3;
}

/* 搜索区域 */
.search-section {
    display: flex;
    align-items: center;
    margin-left: clamp(10px, 1.5vw, 20px);
    height: 100%;
    flex-shrink: 0;
}

.search-container-harting { width: clamp(140px, 15vw, 250px); }

.search-form {
    display: flex;
    position: relative;
    height: clamp(30px, 2.5vw, 36px);
}

.search-input-harting {
    width: 100%;
    padding: 0 clamp(35px, 3vw, 45px) 0 clamp(8px, 0.8vw, 12px);
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: var(--text-dark);
    border-radius: 0; /* 保持0，无需修改 */
    font-size: clamp(12px, 0.9vw, 14px);
    transition: all var(--transition-default);
    height: 100%;
}

.search-input-harting:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 182, 0, 0.2);
    background-color: var(--bg-light);
}

.search-button-harting {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: clamp(30px, 2.5vw, 40px);
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-default);
}

.search-button-harting:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.05);
}

/* 移动端菜单切换按钮 */
.menu-toggle {
    display: none;
    align-items: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-dark);
    transition: all var(--transition-default);
    padding: 8px 12px;
    border-radius: 0px; /* 修改：圆角改为0 */
    height: 100%;
    margin-left: auto;
}

.menu-toggle:hover { background-color: rgba(0, 0, 0, 0.1); }
.menu-toggle i { font-size: 20px; margin-right: 8px; }

/* 响应式设计 - 调整布局在不同屏幕的显示 */
@media (min-width: 1920px) {
    .contact-info-container,
    .main-navigation { 
        max-width: var(--content-max-width);
    }
    /* 关键修改：超大屏保持8列 */
    .mega-columns {
        grid-template-columns: repeat(8, 1fr);
        max-width: 1600px;
    }
}

@media (max-width: 1600px) {
    /* 关键修改：产品中心从8列改为7列，其他分类保持6列 */
    .mega-columns {
        grid-template-columns: repeat(7, 1fr);
        max-width: 1300px;
    }
    .other-mega-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 1100px;
    }
}

@media (max-width: 1400px) {
    /* 关键修改：产品中心从7列改为6列，其他分类保持5列 */
    .mega-columns {
        grid-template-columns: repeat(6, 1fr);
        max-width: 1100px;
    }
    .other-mega-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 900px;
    }
}

@media (max-width: 1200px) {
    .nav-link-harting { padding: 12px 15px; }
    /* 关键修改：产品中心从6列改为5列，其他分类保持4列 */
    .mega-columns {
        grid-template-columns: repeat(5, 1fr);
        max-width: 900px;
    }
    .other-mega-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 700px;
    }
}

@media (max-width: 992px) {
    .nav-container,
    .nav-menu-harting { display: none; }
    .menu-toggle { display: flex; }
    
    .contact-dropdown { display: none; }
    .mega-columns,
    .other-mega-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
    }
    
    /* 移动端其他分类菜单样式 */
    .other-category-mega-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        max-height: 70vh;
        transform: translateY(-100%);
        /* 移动端保持无边框 */
        border: none;
        padding: 0;
    }
    
    .other-category-mega-menu.active {
        transform: translateY(0);
        /* 移动端内间距更小 */
        padding: 10px 0;
    }
    
    .other-grid-item {
        box-shadow: none;
        border: 1px solid #eee;
        /* 移动端内间距优化 */
        padding: 8px;
    }
    
    .other-grid-image {
        height: 80px;
        margin-bottom: 6px;
    }
    
    .other-grid-title {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .top-contact-bar { display: none; }
    .main-nav-bar { height: 70px; }
    .logo-harting { width: 160px; height: 40px; }
    body { padding-top: 70px !important; }
    
    .category-mega-menu.active,
    .other-category-mega-menu.active {
        padding: 10px 0;
    }
    
    .mega-columns,
    .other-mega-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .other-grid-image {
        height: 70px;
        margin-bottom: 5px;
    }
    
    .other-grid-title {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .logo-harting { width: 140px; height: 35px; }
    .menu-toggle span { display: none; }
    .menu-toggle i { margin-right: 0; }
    
    .mega-columns,
    .other-mega-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .other-grid-image {
        height: 60px;
    }
    
    .other-grid-title {
        font-size: 11px;
    }
    
    /* 移动端容器内间距优化 */
    .other-mega-container {
        padding: 0 12px;
    }
}

@media (max-width: 400px) {
    .mega-columns,
    .other-mega-grid {
        grid-template-columns: 1fr;
        max-width: 280px;
        margin: 0 auto;
    }
}

/* 移动端侧边导航 */
.nav-mobile-container {
    position: fixed;
    top: 70px;
    left: -320px;
    width: 300px;
    height: calc(100vh - 70px);
    background: var(--bg-dark);
    padding: 20px;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1002;
    box-shadow: 5px 0 15px rgba(0,0,0,0.4);
    overflow-y: auto;
}

.nav-mobile-container.active { transform: translateX(320px); }

/* 移动端导航菜单 */
.nav-mobile-menu { display: flex; flex-direction: column; }

.nav-mobile-item { position: relative; margin: 12px 0; }

.nav-mobile-link {
    padding: 12px 15px;
    display: block;
    font-weight: 500;
    font-size: 16px;
    color: var(--text-light);
    transition: all var(--transition-default);
    border-radius: 0px; /* 修改：圆角改为0 */
}

.nav-mobile-link:hover,
.nav-mobile-link.active {
    color: var(--primary-color);
    background-color: rgba(255, 255, 250, 0.1);
}

/* 移动端下拉菜单 */
.mobile-dropdown-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    margin: 5px 0 0 15px;
    background: rgba(51,51,51,0.9);
    border-left: 2px solid var(--primary-color);
    padding: 5px 0;
    max-height: 0;
    overflow: hidden;
    transition: all var(--transition-default);
}

.mobile-dropdown-menu.active {
    visibility: visible;
    opacity: 1;
    max-height: 1000px;
    padding: 10px 0;
}

.mobile-dropdown-menu li {
    margin: 8px 0;
    position: relative;
}

.mobile-dropdown-menu li::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: var(--primary-color);
    border-radius: 0; /* 修改：圆点改为方块 */
}

.mobile-dropdown-menu a {
    display: block;
    padding: 8px 15px;
    color: #ddd;
    font-size: 14px;
    transition: all var(--transition-default);
    border-radius: 0px; /* 修改：圆角改为0 */
}

.mobile-dropdown-menu a:hover {
    color: var(--primary-color);
    background: rgba(255,255,255,0.1);
    padding-left: 20px;
}

/* 导航遮罩 */
.nav-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-default);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 优化动画性能 */
.category-mega-menu,
.other-category-mega-menu,
.mobile-dropdown-menu,
.nav-overlay {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* 添加产品中心悬停延迟效果，防止误触 */
.nav-item-harting.product-center .category-mega-menu,
.nav-item-harting:not(.product-center) .other-category-mega-menu {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}