/* app.css - 主 app 框架(4 tab + 导航) - QQ 范式:头尾 fixed + 中间 margin 滚动 */
.app-shell {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
}

/* 顶部导航:position: fixed 靠上,iOS Safari 100% 可靠 */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  max-width: 720px; margin: 0 auto;
  height: calc(var(--h-header) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; align-items: center; justify-content: space-between;
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}
.app-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.app-header-left, .app-header-right { display: flex; align-items: center; gap: var(--sp-1); min-width: 80px; }
.app-header-right { justify-content: flex-end; }

/* 内容区:中间滚动,padding-top 让出 header,padding-bottom 让出 tabbar */
.app-main {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  position: relative;
  z-index: 1;
  /* 头尾独立:中间用 padding 让位给 fixed 头尾 */
  padding-top: calc(var(--h-header) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--h-tabbar) + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
.tab-pane { display: none; min-height: 100%; }
.tab-pane.active { display: block; animation: fadeIn var(--t-base) var(--ease); }
#tab-contacts { position: relative; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 底部 tabbar:position: fixed 靠下 */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 720px; margin: 0 auto;
  height: calc(var(--h-tabbar) + env(safe-area-inset-bottom, 0px));
  display: flex; background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(var(--glass-saturate));
  border-top: 1px solid var(--glass-border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}
/* tab:扁平化，移除顶部装饰条，靠颜色差区分 active */
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: var(--fs-xs);
  transition: color var(--t-fast) var(--ease);
  position: relative;
}
.tab-item-icon { font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.tab-item-icon img { transition: all var(--t-fast) var(--ease); }
/* active:文字变品牌色 + icon 加深不透明 + 轻微 scale */
.tab-item.active { color: var(--brand-500); }
.tab-item.active .tab-item-icon img { opacity: 1 !important; transform: scale(1.05); }
.tab-item-badge { position: absolute; top: 4px; right: calc(50% - 16px); }

/* ★ v4.1-fix7dao-v12: 底栏 tab 内的 badge 从"消息下方"改为"图标右上角" */
/* 原因: .tab-item flex-direction:column 会让 badge 被推成第三行(消息下方),破晓反馈"应该在右上角" */
.tab-item > .badge {
  position: absolute;
  /* 位于图标右上角: tab-item 宽 ~104px,图标在 41-62(22x22),想贴到 icon top-right(62, 772) */
  top: 4px;
  /* 在 50% 中心点基础上, 往右 8-10px 让 badge 中心大致在 icon 的右边缘 */
  left: 50%;
  margin-left: 6px;
  min-width: 16px; height: 16px;
  font-size: 10px; padding: 0 4px;
  z-index: 2;
}
/* dot 模式:不显示数字,只显示红点 */
.tab-item > .badge.badge-dot {
  width: 8px; height: 8px; min-width: 8px;
  top: 6px;
}
/* 隐藏状态 - 保留布局避免跳动 */
.tab-item > .badge.hidden { display: none; }

/* 空状态 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-12) var(--sp-6); text-align: center;
}
.empty-state-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gray-100); color: var(--text-4);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: var(--sp-4);
}
.empty-state-title { font-size: var(--fs-md); color: var(--text-2); margin-bottom: var(--sp-1); }
.empty-state-desc { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--sp-4); }
