* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏 */
.navbar {
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2196F3;
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.navbar-nav a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.navbar-nav a:hover {
  color: #2196F3;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background: #2196F3;
  color: white;
}

.btn-primary:hover {
  background: #1976D2;
}

.btn-outline {
  background: transparent;
  border: 1px solid #2196F3;
  color: #2196F3;
}

.btn-outline:hover {
  background: #2196F3;
  color: white;
}

/* 表单 */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-body {
  padding: 1.5rem;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 帖子列表 */
.post-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-item:hover .post-title {
  color: #2196F3;
}

.post-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.post-meta {
  color: #999;
  font-size: 0.875rem;
  display: flex;
  gap: 1rem;
}

.post-content {
  color: #666;
  margin: 1rem 0;
  line-height: 1.8;
}

/* 媒体展示 */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.media-item {
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}

.media-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.media-item video {
  width: 100%;
  max-height: 400px;
  display: block;
}

/* 用户头像 */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #666;
}

.avatar-large {
  width: 80px;
  height: 80px;
  font-size: 2rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* 点赞和评论 */
.post-actions {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.action-btn:hover {
  color: #2196F3;
}

.action-btn.liked {
  color: #f44336;
}

/* 评论区 */
.comments-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #eee;
}

.comment {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}

.comment:last-child {
  border-bottom: none;
}

.comment-body {
  flex: 1;
}

.comment-author {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.comment-content {
  color: #666;
}

.comment-date {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.5rem;
}

/* 页面标题 */
.page-header {
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 2rem;
  color: #333;
}

/* 认证页面 */
.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.auth-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.75rem;
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1.5rem;
}

/* 响应式 */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 1rem;
  }

  .page-header {
    flex-direction: column;
    gap: 1rem;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* 文件上传 */
.file-upload {
  border: 2px dashed #ddd;
  padding: 2rem;
  text-align: center;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload:hover {
  border-color: #2196F3;
  background: #f5f9ff;
}

.file-upload input {
  display: none;
}

.file-upload-label {
  cursor: pointer;
  color: #666;
}

.file-list {
  margin-top: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f5f5f5;
  border-radius: 5px;
  margin-top: 0.5rem;
}

/* ============ 帖子内容美化 ============ */

/* 帖子详情内容区 */
.post-detail-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: #2c3e50;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 段落 */
.post-detail-content p {
  margin-bottom: 1.25rem;
  text-align: justify;
}

.post-detail-content p:last-child {
  margin-bottom: 0;
}

/* 标题层次 */
.post-detail-content h1,
.post-detail-content h2,
.post-detail-content h3,
.post-detail-content h4,
.post-detail-content h5,
.post-detail-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #1a202c;
}

.post-detail-content h1 {
  font-size: 1.75rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.post-detail-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.4rem;
}

.post-detail-content h3 {
  font-size: 1.25rem;
}

.post-detail-content h4 {
  font-size: 1.125rem;
}

/* 列表 */
.post-detail-content ul,
.post-detail-content ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

.post-detail-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.post-detail-content li::marker {
  color: #2196F3;
}

/* 引用块 */
.post-detail-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #2196F3;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
  color: #4a5568;
  font-style: italic;
}

.post-detail-content blockquote p {
  margin-bottom: 0;
}

/* 表格样式 */
.post-detail-content table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.post-detail-content thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.post-detail-content th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9375rem;
}

.post-detail-content td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.post-detail-content tbody tr {
  transition: background-color 0.2s;
}

.post-detail-content tbody tr:hover {
  background: #f8f9fa;
}

.post-detail-content tbody tr:last-child td {
  border-bottom: none;
}

.post-detail-content tbody tr:nth-child(even) {
  background: #fafbfc;
}

.post-detail-content tbody tr:nth-child(even):hover {
  background: #f0f4f8;
}

/* 代码块 */
.post-detail-content code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9em;
  background: #f6f8fa;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: #e83e8c;
}

.post-detail-content pre {
  background: #2d3748;
  color: #f7fafc;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-detail-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* 分割线 */
.post-detail-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #e2e8f0, transparent);
  margin: 2rem 0;
}

/* 强调文本 */
.post-detail-content strong {
  font-weight: 600;
  color: #1a202c;
}

.post-detail-content em {
  font-style: italic;
  color: #4a5568;
}

/* 链接 */
.post-detail-content a {
  color: #2196F3;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.post-detail-content a:hover {
  color: #1976D2;
  border-bottom-color: #1976D2;
}

/* 图片 */
.post-detail-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 分隔符后的说明文字 */
.post-detail-content .footnote {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.875rem;
  color: #718096;
  font-style: italic;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .post-detail-content {
    font-size: 1rem;
  }
  
  .post-detail-content table {
    font-size: 0.875rem;
  }
  
  .post-detail-content th,
  .post-detail-content td {
    padding: 0.75rem 0.875rem;
  }
}
