/* ===========================================================
   潮州市研学管理服务平台 — Vercel Design System
   Mobile-first mini-program shell
   =========================================================== */

:root {
  /* Vercel Geist palette */
  --background: #ffffff;
  --background-100: #fafafa;
  --background-200: #ededed;
  --foreground: #0a0a0a;
  --foreground-900: #171717;
  --foreground-700: #404040;
  --foreground-500: #737373;
  --foreground-400: #a3a3a3;
  --foreground-300: #d4d4d4;
  --border: #ededed;
  --border-strong: #eaeaea;

  /* Brand — ChaoZhou Red (潮州朱砂) */
  --accent: #c8102e;
  --accent-soft: #fef2f3;
  --accent-foreground: #ffffff;
  --accent-hover: #a30d26;

  /* Status */
  --success: #0070f3;
  --success-bg: #f0f6ff;
  --warning: #f5a623;
  --warning-bg: #fff8ec;
  --danger: #e00;
  --danger-bg: #ffecec;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Shadows — subtle, Vercel-like */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.08);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--foreground-900);
  background: var(--background-200);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- App Shell (phone frame) ---------- */
.app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--background);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

.page {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Top nav ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  gap: 12px;
}
.navbar .title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.navbar .nav-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  border: none; background: var(--background-100);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--foreground-700);
}
.icon-btn:active { background: var(--background-200); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Tabs / segments ---------- */
.segment {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--background-100);
  border-radius: var(--r-full);
  margin: 0 16px 16px;
}
.segment button {
  flex: 1;
  border: none; background: transparent;
  padding: 8px 12px;
  border-radius: var(--r-full);
  font-size: 13px; font-weight: 600;
  color: var(--foreground-500);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.segment button.active {
  background: var(--foreground-900);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------- Cards ---------- */
.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-pad { padding: 16px; }
.section { padding: 0 16px; margin-bottom: 20px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .more { font-size: 12px; color: var(--foreground-500); text-decoration: none; display: flex; align-items: center; gap: 2px; }

/* ---------- Home hero ---------- */
.hero {
  margin: 0 16px 18px;
  border-radius: var(--r-xl);
  padding: 22px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,.18), transparent 50%),
    linear-gradient(135deg, #c8102e 0%, #8a0a1f 100%);
  box-shadow: 0 8px 24px rgba(200,16,46,.28);
}
.hero::after {
  content: ""; position: absolute; right: -30px; bottom: -40px;
  width: 160px; height: 160px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path fill='%23ffffff' fill-opacity='0.08' d='M50 5 L62 38 L97 38 L68 58 L79 92 L50 72 L21 92 L32 58 L3 38 L38 38 Z'/></svg>") no-repeat center/contain;
}
.hero .badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  background: rgba(255,255,255,.18);
  border-radius: var(--r-full);
  backdrop-filter: blur(4px);
}
.hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; line-height: 1.25; }
.hero p { font-size: 13px; opacity: .9; margin-top: 6px; }
.hero .hero-search {
  margin-top: 16px;
  background: rgba(255,255,255,.96);
  border-radius: var(--r-full);
  display: flex; align-items: center;
  padding: 0 14px;
  height: 40px;
}
.hero .hero-search svg { width: 16px; height: 16px; color: var(--foreground-400); }
.hero .hero-search input {
  border: none; background: transparent; outline: none;
  flex: 1; margin-left: 8px; font-size: 13px; color: var(--foreground-700);
}

/* ---------- Quick actions grid ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  padding: 0 16px;
  margin-bottom: 22px;
}
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.quick-ico {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.quick-ico svg { width: 22px; height: 22px; }
.quick-ico.alt { background: var(--success-bg); color: var(--success); }
.quick-ico.amber { background: var(--warning-bg); color: var(--warning); }
.quick-ico.dark { background: #f3f4f6; color: var(--foreground-700); }
.quick-item span { font-size: 11px; color: var(--foreground-700); font-weight: 500; }

/* ---------- Banner carousel ---------- */
.banner {
  margin: 0 16px 22px;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  height: 110px;
}
.banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner .banner-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 16px 14px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.45), transparent);
}
.banner .banner-cap h4 { font-size: 15px; font-weight: 700; }
.banner .banner-cap p { font-size: 11px; opacity: .95; }
.banner .dots { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 4px; }
.banner .dots i { width: 5px; height: 5px; background: rgba(255,255,255,.5); border-radius: 50%; }
.banner .dots i.on { background: #fff; width: 14px; border-radius: 3px; }

/* ---------- Course / route cards ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.media-card { background: var(--background); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; transition: transform .15s; }
.media-card:active { transform: scale(.99); }
.media-card .thumb { width: 100%; height: 160px; object-fit: cover; display: block; background: var(--background-200); }
.media-card .body { padding: 12px 14px 14px; }
.media-card h4 { font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.media-card .desc { font-size: 12px; color: var(--foreground-500); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--r-sm);
  background: var(--background-100); color: var(--foreground-700);
}
.tag.brand { background: var(--accent-soft); color: var(--accent); }
.tag.blue { background: var(--success-bg); color: var(--success); }
.tag.amber { background: var(--warning-bg); color: var(--warning); }
.price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 10px; }
.price { font-size: 18px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.price small { font-size: 11px; font-weight: 600; }
.meta-row { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--foreground-500); }
.meta-row svg { width: 12px; height: 12px; }

/* ---------- Horizontal scroll cards ---------- */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 140px; scroll-snap-align: start; }
.base-card { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--background); cursor: pointer; }
.base-card img { width: 100%; height: 90px; object-fit: cover; }
.base-card .info { padding: 8px 10px 10px; }
.base-card h5 { font-size: 13px; font-weight: 600; }
.base-card .lvl { font-size: 10px; color: var(--accent); margin-top: 3px; font-weight: 600; }

/* ---------- News list ---------- */
.news-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.news-item:last-child { border-bottom: none; }
.news-item img { width: 92px; height: 68px; border-radius: var(--r-md); object-fit: cover; flex-shrink: 0; background: var(--background-200); }
.news-item .news-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.news-item h5 { font-size: 14px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-item .news-meta { font-size: 11px; color: var(--foreground-400); display: flex; gap: 10px; }

/* ---------- Mine (profile) ---------- */
.profile-hero {
  background: linear-gradient(160deg, #c8102e 0%, #8a0a1f 100%);
  color: #fff; padding: 24px 16px 20px;
  border-bottom-left-radius: var(--r-xl);
  border-bottom-right-radius: var(--r-xl);
}
.profile-top { display: flex; align-items: center; gap: 14px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.2); display:flex; align-items:center; justify-content:center; border: 2px solid rgba(255,255,255,.4); flex-shrink:0; overflow:hidden; }
.avatar svg { width: 30px; height: 30px; color: rgba(255,255,255,.8); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-top .name { font-size: 18px; font-weight: 700; }
.profile-top .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.profile-top .login-btn { background: rgba(255,255,255,.95); color: var(--accent); border: none; padding: 8px 18px; border-radius: var(--r-full); font-size: 13px; font-weight: 700; cursor: pointer; }

.stats-row { display: flex; gap: 10px; margin-top: 18px; }
.stat-pill { flex: 1; background: rgba(255,255,255,.15); border-radius: var(--r-md); padding: 10px; text-align: center; backdrop-filter: blur(4px); }
.stat-pill .n { font-size: 18px; font-weight: 800; }
.stat-pill .l { font-size: 11px; opacity: .9; }

.menu-group { margin: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--background); }
.menu-item { display: flex; align-items: center; padding: 14px 16px; gap: 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--background-100); }
.menu-item .mi-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-item .mi-ico svg { width: 16px; height: 16px; }
.menu-item .mi-label { flex: 1; font-size: 14px; font-weight: 500; }
.menu-item .mi-val { font-size: 12px; color: var(--foreground-400); }
.menu-item .chev { color: var(--foreground-300); }
.menu-item .chev svg { width: 16px; height: 16px; }
.menu-group h6 { padding: 14px 16px 6px; font-size: 12px; color: var(--foreground-500); font-weight: 600; }

/* ---------- Workflow (school/govt) ---------- */
.flow-page { padding: 0 16px; }
.flow-intro { text-align: center; padding: 20px 0 24px; }
.flow-intro .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: var(--r-full); }
.flow-intro h2 { font-size: 20px; font-weight: 800; margin-top: 10px; letter-spacing: -0.02em; }
.flow-intro p { font-size: 13px; color: var(--foreground-500); margin-top: 6px; }

.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--border-strong); }
.tl-step { position: relative; padding-bottom: 22px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step .dot { position: absolute; left: -32px; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--background); border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--foreground-400); z-index: 1; }
.tl-step.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl-step.active .dot { background: #fff; border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-step .tl-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-step .tl-desc { font-size: 12px; color: var(--foreground-500); margin-top: 4px; line-height: 1.6; }
.status-chip { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-sm); }
.status-chip.done { background: #e6f9ee; color: #0a7c3e; }
.status-chip.active { background: var(--warning-bg); color: var(--warning); }
.status-chip.wait { background: var(--background-100); color: var(--foreground-400); }

.govt-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; background: var(--background); }
.govt-card .gh { display: flex; justify-content: space-between; align-items: start; }
.govt-card .gt { font-size: 14px; font-weight: 700; }
.govt-card .gd { font-size: 12px; color: var(--foreground-500); margin-top: 4px; }
.govt-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--background);
  color: var(--foreground-900);
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--foreground-900); color: #fff; border-color: var(--foreground-900); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:active { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--foreground-700); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Detail page ---------- */
.detail-hero { position: relative; }
.detail-hero img { width: 100%; height: 260px; object-fit: cover; display: block; }
.detail-hero .back { position: absolute; top: 14px; left: 14px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.detail-hero .back svg { width: 18px; height: 18px; }
.detail-body { background: var(--background); border-radius: var(--r-xl) var(--r-xl) 0 0; margin-top: -20px; position: relative; padding: 20px 16px 100px; z-index: 1; }
.detail-body h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.detail-meta { display: flex; gap: 14px; font-size: 12px; color: var(--foreground-500); margin-top: 10px; }
.detail-meta span { display: inline-flex; align-items: center; gap: 4px; }
.detail-meta svg { width: 13px; height: 13px; }
.detail-section { margin-top: 24px; }
.detail-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.detail-section h3::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; }
.detail-section p { font-size: 14px; color: var(--foreground-700); line-height: 1.7; }
.detail-section .itinerary { display: flex; flex-direction: column; gap: 12px; }
.detail-section .iti-item { display: flex; gap: 12px; }
.detail-section .iti-item .day { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 4px 8px; border-radius: var(--r-sm); height: fit-content; flex-shrink: 0; }

.buy-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; background: var(--background); border-top: 1px solid var(--border); padding: 10px 16px calc(10px + var(--safe-bottom)); display: flex; align-items: center; gap: 12px; z-index: 50; }
.buy-bar .bb-ico { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--foreground-500); cursor: pointer; }
.buy-bar .bb-ico svg { width: 20px; height: 20px; }
.buy-bar .bb-price { flex: 1; }
.buy-bar .bb-price .bp { font-size: 18px; font-weight: 800; color: var(--accent); }
.buy-bar .bb-price .bp small { font-size: 11px; }
.buy-bar .bb-price .bl { font-size: 11px; color: var(--foreground-400); text-decoration: line-through; }

/* ---------- Filter chips ---------- */
.filter-bar { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; }
.filter-bar::-webkit-scrollbar { display: none; }
.chip { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: var(--r-full); background: var(--background-100); color: var(--foreground-700); white-space: nowrap; cursor: pointer; border: 1px solid transparent; }
.chip.active { background: var(--foreground-900); color: #fff; }

/* ---------- Empty / search ---------- */
.search-bar { margin: 0 16px 14px; display: flex; align-items: center; gap: 8px; background: var(--background-100); border-radius: var(--r-md); padding: 9px 12px; }
.search-bar svg { width: 16px; height: 16px; color: var(--foreground-400); }
.search-bar input { border: none; background: transparent; outline: none; flex: 1; font-size: 14px; font-family: inherit; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 calc(8px + var(--safe-bottom));
  z-index: 40;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; color: var(--foreground-400);
  font-size: 10px; font-weight: 500;
  cursor: pointer;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active span { font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--foreground-900); color: #fff;
  padding: 10px 18px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .3s;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Helpers ---------- */
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .between { justify-content: space-between; } .aic { align-items: center; }
.muted { color: var(--foreground-500); }
.hidden { display: none !important; }

/* ---------- Desktop hint ---------- */
.desktop-hint { display: none; }
@media (min-width: 700px) {
  body { background: var(--background-200); padding: 24px 0; }
  .app { border-radius: 32px; overflow: hidden; min-height: calc(100vh - 48px); max-height: 920px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
}
