/* ========== 首页两栏布局 ========== */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1024px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
    .home-sidebar {
        order: 2;
    }
    .home-main {
        order: 1;
    }
}

/* ========== 侧边栏卡片 ========== */
.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

@media (max-width: 1024px) {
    .home-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .home-sidebar {
        grid-template-columns: 1fr;
    }
}

.widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.widget:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.widget-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-header h3 i {
    color: var(--accent);
}

/* ========== 标签云 ========== */
.widget-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-tag {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.widget-tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ========== 最新/最热文章列表 ========== */
.widget-posts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-primary);
}

.widget-post-item:hover {
    background: var(--bg-hover);
}

.widget-post-thumb,
.widget-post-icon,
.widget-rank {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.widget-post-thumb {
    object-fit: cover;
    background: var(--bg-secondary);
}

.widget-post-icon {
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.1rem;
}

.widget-rank {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 2px solid var(--border);
}

.widget-rank.rank-top {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.widget-post-body {
    flex: 1;
    min-width: 0;
}

.widget-post-body h4 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-post-body span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== 最新评论 ========== */
.widget-comments {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.widget-comment-item {
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.widget-comment-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.widget-comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.widget-comment-meta img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.widget-comment-author {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.widget-comment-author strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.widget-comment-author span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.widget-comment-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
