/* ============================================================
   base.css — 设计 Token、重置、应用骨架
   城资云 移动端 H5
   ============================================================ */

/* ---------- 设计 Token ---------- */
:root {
  /* 品牌色 */
  --primary: #1a5f7a;
  --primary-deep: #13475c;
  --primary-light: #2e86ab;
  --primary-bg: #e8f1f5;
  --accent: #e6a23c;
  --accent-bg: #fdf3e3;

  /* 文字 */
  --text-main: #1f2d3d;
  --text-sub: #5e6b7c;
  --text-muted: #8492a6;
  --text-faint: #9aa7b8;

  /* 背景 / 边框 */
  --bg-page: #f4f6f8;
  --bg-card: #ffffff;
  --border: #edf0f3;

  /* 圆角 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* 间距 */
  --gap: 12px;
  --gap-lg: 16px;
  --pad: 16px;

  /* 尺寸 */
  --navbar-h: 48px;
  --tabbar-h: 56px;

  /* 阴影 */
  --shadow: 0 2px 10px rgba(26, 95, 122, 0.07);
  --shadow-soft: 0 1px 6px rgba(26, 95, 122, 0.05);

  /* 安全区 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 重置 ---------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: #d8dee4;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
img { display: block; max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- 应用骨架 ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-page);
  position: relative;
  overflow: hidden;
}

/* 桌面端：手机外壳，居中限宽 */
@media (min-width: 560px) {
  body { background: #cfd6dd; display: flex; align-items: center; justify-content: center; }
  .app {
    width: 420px;
    max-height: 880px;
    height: 92vh;
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    border: 8px solid #1c242c;
  }
}

/* ---------- 顶部导航栏 ---------- */
.navbar {
  flex-shrink: 0;
  height: calc(var(--navbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 20;
}

.nav-back {
  width: 44px;
  height: var(--navbar-h);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-back.show { display: flex; }
.nav-back:active { opacity: 0.6; }

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 有返回按钮时标题仍居中：左右占位平衡 */
.nav-back.show ~ .nav-right { width: 44px; }

.nav-right {
  min-width: 44px;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

/* ---------- 页面容器 ---------- */
.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-page);
  position: relative;
}

/* 页面根节点 */
.page {
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  animation: pageIn 0.22s ease;
}

/* 全屏页面（地图等）不需要底部 padding */
.page.fullscreen { padding-bottom: 0; height: 100%; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 底部 TabBar ---------- */
.tabbar {
  flex-shrink: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
}

.tab-ico {
  width: 23px;
  height: 23px;
}

.tab-label {
  font-size: 11px;
  line-height: 1;
}

.tab-item.active {
  color: var(--primary);
}

.tabbar.hidden { display: none; }

/* ---------- 通用工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.muted { color: var(--text-muted); }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ellipsis-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* 隐藏滚动条 */
.view::-webkit-scrollbar { width: 0; height: 0; }
