/* ============================================================
 * FISHMQ 手摇相册定制系统 · 网页版 v2.0
 * css/base.css —— 品牌视觉规范 / 通用组件
 * 色值与字体栈 1:1 取自小程序（见复刻说明书 §1.1）
 * ============================================================ */

:root {
  /* 品牌色 */
  --bg: #f5f0eb;
  --surface: #ffffff;
  --surface-soft: #ede7df;
  --text: #33291f;
  --text-sub: #7a6a58;
  --text-mute: #a89886;
  --line: #e3dbd0;

  --primary-from: #d4a373;
  --primary-to: #bf8960;
  --primary: #c5976b;
  --primary-strong: #a9764f;
  --danger: #c8563c;
  --success: #8fa88a;

  /* 步骤导航 */
  --step-current: #c5976b;
  --step-done: #8fa88a;
  --step-todo: #c5bfb8;

  /* 裁剪页深色主题 */
  --crop-bg: #1a1510;

  /* 尺寸 */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(74, 55, 40, 0.08);
  --shadow-lg: 0 12px 40px rgba(74, 55, 40, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ---------- 应用外壳 ---------- */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* 阶段二十九：将 #app 设为容器，使内部断点以「应用宽度」而非「视口宽度」为准，
     从而 PC 端能把整个应用约束为手机宽列、双端视觉一致对齐小程序手机端。 */
  container-type: inline-size;
  container-name: app;
}
/* PC / 平板（视口 ≥600px）：整个应用约束为手机宽列（420px）水平居中，两侧自然留白；
   不引入任何宽屏拉伸 / 双栏拓展布局。内部样式由 @container 断点统一按手机端渲染。 */
@media (min-width: 600px) {
  #app {
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 24px 80px rgba(74, 55, 40, 0.12);
  }
}
#page-host {
  position: relative;
  flex: 1;
  min-height: 0;
  /* 非活动页带 transform: translateX(18px)，会撑出 18px 横向滚动空间 */
  overflow: hidden;
}
.fmq-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.fmq-page.is-active { opacity: 1; transform: none; }
.fmq-page.is-leaving { opacity: 0; transform: translateX(18px); }
.fmq-error { padding: 40px; text-align: center; color: var(--danger); }

/* ---------- 顶部导航 ---------- */
.fmq-navbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(52px + var(--safe-t));
  padding: var(--safe-t) calc(14px + var(--safe-r)) 0 calc(14px + var(--safe-l));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.fmq-navbar__back {
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fmq-navbar__back:hover { background: rgba(0,0,0,0.05); }
.fmq-navbar__title {
  font-size: 16px; font-weight: 600;
  flex: 1; text-align: center;
  margin-right: 34px;
}
.fmq-navbar__action {
  min-width: 34px;
  border: none; background: transparent;
  color: var(--primary-strong);
  font-size: 14px; cursor: pointer;
}

/* ---------- 步骤导航（1:1 对齐小程序 pages/step1/step1.wxss .step-nav）----------
 * 纵向结构：圆形序号在上、步骤名在下，序号右侧延伸渐变连接线。
 * 未达 #c5bfb8 / 当前 #c5976b（渐变底 + 微放大）/ 完成 #8fa88a。
 * rpx→px 按 1rpx = 0.5px 折算后为桌面端做了可读性放大。
 */
.step-nav {
  flex: none;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 10px;
  margin: 14px 14px 12px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 3px 12px rgba(0, 0, 0, 0.04);
  gap: 0;
}
.step-item {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: #c5bfb8;
}
.step-item__dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: #f3eeea; color: #a89886;
  flex: none;
  margin-bottom: 4px;
  position: relative; z-index: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.step-item__label {
  font-size: 12px; color: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
/* 连接线：从当前项右侧延伸到下一项（小程序 right:-44% / width:70%） */
.step-item__line {
  position: absolute;
  top: 13px; left: 74%; width: 70%;
  height: 1px;
  background: linear-gradient(90deg, #e8e2d8 60%, #f3eeea 100%);
  z-index: 0;
  transition: background 0.3s;
}
.step-item.is-current { color: #c5976b; font-weight: 600; }
.step-item.is-current .step-item__dot {
  background: linear-gradient(135deg, #d4a373 0%, #bf8960 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(197, 151, 107, 0.35);
  transform: scale(1.08);
}
.step-item.is-done { color: #8fa88a; }
.step-item.is-done .step-item__dot {
  background: #8fa88a; color: #ffffff;
  box-shadow: 0 1px 6px rgba(143, 168, 138, 0.2);
}
.step-item.is-done .step-item__line { background: #8fa88a; }
.step-item:last-child .step-item__line { display: none; }

/* ---------- 按钮 ---------- */
.fmq-btn {
  border: none; outline: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.12s ease, box-shadow 0.2s, opacity 0.2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.fmq-btn:active { transform: scale(0.98); }
.fmq-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.fmq-btn--primary {
  background: linear-gradient(135deg, var(--primary-from) 0%, var(--primary-to) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(191, 137, 96, 0.32);
}
.fmq-btn--ghost { background: var(--surface-soft); color: var(--text-sub); }
.fmq-btn--outline {
  background: #fff; color: var(--primary-strong);
  border: 1.5px solid var(--primary-from);
}
.fmq-btn--block { width: 100%; }
.fmq-btn--sm { min-height: 36px; padding: 8px 14px; font-size: 13px; }
.fmq-btn--danger { background: var(--danger); color: #fff; }

/* ---------- 卡片 ---------- */
.fmq-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* ---------- 页面内容区 ---------- */
.fmq-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fmq-footer {
  flex: none;
  padding: 12px calc(16px + var(--safe-r)) calc(12px + var(--safe-b)) calc(16px + var(--safe-l));
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px;
}
.fmq-footer .fmq-btn { flex: 1; }

/* ---------- Toast / Modal / Loading ---------- */
.fmq-toast {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  max-width: 76vw;
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(28, 22, 16, 0.88);
  color: #fff; font-size: 14px; line-height: 1.5;
  text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9000;
}
.fmq-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fmq-toast--success { background: rgba(58, 88, 56, 0.92); }

.fmq-mask {
  position: fixed; inset: 0;
  background: rgba(30, 22, 16, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.2s;
  z-index: 9100;
}
.fmq-mask.show { opacity: 1; }
.fmq-modal {
  width: 100%; max-width: 340px;
  background: #fff; border-radius: 16px;
  padding: 22px 20px 16px;
  transform: scale(0.94); transition: transform 0.2s;
}
.fmq-mask.show .fmq-modal { transform: scale(1); }
.fmq-modal__title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.fmq-modal__content { font-size: 14px; line-height: 1.65; color: var(--text-sub); text-align: center; white-space: pre-wrap; }
.fmq-modal__actions { display: flex; gap: 10px; margin-top: 20px; }
.fmq-modal__actions .fmq-btn { flex: 1; }

.fmq-loading {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  z-index: 9200;
}
.fmq-loading.show { display: flex; }
.fmq-loading__box {
  background: rgba(28, 22, 16, 0.86);
  border-radius: 12px;
  padding: 20px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: #fff; font-size: 14px;
}
.fmq-loading__spin {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fmq-spin 0.8s linear infinite;
}
@keyframes fmq-spin { to { transform: rotate(360deg); } }

/* ---------- 空态 / 提示条 ---------- */
.fmq-empty { text-align: center; color: var(--text-mute); font-size: 14px; padding: 40px 20px; }
.fmq-tip {
  display: flex; gap: 8px; align-items: flex-start;
  background: #fff7e9; color: #8a6a34;
  border: 1px solid #f0dfb8;
  border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; line-height: 1.6;
}
