/* ============================================================
   AI 拍照教练 - 样式表
   主题：暗色摄影风 | 布局：移动端优先，768px 断点适配桌面
   ============================================================ */

/* ---------- 全局变量与基础重置 ---------- */
:root {
  --bg: #101418;          /* 页面背景 */
  --bg-soft: #171d24;     /* 卡片背景 */
  --bg-hover: #1e2630;    /* 悬浮背景 */
  --line: #2a3440;        /* 分割线/边框 */
  --text: #e8edf2;        /* 主文字 */
  --text-dim: #93a1b0;    /* 次要文字 */
  --accent: #ffb84d;      /* 主题强调色（暖金色，摄影感） */
  --accent-soft: rgba(255, 184, 77, 0.14);
  --ok: #4ade80;          /* 成功 */
  --err: #f87171;         /* 失败 */
  --warn: #fbbf24;        /* 警告（校验降级提示） */
  --radius: 14px;         /* 统一圆角 */
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(16, 20, 24, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.logo { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }

/* ---------- 主容器 ---------- */
.container {
  max-width: 720px;      /* 桌面下限制阅读宽度，手机自然全宽 */
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* ---------- 按钮通用 ---------- */
button {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent; /* 去除移动端点击高亮 */
}

button:active { transform: scale(0.97); }

button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 8px 14px;
  min-height: 40px;
}

.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-primary {
  background: var(--accent);
  color: #221703;
  font-weight: 700;
  padding: 10px 20px;
  min-height: 44px; /* 移动端触控最小高度 */
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger {
  background: transparent;
  color: var(--err);
  border: 1px solid var(--err);
  padding: 10px 20px;
  min-height: 44px;
}

.btn-lg { flex: 1; font-size: 16px; }

/* ---------- 设置抽屉 ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;           /* 默认隐藏，加 open 类后可见 */
}

.drawer.open { visibility: visible; }

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.2s;
}

.drawer.open .drawer-mask { opacity: 1; }

.drawer-body {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(400px, 100%);      /* 手机全宽、桌面侧栏 */
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.drawer.open .drawer-body { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.drawer-head h2 { font-size: 17px; }

.drawer-tip { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

.field { display: block; margin-bottom: 14px; }

.field span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 15px;              /* ≥16px 才能避免 iOS 聚焦自动放大，此处权衡后用 15px+44px 高度 */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  font-family: inherit;
}

.field select { appearance: auto; }

.field input:focus,
.field select:focus { border-color: var(--accent); }

.drawer-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.drawer-actions .btn-primary { width: 100%; }

/* ---------- 配置分组（分析服务 / 生图服务） ---------- */
.cfg-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px 2px;
  margin-bottom: 14px;
}

.cg-title {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 10px;
}

.cg-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.cg-title-row .cg-title { margin-bottom: 0; }

.btn-mini {
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 4px 10px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.btn-mini:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 配置校验结果条 ---------- */
.check-result {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.check-result.err {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--err);
  color: var(--err);
}

.check-result.warn {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid var(--warn);
  color: var(--warn);
}

/* ---------- 模式 Tab ---------- */
.tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 10px;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--text-dim);
  padding: 10px 8px;
  min-height: 44px;
  border-radius: 10px;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.mode-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-align: center;
}

/* ---------- 双图上传区（场景图 + 人像图） ---------- */
.upload-duo {
  display: grid;
  grid-template-columns: 1fr;   /* 手机：上下堆叠 */
  gap: 10px;
  margin-bottom: 14px;
}

/* 间距由 gap 控制，抵消 dropzone 自带的下边距 */
.upload-duo .dropzone { margin-bottom: 0; }

/* 人像区空态图标稍小，与场景区形成主次区分 */
.portrait-zone .dz-icon { font-size: 30px; }

/* 人像区文案紧凑一点（同为可选次要入口） */
.portrait-zone .dz-main { font-size: 14px; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 14px;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dz-icon { font-size: 40px; margin-bottom: 8px; }

.dz-main { font-size: 15px; }

.dz-sub { font-size: 13px; color: var(--text-dim); margin: 4px 0 12px; }

.dz-preview { position: relative; }

.dz-preview img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

.btn-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
}

/* ---------- 快捷标签 ---------- */
.tag-groups { margin-bottom: 14px; }

.tag-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.tg-label {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 34px;
}

.tg-options { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  background: var(--bg-soft);
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 999px;
  font-size: 13px;
}

.tag.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 操作区 ---------- */
.actions { display: flex; gap: 10px; margin-bottom: 16px; }

/* ---------- 分步进度 ---------- */
.progress {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.p-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.p-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}

/* 进行中的步骤：文字高亮 + 圆点呼吸动画 */
.p-step.doing { color: var(--text); }

.p-step.doing .p-dot {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

/* 已完成的步骤 */
.p-step.done { color: var(--ok); }

.p-step.done .p-dot { background: var(--ok); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.35); }
}

/* ---------- 错误提示条 ---------- */
.error-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--err);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.error-bar p { color: var(--err); }

/* ---------- 结果卡片 ---------- */
.result { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* 标题行（标题 + 行内操作按钮，如摆姿卡的"生成全部"） */
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title-row .card-title {
  flex: 1;
  margin-bottom: 10px;
}

.card-title-row .btn-mini { margin-bottom: 10px; flex-shrink: 0; }

.card-text { font-size: 14px; color: var(--text); }

/* 人像识别结果行（穿搭/发型/体型/脸型，供用户核对） */
.appearance-line {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.5;
  word-break: break-all;
}

/* 复盘问题列表 */
.problem-item {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

.problem-item:last-child { margin-bottom: 0; }

.problem-item .p-issue { color: var(--err); font-weight: 600; }

.problem-item .p-fix { color: var(--ok); margin-top: 2px; }

/* 摆姿列表 */
.pose-item { margin-bottom: 12px; }

.pose-item:last-child { margin-bottom: 0; }

.pose-item h4 { font-size: 14px; color: var(--accent); }

.pose-item p { font-size: 14px; margin-top: 2px; }

.pose-item .pose-tip,
.pose-item .pose-expression {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---------- 摆姿参考图搜索直达 ---------- */
.search-refs {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.sr-title {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.sr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;   /* 窄屏时链接自动换行 */
  padding: 6px 0;
}

.sr-kw {
  font-size: 14px;
  flex: 1;
  min-width: 140px;  /* 关键词占主行，链接挤到下一行也不变形 */
}

.sr-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.sr-link:hover { border-color: var(--accent); }

/* 摆姿建议内嵌示意图区（每条建议一个，动态创建：图随文走、一一对应） */
.pose-image-wrap { margin-top: 8px; text-align: center; }

.pose-image-wrap .pose-gen-btn { min-height: 36px; }

.pose-image-wrap img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.pose-image-fail {
  padding: 14px;
  border: 1px dashed var(--err);
  border-radius: 10px;
  font-size: 14px;
  color: var(--err);
}

.pose-image-fail button { margin-top: 8px; }

/* 生图失败的具体原因（常驻显示，便于排障） */
.pif-msg {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  word-break: break-all;
  text-align: left;
}

/* 相机参数：网格卡片式（窄屏友好，替代传统表格） */
.cam-row {
  display: grid;
  grid-template-columns: 64px 1fr; /* 左：参数名；右：值+解释 */
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.cam-row:last-child { border-bottom: none; }

.cam-name { font-size: 14px; color: var(--accent); font-weight: 600; }

.cam-value { font-size: 15px; font-weight: 700; }

.cam-why { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* 拍摄流程时间线 */
.flow-list { list-style: none; counter-reset: flow; }

.flow-list li {
  position: relative;
  counter-increment: flow;
  padding: 0 0 14px 36px;
  font-size: 14px;
}

.flow-list li::before {
  content: counter(flow);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-list li::after {
  content: "";
  position: absolute;
  left: 11.5px;
  top: 26px;
  bottom: 2px;
  width: 1px;
  background: var(--line);
}

.flow-list li:last-child { padding-bottom: 0; }

.flow-list li:last-child::after { display: none; }

/* 补光方案列表 */
.light-list { list-style: none; }

.light-list li {
  font-size: 14px;
  padding: 8px 0 8px 22px;
  position: relative;
  border-bottom: 1px dashed var(--line);
}

.light-list li:last-child { border-bottom: none; }

.light-list li::before {
  content: "💡";
  position: absolute;
  left: 0;
  font-size: 13px;
}

/* ---------- Toast 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 38, 48, 0.95);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 桌面端增强（≥768px） ---------- */
@media (min-width: 768px) {
  .container { padding: 24px 24px 64px; }

  .logo { font-size: 20px; }

  /* 双图上传区桌面端左右双列 */
  .upload-duo { grid-template-columns: 1fr 1fr; }

  .dropzone { padding: 40px 20px; }

  /* 桌面上相机参数恢复双栏表格式观感 */
  .cam-row { grid-template-columns: 80px 160px 1fr; align-items: baseline; }

  .cam-why { margin-top: 0; }
}
