/* ===== 智能校徽 H5 - 公共样式库 v3 ===== */
/* 现代设计系统 · 蓝色主题 · 克制 · 精致 */

/* ── 设计 Token ── */
:root {
  /* 主色 — 明亮蓝色 */
  --c-primary: #165DFF;
  --c-primary-soft: #E8F3FF;
  --c-primary-muted: #F0F7FF;

  /* 中性色 */
  --c-bg: #F7F8FA;
  --c-surface: #FFFFFF;
  --c-surface-raised: #FAFBFC;
  --c-border: #EBEEF2;
  --c-border-subtle: #F2F4F7;

  /* 文字色阶 */
  --c-text-1: #1D2129;
  --c-text-2: #4E5969;
  --c-text-3: #86909C;
  --c-text-4: #C9CDD4;

  /* 语义色 */
  --c-success: #00B42A;
  --c-warning: #FF7D00;
  --c-danger: #F53F3F;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  /* 间距 — 4pt基数 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* 字号 — 固定5级 */
  --f-xs: 0.75rem;
  --f-sm: 0.8125rem;
  --f-base: 0.9375rem;
  --f-lg: 1.125rem;
  --f-xl: 1.375rem;
  --f-2xl: 1.75rem;
}

/* ── 重置 ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ── 页面容器 ── */
.page-container {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.content-padded {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 16px) + 16px);
}

/* ── 安全区 ── */
.safe-top {
  height: max(env(safe-area-inset-top), 12px);
  width: 100%;
  flex-shrink: 0;
}

/* ── TabBar — 极简线条风格 ── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-top: 1px solid var(--c-border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 6px;
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  cursor: pointer;
  text-decoration: none;
  padding: 4px 0;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity 0.15s ease;
}

.tab-item:active { opacity: 0.6; }

.tab-icon-wrap {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.tab-icon-wrap.active {
  transform: scale(1.05);
}

.tab-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--c-text-4);
  letter-spacing: 0.02em;
  transition: color 0.2s, font-weight 0.2s;
}

.tab-label.active {
  color: var(--c-primary);
  font-weight: 700;
}

/* ── ICP 备案号 ── */
.icp-footer {
  text-align: center;
  padding: 12px 0 calc(56px + env(safe-area-inset-bottom, 0px) + 12px);
  font-size: 11px;
  color: var(--c-text-4);
  letter-spacing: 0.02em;
}

/* ── Toast ── */
#globalToast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  background: rgba(29,33,41,0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--r-md);
  font-size: var(--f-sm);
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

#globalToast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ── 卡片 ── */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border-subtle);
}

/* ── 按钮 ── */
.btn-primary {
  width: 100%;
  height: 50px;
  background: var(--c-primary);
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  font-size: var(--f-base);
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary:active {
  opacity: 0.85;
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  flex: 1;
  height: 50px;
  background: var(--c-primary-muted);
  border: none;
  border-radius: var(--r-md);
  color: var(--c-primary);
  font-size: var(--f-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:active {
  background: var(--c-primary-soft);
}

/* ── 表单 ── */
.form-input {
  border: none;
  outline: none;
  font-size: var(--f-sm);
  color: var(--c-text-1);
  text-align: right;
  width: 100%;
  background: transparent;
  font-family: inherit;
}

.form-input::placeholder {
  color: var(--c-text-4);
}

/* ── 头像 ── */
.avatar {
  border-radius: 50%;
  background: var(--c-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--c-primary);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.avatar-md { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ── 导航栏 ── */
.navbar {
  display: flex;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-bg);
}

.navbar-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}

.navbar-back:active { background: rgba(0,0,0,0.05); }

.navbar-title {
  flex: 1;
  font-size: var(--f-lg);
  font-weight: 800;
  color: var(--c-text-1);
  text-align: center;
  letter-spacing: -0.01em;
}


/* ── 底部渐变遮罩 ── */
.bottom-fade {
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--c-bg));
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  pointer-events: none;
  z-index: 99;
}
