/* =========================================
   信息交流社区 - 现代化布局
   ========================================= */

.community-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

/* =========================================
   左侧导航栏
   ========================================= */
.community-nav {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
  background: var(--white);
  border-radius: 16px;
  padding: 16px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-menu-item:hover {
  background: #f9fbf9;
  color: var(--primary-color);
}

.nav-menu-item.active {
  background: rgba(76, 175, 80, 0.08);
  color: var(--primary-color);
  font-weight: bold;
}

.nav-menu-item i {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* 发布按钮悬浮 */
.btn-publish-large {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  margin-top: 20px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
  transition: all 0.3s;
}

.btn-publish-large:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

/* =========================================
   中间动态信息流
   ========================================= */
.community-main {
  flex: 1;
  min-width: 0; /* 允许子元素截断 */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 发布框 */
.publish-box {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.publish-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
}

.publish-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

.publish-input-wrap {
  flex: 1;
}

.publish-input {
  width: 100%;
  border: none;
  background: #f9f9f9;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  height: 60px;
  transition: all 0.3s;
  color: var(--text-primary);
}

.publish-input:focus {
  outline: none;
  background: #fff;
  border: 1px solid var(--primary-color);
  height: 100px;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.publish-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.tools-left {
  display: flex;
  gap: 20px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 6px 10px;
  border-radius: 8px;
}

.tool-btn:hover {
  background: #f5f5f5;
  color: var(--primary-color);
}

.tool-btn i {
  font-size: 18px;
}

/* 动态过滤器 */
.feed-filter {
  display: flex;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}

.filter-tab {
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  padding-bottom: 8px;
  transition: color 0.2s;
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  color: var(--text-primary);
  font-weight: bold;
}

.filter-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px;
}

/* 动态卡片 */
.feed-card {
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feed-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
}

.feed-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.user-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: bold;
  font-size: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: normal;
}

.badge-expert {
  background: #FFF3E0;
  color: #FF9800;
  border: 1px solid #FFE0B2;
}

.badge-farmer {
  background: #E8F5E9;
  color: var(--primary-color);
  border: 1px solid #C8E6C9;
}

.user-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-follow {
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-follow:hover {
  background: rgba(76, 175, 80, 0.1);
}

.feed-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 16px;
  word-wrap: break-word;
}

.feed-text .hashtag {
  color: var(--primary-color);
  cursor: pointer;
  margin-right: 4px;
}

.feed-text .hashtag:hover {
  text-decoration: underline;
}

/* 图片网格布局 */
.feed-gallery {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
}

/* 单图 */
.feed-gallery.grid-1 {
  grid-template-columns: 1fr;
}
.feed-gallery.grid-1 img {
  width: 100%;
  max-width: 400px;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  border-radius: 12px;
}

/* 多图 */
.feed-gallery.grid-more {
  grid-template-columns: repeat(3, 1fr);
}
.feed-gallery.grid-more img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
}

/* 底部交互 */
.feed-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
  margin-top: 16px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}

.action-item:hover {
  color: var(--primary-color);
}

.action-item i {
  font-size: 18px;
}

.action-item.liked {
  color: #FF5252;
}

.action-item.liked i {
  font-weight: 900;
}

/* =========================================
   右侧边栏 (热门/推荐)
   ========================================= */
.community-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 90px;
}

.sidebar-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.sidebar-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title .more {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: normal;
  cursor: pointer;
}

/* 热门话题 */
.hot-topic-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.topic-item:hover .topic-name {
  color: var(--primary-color);
}

.topic-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  overflow: hidden;
}

.topic-rank {
  font-size: 14px;
  font-weight: bold;
  font-style: italic;
  color: #999;
  width: 16px;
}

.topic-rank.top-1 { color: #F44336; }
.topic-rank.top-2 { color: #FF9800; }
.topic-rank.top-3 { color: #FFC107; }

.topic-name {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.topic-hotness {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 推荐专家 */
.expert-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.expert-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expert-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.expert-info {
  flex: 1;
  overflow: hidden;
}

.expert-name {
  font-size: 14px;
  font-weight: bold;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.expert-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.btn-follow-sm {
  background: #f5f5f5;
  color: var(--text-primary);
  border: none;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-follow-sm:hover {
  background: #e0e0e0;
}

/* 响应式 */
@media (max-width: 1024px) {
  .community-nav {
    display: none; /* 平板隐藏左侧导航，可放到顶部 */
  }
}

@media (max-width: 768px) {
  .community-container {
    flex-direction: column;
  }
  .community-sidebar {
    width: 100%;
    position: static;
  }
  .feed-gallery.grid-more {
    grid-template-columns: repeat(2, 1fr);
  }
}