/**
 * 三列布局样式
 * 左侧：板块导航 | 中间：最新帖子 | 右侧：侧边栏
 */

/* ===== 三列布局容器 ===== */
.three-column-layout .container {
    max-width: 1400px;
}

.three-column-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* ===== 左侧板块导航 ===== */
.left-sidebar.category-nav {
    position: sticky;
    top: 80px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.category-nav-header {
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    color: #fff;
}

.category-nav-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-nav-header i {
    font-size: 18px;
}

.category-nav-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 8px 0;
}

.category-nav-list::-webkit-scrollbar {
    width: 6px;
}

.category-nav-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.category-nav-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.category-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    border-left: 3px solid transparent;
}

.category-nav-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--primary-color);
}

.category-nav-item.active {
    background: var(--primary-color)10;
    border-left-color: var(--primary-color);
}

.category-nav-item.active .category-nav-name {
    color: var(--primary-color);
    font-weight: 600;
}

.category-nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.category-nav-info {
    flex: 1;
    min-width: 0;
}

.category-nav-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-nav-count {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.category-nav-badge {
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.category-nav-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

/* ===== 友情链接区域 ===== */
.category-nav-section {
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}

.category-nav-section .category-nav-header {
    background: var(--bg-secondary);
    padding: 12px 16px;
}

.category-nav-section .category-nav-header h3 {
    color: var(--text-primary);
    font-size: 14px;
}

.friends-list-compact {
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}

.friends-list-compact::-webkit-scrollbar {
    width: 6px;
}

.friends-list-compact::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.friends-list-compact::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.friends-list-compact li {
    list-style: none;
    margin-bottom: 8px;
}

.friends-list-compact li:last-child {
    margin-bottom: 0;
}

.friends-list-compact a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.friends-list-compact a:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
    border-color: var(--primary-color)40;
    transform: translateX(4px);
}

.friends-list-compact a img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.friends-list-compact a span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.friends-list-compact a:hover span {
    color: var(--primary-color);
}

/* ===== 中间内容区 ===== */
.center-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.posts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    gap: 16px;
}

.posts-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.posts-title i {
    color: var(--primary-color);
    font-size: 20px;
}

.posts-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.posts-filter select {
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.posts-filter select:hover {
    border-color: var(--primary-color);
}

.posts-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color)20;
}

.posts-list {
    padding: 12px;
}

/* ===== 紧凑型帖子卡片 ===== */
.post-item-compact {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.post-item-compact:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-color)40;
}

.post-thumb-compact {
    width: 120px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.post-thumb-compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-item-compact:hover .post-thumb-compact img {
    transform: scale(1.05);
}

.post-content-compact {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-title-compact {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.post-title-compact a {
    color: var(--text-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-title-compact a:hover {
    color: var(--primary-color);
}

.post-excerpt-compact {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta-compact {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: auto;
}

.post-meta-compact > * {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-author {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.post-author:hover {
    color: var(--primary-color);
}

.post-author img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.post-category a {
    color: var(--text-muted);
    text-decoration: none;
}

.post-category a:hover {
    color: var(--primary-color);
}

.post-time i,
.post-comments i,
.post-category i {
    font-size: 14px;
}

/* ===== 空状态 ===== */
.empty-posts {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-posts i {
    font-size: 64px;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-posts p {
    margin: 0;
    font-size: 14px;
}

/* ===== 加载更多 ===== */
.load-more-container {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-light);
}

/* ===== 右侧边栏 ===== */
.right-sidebar {
    position: sticky;
    top: 80px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .three-column-wrapper {
        grid-template-columns: 240px 1fr 280px;
        gap: 16px;
    }
    
    .category-nav-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .post-thumb-compact {
        width: 100px;
        height: 75px;
    }
}

@media (max-width: 992px) {
    .three-column-wrapper {
        grid-template-columns: 1fr 280px;
    }
    
    .left-sidebar.category-nav {
        display: none;
    }
    
    /* 移动端显示分类选择器 */
    .posts-header::before {
        content: '';
        /* 可以添加一个下拉菜单来选择分类 */
    }
}

@media (max-width: 768px) {
    .three-column-wrapper {
        grid-template-columns: 1fr;
    }
    
    .right-sidebar {
        display: none;
    }
    
    .post-item-compact {
        flex-direction: column;
        gap: 12px;
    }
    
    .post-thumb-compact {
        width: 100%;
        height: 180px;
    }
    
    .posts-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .posts-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .posts-filter {
        flex: 1;
    }
    
    .posts-filter select {
        width: 100%;
    }
    
    /* 移动端添加分类选择按钮 */
    .center-content::before {
        content: '';
        display: block;
        position: sticky;
        top: 60px;
        z-index: 10;
    }
}

/* ===== 动画效果 ===== */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-nav-item {
    animation: slideInLeft 0.3s ease-out backwards;
}

.category-nav-item:nth-child(1) { animation-delay: 0.05s; }
.category-nav-item:nth-child(2) { animation-delay: 0.1s; }
.category-nav-item:nth-child(3) { animation-delay: 0.15s; }
.category-nav-item:nth-child(4) { animation-delay: 0.2s; }
.category-nav-item:nth-child(5) { animation-delay: 0.25s; }
.category-nav-item:nth-child(n+6) { animation-delay: 0.3s; }

.post-item-compact {
    animation: slideInUp 0.4s ease-out backwards;
}

.post-item-compact:nth-child(1) { animation-delay: 0.05s; }
.post-item-compact:nth-child(2) { animation-delay: 0.1s; }
.post-item-compact:nth-child(3) { animation-delay: 0.15s; }
.post-item-compact:nth-child(4) { animation-delay: 0.2s; }
.post-item-compact:nth-child(5) { animation-delay: 0.25s; }
.post-item-compact:nth-child(n+6) { animation-delay: 0.3s; }

/* ===== 暗色模式适配 ===== */
@media (prefers-color-scheme: dark) {
    .category-nav-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .category-nav-item.active {
        background: var(--primary-color)20;
    }
    
    .post-item-compact {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .post-item-compact:hover {
        border-color: var(--primary-color)60;
    }
}

/* ===== 分页导航 ===== */
.pagination-container {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-color-light);
}

.page-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.page-link i {
    font-size: 16px;
}
