/*
Theme Name: B2 PRO UPOP
Theme URI: https://7b2.com/
Description: B2 PRO UPOP定制子主题，用于安全的功能扩展
Author: 萌小果 12155673
Author URI: 
Template: b2
Version: 1.0.0
Text Domain: b2-upop
*/
/* 文章标题样式 */
article.single-article h1 {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.0 !important;
}

/* 为公告文章添加灰色水平线 */
.single article.single-article .entry-header {
    margin-bottom: 20px !important;
    border-bottom: 1px solid #f5f6f7 !important;
    padding-bottom: 20px !important;
}

/* 确保影视文章不受影响 */
.single article.single-article .entry-header.movie-header {
    margin-bottom: 0 !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

/* 移动端内容布局修复 - 恢复B2主题原始边距设置 */
@media screen and (max-width: 768px) {
    /* 恢复B2主题原始的模块与两侧间距 - 排除影响滑块模块的样式 */
    .site-content,
    .content-area:not(.slider-area),
    .home_row:not(.slider-row),
    .content-wrap:not(.slider-content),
    .b2_module:not(.module-sliders):not(.index-slider-top),
    .b2_ajax_load {
        margin: 0 6px !important;
        padding: 0 !important;
        max-width: none !important;
        width: auto !important;
    }
    
    /* 确保.b2-content不影响滑块模块的左右间距 */
    .b2-content {
        margin: 0 auto !important;
        padding: 0 !important;
    }
    
    /* 确保滑块模块的最外层容器左右边距调整为12px */
    .home_row.module-sliders,
    .slider-row {
        margin: 0 12px !important;
        padding: 0 !important;
    }
    
    /* 确保滑块模块的内容区域与下方模块的内容区域对齐 */
    .module-sliders {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* 确保滑块模块的内容区域左右间距为0，与外层容器的6px边距配合使用 */
    .module-sliders .b2-content,
    .module-sliders .content-area,
    .module-sliders .home-row-left,
    .module-sliders .wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 确保滑块内部的slider-2与内容区域对齐 */
    .module-sliders .slider-2 {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 修复#primary-home和.content-area在移动端的样式，不直接修改DOM结构 */
    @media screen and (max-width: 768px) {
        /* 确保#primary-home在移动端不影响布局，两侧没有空隙 */
        #primary-home {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 确保.content-area在移动端不影响布局，两侧没有空隙 */
        .content-area {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 确保.home-row-left在移动端不受content-area类影响，两侧没有空隙 */
        .home-row-left {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 确保.home-row-left.content-area在移动端两侧没有空隙 */
        .home-row-left.content-area {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 确保模块内容区域没有左右边距和内边距 */
        .module-content,
        .module-body {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 调整“近期更新”h2标题与上方幻灯模块的间距，只在移动端生效 */
        .module-title {
            margin-top: 20px !important;
            margin-bottom: 10px !important;
            margin-left: 0 !important;
            padding-left: 0 !important;
            box-sizing: border-box !important;
        }
        
        /* 确保h2标题本身与图片对齐 */
        .module-title h2 {
            margin: 0 !important;
            padding: 0 !important;
            padding-left: 0 !important;
            margin-left: 0 !important;
        }
        
        /* 简化模块标题区域样式 */
        .post-modules-top {
            padding: 0 0 12px 0 !important;
            margin: 10px 0 0 0 !important;
            display: flex !important;
            align-items: center !important;
            justify-content: space-between !important;
            width: 100% !important;
        }
        
        /* 确保modules-title-box和h2标题没有额外边距 */
        .modules-title-box {
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* 确保h2标题样式正确 */
        .module-title {
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* 确保h2标题本身样式正确 */
        .module-title h2 {
            margin: 0 !important;
            padding: 0 !important;
            font-size: 18px !important;
            font-weight: bold !important;
        }
        
        /* 确保"更多"按钮容器没有额外边距 */
        .post-list-cats {
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* 确保"更多"按钮行样式正确 */
        .post-carts-list-row {
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* 确保.b2-content在移动端两侧没有空隙 */
        .b2-content {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
        
        /* 确保.site-content在移动端两侧没有空隙 */
        .site-content {
            margin: 0 !important;
            padding: 0 !important;
            width: 100% !important;
            max-width: 100% !important;
        }
    }
    
    /* 统一普通列表容器的样式，但排除幻灯片列表 */
    ul.b2_gap:not(.slider-list),
    .b2_module:not(.module-sliders):not(.index-slider-top) ul,
    .b2_module:not(.module-sliders):not(.index-slider-top) ol {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
    }
    
    /* 恢复普通列表项的内边距 */
    ul.b2_gap:not(.slider-list) > li,
    .b2_module:not(.module-sliders):not(.index-slider-top) ul > li,
    .b2_module:not(.module-sliders):not(.index-slider-top) ol > li {
        width: calc(50% - 6px) !important;
        padding: 0 6px !important;
        margin: 0 !important;
    }
    
    /* 根据移动端每行显示数量调整列表项宽度 */
    .b2_module[data-mobile-row-count="1"] ul > li,
    .b2_module[data-mobile-row-count="1"] ol > li {
        width: calc(100% - 12px) !important;
    }
    
    .b2_module[data-mobile-row-count="3"] ul > li,
    .b2_module[data-mobile-row-count="3"] ol > li {
        width: calc(33.333% - 8px) !important;
    }
    
    .b2_module[data-mobile-row-count="4"] ul > li,
    .b2_module[data-mobile-row-count="4"] ol > li {
        width: calc(25% - 9px) !important;
    }
    
    .b2_module[data-mobile-row-count="5"] ul > li,
    .b2_module[data-mobile-row-count="5"] ol > li {
        width: calc(20% - 9.6px) !important;
    }
    
    .b2_module[data-mobile-row-count="6"] ul > li,
    .b2_module[data-mobile-row-count="6"] ol > li {
        width: calc(16.666% - 10px) !important;
    }
    
    /* 确保普通模块标题区域与模块对齐 */
    .module_title:not(.slider-title) {
        margin: 0;
        padding: 0 0 10px 0;
    }
    
    /* 确保h2标题本身与图片对齐 */
    .module_title:not(.slider-title) h2 {
        margin: 0 !important;
        padding: 0 !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
    
    /* 统一普通内容块的边距 */
    .b2_module:not(.module-sliders):not(.index-slider-top) .module-content,
    .b2_module:not(.module-sliders):not(.index-slider-top) .module-body {
        margin: 0;
        padding: 0;
    }
    
    /* 确保h2标题所在的整个模块链都没有额外边距 */
    .b2_module:not(.module-sliders):not(.index-slider-top) {
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ---------------------------- */
/* 滑块slider-2移动端布局修复 */
/* ---------------------------- */

/* 修复移动端slider-2布局 - 使用最高优先级选择器和!important覆盖内联样式 */
@media screen and (max-width: 768px) {
    /* 确保slider-2使用flex布局，覆盖父主题的内联样式 */
    .site-content .b2-content .module-sliders .home_row .slider-2 {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 修复左侧大滑块宽度，覆盖父主题的内联样式 */
    .site-content .b2-content .module-sliders .home_row .slider-2 > .slider-in-out {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 12px !important;
        margin-left: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 修复右侧两个小滑块容器，覆盖父主题的内联样式 */
    .site-content .b2-content .module-sliders .home_row .slider-2 > .slider-2-bottom {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 修复右侧每个小滑块的宽度和边距，确保与下方模块一致 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .slider-2-bottom > div {
        flex: 0 0 calc(50% - 6px) !important;
        width: calc(50% - 6px) !important;
        max-width: calc(50% - 6px) !important;
        margin-right: 12px !important;
        margin-bottom: 0 !important;
    }
    
    /* 修复右侧第二个小滑块的右边距 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .slider-2-bottom > div:last-child {
        margin-right: 0 !important;
    }
    
    /* 确保滑块内部元素高度正确 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .flickity-viewport {
        height: auto !important;
        min-height: 150px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 确保滑块内部容器宽度正确 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .slider-in-out-row,
    .site-content .b2-content .module-sliders .home_row .slider-2 .slider-in {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 确保滑块轮播容器宽度正确 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .carousel {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 修复右侧小滑块的高度 */
    .site-content .b2-content .module-sliders .home_row .slider-2 .slider-2-right-item {
        height: 0 !important;
        padding-top: 43.665437% !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* 确保滑块模块的所有子元素都使用正确的盒模型 */
    .site-content .b2-content .module-sliders .home_row .slider-2 * {
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* 确保桌面端布局不受影响 */
@media screen and (min-width: 769px) {
    /* 桌面端不添加任何样式，完全使用父主题的默认样式 */
}