/* ── style-pro.css ───────────────────────────────────────────────────────────
   Pro mode: visibility toggle, style cards, genre buttons, settings panel,
   quality badge, share/regen buttons, pro theme vars, ripple animation.
   Loaded by index.html after style.css.
*/

/* ── pro-only 显隐 ── */
.pro-only {
  display: none !important;
}
:root.pro-theme .pro-only {
  display: revert !important;
}
:root.pro-theme .style-group {
  display: none;
}

/* ── pro 平台+类型同行容器 ── */
.style-genre-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.style-genre-divider {
  width: 1px;
  height: 44px;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── 两排卡片的纵向包装容器 ── */
.style-cards-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 更多平台切换按钮 ── */
.style-more-btn {
  background: none;
  border: none;
  color: var(--muted, #817e78);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  transition: color 0.2s;
  line-height: 1;
}
.style-more-btn:hover {
  color: var(--accent2, #e8b44b);
}

/* ── pro 风格卡片 ── */
.style-cards {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* 第二排默认隐藏（由 JS 控制，CSS 仅作初始状态备用） */
.style-cards-r2 {
  display: none;
}

.style-card {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 84px;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    color 0.2s;
  overflow: hidden;
}

.style-card:hover {
  border-color: var(--accent2);
  color: var(--text);
  box-shadow: 0 0 12px var(--glow);
}

.style-card.active {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 16px var(--glow);
  background: linear-gradient(
    135deg,
    rgba(77, 184, 176, 0.14),
    rgba(77, 184, 176, 0.1)
  );
}

:root.pro-theme .style-card.active {
  background: linear-gradient(
    135deg,
    rgba(77, 184, 176, 0.14),
    rgba(77, 184, 176, 0.1)
  );
}

.style-card:disabled {
  cursor: not-allowed;
}

.style-card:disabled:not(.active) {
  opacity: 0.42;
  box-shadow: none;
  background: rgba(26, 26, 34, 0.58);
}

.style-card:disabled:hover {
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}

.style-card:disabled:hover .card-desc {
  transform: translateY(100%);
}

.style-card:disabled.active {
  opacity: 1;
  cursor: default;
}

/* ── 卡片内元素 ── */
.card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.card-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.card-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* hover 时从底部滑入的说明文字 */
.card-desc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.style-card:hover .card-desc {
  transform: translateY(0);
}

/* ── 类型行 ── */
.genre-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.genre-btn {
  padding: 7px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.18s;
}

.genre-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.genre-btn.active,
:root.pro-theme .genre-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(77, 184, 176, 0.12);
}

/* ── 输出区操作按钮组 ── */
.output-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── 分享图按钮 ── */
#share-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--glow);
  transition:
    opacity 0.2s,
    transform 0.15s;
}

#share-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* ── 重新生成按钮 ── */
#regen-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

#regen-btn:hover:not(:disabled) {
  border-color: var(--accent2);
  color: var(--accent2);
}
#regen-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.quota-toast-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quota-toast-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex: 0 0 auto;
  vertical-align: middle;
  image-rendering: optimize-contrast;
}

.quota-toast-sep {
  opacity: 0.7;
  margin: 0 4px;
}

/* ── 质量检测标签 ── */
#quality-badge {
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  align-self: flex-start;
}

#quality-badge.badge-ok {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #34d399;
}

#quality-badge.badge-warn {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

/* ── Banner stack container (WF update + summary save, one above the other) ── */
#banner-stack {
  position: fixed;
  right: 24px;
  bottom: 80px;
  max-width: 340px;
  width: calc(100vw - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  overflow: visible;
  pointer-events: none; /* individual banners handle their own pointer-events */
}

#banner-stack > .wf-leaving {
  position: absolute;
  top: var(--wf-banner-leave-top, 0);
  right: 0;
  width: 100%;
  z-index: 0;
}

/* ── 世界观状态更新面板（右侧滑入对话框） ── */
#wv-update-banner {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2, #16162a);
  border: 1px solid var(--accent, #4db8b0);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 24px rgba(77, 184, 176, 0.2);
  /* hidden state: off-screen right */
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

#wv-update-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#wv-update-text {
  font-size: 0.82rem;
  color: var(--text, #e4e0da);
  line-height: 1.65;
}
.wv-banner-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#wv-banner-apply {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--accent, #4db8b0);
  color: #fff;
  font-size: 0.8rem;
  transition: opacity 0.15s;
}
#wv-banner-apply:hover {
  opacity: 0.85;
}
#wv-banner-dismiss {
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  color: var(--muted, #817e78);
  font-size: 0.8rem;
  transition: border-color 0.15s;
}
#wv-banner-dismiss:hover {
  border-color: var(--muted, #817e78);
}

/* ── Chapter summary save banner ── */
#summary-save-banner {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2, #16162a);
  border: 1px solid rgba(77, 184, 176, 0.55);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 24px rgba(77, 184, 176, 0.15);
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}
#summary-save-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
#summary-banner-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #e4e0da);
}
#summary-banner-preview {
  font-size: 0.78rem;
  color: var(--muted, #817e78);
  line-height: 1.55;
  max-height: 80px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.summary-banner-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#summary-banner-save {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--accent, #4db8b0);
  color: #fff;
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: opacity 0.15s;
}
#summary-banner-save:hover {
  opacity: 0.85;
}
#summary-banner-skip {
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  color: var(--muted, #817e78);
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}
#summary-banner-skip:hover {
  border-color: var(--muted, #817e78);
}

/* ── Chapter done confirmation banner ── */
#chapter-done-banner {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2, #16162a);
  border: 1px solid rgba(52, 211, 153, 0.5);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 24px rgba(52, 211, 153, 0.12);
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}
#chapter-done-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
#chapter-done-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #e4e0da);
  line-height: 1.5;
}
.chapter-done-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#chapter-done-yes {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #059669;
  color: #fff;
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: opacity 0.15s;
}
#chapter-done-yes:hover {
  opacity: 0.85;
}
#chapter-done-no {
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  color: var(--muted, #817e78);
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}
#chapter-done-no:hover {
  border-color: var(--muted, #817e78);
}

/* ── No-summary warning banner ── */
#no-summary-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface2, #16162a);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.1);
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}
#no-summary-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
#no-summary-text {
  flex: 1;
  font-size: 0.8rem;
  color: rgba(245, 158, 11, 0.9);
  line-height: 1.5;
}
#no-summary-dismiss {
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: rgba(245, 158, 11, 0.7);
  font-size: 0.78rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}
#no-summary-dismiss:hover {
  border-color: rgba(245, 158, 11, 0.7);
}

#workflow-review-banner {
  background: linear-gradient(135deg, rgba(20, 34, 44, 0.98), rgba(18, 48, 55, 0.98));
  border: 1px solid rgba(45, 212, 191, 0.5);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 26px rgba(45, 212, 191, 0.14);
  display: none;
  flex-direction: column;
  gap: 10px;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

#workflow-review-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#workflow-review-title {
  color: var(--text, #e4e0da);
  font-size: 0.86rem;
  font-weight: 700;
}

#workflow-review-text {
  color: rgba(226, 226, 240, 0.78);
  font-size: 0.78rem;
  line-height: 1.6;
}

.workflow-review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#workflow-maintain-btn,
#workflow-rewrite-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

#workflow-maintain-btn {
  color: #062c29;
  background: linear-gradient(135deg, #5eead4, #99f6e4);
  font-weight: 700;
}

#workflow-rewrite-btn {
  color: rgba(226, 226, 240, 0.9);
  background: rgba(255, 255, 255, 0.08);
}

#output-text.wf-editable {
  outline: 1px solid rgba(45, 212, 191, 0.42);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.18);
}

#submit-btn.wf-loading,
body.wf-workflow-busy {
  cursor: progress;
}

#basic-pro-upsell-banner {
  display: none;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(135deg, rgba(22, 22, 42, 0.98), rgba(35, 25, 68, 0.98));
  border: 1px solid rgba(167, 139, 250, 0.55);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 30px rgba(77, 184, 176, 0.22);
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

#basic-pro-upsell-banner.wf-visible {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#upsell-title {
  color: var(--text, #e4e0da);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 8px;
}

.upsell-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  color: var(--muted, #a3a3c2);
  font-size: 0.76rem;
  line-height: 1.35;
}

#upsell-pro-label,
#upsell-pro-style,
#upsell-pro-memory {
  color: #e8b44b;
}

.upsell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#upsell-login-btn,
#upsell-dismiss-btn {
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
}

#upsell-login-btn {
  border: none;
  background: linear-gradient(135deg, #4db8b0, #ec4899);
  color: #fff;
}

#upsell-dismiss-btn {
  background: transparent;
  border: 1px solid rgba(167, 139, 250, 0.32);
  color: var(--muted, #a3a3c2);
}

/* ── WV success toast (bottom-center, clickable) ── */
.wv-success-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #134e26;
  color: #86efac;
  border: 1px solid #166534;
  padding: 11px 28px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wv-success-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.wv-success-toast.error {
  background: #4e1313;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
  text-decoration: none;
}

/* ── WV context hint（底部居中，纯展示，无交互） ── */
.wv-context-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface2, #1e1e2e);
  color: var(--muted, #817e78);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  padding: 8px 20px;
  border-radius: 99px;
  font-size: 0.78rem;
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  white-space: nowrap;
}
.wv-context-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── WF banner 复选框变更行 ── */
.wf-change-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
}
.wf-change-item input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent, #4db8b0);
  cursor: pointer;
}
.wf-change-body {
  flex: 1;
  min-width: 0;
}
.wf-change-name {
  font-size: 0.85rem;
  color: var(--text, #e4e0da);
  line-height: 1.4;
}
.wf-change-badge {
  color: var(--accent, #4db8b0);
  font-size: 0.73em;
  margin-left: 5px;
}
.wf-change-fields {
  font-size: 0.77rem;
  color: var(--muted, #817e78);
  margin-top: 2px;
  line-height: 1.5;
  word-break: break-all;
}

/* ── pro 主题色变量（沿用基础版配色）── */
:root.pro-theme {
  --bg: #09090d;
  --surface: #111118;
  --surface2: #1a1a22;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #4db8b0;
  --accent2: #e8b44b;
  --text: #e4e0da;
  --muted: #817e78;
  --glow: rgba(77, 184, 176, 0.35);
}

/* ── 涟漪遮罩（从右上扩散到左下）── */
.pro-ripple {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  clip-path: circle(0% at calc(100% - 60px) 40px);
  transition: clip-path 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.pro-ripple.expanding {
  clip-path: circle(200% at calc(100% - 60px) 40px);
}

/* ── 抽屉按钮行（高级参数 + 剧情指导横排）── */
.drawer-toggle-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── pro 高级参数按钮 ── */
.pro-settings-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 7px 14px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.pro-settings-toggle:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

/* ── 高级参数内容区（max-height 动画）── */
.pro-settings-body {
  flex-direction: column;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  padding: 0 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition:
    max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    margin-top 0.3s ease,
    padding 0.3s ease;
}

.pro-settings-body.open {
  max-height: 500px;
  opacity: 1;
  margin-top: 10px;
  padding: 16px;
}

/* ── 在 pro 模式下显示（非 pro 模式完全隐藏）── */
.pro-drawer-hidden {
  display: none !important;
}
:root.pro-theme .pro-drawer-hidden {
  display: flex !important;
}

.pro-params-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.param-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.param-name {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.param-desc {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--muted);
  flex: 1;
}

.param-val {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--accent2);
  min-width: 38px;
  text-align: right;
}

.param-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.15s;
}

.param-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

#param-reset-btn {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

#param-reset-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
