/* base.css —— 全局基础：重置、配色变量、手机壳容器、页面框架、顶栏、底栏、按钮、表单、移动端适配补丁 */

/* ====================== 全局重置 ====================== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #dde2e8; /* 桌面端壳外背景 */
  color: var(--text-title);
}
body {
  display: flex; align-items: center; justify-content: center;
}
button, input, textarea { font-family: inherit; outline: none; border: none; background: none; }

/* ====================== 配色变量 ====================== */
:root {
  --primary: #4fc3f7;        /* 冰蓝主色调 */
  --primary-light: #81d4fa;
  --accent: #29b6f6;         /* 链接/次级强调（与主色同一蓝色系） */
  --alert: #f06292;          /* 点赞/未读/退出提示色 */
  --ink-on-primary: #16435c; /* 铺在主色块上的深色文字 */
  --bg-page: #f0f2f5;        /* 页面浅灰底色 */
  --bg-card: #ffffff;        /* 卡片纯白 */
  --text-title: #212529;     /* 标题深色加粗 */
  --text-body: #6c757d;      /* 正文常规灰色 */
  --text-tip: #adb5bd;       /* 辅助提示浅灰 */
  --border-light: #ebedf0;
  --line: #e7eaee;           /* 细线分割色，用于档案感的虚线/分割 */
  --stamp: #e2a23f;          /* 琥珀标记色，用于统计条/徽标点缀 */
  --shadow: 0 2px 8px rgba(26,58,110,0.08);
  --font-display: 'Noto Serif SC', 'Songti SC', 'PingFang SC', serif;
}

/* ====================== 容器：模拟手机屏幕（桌面端居中显示手机壳，移动端全屏） ====================== */
#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  max-height: 900px;
  position: relative;
  overflow: hidden;
  background: var(--bg-page);
  box-shadow: 0 0 40px rgba(0,0,0,0.18);
}
@media (min-width: 481px) {
  #app { border-radius: 24px; }
}
@media (max-width: 480px) {
  body { background: var(--bg-page); }
  #app { max-height: none; box-shadow: none; border-radius: 0; }
}

/* ====================== 页面模块：绝对定位铺满手机壳，自身不滚动，内部page-content滚动 ====================== */
.page {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}
.page.active { display: block; }

/* ====================== 顶部导航栏（公共组件） ====================== */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 50px;
  background: var(--primary);
  color: var(--ink-on-primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.topbar-left, .topbar-right {
  width: 60px; display: flex; align-items: center;
  font-size: 14px;
}
.topbar-right { justify-content: flex-end; }
.topbar-center {
  flex: 1; text-align: center; font-size: 17px; font-weight: 700;
  font-family: var(--font-display); letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.topbar-btn {
  color: var(--ink-on-primary); font-size: 14px; padding: 6px 8px; cursor: pointer;
  border-radius: 4px; transition: background .15s;
}
.topbar-btn:active { background: rgba(255,255,255,0.3); }

/* 关注 / 消息 / 我的 这三个页面不要顶部导航条，内容直接从最上面开始 */
#page-follow .page-content,
#page-message .page-content,
#page-profile .page-content {
  top: 0;
}
/* 关注页 / 消息页：去掉 .page-content 默认的 12px 顶部内边距。吸顶的标签栏是贴在滚动区「内边距下沿」的，
   留着内边距的话，标签栏上方会露出一条缝，滚动的内容会从缝里透出来 */
#page-follow .page-content,
#page-message .page-content {
  padding-top: 0;
}
/* 标签栏自己吃掉刘海 / 状态栏的安全区（背景色连成一片，不留缝；没有刘海的设备这里是 0） */
.follow-tabs, .msg-tabs {
  padding-top: env(safe-area-inset-top, 0px);
}
/* 个人中心页额外去掉顶部内边距，让自定义封面图能顶满到屏幕最上沿，不留白条 */
#page-profile .page-content {
  padding-top: 0;
}

/* 悬浮设置齿轮（个人中心页专用）：贴在屏幕右上角，浮在封面图上方，不占布局空间 */
.profile-settings-btn-float {
  position: absolute; top: 14px; right: 14px; z-index: 60;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,0.32); color: #fff; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(2px);
}
.profile-settings-btn-float:active { background: rgba(0,0,0,0.5); }

/* 悬浮返回按钮（个人中心页专用）：贴在屏幕左上角，跟设置齿轮对称 */
.profile-back-btn-float {
  position: absolute; top: 14px; left: 14px; z-index: 60;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,0.32); color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(2px);
}
.profile-back-btn-float:active { background: rgba(0,0,0,0.5); }

/* 首页搜索框 */
.topbar-search {
  flex: 1; height: 34px; background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 17px; display: flex; align-items: center;
  padding: 0 14px; color: rgba(255,255,255,0.92); font-size: 13px;
  gap: 6px; letter-spacing: .2px; cursor: pointer;
}

/* 搜索页 */
.search-topbar { gap: 8px; padding: 0 10px; }
.search-topbar .topbar-left { width: auto; flex-shrink: 0; }
.search-input-wrap {
  flex: 1; height: 34px; background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 17px; display: flex; align-items: center;
  padding: 0 12px; gap: 6px;
}
.search-input-wrap .search-input-icon { font-size: 13px; color: var(--text-tip); }
.search-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 14px; color: var(--text-title); min-width: 0;
}
.search-input::placeholder { color: var(--text-tip); }
.search-submit-btn {
  flex-shrink: 0; color: var(--primary); font-size: 14px; font-weight: 700;
  padding: 6px 4px; cursor: pointer; user-select: none;
}
.search-submit-btn:active { opacity: .6; }
.search-section-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 12px 10px; font-size: 13px; color: var(--text-tip); font-weight: 600;
}
.search-clear-recent { font-size: 12px; color: var(--text-tip); cursor: pointer; }
.search-clear-recent:active { opacity: .6; }
.search-recent-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.search-recent-chip {
  padding: 6px 14px; border-radius: 16px; background: var(--bg-page);
  font-size: 13px; color: var(--text-body); cursor: pointer; user-select: none;
}
.search-recent-chip:active { opacity: .6; }


/* ====================== 页面内容区（绝对定位，自动避开顶部/底部栏，内部独立滚动） ====================== */
.page-content {
  position: absolute;
  top: 50px; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
  scrollbar-width: none; /* Firefox：隐藏滚动条但保留滚动能力 */
}
.page-content::-webkit-scrollbar { display: none; } /* Chrome/Safari/Edge：隐藏滚动条 */
.page-content.with-tabbar { bottom: 58px; }

/* ====================== 底部Tab导航栏（仅首页展示） ====================== */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 58px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  display: flex;
  z-index: 100;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-tip);
  transition: color .15s;
}
.tab-item .tab-icon { font-size: 26px; line-height: 1; margin-bottom: 3px; }
.tab-item.active { color: var(--accent); font-weight: 700; }

/* 中间发布按钮：蓝色圆形凸起，白色加号放大 */
.tab-item-post {
  position: relative;
}
.tab-post-btn {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 32px;
  font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(79,195,247,0.5);
  line-height: 1;
}
.tab-item-post:active .tab-post-btn { transform: translateX(-50%) scale(0.92); }

/* ====================== 通用按钮 ====================== */
.btn-primary {
  width: 100%; height: 44px; background: var(--primary); color: var(--ink-on-primary);
  border-radius: 8px; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity .15s;
}
.btn-primary:active { opacity: .8; }
.btn-secondary {
  height: 36px; background: #f0f4f7; color: var(--ink-on-primary);
  border-radius: 8px; font-size: 13px; font-weight: 600;
  transition: opacity .15s;
}
.btn-secondary:active { opacity: .7; }
.btn-link {
  text-align: center; color: var(--accent);
  font-size: 14px; padding: 14px 0; cursor: pointer;
}

/* ====================== 表单输入框 ====================== */
.form-group { margin-bottom: 14px; }
.form-label {
  font-size: 13px; color: var(--text-body); margin-bottom: 6px; display: block;
}
.form-input {
  width: 100%; height: 44px; background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 0 14px; font-size: 15px; color: var(--text-title);
}
.form-input:focus { border-color: var(--primary-light); }
.post-board-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.post-board-chip {
  padding: 6px 14px; border-radius: 16px; font-size: 13px;
  background: var(--bg-page); color: var(--text-body);
  border: 1px solid var(--border-light);
  cursor: pointer; user-select: none; transition: all .15s;
}
.post-board-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700;
}

/* [改动] 移动端适配补丁 ------------------------------------------------ */
/* iOS Safari 输入框字体小于 16px 会在聚焦时自动放大页面，造成"缩放错乱" */
@media (max-width: 480px) {
  input, textarea, .form-input, .chat-input, .search-input, .post-textarea { font-size: 16px !important; }
}
/* 底部导航避开 iPhone 底部横条（viewport-fit=cover 时需要） */
.tabbar { height: calc(58px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
.page-content.with-tabbar { bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

/* [新增] 底部导航「消息」红色未读角标 */
.tab-item { position: relative; }
.tab-item .tab-icon { position: relative; display: inline-block; }
/* 消息 tab 图标右上角的未读红点（只是一个点，不带数字） */
.tab-dot {
  position: absolute; top: -2px; right: -6px;
  width: 9px; height: 9px; border-radius: 50%; background: #f44336;
  border: 1.5px solid #fff; box-sizing: content-box;
  display: none; pointer-events: none;
}
.tab-dot.show { display: block; }

/* [新增] ICP 备案号公共底部 ------------------------------------------ */
/* body 改为纵向排布：#app 占满剩余高度，备案条固定在最底部，不遮挡任何页面 */
body { flex-direction: column; }
body > #app { flex: 1 1 auto; height: auto; min-height: 0; }
.site-footer {
  flex-shrink: 0;
  width: 100%; max-width: 480px;
  text-align: center;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  font-size: 11px; line-height: 1.5;
  color: var(--text-tip);
  background: transparent;
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:active { opacity: .6; }
/* 安全区改由备案条承担，避免与底部 Tab 栏重复留白 */
.tabbar { height: 58px; padding-bottom: 0; }
.page-content.with-tabbar { bottom: 58px; }
