/* ═══════════════════════════════════════════════════════════════
   AI PPT 生成器 — style.css  v7
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #2563eb;
  --primary-dk: #1d4ed8;
  --secondary:  #64748b;
  --accent:     #f59e0b;
  --surface:    #ffffff;
  --bg:         #f8fafc;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #475569;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── 版面容器 ────────────────────────────────────────────────── */
.hero, section, .download-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Hero 头部 ───────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding-top: 3.5rem;
  padding-bottom: 2rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
}
.hero p {
  color: var(--secondary);
  font-size: 1.05rem;
}

/* ── 卡片容器 ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* ── 表单布局 ────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.field--full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.4rem;
}
.field .req { color: var(--accent); margin-left: 2px; }

.field textarea,
.field select,
.field input[type="color"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
}
.field textarea:focus,
.field select:focus { border-color: var(--primary); }

.field textarea { resize: vertical; min-height: 120px; }
.field input[type="color"] { height: 40px; padding: 2px 4px; cursor: pointer; }

/* ── 颜色选择行 ──────────────────────────────────────────────── */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.color-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); border-color: var(--primary); }

/* ── Turnstile ───────────────────────────────────────────────── */
.cf-turnstile { margin: 1.25rem 0; }

/* ── 按钮 ────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost, .btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dk); }
.btn-primary.btn--lg {
  width: 100%;
  padding: 0.85rem;
  font-size: 1.05rem;
  margin-top: 1rem;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: #eff6ff; }

.btn-ghost {
  background: transparent;
  color: var(--secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-download {
  background: var(--primary);
  color: #fff;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
}
.btn-download:hover:not(:disabled) { background: var(--primary-dk); }

button:disabled { opacity: 0.45; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(0.97); }

/* ── 状态提示 ────────────────────────────────────────────────── */
.status {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 1.4rem;
}
.status--loading { color: var(--primary); }
.status--success { color: #16a34a; }
.status--error   { color: #dc2626; }

/* ── 输入模式提示 ────────────────────────────────────────────── */
.input-hint {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  min-height: 1.1rem;
}
.input-hint--outline { color: #7c3aed; }
.input-hint--topic   { color: var(--secondary); }

/* ── 预览区 ──────────────────────────────────────────────────── */
.preview-section h2 { margin-bottom: 1rem; }

.slideshow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.slide-frame {
  flex: 1;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.slide-nav {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 1.75rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.slide-nav:hover:not(:disabled) { background: #e2e8f0; }
.slide-nav:disabled { opacity: 0.25; cursor: not-allowed; }

.slide-counter {
  text-align: center;
  font-size: 0.85rem;
  color: var(--secondary);
  margin: 0.6rem 0 1rem;
}

/* ── 操作栏 ──────────────────────────────────────────────────── */
.action-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* ── 分享链接结果 ─────────────────────────────────────────────── */
.share-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.share-result a {
  color: var(--primary);
  font-weight: 600;
  word-break: break-all;
  flex: 1;
}

/* ── 修改建议区 ───────────────────────────────────────────────── */
.revision-area {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}
.revision-area h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.revision-area textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}
.revision-area textarea:focus { border-color: var(--primary); }

/* ── 代码折叠预览 ─────────────────────────────────────────────── */
.code-preview {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.code-preview summary {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--secondary);
  user-select: none;
  background: var(--bg);
}
.code-preview pre {
  max-height: 320px;
  overflow: auto;
  padding: 1rem;
  background: #0f172a;
  font-size: 0.8rem;
  line-height: 1.55;
}
.code-preview code { color: #e2e8f0; font-family: "Fira Code", "Cascadia Code", monospace; }

/* ── 资产下载区 ───────────────────────────────────────────────── */
.download-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.download-section .desc {
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.download-section .desc code {
  background: #f1f5f9;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow);
}
.asset-card--featured {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(37,99,235,0.12);
}
.asset-icon {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  line-height: 1;
}
.asset-card h3 { font-size: 1rem; font-weight: 700; }
.asset-card p  { font-size: 0.82rem; color: var(--muted); }
.dl-count      { font-size: 0.78rem; color: var(--secondary); }

/* ── Toast 通知 ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 骨架屏脉冲动画 ──────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton-pulse {
  background: linear-gradient(
    90deg,
    #e2e8f0 25%,
    #f1f5f9 50%,
    #e2e8f0 75%
  );
  background-size: 1200px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  min-height: 400px;
  border-radius: 10px;
}

/* ── 响应式 ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: 1; }
  .action-area { flex-direction: column; }
  .slideshow { gap: 0.4rem; }
  .slide-nav { width: 2.25rem; height: 2.25rem; font-size: 1.4rem; }
  .asset-grid { grid-template-columns: 1fr 1fr; }
}
