/* ==========================================================
   skins/mobile-common.css — 手机骨架的共用件（js/skins/mobile-nav.js 写 <html data-mnav / data-composer / data-mfab / data-mtab>）
   导航区：top = 搜索栏下的 Tab 条；bottom = 底部 Tab 栏（含 safe-area）；none = 没有（经典）
   只在 < 900px 生效；PC 四套共用三栏，这里的规则一条都不碰
   ========================================================== */
:root { --mnav-h: 56px; }
.m-nav, .m-page, .send-label, .ci-pre { display: none; }

@media (width < 900px) {
  /* —— 导航条 —— */
  html[data-mnav="bottom"] .m-nav, html[data-mnav="top"] .m-nav { display: flex; }
  .m-nav { align-items: stretch; background: var(--bg); }
  html[data-mnav="bottom"] .m-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: calc(var(--mnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
  }
  html[data-mnav="top"] .m-nav { height: 44px; border-bottom: 1px solid var(--border); }
  .m-tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); }
  html[data-mnav="top"] .m-tab { flex-direction: row; gap: 6px; border-bottom: 2px solid transparent; }
  .m-tab.active { color: var(--accent); }
  html[data-mnav="top"] .m-tab.active { border-bottom-color: var(--accent); }
  .m-ic { position: relative; display: inline-flex; }
  .m-ic .ti { font-size: 24px; }
  .m-lb { max-width: 100%; font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-badge {
    position: absolute; top: -4px; left: calc(100% - 8px);
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--badge-bg); color: var(--badge-fg);
    font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
  }
  .m-badge[hidden] { display: none; }
  /* 进了对话 / 设置 / 资料 / 新建：导航让位（这些页自己有返回） */
  .app:is(.chat-open, .settings-open) .m-nav,
  #sidebar:has(#profilePanel:not([hidden]), #newPanel:not([hidden])) .m-nav { display: none; }

  /* —— 底栏给内容留位 —— */
  html[data-mnav="bottom"] .side-scroll { padding-bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom)); }
  html[data-mnav="bottom"] :is(#mPage, #contactsPanel.m-tabbed) { padding-bottom: calc(var(--mnav-h) + env(safe-area-inset-bottom)); }
  html[data-mnav="bottom"][data-mfab="corner"] .fab { bottom: calc(var(--mnav-h) + 16px + env(safe-area-inset-bottom)); }
  /* 联系人当 Tab 用时：不显示返回（返回 = 切别的 Tab） */
  #contactsPanel.m-tabbed [data-close-panel] { visibility: hidden; width: 8px; }

  /* —— Tab 页 —— */
  .m-page:not([hidden]) { display: flex; }
  .m-page .side-head { padding-left: 12px; }
  .m-page .m-page-back:not([hidden]) + .panel-title { margin-left: -6px; }
  .m-page-body { flex: 1; min-height: 0; overflow-y: auto; }
  .m-note { padding: 8px 16px; }
  .m-group { margin: 8px 0; background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .m-entry { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 16px; text-align: left; }
  .m-entry + .m-entry { border-top: 1px solid var(--border); }
  .m-entry > .ti:first-child { font-size: 22px; color: var(--accent); }
  .m-entry > span { flex: 1; min-width: 0; }
  .m-count { flex: 0 0 auto !important; color: var(--text-2); }
  .m-chev { color: var(--text-3); }
  .m-me { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; text-align: left; }
  .m-me .m-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .m-me .m-name { font-size: 17px; font-weight: 600; }
  .m-file-ic { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }

  /* 搜索常驻：Tab 页从搜索栏下面开始，自己的标题栏不要 */
  html[data-msearch="pinned"] #mPage { top: calc(var(--head-h) + env(safe-area-inset-top)); }
  html[data-msearch="pinned"] #mPage > .side-head:has(.m-page-back[hidden]) { display: none; }

  /* —— 新建按钮放到顶栏右上角（简约 / 明快：没有悬浮钮） —— */
  html[data-mfab="head"] .fab {
    top: calc(env(safe-area-inset-top) + 8px); bottom: auto; right: 6px;
    width: 40px; height: 40px; background: none; color: var(--text); box-shadow: none;
  }
  html[data-mfab="head"] .fab .ti::before { content: "\ea69"; }   /* ti-circle-plus */
  html[data-mfab="head"] .sidebar > .side-head { padding-right: 52px; }

  /* —— 输入栏三种排列（classic = 原样） —— */
  /* attach-right：附件钮挪到输入框外右侧，后面是圆形麦克风 / 发送 */
  html[data-composer="attach-right"] #attachBtn { order: 1; width: 40px; background: none; }
  html[data-composer="attach-right"] .composer > .send-btn { order: 2; }
  /* voice-left：左语音圆钮 + 输入框 + 表情 + 加号；有字时加号换成绿色「发送」文字钮 */
  html[data-composer="voice-left"] #sendBtn { width: auto; min-width: 56px; height: 36px; padding: 0 12px; border-radius: 4px; background: var(--send-bg); color: var(--send-fg); }
  html[data-composer="voice-left"] #sendBtn .ti { display: none; }
  html[data-composer="voice-left"] #sendBtn .send-label { display: inline; font-size: 15px; font-weight: 600; white-space: nowrap; }
  /* plus-left：左加号 + 输入框（含表情）+ 右绿色实心圆发送 / 麦克风 */
  html[data-composer="plus-left"] .composer > .send-btn { width: 40px; height: 40px; background: var(--accent); color: var(--on-accent); }
}
