/* 渔渔论坛 v2 - 清新粉色系 Mobile First */
:root {
  --primary: #f04494;
  --primary-light: #f871a5;
  --primary-bg: #fff0f5;
  --primary-dark: #d43c7e;
  --bg: #f8f9fc;
  --card-bg: #fff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #f0f0f5;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --tab-height: 56px;
  --header-height: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 8px);
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

/* ===== 顶部导航 ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.header-inner {
  max-width: 800px; margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-size: 20px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-user {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer;
}
.header-avatar {
  width: 30px; height: 30px;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--primary-bg);
}

/* ===== 底部导航 ===== */
.tab-bar {
  position: fixed; bottom: 0; z-index: 200;
  width: 100%;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.tab-inner {
  max-width: 800px; margin: 0 auto;
  display: flex; align-items: center;
  height: var(--tab-height);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  font-size: 10px; color: var(--text-light);
  cursor: pointer; transition: color 0.2s;
  padding: 4px 0;
  border: none; background: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-item.active { color: var(--primary); }
.tab-item:active { opacity: 0.6; }
.tab-icon { font-size: 22px; line-height: 1; }
.tab-item.active .tab-icon { }
.tab-label { font-size: 10px; }
.tab-post-btn {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
  box-shadow: 0 4px 12px rgba(240,68,148,0.35);
  margin-top: -12px;
  transition: transform 0.2s;
}
.tab-post-btn:active { transform: scale(0.9); }

/* ===== 主容器 ===== */
.container {
  max-width: 800px; margin: 0 auto;
  padding: 0;
  min-height: calc(100vh - var(--header-height) - var(--tab-height));
}

/* ===== 分类标签 ===== */
.category-tabs {
  display: flex; overflow-x: auto;
  gap: 8px; padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 7px 16px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; border: none; background: #f5f5f5;
  position: relative; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  border-radius: 20px;
  font-weight: 500;
}
.cat-tab.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: 0 2px 8px rgba(240,68,148,0.25);
}

/* ===== 帖子列表 ===== */
.post-feed { padding: 12px 12px 0; }

.post-card {
  display: block; background: var(--card-bg);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.15s;
}
.post-card:active { transform: scale(0.98); background: #fafafa; }

.post-card-title {
  font-size: 17px; font-weight: 600;
  color: var(--text); line-height: 1.45;
  margin-bottom: 8px;
}
.post-card-excerpt {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-images {
  display: flex; gap: 4px; overflow-x: auto;
  margin-bottom: 12px; scrollbar-width: none;
}
.post-images::-webkit-scrollbar { display: none; }
.post-image {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  object-fit: cover; flex-shrink: 0;
  background: var(--bg);
}
.post-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px;
  border-top: 1px solid #f5f5f5;
}
.post-card-left {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; flex: 1;
}
.post-card-right {
  display: flex; gap: 12px; flex-shrink: 0;
}
.post-author-avatar-sm {
  width: 20px; height: 20px; border-radius: 50%;
  flex-shrink: 0; object-fit: cover;
}
.post-author-avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-bg); color: var(--primary);
  font-size: 10px; font-weight: 600;
  width: 20px; height: 20px; border-radius: 50%;
}
.post-author-name-sm {
  font-size: 12px; color: #999;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-time-sm {
  font-size: 11px; color: #ccc; flex-shrink: 0;
}
.post-stat-item {
  font-size: 12px; color: #bbb; white-space: nowrap;
}

.post-cat-tag {
  display: inline-block;
  font-size: 11px; padding: 1px 8px;
  border-radius: 4px;
  background: var(--primary-bg); color: var(--primary);
  margin-bottom: 6px;
}
.post-top-badge {
  display: inline-block;
  font-size: 10px; padding: 1px 6px;
  border-radius: 3px;
  background: #fef3c7; color: #d97706;
  margin-left: 6px; vertical-align: middle;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-light);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ===== 加载更多 ===== */
.load-more {
  text-align: center; padding: 20px;
  color: var(--text-light); font-size: 13px;
}

/* ===== 帖子详情 ===== */
.post-detail {
  background: var(--card-bg);
  margin-bottom: 1px;
}
.post-detail-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.post-detail-title {
  font-size: 20px; font-weight: 700;
  line-height: 1.4; margin-bottom: 12px;
}
.post-detail-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-light);
}
.post-detail-content {
  padding: 20px 16px;
  font-size: 15px; line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.post-attachments {
  padding: 0 16px 16px;
  display: flex; flex-direction: column;
  gap: 8px;
}
.post-attachment-item {
  border-radius: 8px; overflow: hidden;
  background: #f5f5f5;
}
.post-attachment-item img, .post-attachment-item video {
  max-height: 400px;
  width: 100%; object-fit: contain;
  display: block;
}
.post-detail-actions {
  display: flex; border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.post-action-btn {
  flex: 1; display: flex; align-items: center;
  justify-content: center; gap: 6px;
  padding: 8px; font-size: 14px;
  color: var(--text-secondary);
  border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.post-action-btn:active { background: var(--bg); }
.post-action-btn.liked { color: var(--primary); }

/* ===== 回复列表 ===== */
.reply-section {
  background: var(--card-bg); margin-top: 1px;
  padding: 16px;
}
.reply-title {
  font-size: 15px; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.reply-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.reply-item:last-child { border-bottom: none; }
.reply-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.reply-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover;
}
.reply-author-name { font-size: 13px; font-weight: 500; }
.reply-time { font-size: 11px; color: var(--text-light); margin-left: auto; }
.reply-content {
  font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  padding-left: 36px;
}

/* ===== 回复表单 ===== */
.reply-form-wrap {
  background: var(--card-bg); margin-top: 1px;
  padding: 16px; margin-bottom: 12px;
}
.reply-form-wrap textarea {
  width: 100%; padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; resize: none;
  outline: none; min-height: 80px;
  font-family: inherit; line-height: 1.5;
  transition: border-color 0.2s;
}
.reply-form-wrap textarea:focus {
  border-color: var(--primary);
}

/* ===== 发帖页 ===== */
.create-page {
  padding: 16px; max-width: 600px; margin: 0 auto;
}
.create-page .page-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.create-form .form-group {
  margin-bottom: 16px;
}
.create-form label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.create-form input, .create-form select, .create-form textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--card-bg);
}
.create-form input:focus, .create-form select:focus, .create-form textarea:focus {
  border-color: var(--primary);
}
.create-form textarea { min-height: 200px; resize: vertical; line-height: 1.7; }
.create-form .form-hint {
  font-size: 12px; color: var(--text-light);
  margin-top: 4px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block; padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500;
  border: none; cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 12px rgba(240,68,148,0.25);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-sm {
  padding: 8px 16px; font-size: 13px;
}

/* ===== 个人主页 ===== */
.profile-header {
  text-align: center; padding: 30px 20px;
  background: var(--card-bg);
  margin-bottom: 1px;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; margin-bottom: 12px;
  border: 3px solid var(--primary-bg);
}
.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.profile-bio { font-size: 13px; color: var(--text-secondary); }
.profile-stats {
  display: flex; justify-content: center; gap: 32px;
  padding: 16px; background: var(--card-bg);
  margin-bottom: 1px;
}
.profile-stat { text-align: center; }
.profile-stat-num { font-size: 18px; font-weight: 700; color: var(--primary); }
.profile-stat-label { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.profile-tabs {
  display: flex; background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.profile-tab {
  flex: 1; padding: 12px; text-align: center;
  font-size: 14px; color: var(--text-secondary);
  cursor: pointer; border: none; background: none;
  position: relative;
}
.profile-tab.active { color: var(--primary); font-weight: 600; }
.profile-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 3px;
  background: var(--primary); border-radius: 3px 3px 0 0;
}

.profile-section { display: none; }
.profile-section.active { display: block; }

/* ===== 登录页 ===== */
.login-page {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; padding: 40px 20px;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin-bottom: 16px;
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.login-card {
  width: 100%; max-width: 300px;
  text-align: center;
}
.login-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #07c160, #06ad56);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}
.login-btn:active { opacity: 0.9; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff; padding: 12px 24px;
  border-radius: 8px; font-size: 14px;
  z-index: 9999; display: none;
  max-width: 80%; text-align: center;
  backdrop-filter: blur(4px);
}
.toast.show { display: block; animation: toastIn 0.3s ease; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== 杂项 ===== */
.divider { height: 1px; background: var(--border); margin: 0; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 12px;
}
.error-msg {
  color: #ef4444; font-size: 14px;
  padding: 10px 14px; background: #fef2f2;
  border-radius: var(--radius-sm); margin-bottom: 12px;
}

/* ===== 扫码弹窗 ===== */
.qr-overlay {
  display: none; position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.qr-overlay.show { display: flex; }
.qr-modal {
  background: #fff; border-radius: 16px;
  padding: 32px; width: 300px;
  text-align: center; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: qrFadeIn 0.25s ease;
}
@keyframes qrFadeIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.qr-close {
  position: absolute; top: 10px; right: 14px;
  border: none; background: none;
  font-size: 20px; color: var(--text-light);
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.qr-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.qr-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.qr-img-wrap {
  width: 200px; height: 200px;
  margin: 0 auto 14px;
  border: 2px solid var(--border);
  border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
}
.qr-img { width: 100%; height: 100%; object-fit: contain; }
.qr-status {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 14px;
}
.qr-refresh {
  border: none; background: none;
  color: var(--primary); font-size: 13px;
  cursor: pointer; padding: 4px 12px;
}
