/* =====================================================
   南洋通 NanYangTong — 社区模块样式
   经验分享、点赞、评论功能
===================================================== */

/* ============ 社区帖子表单 ============ */
.community-post-form {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid #f0f0f0;
}

.post-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #2d9b5c;
  font-weight: 600;
  font-size: 14px;
}

.post-form-header i {
  font-size: 16px;
}

.post-form-textarea {
  width: 100%;
  min-height: 100px;
  padding: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.post-form-textarea:focus {
  outline: none;
  border-color: #2d9b5c;
  box-shadow: 0 0 0 3px rgba(45,155,92,0.1);
}

.post-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.char-count {
  font-size: 12px;
  color: #999;
}

.post-form-submit {
  background: linear-gradient(135deg, #2d9b5c 0%, #1a6b3a 100%);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45,155,92,0.3);
}

.post-form-submit:active {
  transform: translateY(0);
}

/* ============ 帖子卡片 ============ */
.community-post {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #f5f5f5;
  transition: box-shadow 0.2s;
}

.community-post:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.post-meta {
  flex: 1;
}

.post-author {
  font-weight: 600;
  color: #333;
  font-size: 15px;
}

.post-time {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.post-content {
  margin-bottom: 16px;
}

.post-text {
  font-size: 14px;
  line-height: 1.8;
  color: #444;
  word-wrap: break-word;
}

.post-images {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-images.multi .post-image {
  width: calc(50% - 4px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.post-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.post-image:hover {
  transform: scale(1.02);
}

/* ============ 帖子操作栏 ============ */
.post-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s;
}

.post-action:hover {
  background: #f5f5f5;
}

.post-action i {
  font-size: 16px;
}

.post-action.like-btn:hover {
  background: #ffebee;
  color: #e91e63;
}

.post-action.like-btn.liked {
  color: #e91e63;
}

.post-action.like-btn.liked i {
  animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.post-action.comment-btn:hover {
  background: #e3f2fd;
  color: #1976d2;
}

.post-action.share-btn:hover {
  background: #e8f5e9;
  color: #2d9b5c;
}

/* ============ 评论区 ============ */
.post-comments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.comments-list {
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.no-comments {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 13px;
}

.comment-item {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-author {
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.comment-text {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-top: 4px;
}

.comment-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* 评论输入区 */
.comment-input-area {
  display: flex;
  gap: 10px;
  padding-top: 12px;
}

.comment-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.comment-input:focus {
  outline: none;
  border-color: #2d9b5c;
}

.comment-submit {
  padding: 10px 20px;
  background: #2d9b5c;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.comment-submit:hover {
  background: #1a6b3a;
}

/* ============ 提示消息 ============ */
.community-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.community-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ 空状态 ============ */
.no-posts {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 14px;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .community-post-form {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .community-post {
    padding: 16px;
  }
  
  .post-action {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .post-images.multi .post-image {
    width: 100%;
  }
  
  .comment-input-area {
    flex-direction: column;
  }
  
  .comment-submit {
    width: 100%;
  }
}

/* ============ 暗色模式 ============ */
@media (prefers-color-scheme: dark) {
  .community-post-form,
  .community-post {
    background: #1e2030;
    border-color: rgba(255,255,255,0.1);
  }
  
  .post-form-textarea,
  .comment-input {
    background: #2a2d3e;
    border-color: rgba(255,255,255,0.1);
    color: #ddd;
  }
  
  .post-author {
    color: #ddd;
  }
  
  .post-text {
    color: #bbb;
  }
  
  .post-action:hover {
    background: rgba(255,255,255,0.05);
  }
}
