/*
 * Single Sites页面样式修复
 * 解决article-container和footer-inner居中问题
 * 清理多余的margin和padding
 */

/* ===== 主内容区域定位修复 ===== */
/* single-sites页面需要为侧边栏留出空间 */
.single-sites .main-content {
    width: calc(100% - 250px) !important; /* 减去侧边栏宽度 */
    margin-left: 250px !important; /* 为侧边栏留出空间 */
    margin-top: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    min-height: 100vh !important;
    position: relative !important;
}

/* 当侧边栏收起时调整宽度 */
.single-sites .sidebar-menu.collapsed ~ .main-content {
    width: calc(100% - 80px) !important;
    margin-left: 80px !important;
}

/* 移动端：侧边栏隐藏，内容全宽 */
@media (max-width: 768px) {
    .single-sites .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 15px 0 !important;
    }
}

.single-sites .container {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
}

/* 移除row的负margin */
.single-sites .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 确保article-container正确居中 */
.single-sites .col-lg-8.col-md-10.col-12 {
    width: 100% !important;
    max-width: 900px !important; /* 限制最大宽度 */
    margin: 0 auto !important; /* 水平居中 */
    padding: 0 !important;
    float: none !important; /* 移除Bootstrap的float */
    position: relative !important;
}

/* article-container样式优化 */
.single-sites .article-container {
    margin: 30px auto 40px auto !important; /* 上下边距，左右自动居中 */
    padding: 0 !important; /* 移除内边距 */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ===== Footer定位修复 ===== */
/* Footer全宽显示，不受侧边栏限制 */
.single-sites .main-footer {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

/* 确保footer不受侧边栏状态影响 */
.single-sites .sidebar-menu.collapsed ~ .main-footer,
.single-sites .sidebar-menu:not(.collapsed) ~ .main-footer {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.single-sites .main-footer .footer-inner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 30px 20px !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

/* 确保footer容器不受页面布局限制 */
.single-sites .main-footer .container,
.single-sites .main-footer .row {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 移动端Footer全宽 */
@media (max-width: 768px) {
    .single-sites .main-footer {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    .single-sites .main-footer .footer-inner {
        padding: 20px 15px !important;
    }
}

@media (max-width: 576px) {
    .single-sites .main-footer .footer-inner {
        padding: 15px 10px !important;
    }
}

/* ===== 清理多余的边距 ===== */
/* 移除Bootstrap默认的col边距 */
.single-sites [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* 确保mt-5类不会添加过多顶部边距 */
.single-sites .mt-5 {
    margin-top: 2rem !important; /* 减少到合理的边距 */
}

/* 移除mt-sm-0在大屏幕上的影响 */
@media (min-width: 576px) {
    .single-sites .mt-sm-0 {
        margin-top: 0 !important;
    }
}

/* ===== 文章头部区域边距优化 ===== */
.single-sites .article-header-section {
    padding: 40px 30px !important; /* 减少内边距 */
    margin: 0 !important;
}

/* 文章内容区域边距优化 */
.single-sites .article-content-section {
    padding: 30px !important; /* 统一内边距 */
    margin: 0 !important;
}

/* 相关链接区域边距优化 */
.single-sites .related-links-section {
    padding: 30px !important;
    margin: 0 !important;
    border-top: 1px solid #e9ecef;
}

/* ===== 响应式优化 ===== */
@media (max-width: 1200px) {
    .single-sites .container {
        max-width: 960px !important;
    }
}

@media (max-width: 992px) {
    .single-sites .container {
        max-width: 720px !important;
    }
    
    .single-sites .col-lg-8.col-md-10.col-12 {
        max-width: 100% !important;
        padding: 0 15px !important;
    }
}

@media (max-width: 768px) {
    .single-sites .container {
        max-width: 540px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .single-sites .article-container {
        margin: 20px auto 30px auto !important;
        border-radius: 16px !important;
    }
    
    .single-sites .article-header-section {
        padding: 30px 20px !important;
    }
    
    .single-sites .article-content-section {
        padding: 20px !important;
    }
    
    .single-sites .related-links-section {
        padding: 20px !important;
    }
    
    .single-sites .main-footer .footer-inner {
        padding: 20px 15px !important;
    }
}

@media (max-width: 576px) {
    .single-sites .container {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .single-sites .article-container {
        margin: 15px auto 20px auto !important;
        border-radius: 12px !important;
    }
    
    .single-sites .article-header-section {
        padding: 25px 15px !important;
    }
    
    .single-sites .article-content-section,
    .single-sites .related-links-section {
        padding: 15px !important;
    }
}

/* ===== 确保样式优先级 ===== */
/* 使用更具体的选择器覆盖其他样式 */
body.single-sites .main-content .container,
body.single-sites .main-content.page .container,
html body.single-sites .main-content .container {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* 确保article-container完全居中 */
html body.single-sites .article-container {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 确保footer-inner完全居中 */
html body.single-sites .main-footer .footer-inner {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ===== 修复页面整体布局 ===== */
.single-sites .page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.single-sites .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.single-sites .main-footer {
    margin-top: auto; /* 确保footer在底部 */
}

/* ===== 清理Bootstrap网格系统的影响 ===== */
.single-sites .container::before,
.single-sites .container::after,
.single-sites .row::before,
.single-sites .row::after {
    display: none !important;
    content: none !important;
}

/* 重置Bootstrap的container-fluid如果存在 */
.single-sites .container-fluid {
    padding: 0 !important;
    margin: 0 !important;
}

/* ===== 调试辅助（可选，用于查看布局） ===== */
/*
.single-sites .container {
    border: 2px solid red;
}

.single-sites .article-container {
    border: 2px solid blue;
}

.single-sites .footer-inner {
    border: 2px solid green;
}
*/