/* 萍乡七中校园墙 — 全局样式 */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #8b5cf6;
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1f2333;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #10b981;
  --gold: #d97706;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 35, 51, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { cursor: pointer; color: var(--primary); text-decoration: none; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; cursor: pointer; }
.brand-icon { font-size: 22px; }
.brand-name { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.nav-link { padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-size: 14px; position: relative; }
.nav-link:hover { background: #eef0ff; color: var(--primary); }
.nav-link.active { background: #eef0ff; color: var(--primary); font-weight: 600; }
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px;
  background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px;
  line-height: 18px; text-align: center; padding: 0 5px;
}
.user-chip {
  padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3); white-space: nowrap;
}
.user-chip:hover { opacity: .92; }

/* 公告 */
.announcement {
  max-width: 928px; margin: 12px auto 0; padding: 10px 16px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius);
  color: #92400e; font-size: 13px;
}

/* 主区域 */
main { max-width: 960px; margin: 0 auto; padding: 16px; }

/* 板块栏 */
.board-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.board-chip {
  padding: 8px 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--border);
  cursor: pointer; font-size: 14px; color: var(--text-2); transition: all .15s;
}
.board-chip:hover { border-color: var(--primary); color: var(--primary); }
.board-chip.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; }

/* 帖子列表 */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(31,35,51,.12); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.post-author { font-weight: 600; font-size: 14px; }
.post-meta { font-size: 12px; color: var(--text-2); }
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; margin-left: 6px; }
.role-4 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.role-3 { background: #ef4444; }
.role-2 { background: #f97316; }
.role-1 { background: #3b82f6; }
.role-0 { background: #9ca3af; }
.post-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.post-content { font-size: 14px; color: #374151; line-height: 1.7; word-break: break-word; white-space: pre-wrap; }
.post-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }
.post-media img { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.post-media video { width: 100%; max-height: 300px; border-radius: 10px; background: #000; }
.post-foot { display: flex; gap: 20px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.post-foot span { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.post-foot span:hover { color: var(--primary); }
.liked { color: var(--danger) !important; }
.guest-lock { font-size: 12px; color: var(--text-2); background: #f3f4f6; padding: 4px 10px; border-radius: 8px; display: inline-block; margin-top: 8px; }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 0; color: var(--text-2); }
.empty-icon { font-size: 48px; margin-bottom: 10px; }

/* 悬浮按钮 */
.fab {
  position: fixed; right: 28px; bottom: 28px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 22px;
  border: none; cursor: pointer; box-shadow: 0 8px 24px rgba(99,102,241,.4); z-index: 90;
  transition: transform .15s;
}
.fab:hover { transform: scale(1.08); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 17, 30, .55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-close { border: none; background: none; font-size: 24px; color: var(--text-2); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { margin-top: 16px; text-align: right; }

/* 表单 */
.text-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; margin-bottom: 10px; outline: none; font-family: inherit;
}
.text-input:focus { border-color: var(--primary); }
textarea.text-input { resize: vertical; min-height: 60px; }
select.text-input { appearance: auto; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 10px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit;
  text-align: center;
}
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; width: 100%; }
.btn.primary:hover { opacity: .92; }
.btn.ghost { background: #f3f4f6; color: var(--text); width: 100%; margin-top: 8px; }
.btn.ghost:hover { background: #e5e7eb; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; background: #f3f4f6; padding: 4px; border-radius: 12px; }
.tab { flex: 1; padding: 9px; border: none; background: none; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2); }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.hint { font-size: 13px; color: var(--text-2); margin-bottom: 14px; line-height: 1.6; }

.drop-zone {
  border: 2px dashed #c7c9d9; border-radius: 12px; padding: 26px 16px; text-align: center;
  color: var(--text-2); cursor: pointer; margin-bottom: 12px; transition: all .15s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--primary); background: #eef0ff; }
.drop-icon { font-size: 34px; margin-bottom: 8px; }
.drop-sub { font-size: 12px; margin-top: 6px; opacity: .7; }
.token-input { width: 100%; padding: 10px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 12px; margin-bottom: 12px; font-family: monospace; resize: vertical; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }

.qr-wrap { text-align: center; }
.qr-wrap img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--border); margin: 10px auto; display: block; }
.qr-warn { font-size: 13px; color: var(--danger); margin: 8px 0; line-height: 1.6; }
.token-box { background: #f8f9fc; border-radius: 10px; padding: 12px; margin: 10px 0; }
.token-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.token-box code { font-size: 11px; word-break: break-all; cursor: pointer; color: var(--primary); }

.level-row { display: flex; gap: 18px; font-size: 13px; margin: 10px 0; color: var(--text); }
.upload-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.upload-btn { width: auto; margin: 0; }
.upload-tip { font-size: 12px; color: var(--text-2); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.preview-grid .pv { position: relative; }
.preview-grid img, .preview-grid video { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; }
.preview-grid .pv-rm { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 20px; }

/* 详情 */
.detail-content { white-space: pre-wrap; line-height: 1.8; font-size: 15px; margin: 12px 0; }
.comment-item { padding: 10px 0; border-bottom: 1px solid #f0f0f4; font-size: 14px; }
.comment-item b { color: var(--primary); margin-right: 8px; }
.comment-time { font-size: 11px; color: var(--text-2); margin-left: 8px; }
.comment-input-row { display: flex; gap: 8px; margin-top: 14px; }
.comment-input-row input { margin: 0; }

/* 好友 */
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row input { margin: 0; flex: 1; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 16px 0 8px; }
.friend-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; }
.friend-item:hover { background: #f8f9fc; }
.friend-item .grow { flex: 1; }
.friend-item .btn { width: auto; padding: 7px 14px; margin: 0; font-size: 13px; }

/* 私聊 */
.chat-layout { display: flex; height: 70vh; max-width: 800px; padding: 0; overflow: hidden; }
.chat-side { width: 220px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-side .modal-head { border-bottom: 1px solid var(--border); }
.chat-friends { flex: 1; overflow-y: auto; }
.chat-friend { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f5f5f8; }
.chat-friend:hover { background: #f8f9fc; }
.chat-friend.active { background: #eef0ff; }
.chat-friend-name { font-size: 14px; font-weight: 600; }
.chat-main { flex: 1; display: flex; flex-direction: column; position: relative; }
.chat-empty { margin: auto; color: var(--text-2); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 70%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: #f1f2f7; border-bottom-left-radius: 4px; }
.msg-time { font-size: 10px; opacity: .7; margin-top: 4px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row input { margin: 0; flex: 1; }

/* 密保 */
.secq-row { display: flex; gap: 8px; margin-bottom: 6px; }
.secq-row .text-input { flex: 1; margin: 0; font-size: 13px; }
.secq-item { display: block; padding: 8px 10px; background: #f8f9fc; border-radius: 8px; margin-bottom: 6px; font-size: 14px; cursor: pointer; }
.secq-item:hover { background: #eef0ff; }

/* 我的 */
.me-info { text-align: center; padding: 10px 0 18px; }
.me-avatar { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px; font-size: 28px; display: flex; align-items: center; justify-content: center; color: #fff; }
.me-name { font-size: 18px; font-weight: 700; }
.me-role { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2333; color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px;
  z-index: 999; opacity: 0; pointer-events: none; transition: all .25s; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* 响应式 */
@media (max-width: 640px) {
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .brand-name { font-size: 16px; }
  .nav-link { padding: 7px 10px; font-size: 13px; }
  .user-chip { padding: 7px 12px; font-size: 13px; }
  main { padding: 12px; }
  .chat-layout { flex-direction: column; height: 80vh; }
  .chat-side { width: 100%; height: 120px; border-right: none; border-bottom: 1px solid var(--border); }
  .chat-friends { display: flex; overflow-x: auto; }
  .chat-friend { border-bottom: none; border-right: 1px solid #f0f0f4; white-space: nowrap; }
}
