/* ============================================================
   溏心蛋爱好者社区 - 前端样式
   配色: 主色#FFD700 辅色#FFF9F0 背景#FFF8E7 文字#4B3625
   ============================================================ */

:root {
    --primary: #FFD700;
    --primary-dark: #D4A017;
    --primary-tint: #FFF0D9;
    --secondary: #FFF9F0;
    --bg: #FFF8E7;
    --card: #FFFFFF;
    --text: #4B3625;
    --text2: #8B7355;
    --text3: #B8A08A;
    --border: #FFF0D9;
    --border2: #E8D5B5;
    --success: #6BAF7A;
    --danger: #E85D5D;
    --like-red: #E85D5D;
    --shadow: 0 2px 12px rgba(75,54,37,.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }

/* ===== 按钮 ===== */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; transition: all .2s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text2); padding: 8px 16px; border-radius: 8px; font-size: 13px; transition: all .2s; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 6px; }
.full-width { width: 100%; }

/* ===== 导航栏 ===== */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: 60px; background: var(--card); border-bottom: 1px solid var(--border); z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.nav-inner { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; align-items: center; padding: 0 24px; gap: 32px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.logo-icon { font-size: 28px; }
.nav-menu { display: flex; gap: 24px; }
.nav-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text2); padding: 8px 0; border-bottom: 2px solid transparent; transition: all .2s; }
.nav-item:hover, .nav-item.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--secondary); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; transition: border .2s; }
.search-box:focus-within { border-color: var(--primary); }
.search-box input { border: none; outline: none; background: transparent; font-size: 13px; color: var(--text); width: 160px; }
.search-box svg { color: var(--text3); flex-shrink: 0; }
.user-avatar-nav { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid var(--primary); color: var(--primary-dark); }
.user-avatar-nav:hover { box-shadow: 0 0 0 3px var(--primary-tint); }

/* ===== 三栏布局 ===== */
.main-container { max-width: 1200px; margin: 76px auto 24px; display: grid; grid-template-columns: 220px 1fr 260px; gap: 20px; padding: 0 24px; min-height: calc(100vh - 100px); }

/* ===== 左侧栏 ===== */
.sidebar-left { position: sticky; top: 76px; align-self: start; }
.user-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 16px; }
.user-card-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-tint); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.user-card-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.user-card-level { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.user-stats { display: flex; justify-content: space-around; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.stat { text-align: center; }
.stat strong { display: block; font-size: 16px; color: var(--primary-dark); }
.stat span { font-size: 11px; color: var(--text3); }

.side-nav { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin-bottom: 12px; }
.side-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text2); font-size: 14px; transition: all .15s; }
.side-nav-item:hover { background: var(--bg); color: var(--text); }
.side-nav-item.active { background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; }

/* ===== 中间内容区 ===== */
.content-main { min-width: 0; }
.feed-tabs { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.feed-tab { flex: 1; padding: 12px; border: none; background: transparent; font-size: 14px; color: var(--text2); transition: all .2s; }
.feed-tab.active { background: var(--primary); color: #fff; font-weight: 500; }
.feed-tab:hover:not(.active) { background: var(--secondary); }
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 22px; margin-bottom: 4px; }
.page-header p { color: var(--text3); font-size: 14px; }

/* ===== 帖子卡片 ===== */
.post-feed { display: flex; flex-direction: column; gap: 12px; }
.post-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: box-shadow .2s; }
.post-card:hover { box-shadow: var(--shadow); }
.post-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.post-author { display: flex; align-items: center; gap: 10px; }
.post-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.post-author-info { line-height: 1.3; }
.post-author-name { font-size: 14px; font-weight: 600; }
.post-time { font-size: 12px; color: var(--text3); }
.post-content { font-size: 15px; line-height: 1.7; margin-bottom: 12px; word-break: break-word; cursor: pointer; }
.post-content:hover { color: var(--primary-dark); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.post-tag { background: var(--primary-tint); color: var(--primary-dark); padding: 3px 10px; border-radius: 10px; font-size: 12px; cursor: pointer; transition: background .2s; }
.post-tag:hover { background: var(--primary); color: #fff; }
.post-actions { display: flex; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.post-action { display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--text2); background: transparent; border: none; transition: all .15s; }
.post-action:hover { background: var(--secondary); }
.post-action.liked { color: var(--like-red); }
.post-action.liked svg { fill: var(--like-red); }

/* ===== 置顶标记 ===== */
.pin-badge { display: inline-block; font-size: 11px; color: var(--primary-dark); background: var(--primary-tint); padding: 1px 8px; border-radius: 10px; margin-left: 6px; font-weight: 500; }
.post-card.pinned { border-left: 3px solid var(--primary); }

/* ===== 帖子图片 ===== */
.post-images { display: grid; gap: 6px; margin-bottom: 12px; }
.post-images.cols-1 { grid-template-columns: 1fr; max-width: 360px; }
.post-images.cols-2 { grid-template-columns: repeat(2, 1fr); }
.post-images.cols-3 { grid-template-columns: repeat(3, 1fr); }
.post-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; transition: opacity .2s; background: var(--secondary); }
.post-images img:hover { opacity: .9; }
.post-images.cols-1 img { aspect-ratio: auto; max-height: 400px; }

/* ===== 图片上传 ===== */
.image-upload-area { display: flex; flex-wrap: wrap; gap: 8px; }
.image-preview-list { display: flex; flex-wrap: wrap; gap: 8px; }
.image-preview-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border2); }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-img { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; background: rgba(0,0,0,.5); color: #fff; border: none; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
.image-preview-item .remove-img:hover { background: var(--danger); }
.image-upload-btn { width: 80px; height: 80px; border: 2px dashed var(--border2); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--text3); font-size: 11px; transition: all .2s; }
.image-upload-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.image-upload-btn svg { color: inherit; }
.image-upload-btn.uploading { pointer-events: none; opacity: .5; }

/* ===== 推荐区域 ===== */
.recommend-section { background: linear-gradient(135deg, #FFF8E7 0%, #FFF0D9 100%); border: 1px solid var(--primary); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.recommend-header { font-size: 14px; margin-bottom: 12px; color: var(--primary-dark); }
.recommend-icon { font-size: 16px; }
.recommend-feed { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.recommend-feed::-webkit-scrollbar { height: 4px; }
.recommend-feed::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.recommend-item { min-width: 200px; max-width: 260px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; transition: all .2s; flex-shrink: 0; }
.recommend-item:hover { box-shadow: 0 4px 16px rgba(255,215,0,.2); transform: translateY(-2px); }
.recommend-item .ri-author { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
.recommend-item .ri-content { font-size: 13px; color: var(--text); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.recommend-item .ri-img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }

/* ===== 帖子详情 ===== */
.post-detail-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin: 16px 0; }
.post-detail-card .post-content { cursor: default; font-size: 16px; }

/* ===== 评论 ===== */
.comment-section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-top: 16px; }
.comment-section h3 { margin-bottom: 16px; font-size: 16px; }
.comment-form textarea { width: 100%; padding: 12px; border: 1px solid var(--border2); border-radius: 8px; font-size: 14px; resize: vertical; outline: none; margin-bottom: 8px; font-family: inherit; }
.comment-form textarea:focus { border-color: var(--primary); }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.comment-name { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 11px; color: var(--text3); }
.comment-body { font-size: 14px; padding-left: 36px; line-height: 1.6; }
.comment-reply-to { font-size: 12px; color: var(--primary-dark); }
.comment-actions-bar { padding-left: 36px; margin-top: 4px; }
.comment-reply-btn { font-size: 12px; color: var(--text3); background: none; border: none; cursor: pointer; }
.comment-reply-btn:hover { color: var(--primary-dark); }

/* ===== 话题广场 ===== */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.topic-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; transition: all .2s; }
.topic-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(255,215,0,.15); transform: translateY(-2px); }
.topic-icon { font-size: 32px; margin-bottom: 8px; }
.topic-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.topic-count { font-size: 12px; color: var(--text3); }

/* ===== 右侧栏 ===== */
.sidebar-right { position: sticky; top: 76px; align-self: start; }
.right-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.right-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.link { font-size: 12px; color: var(--primary-dark); font-weight: 400; }
.link:hover { text-decoration: underline; }

/* 公告 */
.announcement-list { display: flex; flex-direction: column; gap: 10px; }
.announcement-item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.announcement-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 7px; }
.announcement-dot.dim { background: var(--border2); }
.announcement-text { line-height: 1.5; color: var(--text); }
.announcement-text.dim { color: var(--text2); }
.announcement-text:hover { color: var(--primary-dark); }
.announcement-detail { display: none; background: var(--secondary); border-radius: 8px; padding: 12px; margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--text2); }
.announcement-detail.show { display: block; }

/* 热门话题 */
.hot-topic-list { display: flex; flex-direction: column; gap: 2px; }
.hot-topic-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.hot-topic-item:hover .ht-name { color: var(--primary-dark); }
.ht-rank { width: 22px; height: 22px; border-radius: 4px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ht-rank.dim { background: var(--border2); color: var(--text3); }
.ht-info { flex: 1; min-width: 0; }
.ht-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-count { font-size: 11px; color: var(--text3); }

/* 推荐用户 */
.recommend-list { display: flex; flex-direction: column; gap: 12px; }
.recommend-item { display: flex; align-items: center; justify-content: space-between; }
.recommend-info { display: flex; align-items: center; gap: 8px; }
.recommend-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.recommend-name { font-size: 13px; font-weight: 500; }
.recommend-desc { font-size: 11px; color: var(--text3); }
.follow-btn { padding: 4px 12px; border-radius: 10px; background: var(--primary); color: #fff; border: none; font-size: 12px; font-weight: 500; }
.follow-btn.following { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.follow-btn:hover { opacity: .85; }

/* ===== 弹窗 ===== */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200; justify-content: center; align-items: center; }
.modal-mask.show { display: flex; }
.modal-box { background: var(--card); border-radius: 14px; padding: 28px; width: 400px; max-width: 92vw; }
.modal-box.modal-lg { width: 560px; }
.modal-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.modal-tab { flex: 1; padding: 10px; border: none; background: transparent; font-size: 15px; color: var(--text2); border-bottom: 2px solid transparent; }
.modal-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; }
.form-group input, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border2); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.auth-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }
.modal-close { text-align: center; margin-top: 12px; color: var(--text3); font-size: 13px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.topic-select { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-check { display: flex; align-items: center; gap: 4px; padding: 5px 12px; border: 1px solid var(--border2); border-radius: 16px; font-size: 13px; cursor: pointer; transition: all .15s; user-select: none; }
.topic-check:hover { border-color: var(--primary); }
.topic-check.selected { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); font-weight: 500; }
.topic-check input { display: none; }

/* ===== Toast ===== */
.toast { position: fixed; top: 80px; right: 24px; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 9999; transform: translateX(120%); transition: transform .3s; }
.toast.show { transform: translateX(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ===== 加载/空状态 ===== */
.load-more { text-align: center; padding: 16px; color: var(--text3); font-size: 13px; cursor: pointer; }
.load-more:hover { color: var(--primary-dark); }
.empty-state { text-align: center; padding: 40px; color: var(--text3); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .main-container { grid-template-columns: 200px 1fr; }
    .sidebar-right { display: none; }
}
@media (max-width: 768px) {
    .main-container { grid-template-columns: 1fr; padding: 0 12px; }
    .sidebar-left { display: none; }
    .nav-menu { display: none; }
    .search-box input { width: 120px; }
}

/* ===== 私信对话 ===== */
.msg-bubble { max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg-bubble.sent { background: var(--primary-tint); color: var(--text); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-bubble.received { background: var(--card); border: 1px solid var(--border); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: var(--text3); margin-top: 4px; }
.msg-time.sent { text-align: right; }

/* 会话卡片 */
.conv-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: all .2s; margin-bottom: 8px; }
.conv-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.conv-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 14px; font-weight: 600; }
.conv-preview { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.conv-unread { background: var(--danger); color: #fff; border-radius: 50%; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }

/* 关注列表 */
.follow-list-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.follow-list-item:last-child { border-bottom: none; }
.follow-info { display: flex; align-items: center; gap: 10px; }
.follow-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-tint); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.stat-clickable { cursor: pointer; transition: all .15s; border-radius: 6px; padding: 2px 4px; }
.stat-clickable:hover { background: var(--primary-tint); }
.modal-tabs { display: flex; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.modal-tab { flex: 1; padding: 10px; border: none; background: transparent; font-size: 15px; color: var(--text2); border-bottom: 2px solid transparent; cursor: pointer; }
.modal-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
