/* 《风月同天》全站样式（M1）
   配色：靛青 + 米白，呼应"山川异域，风月同天"的东方气质 */

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f6f4ef;
  color: #2b2b2b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  background: #1f3a5f;
  color: #fff;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
}
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: #dbe4f0; text-decoration: none; padding: 4px 8px; border-radius: 4px; }
.nav a:hover { background: #2c4a75; color: #fff; }
/* 当前所在页的导航项保持高亮（第 10 课打磨：四页导航状态一眼可辨） */
.nav a.active { background: #2c4a75; color: #fff; }
.userbox { display: flex; align-items: center; gap: 8px; }
.who { color: #ffd97a; font-weight: bold; }
.btn-mini {
  color: #fff; text-decoration: none; font-size: 13px;
  border: 1px solid #6d87ab; padding: 3px 10px; border-radius: 12px;
}
.btn-mini:hover { background: #2c4a75; }
.btn-accent { background: #c8842c; border-color: #c8842c; }

/* ---------- 主体 ---------- */
.page { flex: 1; width: min(1100px, 94%); margin: 20px auto; }
.hero { text-align: center; padding: 18px 0 6px; }
.hero h1 { font-size: 30px; color: #1f3a5f; letter-spacing: 4px; }
.hero p { color: #777; margin-top: 6px; }

/* ---------- 搜索栏 ---------- */
.searchbar { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.searchbar input {
  flex: 1; max-width: 460px; padding: 9px 14px; font-size: 15px;
  border: 1px solid #ccc; border-radius: 20px; outline: none;
}
.searchbar input:focus { border-color: #1f3a5f; }
#search-count { color: #888; font-size: 13px; }

/* ---------- 首页布局：左卡片墙 + 右热搜榜 ---------- */
.layout { display: flex; gap: 22px; align-items: flex-start; }
.cards {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.card {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.card img { width: 100%; height: 130px; object-fit: cover; display: block; }
.card-body { padding: 10px 12px 14px; }
.card-body h3 { font-size: 16px; color: #1f3a5f; }
.card .region { font-size: 12px; color: #c8842c; margin: 3px 0 6px; }
.card .intro { font-size: 13px; color: #555; line-height: 1.6; }

.hot {
  width: 280px; background: #fff; border-radius: 10px;
  padding: 14px 16px; box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.hot h2 { font-size: 17px; color: #b03a2e; }
.hot .hint { font-size: 12px; color: #999; margin: 4px 0 8px; }
.hot .hint a { color: #c8842c; }
.hot ol { margin-left: 20px; }
.hot li { padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 13px; }
.hot li:last-child { border-bottom: none; }
.hot li a { color: #2b2b2b; text-decoration: none; }
.hot li a:hover { color: #b03a2e; }
.views { color: #999; font-size: 12px; margin-left: 4px; white-space: nowrap; }

/* ---------- 表单页（注册/登录/管理/详情/占位页） ---------- */
.form-card {
  background: #fff; border-radius: 10px; padding: 22px 26px;
  max-width: 520px; margin: 24px auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.form-card h2 { color: #1f3a5f; margin-bottom: 12px; }
.form-card h3 { color: #1f3a5f; margin-bottom: 8px; }
.form-card label { display: block; margin: 12px 0 4px; font-size: 14px; color: #555; }
.form-card input[type="text"],
.form-card input[type="password"],
.form-card input[type="search"] {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 6px; margin-top: 4px;
}
.btn-main {
  margin-top: 16px; padding: 9px 26px; font-size: 15px;
  background: #1f3a5f; color: #fff; border: none; border-radius: 20px; cursor: pointer;
}
.btn-main:hover { background: #2c4a75; }
.tip { font-size: 13px; color: #888; margin-top: 10px; }
.tip a { color: #c8842c; }
.msg-error { color: #b03a2e; background: #fdecea; padding: 8px 10px; border-radius: 6px; margin: 8px 0; }
.msg-ok { color: #1e7d45; background: #e8f5ee; padding: 8px 10px; border-radius: 6px; margin: 8px 0; }
.admin-list { margin-left: 20px; font-size: 14px; }
.admin-list li { padding: 4px 0; }
.placeholder ul { margin: 10px 0 10px 22px; color: #555; line-height: 1.9; }
.hot-detail .views { color: #b03a2e; font-weight: bold; margin: 8px 0; }

/* ---------- 地图页（第 8 课 / M2 新增） ---------- */
.map-layout { display: flex; gap: 22px; align-items: flex-start; }
.map-area { flex: 1; min-width: 0; }
/* 地图容器：图片和画布叠放（canvas 铺满上层接收点击、绘制路线） */
.map-wrap { position: relative; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.map-wrap img { width: 100%; height: auto; display: block; user-select: none; }
.map-wrap canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  cursor: crosshair; }
.map-badge { position: absolute; left: 10px; top: 10px; font-size: 12px;
  color: #55606c; background: rgba(255, 255, 255, .85); border: 1px solid #b9cfe2;
  border-radius: 10px; padding: 2px 10px; }
.map-note { font-size: 13px; color: #888; margin-top: 8px; line-height: 1.6; }

/* 地点简介弹窗：悬浮在地图上，位置由 JS 按点击处百分比指定。
   第 10 课修复：弹窗不再挡住它底下的地图——pointer-events:none 让点击
   "穿透"弹窗直接落到画布上（点弹窗右侧的城市照样能选中入路线），
   只有"关闭"按钮保留鼠标事件，负责手动收起弹窗。 */
.place-pop {
  position: absolute; max-width: 300px; background: #fff;
  border: 1px solid #1f3a5f; border-radius: 8px; padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18); z-index: 5;
  pointer-events: none;
}
.place-pop h3 { font-size: 16px; color: #1f3a5f; margin-bottom: 4px; }
.pop-coord { font-size: 12px; color: #c8842c; margin-bottom: 6px; }
.place-pop p { font-size: 13px; color: #555; line-height: 1.6; }
.pop-route-tip { color: #1e7d45; font-size: 12px; margin-top: 6px; }
.pop-close { position: absolute; right: 8px; top: 8px; cursor: pointer;
  pointer-events: auto; }  /* 弹窗整体穿透点击，只有关闭按钮可点（第 10 课修复） */

/* 右侧：路线清单 + 两点查询 */
.map-side { width: 300px; display: flex; flex-direction: column; gap: 16px; }
.map-box { background: #fff; border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.map-box h2 { font-size: 17px; color: #1f3a5f; margin-bottom: 10px; }
.route-list { margin-left: 18px; font-size: 13px; }
.route-list li { position: relative; padding: 6px 0 6px 2px;
  border-bottom: 1px dashed #eee; }
.route-list li:last-child { border-bottom: none; }
.route-name { color: #2b2b2b; padding-right: 20px; }
.route-coord { color: #999; font-size: 12px; }
.route-seg { color: #c8842c; font-size: 12px; margin-top: 2px; }
.route-del { position: absolute; right: 0; top: 6px; width: 18px; height: 18px;
  line-height: 16px; text-align: center; border: 1px solid #ccc; border-radius: 50%;
  background: #fff; color: #999; cursor: pointer; font-size: 12px; padding: 0; }
.route-del:hover { color: #b03a2e; border-color: #b03a2e; }
.route-total { margin: 10px 0 8px; font-size: 14px; color: #1f3a5f; }
.route-total b { color: #b03a2e; }
.btn-ghost { margin-top: 0; background: #fff; color: #b03a2e;
  border: 1px solid #b03a2e; }
.btn-ghost:hover { background: #fdecea; }

/* 两点查询表单 */
.pair-label { display: block; margin: 8px 0 4px; font-size: 14px; color: #555; }
.pair-select {
  width: 100%; padding: 8px 10px; font-size: 14px; margin-top: 4px;
  border: 1px solid #ccc; border-radius: 6px; background: #fff;
}
.pair-result {
  margin-top: 12px; font-size: 13px; color: #444; line-height: 1.7;
  background: #f6f4ef; border-radius: 6px; padding: 10px 12px;
}

/* ---------- 页脚 ---------- */
.footer {
  text-align: center; padding: 14px; font-size: 12px;
  color: #99a; background: #ece9e1;
}

/* ---------- 论坛页（第 9 课 / M3 新增） ---------- */
/* 多行文本框和图片选择框：表单页样式段的补充（论坛/日志/管理页发布攻略都用） */
.form-card textarea {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 6px; margin-top: 4px;
  resize: vertical; font-family: inherit; line-height: 1.6;
}
.form-card input[type="file"] { margin-top: 6px; font-size: 13px; color: #555; }

/* 版块标签页：全部 / 三个版块 / 完整攻略 */
.forum-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }
.forum-tabs a {
  color: #555; text-decoration: none; font-size: 14px;
  padding: 6px 16px; border: 1px solid #d8d2c4; border-radius: 16px; background: #fff;
}
.forum-tabs a:hover { border-color: #1f3a5f; color: #1f3a5f; }
.forum-tabs a.active { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }

/* 发帖表单比注册/登录页宽一点（正文和图片都占得开） */
.post-form { max-width: 720px; margin: 0 auto 22px; }

/* 帖子列表：单列卡片，新的在上 */
.post-list { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin: 0 auto; }
.post-card {
  background: #fff; border-radius: 10px; padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.post-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-head h3 { color: #1f3a5f; font-size: 16px; }
.badge {
  font-size: 12px; color: #1f3a5f; background: #e8eef7;
  border-radius: 10px; padding: 2px 10px; white-space: nowrap;
}
.badge-official { color: #8a5a00; background: #f7e8c6; border: 1px solid #e3c37a; font-weight: bold; }
.post-meta { font-size: 12px; color: #999; margin: 6px 0 8px; }
.post-content { font-size: 14px; color: #444; line-height: 1.7; white-space: pre-wrap; }
.post-img { display: block; max-width: 100%; border-radius: 8px; margin-top: 10px; }

/* ---------- 旅游日志页（第 9 课 / M3 新增）：鱼骨时间轴 ---------- */
.journal-layout { display: flex; gap: 22px; align-items: flex-start; }
/* 中轴线：一条竖线贯穿整个时间轴（有节点才画，filled 由模板按 journals 是否为空加） */
.fishbone { flex: 1; min-width: 0; position: relative; padding: 8px 0; }
.fishbone.filled::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 4px; margin-left: -2px; background: #1f3a5f; border-radius: 2px;
}
/* 节点：占一半宽度，奇数个在左、偶数个在右，左右交替分叉（鱼骨的样子） */
.bone-item { position: relative; width: 50%; padding: 0 30px 24px 0; }
.bone-item:nth-child(even) { margin-left: 50%; padding: 0 0 24px 30px; }
/* 中轴上的圆点：左右两侧各从卡片边上"长"到主线上 */
.bone-item::after {
  content: ""; position: absolute; top: 16px; width: 14px; height: 14px;
  background: #c8842c; border: 3px solid #f6f4ef; border-radius: 50%; z-index: 1;
}
.bone-item:nth-child(odd)::after { right: -10px; }
.bone-item:nth-child(even)::after { left: -10px; }

.bone-card {
  background: #fff; border-radius: 10px; padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
.bone-date {
  display: inline-block; font-size: 12px; color: #fff;
  background: #c8842c; border-radius: 10px; padding: 1px 10px;
}
.bone-card h3 { font-size: 15px; color: #1f3a5f; margin: 4px 0 6px; }
.bone-card p { font-size: 13px; color: #555; line-height: 1.6; white-space: pre-wrap; }
.bone-card img { display: block; max-width: 100%; border-radius: 8px; margin-top: 8px; }

/* 右侧：添加节点 + 我的日志 */
.journal-side { width: 320px; display: flex; flex-direction: column; gap: 16px; }
.journal-side .form-card { margin: 0; max-width: none; }
.journal-list { margin-left: 18px; font-size: 13px; }
.journal-list li { padding: 4px 0; }
.journal-list a { color: #2b2b2b; text-decoration: none; }
.journal-list a:hover { color: #b03a2e; }

/* ---------- 第 10 课打磨：空列表提示（论坛/日志还没有内容时给一句引导） ---------- */
.empty-tip {
  color: #999; font-size: 14px; text-align: center;
  background: #fff; border: 1px dashed #d8d2c4; border-radius: 10px;
  padding: 28px 16px;
}
