/* 移动端底部导航栏样式优化 */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 900;
    display: none; /* 默认隐藏，媒体查询中显示 */
    transform: translateZ(0); /* 启用GPU加速 */
    will-change: transform; /* 告知浏览器元素将变化，优化性能 */
    -webkit-backface-visibility: hidden; /* 防止闪烁 */
    align-items: center; /* 保证子项垂直居中 */
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    width: auto !important;
    text-align: center;
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 5px 0;
    will-change: color; /* 优化颜色变化性能 */
    flex: 1 1 0%;          /* 平均分配剩余空间 */
}

/* 文字导航样式 */
.mobile-nav-item.active {
    color: #ff2a14;
}

.mobile-nav-item:hover, .mobile-nav-item:active {
    color: #ff2a14;
    text-decoration: none;
}

.mobile-nav-item.touching {
    color: #ff2a14;
}

/* 突出短视频 */
.highlight-nav {
    font-weight: 700;
    font-size: 18px;
    color: #ff2a14;
    position: relative; /* 用于放置NEW标识 */
}

/* NEW 倾斜小卡片 */
.highlight-nav::after {
    content: "NEW";
    position: absolute;
    top: -8px;
    right: 6px;
    background: #ff2a14;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 2px;
    transform: rotate(10deg);
    line-height: 14px;
    pointer-events: none;
}

/* 媒体查询 - 在移动设备上显示底部导航 */
@media screen and (max-width: 1024px) {
    /* 显示底部导航栏 */
    .mobile-bottom-nav {
        display: flex; 
    }
    
    /* 为底部导航腾出空间 */
    #footer {
        margin-bottom: 60px;
    }
    
    /* 隐藏右侧工具栏 */
    .fixed_right_bar {
        display: none;
    }
    
    /* 移动端图片懒加载优化 */
    .lazyload {
        will-change: opacity;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .lazyload.loaded {
        opacity: 1;
    }
    
    /* 减少主线程工作 - 简化移动端布局 */
    .module-item {
        transform: translateZ(0);
        will-change: transform, opacity;
    }
    
    /* 减少DOM元素，在移动端隐藏不必要的元素 */
    .seo-content,
    .module-item-text,
    .module-item-desc {
        display: none;
    }
    
    /* 优化滚动性能 */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 减少内存占用，优化列表渲染 */
    .module-list {
        contain: content;
    }
}

/* 黑色主题支持 */
[data-theme="dark"] .mobile-bottom-nav {
    background-color: #25252b;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .mobile-nav-item {
    color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .mobile-nav-item.active,
[data-theme="dark"] .mobile-nav-item:hover {
    color: #ff2a14;
}

[data-theme="dark"] .mobile-nav-item.touching {
    color: #ff2a14;
    opacity: 0.8;
}

/* 适配安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
    }
}

/* ---------- 修复底部导航栏布局 ---------- */
.mobile-bottom-nav {
    height: 60px; /* 调整为更紧凑高度 */
}

.mobile-nav-item {
    width: auto !important; /* 取消固定33%宽度 */
    flex: 1 1 0%;          /* 平均分配剩余空间 */
}

/* 移除已废弃圆形按钮相关样式 */
.center-circle {
    display: none !important;
}

/* freewatch 下拉菜单位置根据新高度调整 */
.freewatch-submenu {
    bottom: 75px;
}

/* freewatch submenu */
.freewatch-item {
    position: relative;
}
.freewatch-submenu {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    min-width: 120px;
    z-index: 910;
}
.freewatch-submenu a {
    padding: 10px 15px;
    color: #606060;
    font-size: 14px;
    text-align: center;
}
.freewatch-submenu a + a {
    border-top: 1px solid #eee;
}
.freewatch-submenu a:hover {
    background: #f6f6f6;
    color: #ff2a14;
}

.freewatch-item.open .freewatch-submenu {
    display: flex;
}

/* 底部语言选择器样式 */
.language-selector-item {
    position: relative;
}

.language-selector-submenu {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.language-selector-item.open .language-selector-submenu {
    display: block;
}

.language-selector-submenu a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
    border-bottom: 1px solid #f0f0f0;
}

.language-selector-submenu a:last-child {
    border-bottom: none;
}

.language-selector-submenu a.active {
    background: #f0f0f0;
    font-weight: bold;
    color: #ff2a14;
}

/* 暗黑模式适配 */
[data-theme="dark"] .language-selector-submenu {
    background: #222;
}

[data-theme="dark"] .language-selector-submenu a {
    color: #ddd;
    border-bottom-color: #333;
}

[data-theme="dark"] .language-selector-submenu a.active {
    background: #333;
    color: #ff2a14;
}

/* ================= 自定义增强 ================= */
/* 1. 扩大底部常驻导航栏与浮动语言选择器在平板等设备上的显示范围
   2. 修复 1024px–1239px 之间的桌面端布局，保证语言选择器始终可见 */

/* 平板与小型桌面 (≤1280px) */
@media screen and (max-width: 1280px) {
    /* 显示底部导航 */
    .mobile-bottom-nav {
        display: flex !important; /* 覆盖默认隐藏 */
    }

    /* 预留底部导航高度 */
    #footer {
        margin-bottom: 60px;
    }

    /* 隐藏侧边工具条，避免与底部导航冲突 */
    .fixed_right_bar {
        display: none;
    }

    /* 显示移动端浮动语言选择器（右下角圆形按钮） */
    .mobile-language-menu {
        display: block !important;
    }
}

/* 中等尺寸桌面 (≤1239px) 保证头部语言选择器可见 */
@media screen and (max-width: 1239px) {
    .nav-menu-item.language-menu {
        display: block !important; /* 覆盖 nth-child 隐藏规则 */
    }
}

/* 永久显示语言选择器，防止因 nth-child 规则被隐藏 */
.nav-menu-item.language-menu {
    display: block !important;
} 