/**
 * 首页模板静态样式
 * 不包含任何PHP动态变量
 */

/* ======== 全局基础 ======== */
body {
    margin: 0;
    padding: 0;
}

.site,
.site-content,
.home-container,
.home-hero-fullwidth,
.magazine-header {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* 英雄区域全宽 */
.home-hero-fullwidth {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
    min-height: 400px;
}

.home-hero-fullwidth .widget {
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

.hero-placeholder {
    font-size: 1.2rem;
    color: #666;
    padding: 60px 20px;
    text-align: center;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

/* ======== 页面主容器 ======== */
.home-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.home-content-wrapper {
    display: flex;
    gap: 30px;
    width: 100%;
    margin: 0 auto;
}

.home-main {
    flex: 1;
    min-width: 300px;
}

/* 全宽主内容区域（无侧边栏） */
.home-main.full-width {
    width: 100%;
}

/* 侧边栏 */
.home-sidebar {
    width: 300px;
}

/* ======== 布局样式 ======== */
.layout-standard .home-content-wrapper {
    flex-direction: row;
}
.layout-standard .home-sidebar.position-right { order: 2; }
.layout-standard .home-sidebar.position-left  { order: 1; }
.layout-standard .home-main { order: 2; }

.layout-magazine .home-content-wrapper {
    flex-direction: row;
}
.layout-magazine .magazine-header {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 0;
    padding: 0 20px 30px;
}

.layout-magazine .featured-posts {
    margin: 0 0 30px;
    padding: 0;
}
.layout-magazine .featured-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

/* 特色内容布局 */
.featured-posts.layout-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.featured-posts.layout-carousel {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
}
.featured-posts.layout-carousel .widget {
    min-width: 250px;
}
.featured-posts.layout-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 无侧边栏时 */
.layout-full-width .home-content-wrapper {
    flex-direction: column;
}
.layout-full-width .home-sidebar {
    width: 100%;
}

/* ======== 其他 ======== */
.home-no-widgets {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
    text-align: center;
    font-size: 1.2rem;
    color: #555;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.widget {
    margin-bottom: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-title {
    font-size: 1.4rem;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-top: 0;
}

.featured-placeholder,
.sidebar-placeholder {
    padding: 30px;
    text-align: center;
    background-color: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

/* ======== 响应式 ======== */
@media (max-width: 1024px) {
    .featured-posts.layout-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动端响应式布局 - 简化修复 */
@media (max-width: 768px) {
    .home-content-wrapper {
        flex-direction: column;
        gap: 20px;
        padding: 0 20px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 简化主内容区设置 */
    .home-main {
        width: 100%;
        flex: none;
        min-width: auto;
        order: 1;
        /* 移除复杂的flex设置，使用简单的块级元素布局 */
        display: block;
    }
    
    /* 侧边栏设置 */
    .home-sidebar {
        width: 100%;
        order: 2;
    }
    
    /* 确保小工具区域正常显示 */
    #home-widgets {
        width: 100%;
    }
    
    #home-widgets .widget {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 特色内容网格布局 */
    .featured-posts.layout-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .home-hero-fullwidth {
        min-height: 300px;
    }
    
    /* 杂志布局调整 */
    .layout-magazine .magazine-header {
        padding: 0 20px 20px;
    }
    
    .magazine-header .featured-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    /* 小工具调整 */
    .widget {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .widget-title {
        font-size: 1.2rem;
    }
    
    /* 简化容器设置 */
    .home-container {
        width: 100%;
        display: block; /* 改为块级布局 */
    }
    
    /* 布局类型在移动端的统一处理 */
    .layout-standard .home-content-wrapper,
    .layout-magazine .home-content-wrapper {
        flex-direction: column;
    }
    
    .layout-full-width .home-content-wrapper {
        flex-direction: column;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .home-content-wrapper {
        padding: 0 15px;
        gap: 15px;
    }
    
    .home-hero-fullwidth {
        min-height: 250px;
    }
    
    .hero-placeholder,
    .featured-placeholder,
    .sidebar-placeholder {
        padding: 20px 15px;
        font-size: 1rem;
    }
    
    .layout-magazine .magazine-header {
        padding: 0 15px 15px;
    }
    
    .magazine-header .featured-title {
        font-size: 1.3rem;
    }
    
    .widget {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .home-no-widgets {
        height: 60vh;
        font-size: 1rem;
        padding: 20px;
    }
}

/* 修复透明头部在首页的显示问题 */
@media (max-width: 768px) {
    .home-transparent-header .home-container {
        margin-top: 0;
    }
    
    .home-transparent-header .home-hero-fullwidth {
        margin-top: 80px;
    }
}

/* 新增：确保主内容区在移动端正确居中 */
@media (max-width: 768px) {
    /* 重置所有可能影响居中的属性 */
    .home-main,
    .home-sidebar,
    #home-widgets,
    .widget-area {
        margin-left: auto;
        margin-right: auto;
        float: none;
        position: static;
    }
    
    /* 确保文本内容居中 */
    .home-no-widgets,
    .hero-placeholder,
    .featured-placeholder,
    .sidebar-placeholder {
        text-align: center;
    }
    
    /* 确保小工具标题居中 */
    .widget-title {
        text-align: center;
    }
}