/* ========================================
   二级页面导航头部样式 - sub-header.css
   这是一个独立的可复用组件
   
   【响应式适配说明】
   - 使用 clamp() 实现等比缩放
   - PC端（有hover能力）：悬浮展开
   - 移动端（无hover能力）：点击展开
   ======================================== */

/* ==================== 主容器 ==================== */
.sub-header {
    width: 100%;
    position: relative;
}

/* 上半部分背景色容器 - 全宽，只包含一级导航 */
.sub-header-top-bg {
    width: 100%;
    background-color: #E0EEFA;
}

/* 上半部分内容容器 */
.sub-header-top-inner {
    /* max-width: 1400px; */
    margin-left: clamp(20px, 6.77vw, 130px); /* 130px at 1920px, scales down */
    display: flex;
    align-items: center;
}

/* 二级菜单内容容器 */
.sub-nav-secondary-inner {
    /* max-width: 1400px; */
    margin: 0 auto;
}

/* ==================== 上半部分：标题 + 一级菜单 ==================== */
.sub-header-top {
    display: flex;
    align-items: center;
    position: relative;
    height: clamp(45px, 2.97vw, 57px); /* 57px at 1920px */
    width: 100%;
}

/* ==================== 左侧渐变色块区域（固定，不滚动） ==================== */
.sub-header-title-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #00D3D4 0%, #014DA5 100%);
    padding: 0 clamp(40px, 3.125vw, 60px) 0 clamp(30px, 2.6vw, 50px);
    border-radius: clamp(35px, 2.6vw, 50px) 0 0 clamp(35px, 2.6vw, 50px);
    margin-right: clamp(20px, 1.56vw, 30px);
    height: clamp(45px, 2.97vw, 57px);
    box-sizing: border-box;
    flex-shrink: 0; /* 不被压缩，不参与滚动 */
}

/* 大标题 */
.sub-header-title {
    font-size: clamp(18px, 1.15vw, 22px);
    font-weight: bold;
    color: #fff;
    letter-spacing: clamp(4px, 0.31vw, 6px);
    white-space: nowrap;
}

/* 白绿色同心圆装饰 */
.sub-header-circle {
    position: absolute;
    right: clamp(-24px, -1.51vw, -29px);
    top: 50%;
    transform: translateY(-50%);
    width: clamp(46px, 3.02vw, 58px);
    height: clamp(46px, 3.02vw, 58px);
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #71C3E4;
}

/* 同心圆内圈 */
.sub-header-circle::after {
    content: '';
    width: clamp(10px, 0.625vw, 12px);
    height: clamp(10px, 0.625vw, 12px);
    border-radius: 50%;
    border: clamp(2px, 0.156vw, 3px) solid #3EC0CB;
    background: transparent;
}

/* ==================== 一级菜单容器（可水平滚动） ==================== */
.sub-nav-primary-wrapper {
    flex: 1;
    overflow-x: auto;
    overflow-y: visible;
    margin-left:10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox 隐藏滚动条 */
    -ms-overflow-style: none; /* IE 隐藏滚动条 */
    /* 为子菜单留出垂直空间，防止被裁剪 */
    padding-bottom: 300px;
    margin-bottom: -300px;
}

/* 隐藏滚动条（移动端风格） */
.sub-nav-primary-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari 隐藏滚动条 */
}

/* ==================== 一级菜单 ==================== */
.sub-nav-primary {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    position: relative; /* 作为子菜单定位的基准（整个导航条内容的中心） */
}

.sub-nav-primary-item {
    position: relative;
    padding: clamp(8px, 0.52vw, 10px) clamp(20px, 1.82vw, 35px);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.sub-nav-primary-item a {
    font-size: clamp(14px, 0.885vw, 17px);
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap;
    font-weight: 550;
    flex-shrink: 0;
}

/* 一级菜单 - 悬浮状态 */
.sub-nav-primary-item:hover > a {
    color: #3EC0CB;
}

/* 当父容器有悬浮时，取消非悬浮项的激活状态 */
.sub-nav-primary:hover .sub-nav-primary-item.permanent-active:not(:hover) > a {
    color: #333;
}

/* 一级菜单 - 激活状态（当前页面） */
.sub-nav-primary-item.permanent-active > a {
    color: #3EC0CB;
}

/* 移动端展开状态 */
.sub-nav-primary-item.expanded > a {
    color: #3EC0CB;
}

/* ==================== 展开箭头图标（仅触摸设备显示） ==================== */
.sub-nav-toggle {
    display: none; /* PC端默认隐藏 */
    width: 16px;
    height: 16px;
    margin-left: 4px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

/* 触摸设备上显示展开按钮 */
.is-touch .has-children > .sub-nav-toggle {
    display: inline-block;
}

/* 箭头样式（收起时向上 ∧） */
.sub-nav-toggle::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-left: 2px solid #666;
    border-top: 2px solid #666;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: transform 0.3s ease, top 0.3s ease;
}

/* 展开状态时箭头旋转（向下 ∨） */
.sub-nav-primary-item.expanded > .sub-nav-toggle::before,
.sub-nav-secondary-item.expanded > .sub-nav-toggle::before {
    top: 40%;
    transform: translate(-50%, -50%) rotate(-135deg);
}

/* ==================== 二级菜单 ==================== */
.sub-nav-secondary {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 200px;
    z-index: 100; /* 提高层级确保显示在最上面 */
    align-items: center;
    list-style: none;
    justify-content: center;
    /* background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
    border-radius: 4px;
}

.sub-nav-secondary-item {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.sub-nav-secondary-item a {
    display: inline-block;
    padding: clamp(12px, 0.78vw, 15px) clamp(15px, 1.5vw, 35px);！important
    font-size: clamp(12px, 0.73vw, 14px);
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative; /* 添加相对定位，为下划线提供参照 */
}

/* 二级菜单 - 悬浮状态 */
.sub-nav-secondary-item:hover > a {
    color: #3EC0CB;
}

/* 二级菜单 - 悬浮状态下划线 */
.sub-nav-secondary-item:hover > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: clamp(25px, 1.82vw, 35px);
    right: clamp(25px, 1.82vw, 35px);
    height: 2px;
    background-color: #3EC0CB;
}

/* 当父容器有悬浮时，取消非悬浮项的激活状态 */
.sub-nav-secondary:hover .sub-nav-secondary-item.permanent-active:not(:hover) > a {
    color: #666;
}

.sub-nav-secondary:hover .sub-nav-secondary-item.permanent-active:not(:hover) > a::after {
    display: none;
}

/* 二级菜单 - 激活状态（当前页面） */
.sub-nav-secondary-item.permanent-active > a {
    color: #3EC0CB;
}

/* 二级菜单 - 激活状态下划线 */
.sub-nav-secondary-item.permanent-active > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: clamp(25px, 1.82vw, 35px);
    right: clamp(25px, 1.82vw, 35px);
    height: 2px;
    background-color: #3EC0CB;
}

/* 移动端展开状态 */
.sub-nav-secondary-item.expanded > a {
    color: #3EC0CB;
}

/* ==================== 三级菜单 ==================== */
.sub-nav-tertiary {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 160px;
    z-index: 101; /* 比二级菜单更高 */
    align-items: center;
    list-style: none;
    justify-content: center;
    /* background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); */
    border-radius: 4px;
}

.sub-nav-tertiary-item {
    position: relative;
    flex-shrink: 0;
}

.sub-nav-tertiary-item a {
    display: block;
    padding: clamp(4px, 0.26vw, 5px) clamp(15px, 1.04vw, 20px);
    font-size: clamp(11px, 0.677vw, 13px);
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    background-color: #F0F7FD;
    border-radius: clamp(12px, 0.78vw, 15px);
    margin: clamp(6px, 0.42vw, 8px) clamp(4px, 0.26vw, 5px);
}

/* 三级菜单 - 悬浮状态 */
.sub-nav-tertiary-item:hover > a {
    color: #3EC0CB;
}

/* 三级菜单 - 激活状态 */
.sub-nav-tertiary-item.permanent-active > a {
    color: #3EC0CB;
}

/* ==================== 菜单布局 ==================== */
.sub-nav-primary-item.has-children,
.sub-nav-secondary-item.has-children {
    position: static; /* 设为 static，让子菜单相对于 .sub-nav-primary 或 .sub-nav-secondary 定位 */
}

/* PC 端悬浮显示子菜单（仅在 is-pc 时生效） */
.is-pc .sub-nav-primary-item.has-children:hover > .sub-nav-secondary {
    display: flex;
}

.is-pc .sub-nav-secondary-item.has-children:hover > .sub-nav-tertiary {
    display: flex;
}

/* 触摸设备点击展开子菜单 */
.is-touch .sub-nav-primary-item.has-children.expanded > .sub-nav-secondary {
    display: flex;
}

.is-touch .sub-nav-secondary-item.has-children.expanded > .sub-nav-tertiary {
    display: flex;
}

/* ==================== 右侧面包屑（隐藏） ==================== */
.sub-header-right {
    display: none;
}

/* ==================== 响应式布局（PC端屏幕适配） ==================== */
@media screen and (max-width: 1200px) {
    .sub-header-top-inner {
        margin-left: clamp(15px, 4vw, 80px);
    }
}

@media screen and (max-width: 768px) {
    .sub-header-top-inner {
        margin-left: 10px;
    }
}

/* ==================== 触摸设备专属样式（等比例缩小） ==================== */
/* 二级菜单缩小 */
.is-touch .sub-nav-secondary {
    min-width: 90px;
}

.is-touch .sub-nav-secondary-item a {
    padding: 5px 10px;
    font-size: 11px;
}

.is-touch .sub-nav-secondary-item:hover > a::after,
.is-touch .sub-nav-secondary-item.permanent-active > a::after {
    left: 12px;
    right: 12px;
}

.is-touch .sub-nav-tertiary {
    min-width: 80px;
}
.is-touch .sub-nav-toggle {
    width: 14px;
    height: 14px;
    margin-left: 2px;
}

.is-touch .sub-nav-toggle::before {
    width: 4px;
    height: 4px;
    border-width: 1.5px;
}

/* ==================== 触摸设备 + 小屏幕（进一步缩小） ==================== */
@media screen and (max-width: 480px) {
    .is-touch .sub-header-top {
        height: 28px;
    }
    
    .is-touch .sub-header-title-wrap {
        padding: 0 20px 0 12px;
        border-radius: 18px 0 0 18px;
        margin-right: 5px;
        height: 28px;
    }
    
    .is-touch .sub-header-title {
        font-size: 10px;
        letter-spacing: 0px;
    }
    
    .is-touch .sub-header-circle {
        right: -12px;
        width: 28px;
        height: 28px;
    }
    
    .is-touch .sub-header-circle::after {
        width: 5px;
        height: 5px;
        border-width: 1px;
    }
    
    .is-touch .sub-nav-primary-item {
        padding: 4px 6px;
    }
    
    .is-touch .sub-nav-primary-item a {
        font-size: 10px;
    }
    
    .is-touch .sub-nav-secondary-item a {
        padding: 4px 8px;
        font-size: 9px;
    }
    
    .is-touch .sub-nav-secondary-item:hover > a::after,
    .is-touch .sub-nav-secondary-item.permanent-active > a::after {
        left: 8px;
        right: 8px;
    }
    
    .is-touch .sub-nav-tertiary-item a {
        padding: 2px 5px;
        font-size: 8px;
        border-radius: 5px;
        margin: 2px 1px;
    }
    
    .is-touch .sub-nav-toggle {
        width: 10px;
        height: 10px;
        margin-left: 1px;
    }
    
    .is-touch .sub-nav-toggle::before {
        width: 3px;
        height: 3px;
        border-width: 1px;
    }
}
/* ==================== 入场动画：从左侧滑入 ==================== 
.sub-header-top-bg.animate {
    animation: subHeaderSlideIn 1.5s ease-out both;
    will-change: transform, opacity;
}

@keyframes subHeaderSlideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sub-header-top-bg.animate {
        animation: none;
    }
}*/

/* ==================== 入场动画：渐变从小到大浅入 ==================== 
/* 先定义初始状态：默认隐藏在左侧+透明 */
.sub-header-title-wrap {
    opacity: 0; /* 初始透明 */
    transform: translateX(-20px); /* 初始左移20px */
    transition: all 0s; /* 兜底过渡 */
}
@keyframes leftRoundSlideIn {
   from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
.sub-header-title-wrap.animate {
    animation: leftRoundSlideIn 1s cubic-bezier(0.25, 0.1, 0.25, 1) both !important;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .sub-header-title-wrap.animate {
        animation: none;
        opacity: 1;
        transform: translateX(0);
    }
}

/* PC端：只有当父菜单没有被hover且自身是激活状态时，才保持展开 */
.is-pc .sub-nav-primary:not(:hover) .sub-nav-primary-item.permanent-active.has-children > .sub-nav-secondary,
.is-pc .sub-nav-secondary:not(:hover) .sub-nav-secondary-item.permanent-active.has-children > .sub-nav-tertiary {
  display: flex;
}

/* 恢复原有hover展开逻辑（其他导航项hover时显示自身子菜单） */
.is-pc .sub-nav-primary-item.has-children:hover > .sub-nav-secondary,
.is-pc .sub-nav-secondary-item.has-children:hover > .sub-nav-tertiary {
  display: flex;
}