/* 小红书式瀑布流布局样式 */

.posts-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0;
    width: 100%;
}

/* 大屏幕：4-5列 */
@media (min-width: 1400px) {
    .posts-masonry {
        grid-template-columns: repeat(5, 1fr);
        gap: 24px;
    }
}

/* 中等大屏幕：3-4列 */
@media (min-width: 1024px) and (max-width: 1399px) {
    .posts-masonry {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* 中等屏幕：2-3列 */
@media (min-width: 768px) and (max-width: 1023px) {
    .posts-masonry {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

/* 小屏幕：2列 */
@media (min-width: 480px) and (max-width: 767px) {
    .posts-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* 超小屏幕：1列 */
@media (max-width: 479px) {
    .posts-masonry {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* 帖子卡片样式 - 小红书风格 */
.post-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    will-change: transform, box-shadow;
    backface-visibility: hidden;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* 帖子图片区域 */
.post-card-image {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.post-card-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

/* 帖子内容区域 */
.post-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* 用户信息区域 */
.post-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.post-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-card-author {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.post-card-author-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-card-author-name:hover {
    color: var(--blue-primary);
}

/* 帖子标题 */
.post-card-title {
    font-size: clamp(0.95em, 2vw, 1.05em);
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px 0;
    color: var(--text-primary);
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-card-title:hover {
    color: var(--blue-primary);
}

/* 帖子内容预览 */
.post-card-text {
    font-size: clamp(0.85em, 1.8vw, 0.9em);
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* 帖子底部操作栏 */
.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: auto;
}

.post-card-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.post-card-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.post-card-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.post-card-action-btn.liked {
    color: #ff3040;
}

.post-card-action-btn.liked .like-icon {
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.post-card-time {
    font-size: 0.75em;
    color: var(--text-muted);
}

/* 徽章样式 */
.post-card-badge {
    position: absolute;
    top: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.post-card-badge.pinned {
    left: 8px;
    background: rgba(255, 215, 0, 0.9);
    color: #333;
}

.post-card-badge.featured {
    right: 8px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.9), rgba(255, 143, 179, 0.9));
    color: white;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .post-card-content {
        padding: 10px;
    }
    
    .post-card-title {
        font-size: 0.95em;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .post-card-text {
        font-size: 0.85em;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .post-card-actions {
        gap: 12px;
    }
    
    .post-card-action-btn {
        font-size: 0.8em;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .post-card {
        border-radius: 12px;
    }
    
    .post-card-content {
        padding: 8px;
    }
    
    .post-card-header {
        margin-bottom: 8px;
    }
    
    .post-card-avatar {
        width: 28px;
        height: 28px;
    }
    
    .post-card-title {
        font-size: 0.9em;
        margin-bottom: 6px;
    }
    
    .post-card-text {
        font-size: 0.8em;
        margin-bottom: 8px;
    }
    
    .post-card-footer {
        padding-top: 8px;
    }
    
    .post-card-actions {
        gap: 10px;
    }
    
    .post-card-action-btn {
        font-size: 0.75em;
        gap: 3px;
    }
}

/* 加载动画 */
.post-card.loading {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 空状态 */
.posts-masonry:empty::before {
    content: '暂无帖子，快来发布第一个吧！';
    display: block;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

