/* =========================
   Header / Mega / Language
   拆分后稳定版：含 min-height 兜底
========================= */

/* 只保留 header-h 的默认值，最终会被 header.js 动态覆盖 */
:root {
    --header-h: 80px;
}

/* 可访问性：跳转到主内容 */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 10px;
    background: #000;
    color: #fff;
    padding: 10px 14px;
    z-index: 2000;
    border-radius: 8px;
}
.skip-link:focus {
    left: 10px;
}

/* 语义化 button：避免默认样式影响布局 */
button.language-current,
button.search-icon,
button.mobile-menu-toggle {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
}

/* =========================
   Header / Nav
========================= */
header {
    background-color: var(--primary-color);
    box-shadow: var(--shadow-light);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    min-height: 80px;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    min-height: 80px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: 10px;
}

.logo-img {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.logo-img a {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.logo picture {
    display: block;
    line-height: 0;
    margin: 0;
    padding: 0;
}

.logo img {
    height: 50px;
    width: auto;
    max-width: none;
    display: block;
    object-fit: contain;
    object-position: left center;
    margin: 0;
    padding: 0;
}

/* Nav */
nav {
    flex: 1 1 auto;
    min-width: 0;
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0 15px;
    position: relative;
}

/* PC端给一级菜单增加一个“悬浮桥接区”，避免与下拉菜单断层 */
nav ul li::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
    background: transparent;
}

nav ul li a {
    font-weight: 500;
    padding: 5px 0;
    position: relative;
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

nav ul li a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

nav ul li a:hover:after,
nav ul li a.active:after {
    width: 100%;
}

nav ul li a.active {
    color: var(--accent-color);
    font-weight: 600;
}

/* Header right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* =========================
   Language Switcher
========================= */
.language-switcher {
    position: relative;
    flex: 0 0 auto;
}

.language-current {
    position: relative;
    width: 120px;
    height: 40px;
    padding: 0 34px 0 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: var(--border-radius);
    background-color: var(--secondary-color);
    cursor: pointer;
    user-select: none;
}

.language-current span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.language-current i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    font-size: 0.85rem;
    transition: transform 0.22s ease;
    pointer-events: none;
}

.language-switcher.is-open .language-current i {
    transform: translateY(-50%) rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 8px;
    z-index: 100;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.language-option {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.language-option:hover {
    background-color: rgba(230, 0, 18, 0.08);
    color: var(--accent-color);
    transform: translateX(2px);
}

.language-option.active {
    background-color: rgba(230, 0, 18, 0.10);
    color: var(--accent-color);
}

/* Search icon */
.search-icon {
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-icon:hover {
    background-color: var(--secondary-color);
}

/* Mobile menu toggle - 放大 */
.mobile-menu-toggle {
    display: none;
    width: 52px;
    height: 52px;
    font-size: 1.8rem;
    cursor: pointer;
    border-radius: 14px;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-dark);
}

.mobile-menu-toggle i {
    font-size: 1.7rem;
    line-height: 1;
}

.mobile-menu-toggle:hover {
    background-color: var(--secondary-color);
}

/* =========================
   Mega Menu（桌面）
========================= */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 6px);   /* 原来 195% 太远，这里改成紧贴一级导航 */
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 140px;
    width: auto;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    padding: 4px 0;
    margin: 0;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    display: block !important;
    float: none !important;
}

nav ul li.mega-open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    float: none !important;
}

.nav-dropdown li::after {
    display: none !important;
}

.nav-dropdown a {
    display: block !important;
    padding: 11px 18px !important;
    color: #333333 !important;
    font-weight: 400 !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    border-bottom: 1px solid #f5f5f5;
    background: transparent !important;
    text-align: center !important;
}

.nav-dropdown li:last-child a {
    border-bottom: none !important;
}

.nav-dropdown a:hover {
    background-color: #f8f8f8 !important;
    color: #e60012 !important;
}

.mega-panel,
.mega-inner,
.mega-menu,
.mega-item {
    display: none !important;
}

/* =========================
   Responsive: <=992 nav drawer; no mega
========================= */
@media (max-width: 992px) {
    :root {
        --header-h: 82px;
    }

    header {
        min-height: 82px;
    }

    .header-container {
        min-height: 82px;
        padding: 10px 14px 10px 18px;
        gap: 10px;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        order: 3;
        width: 56px;
        height: 56px;
        font-size: 1.9rem;
        border-radius: 16px;
    }

    .mobile-menu-toggle i {
        font-size: 1.8rem;
    }

    .logo {
        order: 1;
        margin-left: 12px;
    }

    .header-right {
        order: 2;
        gap: 8px;
        margin-left: auto;
    }

    .logo img {
        height: 58px;
        width: auto;
        max-width: 230px;
        object-fit: contain;
        object-position: left center;
    }

    .language-current {
        width: 104px;
        height: 38px;
        padding: 0 30px 0 10px;
    }

    .search-icon {
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 1.15rem;
    }

    nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        width: 100%;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        background-color: var(--primary-color);
        box-shadow: var(--shadow-medium);
        padding: 14px 16px 18px;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        z-index: 999;
    }

    nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    nav ul {
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
        justify-content: flex-start;
    }

    nav ul li {
        margin: 0;
        position: relative;
        border-radius: 8px;
    }

    nav ul li::after {
        display: none;
    }

    nav ul li > a {
        display: block;
        padding: 14px 54px 14px 14px;
        border-radius: 10px;
        font-weight: 600;
        color: var(--text-dark);
        background: transparent;
        font-size: 1rem;
        line-height: 1.25;
    }

    nav ul li > a:hover {
        background: rgba(0,0,0,0.04);
    }

    nav ul li > a.active {
        color: var(--accent-color);
        background: rgba(230,0,18,0.06);
    }

    .mobile-expand-btn {
        position: absolute;
        right: 6px;
        top: 8px;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #888;
        z-index: 5;
        border-radius: 10px;
    }

    .mobile-expand-btn:hover {
        background: rgba(0,0,0,0.04);
    }

    .mobile-expand-btn i {
        font-size: 1rem;
        transition: transform 0.2s ease;
    }

    .mobile-expand-btn.rotated i {
        transform: rotate(180deg);
    }

    .mobile-submenu {
        margin: 4px 0 6px 12px;
        padding: 4px 0 4px 10px;
        border-left: 1px solid rgba(0,0,0,0.08);
        background: transparent;
    }

    .mobile-submenu-list {
        display: block;
    }

    .mobile-submenu-item {
        display: block;
        padding: 10px 12px;
        margin: 2px 0;
        border-radius: 8px;
        color: var(--text-medium);
        text-decoration: none;
        font-size: 0.92rem;
        font-weight: 400;
        transition: background .18s ease, color .18s ease;
    }

    .mobile-submenu-item:hover {
        background: rgba(230,0,18,0.06);
        color: var(--accent-color);
    }

    .nav-dropdown {
        display: none !important;
    }

    .mega-panel {
        display: none !important;
    }
}

@media (max-width: 768px) {
    :root {
        --header-h: 78px;
    }

    header {
        min-height: 78px;
    }

    .header-container {
        min-height: 78px;
        padding: 8px 12px 8px 16px;
        gap: 8px;
    }

    .logo {
        margin-left: 10px;
    }

    .logo img {
        height: 54px;
        max-width: 210px;
    }

    .mobile-menu-toggle {
        width: 54px;
        height: 54px;
        border-radius: 15px;
    }

    .mobile-menu-toggle i {
        font-size: 1.75rem;
    }

    .language-current {
        width: 96px;
        height: 36px;
        font-size: 0.9rem;
    }

    .search-icon {
        width: 38px;
        height: 38px;
        font-size: 1.05rem;
    }

    nav {
        top: var(--header-h);
        max-height: calc(100vh - var(--header-h));
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 8px 10px 8px 14px;
    }

    .logo {
        margin-left: 8px;
    }

    .logo img {
        height: 56px;
        max-width: 190px;
    }

    .header-right {
        gap: 6px;
    }

    .language-current {
        width: 88px;
        padding: 0 28px 0 8px;
        font-size: 0.86rem;
    }

    .mobile-menu-toggle {
        width: 50px;
        height: 50px;
    }

    .mobile-menu-toggle i {
        font-size: 1.65rem;
    }
}

/* 多语言支持 - 俄文字体 */
.russian-lang {
    font-family: var(--font-family-russian), var(--font-family-english);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 100;
    box-shadow: var(--shadow-medium);
    border: none;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--accent-hover);
    transform: translateY(-5px);
}