/* ==========================================================================
   外贸图片工厂 image-factory.html 专用样式（依赖 style.css 的设计变量）
   ========================================================================== */
.if-wrap { background: var(--bg-soft); }

.if-hero { padding: 40px 0 18px; }
.if-hero .eyebrow { margin-bottom: 12px; }
.if-hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: 10px; }
.if-hero .lead { max-width: 60ch; }
.if-trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.if-trust .chip { background: #fff; }

/* 主体两栏 */
.if-shell { display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start; padding-bottom: 18px; }
.if-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.if-stage { position: sticky; top: 84px; }

/* 控制面板分组 */
.if-group { margin-bottom: 18px; }
.if-group:last-child { margin-bottom: 0; }
.if-group > label.if-lbl,
.if-lbl { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .02em; color: var(--ink); margin: 0 0 8px; text-transform: uppercase; }
.if-lbl .muted { text-transform: none; font-weight: 500; }

/* tab/选项按钮组 */
.if-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.if-chip-btn {
  font: inherit; font-size: .86rem; font-weight: 650; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 9px 13px; border-radius: 10px; transition: .14s; line-height: 1.1;
}
.if-chip-btn:hover { border-color: #c7d2fe; color: var(--brand); }
.if-chip-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.26); }
.if-tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.if-tpl b { font-size: .9rem; }

.if-hint { font-size: .82rem; color: var(--muted); margin: 8px 0 0; min-height: 1.1em; }

/* 表单字段 */
.if-field { margin-bottom: 12px; }
.if-field:last-child { margin-bottom: 0; }
.if-field label { display: block; font-size: .82rem; color: var(--ink-2); font-weight: 600; margin-bottom: 5px; }
.if-input, .if-textarea {
  width: 100%; font: inherit; font-size: .92rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fff;
  transition: border-color .14s, box-shadow .14s;
}
.if-input:focus, .if-textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.if-textarea { resize: vertical; min-height: 96px; line-height: 1.5; font-size: .88rem; }
.if-field .muted { font-size: .78rem; }

/* 配色 */
.if-color-row { display: flex; align-items: center; gap: 12px; }
.if-color-input { width: 46px; height: 38px; padding: 2px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.if-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.if-swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; transition: transform .12s; }
.if-swatch:hover { transform: scale(1.12); }
.if-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }

/* 上传 */
.if-uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.if-upload {
  position: relative; border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px;
  text-align: center; font-size: .82rem; color: var(--muted); cursor: pointer; transition: .14s;
}
.if-upload:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.if-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.if-upload b { display: block; color: var(--ink-2); font-size: .86rem; margin-bottom: 2px; }
.if-upload .if-clear {
  display: none; position: absolute; top: 5px; right: 6px; width: 20px; height: 20px;
  border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; z-index: 2;
}

/* 预览舞台 */
.if-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.if-preview-head .if-meta { font-size: .84rem; color: var(--muted); font-weight: 600; }
.if-canvas-box {
  display: grid; place-items: center; background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #eef2f7 75%) -10px 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%) -10px 0/20px 20px,
    #f8fafc;
  border: 1px solid var(--line); border-radius: 12px; padding: 22px; min-height: 320px;
}
#if-canvas { max-width: 100%; max-height: 560px; width: auto; height: auto; border-radius: 4px; box-shadow: 0 14px 40px rgba(15,23,42,.16); background: #fff; }
.if-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.if-actions .btn { flex: 1 1 auto; }

/* 批量 */
.if-batch { margin-top: 8px; }
.if-batch-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.if-batch-head h3 { margin: 0; font-size: 1.1rem; }
.if-batch-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.if-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px;
}
.if-thumb { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.if-thumb img { width: 100%; display: block; background: #f1f5f9; }
.if-thumb figcaption { font-size: .76rem; color: var(--ink-2); padding: 7px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--line-2); }

/* toast */
.if-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .22s; z-index: 200; max-width: 90vw;
}
.if-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 价值对比表 */
.if-vs td b { color: var(--ink); }
.if-vs .yes { color: var(--ok); font-weight: 700; }
.if-vs .no { color: var(--muted); }

@media (max-width: 1000px) {
  .if-shell { grid-template-columns: 1fr; }
  .if-stage { position: static; }
}
@media (max-width: 520px) {
  .if-uploads { grid-template-columns: 1fr; }
  .if-actions .btn { flex: 1 1 100%; }
}
