/* ===== 社区页样式 ===== */

.page-hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  color: #fff;
  padding: 40px 0 30px;
}

.page-hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-hero p {
  font-size: 15px;
  opacity: 0.88;
  margin-bottom: 12px;
}

.community-main {
  padding: 36px 20px;
}

.community-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

/* 帖子区 */
.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  background: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.post-tabs {
  display: flex;
  gap: 4px;
}

.post-tab {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
}

.post-tab:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.post-tab.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

/* 帖子卡片 */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  gap: 14px;
  transition: box-shadow var(--transition);
}

.post-card:hover {
  box-shadow: var(--shadow-hover);
}

.post-card-left {
  flex-shrink: 0;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.post-card-right {
  flex: 1;
  min-width: 0;
}

.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.post-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-author {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.post-tag {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.post-tag.story { background: #fff3e8; color: var(--primary); }
.post-tag.tips  { background: #edf7ee; color: var(--secondary); }
.post-tag.help  { background: #e8f4f8; color: #2980b9; }
.post-tag.show  { background: #f5e8ff; color: #8e44ad; }

.post-time {
  font-size: 12px;
  color: var(--text-muted);
}

.post-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
  cursor: pointer;
  transition: color var(--transition);
}

.post-title:hover {
  color: var(--primary);
}

.post-excerpt {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-img-preview {
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
}

.post-img-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.post-img-preview.multi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.post-img-preview.multi img {
  height: 120px;
  object-fit: cover;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.post-stats {
  display: flex;
  gap: 4px;
}

.stat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: all var(--transition);
}

.stat-btn:hover {
  background: #f5f5f5;
  color: var(--text);
}

.stat-btn.liked {
  color: #e74c3c;
}

.stat-btn.liked i {
  font-weight: 900;
}

.post-views {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 评论区 */
.comment-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
}

.comment-avatar {
  font-size: 28px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
  background: #f7f7f7;
  border-radius: var(--radius);
  padding: 10px 14px;
}

.comment-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-right: 8px;
}

.comment-content p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
  margin: 4px 0 6px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.comment-meta button {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
}

.comment-meta button:hover {
  color: var(--primary);
}

.comment-input {
  display: flex;
  gap: 10px;
}

.comment-input .form-control {
  flex: 1;
  padding: 8px 12px;
}

/* 侧边栏 */
.community-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.sidebar-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-card h4 i {
  color: var(--primary);
}

.post-guide {
  background: linear-gradient(135deg, #fff8f0, #fff3e8);
  border-color: rgba(224,123,57,0.2);
}

.post-guide p {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* 热门话题 */
.hot-topics {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hot-topics li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.topic-rank {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #eee;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.topic-rank.rank1 { background: #e74c3c; color: #fff; }
.topic-rank.rank2 { background: #e67e22; color: #fff; }
.topic-rank.rank3 { background: #f39c12; color: #fff; }

.hot-topics a {
  flex: 1;
  color: var(--text);
  font-size: 13px;
  transition: color var(--transition);
}

.hot-topics a:hover {
  color: var(--primary);
}

.topic-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 活跃用户 */
.active-users {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.active-users li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-sm {
  font-size: 28px;
  color: var(--text-muted);
}

.user-info-sm {
  display: flex;
  flex-direction: column;
}

.user-name-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-posts {
  font-size: 11px;
  color: var(--text-muted);
}

/* 侧边栏宠物 */
.sidebar-pets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-pet {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 8px;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.sidebar-pet:hover {
  background: #f7f2ec;
}

.sidebar-pet img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
}

.sp-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.sp-info {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

/* 发帖弹窗 */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition);
  color: var(--text-muted);
}

.upload-area:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.upload-area i {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 13px;
}

/* 响应式 */
@media (max-width: 992px) {
  .community-layout {
    grid-template-columns: 1fr;
  }
  .community-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .post-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .post-tabs {
    flex-wrap: wrap;
  }
  .community-sidebar {
    grid-template-columns: 1fr;
  }
  .post-img-preview.multi {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 搜索框 + 排序栏 ===== */
.post-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.post-search-bar .search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  position: relative;
}

.post-search-bar .search-box i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.post-search-bar .search-box .form-control {
  padding-left: 34px;
  flex: 1;
}

.post-search-bar .sort-select {
  flex-shrink: 0;
  min-width: 130px;
}

.post-search-bar .sort-select .form-control {
  padding: 8px 12px;
}

/* 分页按钮（动态渲染） */
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.page-btn.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

.page-info {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 6px;
}

/* 帖子动态渲染样式补充 */
.post-card .post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  background: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  border: none;
}

.post-card .post-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.post-card .post-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.post-card .post-username {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.post-card .post-time {
  font-size: 12px;
  color: var(--text-muted);
}

.post-card .post-category {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.post-card .post-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.post-card .post-content {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .post-images {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.post-card .post-images img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.post-card .post-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.post-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: all var(--transition);
}

.post-action-btn:hover {
  background: #f5f5f5;
  color: var(--text);
}

.post-action-btn.liked {
  color: #e74c3c;
}

/* 评论区 */
.comments-area {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  background: #f7f7f7;
  border-radius: var(--radius);
  padding: 8px 12px;
}

.comment-username {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-right: 8px;
}

.comment-time {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-content {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
  margin: 4px 0 0;
}

.comment-replies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.reply-item {
  font-size: 12px;
  color: var(--text-light);
  padding: 4px 0;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.comment-input-wrap .comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.comment-input-wrap .comment-input:focus {
  border-color: var(--secondary);
}

.no-comment-tip,
.error-tip {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

/* 响应式：搜索栏 */
@media (max-width: 768px) {
  .post-search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .post-search-bar .search-box {
    min-width: 100%;
  }
  .post-search-bar .sort-select {
    min-width: 100%;
  }
}
