/* ═══════════════════════════════════════════════════════
   Content Module — AI 创作工作台
   ═══════════════════════════════════════════════════════ */

.content-module {
  padding: 28px 40px 60px;
  max-width: 1200px;
  margin: 0 auto;
  font-family: -apple-system, 'SF Pro Display', 'PingFang SC', sans-serif;
}

/* ── Page header ── */
.cw-header { margin-bottom: 28px; }

.cw-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.04em; margin-bottom: 10px;
}
.cw-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--color-primary); }

.cw-title { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -0.03em; margin: 0 0 5px; }
.cw-subtitle { font-size: 13px; color: #64748b; margin: 0; }

/* ── Step ── */
.cw-step { margin-bottom: 20px; }

.cw-step-hd {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}

.cw-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cw-step-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.cw-step-sub   { font-size: 11px; color: #94a3b8; }

/* ── Content type cards ── */
.cw-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 900px) { .cw-type-grid { grid-template-columns: repeat(2, 1fr); } }

.cw-type-card {
  padding: 18px 16px 16px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  user-select: none;
}
.cw-type-card:hover {
  border-color: var(--color-primary-border);
  box-shadow: 0 4px 16px var(--color-primary-glow);
  transform: translateY(-2px);
}
.cw-type-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 4px 18px var(--color-primary-glow);
}

.cw-type-check {
  position: absolute; top: 11px; right: 11px;
  width: 17px; height: 17px;
  border-radius: 50%; background: var(--color-primary);
  display: none; align-items: center; justify-content: center;
  color: #fff;
}
.cw-type-card.active .cw-type-check { display: flex; }

.cw-type-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.ci-image   { background: var(--color-primary-light); color: var(--color-primary); }
.ci-video   { background: #fdf4ff; color: #9333ea; }
.ci-avatar  { background: #fff7ed; color: #ea580c; }
.ci-text    { background: #f0fdf4; color: #16a34a; }

.cw-type-card.active .ci-image  { background: #bae6fd; }
.cw-type-card.active .ci-video  { background: #ede9fe; }
.cw-type-card.active .ci-avatar { background: #ffedd5; }
.cw-type-card.active .ci-text   { background: #dcfce7; }

.cw-type-name { font-size: 13px; font-weight: 700; color: #0f172a; }
.cw-type-tag  { font-size: 10px; font-weight: 600; color: var(--color-primary); background: var(--color-primary-light); padding: 2px 7px; border-radius: 4px; align-self: flex-start; }
.cw-type-desc { font-size: 11px; color: #64748b; line-height: 1.4; }

/* ── Input card ── */
.cw-input-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
}

.cw-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  padding: 20px 22px 16px;
}
@media (max-width: 768px) { .cw-form-grid { grid-template-columns: 1fr; } }

.cw-field { display: flex; flex-direction: column; gap: 5px; }
.cw-field-full { grid-column: 1/-1; }

.cw-label { font-size: 11px; font-weight: 600; color: #374151; }

.cw-input, .cw-select {
  height: 40px; padding: 0 11px;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  background: #fff; font-size: 13px; color: #0f172a;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%; font-family: inherit; -webkit-appearance: none;
}
.cw-select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer;
}
.cw-input::placeholder { color: #cbd5e1; }
.cw-input:hover, .cw-select:hover  { border-color: #cbd5e1; }
.cw-input:focus, .cw-select:focus  { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); }

/* Style selector */
.cw-style-section {
  padding: 0 22px 18px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px; padding-top: 16px;
}
.cw-style-label { font-size: 11px; font-weight: 600; color: #374151; margin-bottom: 10px; display: block; }
.cw-style-chips { display: flex; gap: 7px; flex-wrap: wrap; }

.cw-style-chip {
  padding: 6px 13px;
  border: 1.5px solid #e2e8f0;
  border-radius: 100px;
  background: #fff; font-size: 12px; font-weight: 500;
  color: #475569; cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cw-style-chip:hover { border-color: var(--color-primary-border); color: var(--color-primary); }
.cw-style-chip.active {
  border-color: var(--color-primary); background: var(--color-primary-light);
  color: var(--color-primary); font-weight: 600;
}

/* ── Prompt builder card ── */
.cw-prompt-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.cw-prompt-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.cw-prompt-toolbar-left {
  display: flex; align-items: center; gap: 8px;
}

.cw-prompt-label {
  font-size: 12px; font-weight: 600;
  color: #6b7280; letter-spacing: 0.06em; text-transform: uppercase;
}

.cw-gen-prompt-btn {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 14px;
  border: none; border-radius: 7px;
  background: var(--color-primary); color: #fff;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  font-family: inherit;
}
.cw-gen-prompt-btn:hover { background: var(--color-primary-hover); }
.cw-gen-prompt-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cw-prompt-tools {
  display: flex; align-items: center; gap: 4px;
}

.cw-prompt-tool-btn {
  display: flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 10px;
  border: 1px solid #e5e7eb; border-radius: 6px;
  background: #fff; color: #6b7280;
  font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all 0.12s; font-family: inherit;
}
.cw-prompt-tool-btn:hover { background: #f3f4f6; color: #374151; border-color: #d1d5db; }

/* Prompt textarea */
.cw-prompt-body { padding: 18px; }

.cw-prompt-area {
  display: flex; flex-direction: column; gap: 12px;
}

.cw-prompt-field { display: flex; flex-direction: column; gap: 6px; }

.cw-prompt-field-label {
  font-size: 10px; font-weight: 600;
  color: #9ca3af; letter-spacing: 0.08em; text-transform: uppercase;
}

.cw-prompt-ta {
  width: 100%; min-height: 100px; padding: 12px 14px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 9px; color: #111827;
  font-size: 13px; font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
  line-height: 1.6; resize: vertical; outline: none;
  transition: border-color 0.15s;
}
.cw-prompt-ta:focus { border-color: var(--color-primary); background: #fff; }
.cw-prompt-ta::placeholder { color: #9ca3af; }

.cw-negative-ta { min-height: 60px; }

/* Script area */
.cw-script-ta {
  min-height: 140px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 9px; padding: 14px;
  color: #374151; font-family: 'SF Mono', monospace;
  font-size: 12px; line-height: 1.7;
  white-space: pre-wrap; overflow-y: auto;
}

/* Typing cursor */
.typing-cursor {
  display: inline-block; width: 2px; height: 1em;
  background: var(--color-primary);
  animation: blink 0.8s step-end infinite;
  vertical-align: text-bottom; margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Skeleton in prompt area */
.cw-prompt-skeleton-line {
  height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 400px 100%;
  animation: shimmer-dark 1.2s ease-in-out infinite;
}
@keyframes shimmer-dark {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ── Generate + result card ── */
.cw-generate-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
}

.cw-generate-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #f1f5f9;
}

.cw-generate-bar-left {
  display: flex; flex-direction: column; gap: 2px;
}
.cw-generate-bar-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.cw-generate-bar-desc  { font-size: 11px; color: #94a3b8; }

.cw-generate-btn {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 20px;
  border: none; border-radius: 10px;
  background: var(--color-primary); color: #fff;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.cw-generate-btn:hover { background: var(--color-primary-hover); box-shadow: 0 4px 14px var(--color-primary-glow); }
.cw-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.cw-regen-btn {
  display: flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 14px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  background: #fff; color: #64748b;
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.12s; font-family: inherit;
}
.cw-regen-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* Result area */
.cw-result-area { padding: 20px 22px; }

/* Image gallery */
.cw-image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .cw-image-grid { grid-template-columns: repeat(2, 1fr); } }

.cw-image-card {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  position: relative;
  aspect-ratio: 4/5;
  background: #f1f5f9;
  cursor: pointer;
}
.cw-image-card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.2s;
}
.cw-image-card:hover img { transform: scale(1.03); }
.cw-image-card-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center; gap: 8px;
}
.cw-image-card:hover .cw-image-card-overlay { display: flex; }
.cw-img-action-btn {
  height: 32px; padding: 0 12px;
  border-radius: 7px; border: none;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  color: #fff; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.cw-img-action-btn:hover { background: rgba(255,255,255,.25); }

/* Video result */
.cw-video-card {
  border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
}
.cw-video-player {
  width: 100%; aspect-ratio: 16/9;
  background: #0f172a;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 13px; gap: 10px;
}
.cw-video-meta { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.cw-video-title { font-size: 13px; font-weight: 600; color: #0f172a; }
.cw-video-duration { font-size: 11px; color: #94a3b8; }

/* Avatar script result */
.cw-avatar-card {
  border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
}
.cw-avatar-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}
.cw-avatar-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: #fff7ed; color: #ea580c;
  display: flex; align-items: center; justify-content: center;
}
.cw-avatar-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.cw-avatar-sub   { font-size: 11px; color: #94a3b8; }
.cw-avatar-body  { padding: 18px; }
.cw-script-content {
  font-size: 13px; color: #334155; line-height: 1.8;
  white-space: pre-wrap;
  border-left: 3px solid var(--color-primary-border);
  padding-left: 14px; margin: 0;
}
.cw-script-meta { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.cw-script-tag {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 5px;
  background: #f1f5f9; color: #475569;
}

/* Text copywriting result */
.cw-text-card {
  border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
}
.cw-text-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid #f1f5f9; background: #fafbfc;
}
.cw-text-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.cw-text-body  { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.cw-text-headline { font-size: 16px; font-weight: 700; color: #0f172a; }
.cw-text-body-copy { font-size: 13px; color: #334155; line-height: 1.8; }
.cw-text-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--color-primary);
}
.cw-text-hashtags { display: flex; flex-wrap: wrap; gap: 6px; }
.cw-hashtag {
  padding: 3px 10px; background: #f1f5f9;
  border-radius: 100px; font-size: 11px; color: #475569;
}
.cw-text-variations { display: flex; flex-direction: column; gap: 10px; }
.cw-variation {
  padding: 12px 14px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 9px; font-size: 12px; color: #334155; line-height: 1.6;
  position: relative;
}
.cw-variation-num {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; color: #94a3b8; font-weight: 600;
}

/* Result action bar */
.cw-result-actions {
  display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}

.cw-result-btn {
  display: flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 16px;
  border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.cw-result-btn-primary { background: var(--color-primary); color: #fff; border: none; }
.cw-result-btn-primary:hover { background: var(--color-primary-hover); }
.cw-result-btn-ghost { background: #fff; color: #475569; border: 1.5px solid #e2e8f0; }
.cw-result-btn-ghost:hover { border-color: #94a3b8; color: #334155; }

/* Loading skeleton (light) */
.cw-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 400px 100%;
  animation: shimmer-light 1.2s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer-light {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* Empty / loading states */
.cw-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px; text-align: center;
}
.cw-empty-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--color-primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
}
.cw-empty-text { font-size: 13px; color: #64748b; line-height: 1.6; }

/* Loading spinner */
.cw-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
