/* =========================================
   1. 基础公共样式
   ========================================= */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    z-index: 1000;
    /* background: rgba(255, 255, 255, 0.98); */
    background-color: rgba(255, 255, 255, 1);
    backdrop-filter: blur(10px);
    /* 毛玻璃效果 */
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* width: 100%; */
}

.logo {
    font-size: 22px;
    color: #ff4d4f;
    font-weight: 800;
    display: flex;
    align-items: center;
}

.logo-icon {
    margin-right: 6px;
    font-size: 26px;
}

.main-nav a {
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

/* 汉堡按钮 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 1002;
    /* 比菜单高 */
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 24px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 auto;
}

.has-arrow::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid #999;
    border-bottom: 1.5px solid #999;
    transform: rotate(45deg);
    margin-left: 8px;
    margin-bottom: 2px;
    transition: 0.3s;
}

/* =========================================
   2. 电脑端样式 (min-width: 769px)
   ========================================= */
@media (min-width: 769px) {
    .nav-list {
        display: flex;
        gap: 40px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-list>li {
        position: relative;
    }

    .nav-list>li>a {
        display: block;
        padding: 20px 0;
        font-weight: 500;
        font-size: 15px;
    }

    /* .nav-list>li>a:hover {
        color: #ff4d4f;
    } */
    .nav-list>li>a:hover,
.nav-list>li:hover>a {
    color: #ff4d4f;
    font-weight: bold;
}

    .nav-list>li>a.active {
        color: #ff4d4f;
        font-weight: bold;
    }
    .nav-list>li>a.active.has-arrow::after {
        border-color: #ff4d4f;
    }

    /* 二级菜单悬浮 */
    .sub-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: -20px;
        width: 180px;
        background: #fff;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        padding: 8px 0;
        list-style: none;
        z-index: 1001;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s;
    }

    .menu-item-has-children:hover .sub-menu {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

    .menu-item-has-children:hover .has-arrow::after {
        transform: rotate(225deg);
        border-color: #ff4d4f;
    }

    .sub-menu a {
        display: block;
        padding: 10px 20px;
        font-size: 14px;
        color: #555;
    }

    .sub-menu a:hover {
        background: #fdfdfd;
        color: #ff4d4f;
        padding-left: 25px;
    }

    .sub-menu a.active {
        color: #ff3010;
        font-weight: 700;
    }

    /* 悬停微动 */
}

/* =========================================
   3. 手机端优化样式 (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    .site-header {
        padding: 0 20px;
        height: 56px;
    }

    .menu-toggle {
        display: flex;
    }

    /* 汉堡按钮变为 X */
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
        width: 24px;
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-10px);
    }

    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
        width: 24px;
    }

    /* 遮罩层 */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        backdrop-filter: blur(2px);
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* 侧滑抽屉菜单 */
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 75%;
        max-width: 300px;
        height: 100vh;
        background: #fff;
        padding-top: 80px;
        z-index: 1001;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.05);
        transform: translateX(100%);
        /* 移出屏幕 */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        /* 丝滑缓动 */
        overflow-y: auto;
    }

    .main-nav.open {
        transform: translateX(0);
    }

    /* 菜单列表 */
    .nav-list {
        list-style: none;
        padding: 0 20px;
        margin: 0;
    }

    .nav-list>li {
        border-bottom: 1px solid #f5f5f5;
    }

    .nav-list>li>a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 18px 0;
        font-size: 16px;
        font-weight: 500;
        color: #333;
    }

    .nav-list>li>a.active {
        color: #ff4d4f;
    }

    /* 二级菜单 */
    .sub-menu {
        display: none;
        list-style: none;
        padding: 0;
        margin-bottom: 10px;
        background: #f9f9f9;
        border-radius: 8px;
    }

    .sub-menu.sub-menu-open {
        display: block !important;
        animation: expand 0.3s;
    }

    @keyframes expand {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .sub-menu li:last-child {
        border-bottom: none;
    }

    .sub-menu a {
        padding: 12px 20px;
        font-size: 14px;
        color: #666;
        position: relative;
        display: block;
    }

    /* 二级菜单选中指示条 */
    .sub-menu a:hover,
    .sub-menu a:active {
        color: #ff4d4f;
        background: rgba(255, 77, 79, 0.05);
    }

    .sub-menu a.active {
        color: #ff3010;
        font-weight: 700;
        background: rgba(255, 48, 14, 0.06);
    }

    /* 箭头旋转 */
    .has-arrow.arrow-active {
        color: #ff4d4f;
    }

    .has-arrow.arrow-active::after {
        transform: rotate(225deg);
        border-color: #ff4d4f;
    }


    .header-inner {
        justify-content: flex-start; 
    }

    /* 2. 明确 Logo 顺序为 1 */
    .logo {
        order: 1;
    }

    /* 3. 明确语言切换顺序为 2，并吸收所有左侧剩余空间 */
    .language-switcher {
        order: 2;
        margin-left: auto; /* 关键：把后面的元素一起推向右侧 */
        margin-right: 18px; /* 与汉堡菜单保持安全触控距离 */
        padding-left: 0;
        font-size: 14px;
    }

    /* 4. 明确汉堡按钮顺序为 3，固定在最右侧 */
    .menu-toggle {
        order: 3;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 0 14px;
    }

    .logo img {
        width: 92px;
        height: auto;
    }

    .main-nav {
        width: 86vw;
        max-width: 320px;
        padding-top: 72px;
    }

    .nav-list {
        padding: 0 18px;
    }

    .nav-list>li>a {
        padding: 16px 0;
        font-size: 15px;
    }

    .site-header {
        padding: 0 14px;
    }

    .logo img {
        width: 92px;
        height: auto;
    }

    .main-nav {
        width: 86vw;
        max-width: 320px;
        padding-top: 72px;
    }

    .nav-list {
        padding: 0 18px;
    }

    .nav-list>li>a {
        padding: 16px 0;
        font-size: 15px;
    }

    /* 小屏幕进一步压缩间距 */
    .language-switcher {
        margin-right: 14px; 
    }
}


/* 语言切换区域布局 */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 24px;
    padding-left: 24px;
    font-size: 15px;
}

/* 按钮基础样式：默认颜色 */
.language-switcher .lang-btn {
    cursor: pointer;
    color: #333;
    transition: color 0.3s ease;
}

/* 鼠标悬停变色 */
.language-switcher .lang-btn:hover {
    color: #ff4d4f;
}

/* 激活状态：颜色变红并加粗 */
.language-switcher .lang-btn.active {
    color: #ff4d4f;
    font-weight: bold;
}

/* 中间的分割线 / */
.language-switcher .divider {
    color: #ccc;
    font-size: 14px;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .language-switcher {
        margin-left: auto;
        margin-right: 14px;
        padding-left: 0;
        font-size: 14px;
        order: 2;
    }
}
