/* ============================================================
   学子桥 - 样式表 v2.0
   蓝白配色 · 现代简约 · 响应式
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --primary: #1e6fff;
  --primary-dark: #0d47a1;
  --primary-light: #e8f1ff;
  --primary-hover: #1557d4;
  --accent: #00b4d8;
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-alt: #f8faff;
  --text: #1a2332;
  --text-secondary: #5a6b85;
  --text-muted: #8a9bb5;
  --border: #e3ecf7;
  --shadow-sm: 0 1px 3px rgba(30, 111, 255, 0.08);
  --shadow-md: 0 4px 16px rgba(30, 111, 255, 0.1);
  --shadow-lg: 0 8px 32px rgba(30, 111, 255, 0.15);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }
img { max-width: 100%; display: block; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5d5ed; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a3bde0; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.btn-danger { background: #ff4757; color: #fff; }
.btn-danger:hover { background: #e84118; }

/* ---------- 顶部导航栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 32px; }
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.sync-status { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: #4caf50; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--primary-light);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.user-chip:hover { background: #d4e4ff; }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }

/* ---------- 主容器 ---------- */
.container { max-width: 960px; margin: 0 auto; padding: 24px 20px; }

/* ---------- 认证页面 ---------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #e8f1ff 0%, #f5f8ff 50%, #e0f7ff 100%);
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(30, 111, 255, 0.15), transparent 70%);
  border-radius: 50%;
}
.auth-wrapper::after {
  content: '';
  position: absolute;
  bottom: -200px; left: -200px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0, 180, 216, 0.12), transparent 70%);
  border-radius: 50%;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.auth-logo {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.auth-logo .logo-icon { width: 48px; height: 48px; font-size: 26px; }
.auth-logo h1 { font-size: 24px; color: var(--primary); }
.auth-logo p { font-size: 13px; color: var(--text-muted); }

.auth-tabs {
  display: flex;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: none; }
.auth-form.active { display: block; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  background: var(--surface);
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 111, 255, 0.1);
}
.form-group input::placeholder { color: var(--text-muted); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

.auth-hint {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-hint code {
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--primary);
  font-size: 12px;
}
.cloud-recover-btn {
  display: block;
  margin: 12px auto 0;
  font-size: 12px;
  color: var(--primary);
  background: none;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Toast 提示 ---------- */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { background: linear-gradient(135deg, #4caf50, #45a049); }
.toast.error { background: linear-gradient(135deg, #ff4757, #e84118); }
.toast.info { background: linear-gradient(135deg, var(--primary), var(--accent)); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- 问答墙 ---------- */
.page-header {
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 14px;
}
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.question-list { display: flex; flex-direction: column; gap: 12px; }
.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}
.question-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.question-card.pinned {
  border-left: 3px solid var(--primary);
  background: linear-gradient(to right, var(--primary-light), var(--surface) 40%);
}
.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.q-author { font-weight: 600; color: var(--text-secondary); }
.q-tag {
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
}
.q-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.q-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.q-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.q-action {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition);
}
.q-action:hover { background: var(--primary-light); color: var(--primary); }
.q-action.liked { color: var(--primary); }

/* ---------- 问题详情 ---------- */
.question-detail {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.answers-section { margin-top: 24px; }
.answers-section h3 { font-size: 16px; margin-bottom: 16px; }
.answer-card {
  padding: 16px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.answer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ---------- 动态广场 ---------- */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.post-content { font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.post-images img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.comment-list { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.comment-item {
  padding: 8px 0;
  font-size: 13px;
}
.comment-item .c-author { font-weight: 600; color: var(--primary); margin-right: 6px; }

/* ---------- 侧边栏 / 社区数据 ---------- */
.sidebar-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.sidebar-card h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); }
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat-item {
  text-align: center;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ---------- 个人资料 ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 700;
}
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.profile-info .role {
  display: inline-block;
  padding: 2px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.profile-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 50, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
textarea.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 100px;
  transition: all var(--transition);
}
textarea.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 111, 255, 0.1);
}

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

/* ---------- 工具类 ---------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }

/* ---------- 背景音乐播放器 ---------- */
.music-player {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 998;
  background: var(--surface);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: all var(--transition);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.music-player.expanded {
  width: auto;
  height: auto;
  border-radius: var(--radius);
  padding: 0;
}
.music-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.music-toggle:hover { transform: scale(1.05); }
.music-player.expanded .music-toggle {
  width: 40px;
  height: 40px;
  font-size: 18px;
  margin: 6px;
}
.music-body {
  display: none;
  padding: 8px 12px 8px 0;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.music-player.expanded .music-body { display: flex; }
.music-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.music-icon-small { font-size: 14px; }
.music-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.music-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.music-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.music-btn:hover { background: var(--primary-light); color: var(--primary); }
.music-btn.music-main {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 14px;
}
.music-btn.music-main:hover { transform: scale(1.05); }
.music-btn.music-main.playing { animation: musicPulse 2s ease-in-out infinite; }
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30, 111, 255, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(30, 111, 255, 0); }
}
.music-volume {
  display: flex;
  align-items: center;
  gap: 6px;
}
.music-volume input[type="range"] {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.music-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.music-volume input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
}
.music-vol-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .nav-links { display: none; }
  .container { padding: 16px 12px; }
  .auth-card { padding: 28px 20px; }
  .profile-header { flex-direction: column; text-align: center; }
  .music-player.expanded .music-body { min-width: 160px; }
  .music-volume input[type="range"] { width: 50px; }
  .music-title { max-width: 120px; }
}
