/* ===== 亲子陪伴 · 扁平化 UI ===== */

:root {
  --primary: #FF7A59;
  --primary-dark: #F26643;
  --accent: #4ECDC4;
  --warm: #FFD166;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --text: #2C3E50;
  --muted: #7F8C8D;
  --border: #E8EBEF;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 20px 40px; }
.container.narrow { max-width: 640px; }

/* ===== 顶栏 ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand-icon { font-size: 22px; }

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-item {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }

.user-area { display: flex; align-items: center; gap: 12px; }
.hello { font-size: 14px; color: var(--muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--bg); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* ===== 统计卡片 ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-card.accent { border-color: var(--accent); }
.stat-card.soft { border-color: var(--warm); }
.stat-num { font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-card.accent .stat-num { color: var(--accent); }
.stat-card.soft .stat-num { color: #E9A800; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.action-bar { margin-bottom: 24px; }

/* ===== 页面标题 ===== */
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .page-title { margin-bottom: 0; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* ===== 时光轴 ===== */
.timeline { position: relative; padding-left: 8px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 14px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding-left: 34px; margin-bottom: 18px; }
.tl-dot {
  position: absolute;
  left: 3px; top: 22px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
}
.tl-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.tl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tl-date { font-size: 13px; color: var(--muted); font-weight: 600; }
.tl-mood { font-size: 13px; background: var(--bg); padding: 3px 10px; border-radius: 20px; }
.tl-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.tl-content { color: #455A64; font-size: 15px; margin-bottom: 12px; }
.tl-img { width: 100%; border-radius: var(--radius-sm); margin-bottom: 12px; display: block; }
.tl-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--muted);
}
.chip-child { background: #FFF0EC; color: var(--primary-dark); font-weight: 600; }
.chip-user { background: #E6FAF8; color: #2FA79C; font-weight: 600; }

.tl-del { font-size: 13px; color: #C0392B; margin-left: auto; }

/* ===== 表单 ===== */
.form .field { margin-bottom: 16px; }
.form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form input, .form textarea, .form select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--primary);
}
.form textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.mood-picker, .avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.mood-opt, .avatar-opt { cursor: pointer; }
.mood-opt input, .avatar-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.mood-opt span, .avatar-opt span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  background: #fff;
  transition: all .15s;
}
.avatar-opt span { font-size: 20px; padding: 8px 12px; }
.mood-opt input:checked + span, .avatar-opt input:checked + span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 孩子 ===== */
.child-list { list-style: none; }
.child-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.child-item:last-child { border-bottom: none; }
.child-avatar { font-size: 26px; }
.child-info { display: flex; flex-direction: column; }
.child-info small { color: var(--muted); font-size: 13px; }

.child-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.child-stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.child-stat-avatar { font-size: 28px; }
.child-stat-name { font-weight: 600; font-size: 14px; }
.child-stat-num { color: var(--primary); font-weight: 700; font-size: 15px; }

/* ===== 图表 ===== */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .3s;
}
.bar-label { font-size: 11px; color: var(--muted); margin-top: 6px; }

.mood-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mood-name { font-size: 14px; width: 78px; flex-shrink: 0; }
.mood-track { flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.mood-fill { height: 100%; background: var(--warm); border-radius: 7px; }
.mood-count { font-size: 13px; color: var(--muted); width: 30px; text-align: right; flex-shrink: 0; }

/* ===== 论坛 ===== */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color .15s;
}
.post-item:hover { border-color: var(--primary); }
.post-main { flex: 1; min-width: 0; }
.post-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.post-stat { text-align: right; flex-shrink: 0; }
.reply-badge {
  display: inline-block;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
}
.last-reply { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.post-detail { margin-top: 12px; }
.post-detail-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.post-body { margin-top: 14px; font-size: 15px; color: #455A64; }

.back-link { display: inline-block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.back-link:hover { color: var(--primary); }

.reply-section { margin-top: 20px; }
.reply-item {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.reply-avatar { font-size: 22px; }
.reply-body { flex: 1; }
.reply-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.reply-time { font-size: 12px; color: var(--muted); }
.reply-content { font-size: 14px; color: #455A64; }
.reply-form { margin-top: 16px; }

/* ===== 登录 / 注册 ===== */
.auth-wrap { display: flex; justify-content: center; padding: 48px 20px 60px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-hero { font-size: 48px; margin-bottom: 8px; }
.auth-title { font-size: 22px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.auth-card .form { text-align: left; margin-top: 16px; }
.auth-foot { margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-foot a { color: var(--primary); font-weight: 600; }

/* ===== 提示 ===== */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #FDECEA; color: #C0392B; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty.small { padding: 24px 12px; }
.empty-icon { font-size: 44px; margin-bottom: 10px; }
.empty p { margin-bottom: 14px; }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 24px 20px 32px;
  color: var(--muted);
  font-size: 13px;
}

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 0 14px; height: 56px; }
  .brand-text { display: none; }
  .nav-links { gap: 0; }
  .nav-item { padding: 8px 10px; font-size: 14px; }
  .hello { display: none; }
  .stat-cards { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .post-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .post-stat { text-align: left; }
  .container { padding: 18px 14px 32px; }
}
