/* PWA 小红书封面页（独立于排版页；只改这里不动 style.css 的排版布局） */

:root {
  --cv-panel-w: 348px;
}

#cover-root {
  height: calc(100% - var(--top-h));
  background: var(--bg-canvas);
}

.cover-btn {
  height: 30px; padding: 0 11px; border-radius: var(--radius);
  color: var(--text-soft); font-size: 12.5px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--bg-surface);
  transition: background .15s, color .15s, border-color .15s;
}
.cover-btn:hover { background: var(--bg-hover); color: var(--text); }
.cover-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.cv-stage {
  height: 100%;
  display: grid;
  grid-template-columns: var(--cv-panel-w) 1fr;
  min-height: 0;
}

/* ── 左侧控制面板 ── */
.cv-panel {
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}
.cv-sec { margin-bottom: 20px; }
.cv-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.cv-sec-title { font-size: 12px; font-weight: 600; color: var(--text-soft); letter-spacing: .04em; }
.cv-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.cv-mini-btn {
  font-size: 11.5px; color: var(--accent); padding: 2px 6px; border-radius: 4px;
}
.cv-mini-btn:hover { background: var(--accent-soft); }

.cv-text {
  width: 100%; height: 132px; resize: vertical; min-height: 88px;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.6; outline: 0;
}
.cv-text:focus { border-color: var(--border-hi); box-shadow: 0 0 0 3px var(--accent-soft); }
.cv-count { display: block; text-align: right; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.cv-field {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--text); font: inherit; font-size: 13px; outline: 0;
}
.cv-field:focus { border-color: var(--border-hi); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 风格卡 */
.cv-group-label { font-size: 11px; color: var(--text-muted); margin: 10px 0 6px; }
.cv-style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.cv-style {
  position: relative; text-align: left; padding: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); transition: border-color .15s, box-shadow .15s;
}
.cv-style:hover { border-color: var(--border-hi); }
.cv-style[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cv-style-thumb {
  display: block; width: 100%; height: 54px; object-fit: cover;
}
.cv-style-swatch { display: block; width: 100%; height: 54px; }
.cv-style-name {
  display: block; padding: 5px 7px 6px; font-size: 11.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cv-style-badge {
  position: absolute; top: 4px; right: 4px; padding: 1px 5px; border-radius: 99px;
  background: rgba(0,0,0,.42); color: #fff; font-size: 9.5px; letter-spacing: .02em;
}

/* 尺寸 */
.cv-size-row { display: flex; gap: 6px; }
.cv-size {
  flex: 1; min-width: 0; padding: 7px 4px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--text-soft); font-size: 11.5px; text-align: center;
}
.cv-size[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cv-size[disabled] { opacity: .38; cursor: not-allowed; }

/* 底图 */
.cv-modes { display: flex; gap: 4px; padding: 3px; background: var(--bg-hover); border-radius: var(--radius); }
.cv-mode {
  flex: 1; padding: 6px 4px; border-radius: 5px; font-size: 11.5px; color: var(--text-soft);
}
.cv-mode[aria-pressed="true"] { background: var(--bg-raised); color: var(--text); box-shadow: var(--shadow-sm); }
.cv-bg-body { margin-top: 8px; }
.cv-upload {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 62px; border: 1px dashed var(--border-hi); border-radius: var(--radius);
  color: var(--text-soft); font-size: 12px; background: var(--bg-raised); cursor: pointer;
}
.cv-upload:hover { border-color: var(--accent); color: var(--accent); }
.cv-upload input { display: none; }
.cv-search-row { display: flex; gap: 6px; }
.cv-search-row .cv-field { flex: 1; min-width: 0; }
.cv-search-btn {
  flex: none; padding: 0 12px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 12px;
}
.cv-search-btn[disabled] { opacity: .5; cursor: wait; }
.cv-search-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 8px;
}
.cv-cand { padding: 0; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: var(--bg-raised); }
.cv-cand img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.cv-cand[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cv-bg-preview {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
  padding: 7px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised);
}
.cv-bg-preview img { width: 42px; height: 56px; object-fit: cover; border-radius: 4px; flex: none; }
.cv-bg-meta { min-width: 0; flex: 1; font-size: 10.5px; color: var(--text-muted); line-height: 1.45; }
.cv-bg-meta b { display: block; color: var(--text-soft); font-weight: 500; font-size: 11.5px; }
.cv-clear {
  flex: none; width: 24px; height: 24px; border-radius: 50%; font-size: 14px;
  color: var(--text-muted); display: grid; place-items: center;
}
.cv-clear:hover { background: var(--bg-hover); color: var(--text); }

/* 生成 */
.cv-gen {
  width: 100%; height: 42px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  transition: background .15s, opacity .15s;
}
.cv-gen:hover { background: var(--accent-dim); }
.cv-gen[disabled] { opacity: .55; cursor: wait; }
.cv-status {
  min-height: 18px; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); text-align: center;
}
.cv-status.err { color: var(--accent); }

/* ── 右侧结果 ── */
.cv-output { overflow-y: auto; padding: 20px 22px 40px; min-height: 0; }
.cv-out-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cv-out-title { font-size: 15px; font-weight: 600; }
.cv-out-sub { font-size: 11.5px; color: var(--text-muted); }
.cv-empty {
  height: 100%; min-height: 280px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border-hi); border-radius: var(--radius-lg); background: var(--bg-surface);
}
.cv-empty b { color: var(--text-soft); font-weight: 500; font-size: 14px; }
.cv-empty span { font-size: 12px; max-width: 360px; line-height: 1.7; }

.cv-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; align-items: start; }
.cv-card {
  margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-raised); overflow: hidden; box-shadow: var(--shadow-sm);
}
.cv-card-img { display: block; width: 100%; cursor: zoom-in; background: #111; }
.cv-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.cv-card-label { font-size: 11.5px; color: var(--text-soft); }
.cv-dl { font-size: 11.5px; color: var(--accent); padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); }
.cv-dl:hover { background: var(--accent-soft); border-color: var(--accent); }
.cv-tip { margin-top: 16px; font-size: 11.5px; color: var(--text-muted); line-height: 1.7; }

/* Lightbox */
.cv-lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(12, 10, 8, .92);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cv-lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 6px; box-shadow: var(--shadow-xl); }
.cv-lightbox-close {
  position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border-radius: 50%;
  color: #fff; background: rgba(255,255,255,.14); font-size: 18px;
}
.cv-lightbox-close:hover { background: rgba(255,255,255,.24); }

@media (max-width: 900px) {
  #cover-root { height: auto; overflow-y: auto; }
  .cv-stage { height: auto; display: block; }
  .cv-panel { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .cv-output { overflow: visible; padding: 16px; }
  .cv-style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cv-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
