/* ==========================================
   四为数据中心 - Header样式
   包含滚动效果和Mega Menu
   ========================================== */

/* Header基础样式 */
.siwei-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #ffffff;
    transition: all 0.3s ease;
    padding: 20px 0;
}

/* Header内部容器 - 默认居中，固定宽度 */
.siwei-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

/* 滚动后的Header样式 */
.siwei-header.scrolled {
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 滚动后保持居中，只调整高度 */
.siwei-header.scrolled .siwei-header-inner {
    /* 保持与默认相同的max-width，不扩展到全屏 */
    max-width: 1200px;
    padding: 0 30px;
}

/* Logo样式 */
.siwei-logo {
    flex-shrink: 0;
}

.siwei-logo img {
    height: 50px;
    width: auto;
    transition: height 0.3s ease;
}

.siwei-header.scrolled .siwei-logo img {
    height: 40px;
}

.siwei-logo-text {
    font-size: 24px;
    font-weight: bold;
    color: #003366;
    text-decoration: none;
}

/* 导航菜单 */
.siwei-nav {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.siwei-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 5px;
}

.siwei-menu > li {
    position: relative;
}

.siwei-menu > li > a {
    display: block;
    padding: 12px 18px;
    color: #333333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s;
}

.siwei-menu > li > a:hover,
.siwei-menu > li.current-menu-item > a {
    color: #006aa6;
}

/* 子菜单 - 备用显示 */
.siwei-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    padding: 20px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.siwei-menu > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}

.siwei-menu .sub-menu li {
    margin: 10px 0;
}

.siwei-menu .sub-menu li a {
    color: #006aa6;
    text-decoration: none;
    font-size: 14px;
}

.siwei-menu .sub-menu li a:hover {
    color: #003460;
}

/* Mega Menu容器 - 用于自定义内容 */
.siwei-menu > li.menu-item-has-children {
    position: relative;
}

.siwei-menu > li.menu-item-has-children .mega-menu-container {
    position: absolute;
    top: 100%;
    left: 0; /* JavaScript会动态设置为负值 */
    width: 100vw;
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    display: flex;
}

.siwei-menu > li.menu-item-has-children:hover .mega-menu-container {
    opacity: 1;
    visibility: visible;
}

/* Mega Menu 左侧蓝色描述区域 */
.mega-menu-container .mega-menu-left {
    width: 400px;
    background: linear-gradient(135deg, #006aa6 0%, #003460 100%);
    color: #ffffff;
    padding: 30px 30px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mega-menu-container .mega-menu-left h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #ffffff;
}

.mega-menu-container .mega-menu-left p,
.mega-menu-container .mega-menu-left div{
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.95);
}

.mega-menu-container .mega-menu-left p:last-child,
.mega-menu-container .mega-menu-left div:last-child {
    margin-bottom: 0;
}

/* Mega Menu 右侧内容区域 */
.mega-menu-container .mega-menu-right {
    flex: 1;
    padding: 30px 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

/* Mega Menu 右侧标题 */
.mega-menu-container .mega-menu-title {
    width: 100%;
    font-size: 32px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 30px 0;
    text-align: center;
}

/* Mega Menu 内容列 */
.mega-menu-container .mega-menu-column {
    flex: 1;
    min-width: 220px;
}

.mega-menu-container .mega-menu-column h4 {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e5e5;
}

.mega-menu-container .mega-menu-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 两列布局：让链接分两列显示 */
.mega-menu-container .mega-menu-column.two-columns ul {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 30px; /* 列间距 */
}

.mega-menu-container .mega-menu-column ul li {
    margin: 0 0 12px 0;
}

.mega-menu-container .mega-menu-column ul li a {
    display: inline-block;
    color: #006aa6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
    padding-left: 0;
}

.mega-menu-container .mega-menu-column ul li a:hover {
    color: #003460;
    padding-left: 8px;
}

.mega-menu-container .mega-menu-column ul li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: #006aa6;
    transition: width 0.3s;
}

.mega-menu-container .mega-menu-column ul li a:hover::before {
    width: 4px;
}

/* Mega Menu 按钮 */
.mega-menu-container .mega-menu-button {
    display: inline-block;
    padding: 12px 30px;
    background: #006aa6;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    transition: background 0.3s;
    margin-top: 20px;
}

.mega-menu-container .mega-menu-button:hover {
    background: #003460;
}

/* Mega Menu 底部按钮容器 */
.mega-menu-container .mega-menu-bottom {
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.mega-menu-container .mega-menu-bottom .mega-menu-button {
    margin-top: 0;
}

/* Header语言切换器 */
.siwei-header-language {
    flex-shrink: 0;
    margin-right: 15px;
}

.language-switcher-header {
    position: relative;
}

.language-switcher-header .current-language {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.language-switcher-header .current-language:hover {
    background: #e9ecef;
    border-color: #006aa6;
}

.language-switcher-header .current-language .flag {
    font-size: 18px;
    line-height: 1;
}

.language-switcher-header .current-language .lang-code {
    font-weight: 600;
}

.language-switcher-header .current-language .arrow {
    font-size: 10px;
    margin-left: 2px;
    transition: transform 0.3s ease;
}

.language-switcher-header:hover .current-language .arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.language-switcher-header .language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.language-switcher-header:hover .language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 语言选项 */
.language-dropdown .language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.language-dropdown .language-option:last-child {
    border-bottom: none;
}

.language-dropdown .language-option:hover {
    background: #f8f9fa;
    color: #006aa6;
}

.language-dropdown .language-option.active {
    background: #e7f3ff;
    color: #006aa6;
    font-weight: 600;
}

.language-dropdown .language-option .flag {
    font-size: 18px;
    line-height: 1;
}

.language-dropdown .language-option .name {
    flex: 1;
}

.language-dropdown .language-option .checkmark {
    color: #006aa6;
    font-weight: bold;
}

/* CTA按钮 */
.siwei-header-cta {
    flex-shrink: 0;
}

.siwei-btn-cta {
    display: inline-block;
    padding: 12px 24px;
    background: #006aa6;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    transition: background 0.3s;
    white-space: nowrap;
}

.siwei-btn-cta:hover {
    background: #003460;
}

/* 移动端菜单按钮 */
.siwei-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.siwei-mobile-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333333;
    transition: all 0.3s;
}

/* ==========================================
   Header 模式控制
   ========================================== */

/* 标准模式 - 为固定header留出空间 */
body.header-mode-standard {
    padding-top: 90px; /* 默认header高度: padding(20px) + logo(50px) + 间距 ≈ 90px */
}

body.header-mode-standard.admin-bar {
    padding-top: 90px; /* 后台管理栏 + header */
}

/* 悬浮模式 - 不留空间，header悬浮到内容上 */
body.header-mode-overlay {
    padding-top: 0;
}

body.header-mode-overlay.admin-bar {
    padding-top: 32px; /* 只留后台管理栏的空间 */
}

/* 悬浮模式 - Header 默认透明背景 + 白色字体 */
body.header-mode-overlay .siwei-header {
    background: transparent;
}

body.admin-bar .siwei-header{
    top: 32px;
}

body.header-mode-overlay .siwei-menu > li > a {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* 增加文字阴影提高可读性 */
}

body.header-mode-overlay .siwei-menu > li > a:hover,
body.header-mode-overlay .siwei-menu > li.current-menu-item > a {
    color: #006aa6;
}

body.header-mode-overlay .siwei-logo-text {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.header-mode-overlay .siwei-mobile-toggle span {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.header-mode-overlay .siwei-btn-cta {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 2px solid #ffffff;
}

body.header-mode-overlay .siwei-btn-cta:hover {
    background: #006aa6;
    border-color: #006aa6;
    color: #ffffff;
}

/* 悬浮模式下的语言切换器样式 */
body.header-mode-overlay .language-switcher-header .current-language {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

body.header-mode-overlay .language-switcher-header .current-language:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

body.header-mode-overlay .siwei-header.scrolled .language-switcher-header .current-language {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* 悬浮模式 - 滚动后变为半透明黑色背景 */
body.header-mode-overlay .siwei-header.scrolled {
    background: rgba(0, 0, 0, 0.85); /* 85% 不透明度的黑色 */
}

/* 悬浮模式滚动后，字体保持白色 */
body.header-mode-overlay .siwei-header.scrolled .siwei-menu > li > a {
    color: #ffffff;
}

body.header-mode-overlay .siwei-header.scrolled .siwei-menu > li > a:hover,
body.header-mode-overlay .siwei-header.scrolled .siwei-menu > li.current-menu-item > a {
    color: #006aa6;
}

body.header-mode-overlay .siwei-header.scrolled .siwei-logo-text {
    color: #ffffff;
}

/* 悬浮模式的 Mega Menu 样式调整 */
body.header-mode-overlay .siwei-menu > li.menu-item-has-children .mega-menu-container {
    /* Mega Menu 保持白色背景，便于阅读 */
    background: #ffffff;
}

/* 悬浮模式下，移动端菜单的背景 */
body.header-mode-overlay .siwei-nav {
    background: rgba(0, 0, 0, 0.95);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.header-mode-overlay .siwei-nav.active .siwei-menu > li > a {
    color: #ffffff;
}

/* ==========================================
   Footer样式
   ========================================== */
/* Footer基础样式 */
.siwei-footer {
    background: #f8f9fa;
    padding: 40px 20px 20px;
    border-top: 1px solid #e0e0e0;
}

.siwei-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

/* 左侧：Logo */
.footer-left {
    flex-shrink: 0;
}

.footer-logo {
    display: block;
}

.footer-logo img {
    height: 50px;
    width: auto;
    transition: opacity 0.3s ease;
}

.footer-logo:hover img {
    opacity: 0.8;
}

/* 右侧：语言切换器和版权信息 */
.footer-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

/* 语言切换器 */
.footer-right .language-switcher {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.language-switcher ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
}

.language-switcher li {
    display: inline-block;
}

.language-switcher a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    text-decoration: none;
    color: #666;
    background: #f5f5f5;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.language-switcher a:hover {
    background: #e0e0e0;
    color: #333;
}

.language-switcher li.current-lang a {
    background: #006aa6;
    color: #ffffff;
    font-weight: bold;
}

.language-switcher img {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border: 1px solid #ddd;
}

/* 版权信息 */
.footer-right .copyright {
    margin: 0;
    color: #666;
    font-size: 14px;
    text-align: right;
}

/* 响应式 - 平板和手机 */
@media (max-width: 900px) {
    /* 调整Header布局，让右侧元素靠右对齐 */
    .siwei-header-inner {
        gap: 10px;
    }

    /* Logo 靠左 */
    .siwei-logo {
        order: 1;
        margin-right: auto;
    }

    .siwei-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        padding: 20px;
        max-height: calc(100vh - 100px); /* 限制最大高度，留出header和底部空间 */
        overflow-y: auto; /* 允许垂直滚动 */
        overflow-x: hidden; /* 隐藏横向滚动 */
        -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    }

    .siwei-nav.active {
        display: block;
    }

    .siwei-menu {
        flex-direction: column;
        gap: 0;
    }

    /* 移动端隐藏Mega Menu容器 */
    .siwei-menu > li.menu-item-has-children .mega-menu-container {
        display: none !important;
    }

    /* 移动端显示默认sub-menu */
    .siwei-menu .sub-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        padding: 10px 0 10px 20px !important;
        margin-top: 10px !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important;
        display: block !important;
    }

    .siwei-menu .sub-menu li {
        width: 100% !important;
        padding: 5px 0 !important;
    }

    .siwei-menu .sub-menu li a {
        font-size: 14px !important;
        border: none !important;
        padding: 5px 0 !important;
    }

    .siwei-header-cta {
        display: none;
    }

    /* 移动端语言切换器 - 精简样式，和汉堡菜单一起靠右 */
    .siwei-header-language {
        order: 2;
        margin-right: 0;
    }

    /* 移动端：只显示国旗图标，隐藏语言代码和箭头 */
    .language-switcher-header .current-language {
        padding: 8px 10px;
        min-width: auto;
    }

    .language-switcher-header .current-language .lang-code {
        display: none;
    }

    .language-switcher-header .current-language .arrow {
        display: none;
    }

    .language-switcher-header .current-language .flag {
        font-size: 20px;
    }

    /* 移动端下拉菜单保持完整 */
    .language-switcher-header .language-dropdown {
        min-width: 150px;
    }

    /* 汉堡菜单按钮 */
    .siwei-mobile-toggle {
        display: flex;
        order: 3;
    }
}

/* ==========================================
   页面模板样式 (page.php)
   ========================================== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 30px;
}

.page-container article {
    background: #ffffff;
}

.page-container .entry-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #006aa6;
}

.page-container .entry-title {
    font-size: 36px;
    font-weight: 700;
    color: #333333;
    margin: 0;
}

.page-container .entry-content {
    font-size: 16px;
    line-height: 1.8;
    color: #555555;
}

.page-container .entry-content h2,
.page-container .entry-content h3,
.page-container .entry-content h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333333;
}

.page-container .entry-content p {
    margin-bottom: 20px;
}

.page-container .entry-content ul,
.page-container .entry-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.page-container .entry-content img {
    max-width: 100%;
    height: auto;
}

/* ==========================================
   Elementor 全宽模板样式
   ========================================== */
.elementor-full-width {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.elementor-full-width > * {
    margin: 0;
    padding: 0;
}

/* 确保 Elementor 编辑器中的内容区域全宽 */
.elementor-full-width .elementor {
    width: 100%;
}

/* Elementor 容器不添加额外边距 */
.elementor-full-width .elementor-section {
    margin: 0;
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
    .siwei-header {
        padding: 15px 0;
    }

    .siwei-header-inner {
        padding: 0 20px;
    }

    .siwei-logo img {
        height: 40px;
    }

    /* 移动端语言切换器更紧凑 */
    .siwei-header-language {
        order: 2;
        margin-right: 12px;
    }

    .language-switcher-header .current-language {
        padding: 6px 8px;
        background: transparent;
        border: 1px solid #e0e0e0;
    }

    .language-switcher-header .current-language .flag {
        font-size: 22px;
    }

    /* 移动端悬浮模式下的语言切换器 */
    body.header-mode-overlay .language-switcher-header .current-language {
        background: transparent;
        border-color: rgba(255, 255, 255, 0.4);
    }

    body.header-mode-overlay .siwei-header.scrolled .language-switcher-header .current-language {
        border-color: rgba(255, 255, 255, 0.3);
    }

    /* 汉堡菜单靠右 */
    .siwei-mobile-toggle {
        order: 3;
    }

    /* 移动端CTA按钮隐藏 */
    .siwei-header-cta {
        display: none;
    }

    .page-container {
        padding: 40px 20px;
    }

    .page-container .entry-title {
        font-size: 28px;
    }

    /* Footer响应式 */
    .siwei-footer-inner {
        flex-direction: column;
        align-items: center;
        gap: 25px;
        text-align: center;
    }

    .footer-left {
        order: 1;
    }

    .footer-logo img {
        height: 40px;
    }

    .footer-right {
        order: 2;
        align-items: center;
    }

    .footer-right .copyright {
        text-align: center;
    }

    .footer-right .language-switcher {
        justify-content: center;
    }
}
