/* ============================================================
   爆款文案生成器 · 纯静态版样式
   移植自 frontend/src/app/globals.css（Apple 风格），去掉 AntD 依赖
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.08);
  --green: #34c759;
  --red: #ff3b30;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 980px;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration: none; }

.page-shell {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(0, 113, 227, 0.06), transparent 60%),
    var(--bg);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.apple-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.apple-card-solid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.display-title {
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1d1d1f !important;
  margin: 0;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.47;
  margin: 8px 0 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(245, 245, 247, 0.88);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 56px;
  gap: 12px;
  flex-wrap: nowrap !important;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.brand-name {
  font-size: 15px;
  font-weight: 650;
  color: #1d1d1f;
  white-space: nowrap;
}

.topbar-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px;
  flex: 0 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: min(70vw, 520px);
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3d3d3f, #1d1d1f);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---- 按钮 ---- */
.btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 510;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:active { transform: scale(0.97); }

.btn-text:hover { background: rgba(0, 0, 0, 0.04); color: var(--text); }

.btn-primary {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #fff !important;
}
.btn-primary:hover { background: var(--blue-hover) !important; }

.btn-default {
  background: #fff !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}
.btn-default:hover { border-color: #0071e3; color: var(--blue); }

.btn-block { display: block; width: 100%; }

.btn-lg { padding: 13px 20px; font-size: 16px; font-weight: 600; height: 48px; }

.btn-sm { padding: 4px 12px; font-size: 13px; }

.nav-btn {
  flex: 0 0 auto;
  color: #1d1d1f !important;
  white-space: nowrap;
}

/* ---- 标签 / 徽章 ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f2f2f4;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-score { background: rgba(0, 113, 227, 0.1); color: #0071e3; }
.tag-chip { border: 1px solid var(--border); background: #fff; }

.hot-tag {
  padding: 4px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #6e6e73;
  background: #fff;
  font-size: 12px;
  border-radius: 999px;
}

/* ---- 表单 ---- */
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input, .select, .textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input, .select { min-height: 44px; padding: 0 14px; }
.textarea { padding: 12px 14px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2386868b' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* checkbox chips（复选组：类型/风格） */
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.check-chip input { display: none; }
.check-chip.checked {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--text);
  font-weight: 600;
}
.check-chip.checked::before {
  content: "✓";
  font-weight: 700;
  color: var(--blue);
}

/* ---- 布局 ---- */
.main-wrap { padding: 20px 0 28px; }

.hero { text-align: center; margin-bottom: 16px; padding: 4px 8px 0; }

.hot-row { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.template-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
@media (min-width: 992px) {
  .template-row { justify-content: center; flex-wrap: wrap; overflow: visible; }
}

@media (max-width: 991px) {
  .layout-grid { grid-template-columns: 1fr; }
  .container { width: min(1120px, calc(100% - 24px)); }
  .mobile-sticky-cta { position: sticky; bottom: 12px; z-index: 30; }
  .brand-name { font-size: 14px; }
  .topbar-actions { max-width: 62vw; }
}

/* ---- 卡片 ---- */
.section-title { font-size: 15px; font-weight: 650; color: var(--text); margin: 0 0 14px; }
.soft-divider { height: 1px; background: var(--border); margin: 18px 0; }

.pad-lg { padding: 22px; }
.pad-xl { padding: 36px; }

.result-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.result-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.result-card { margin-bottom: 14px; padding: 18px; }

.result-title { font-size: 17px; font-weight: 650; margin: 12px 0; color: #1d1d1f; }

.spoken-box {
  background: #fbfbfd;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.75;
  white-space: pre-line;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
}

.sub-box {
  white-space: pre-line;
  color: #6e6e73;
  font-size: 13px;
  margin: 10px 0;
}

.scene-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fbfbfd;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.scene-time-col { min-width: 56px; text-align: center; }
.scene-time-label { font-size: 12px; color: #86868b; }
.scene-time { font-size: 12px; color: #0071e3; font-weight: 600; }
.scene-body { flex: 1; font-size: 13px; color: #1d1d1f; line-height: 1.55; }
.scene-body .dim { color: #6e6e73; }
.scene-body .tone { color: #86868b; }

.result-actions {
  display: flex;
  gap: 4px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- 进度 ---- */
.progress-wrap { margin-bottom: 14px; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e9e9ed;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  transition: width 0.4s ease;
}
.progress-text { text-align: center; color: #6e6e73; font-size: 13px; margin-top: 8px; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  width: min(720px, 100%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-weight: 650;
  font-size: 16px;
  color: var(--text);
}
.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
}
.modal-close:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.modal-body { padding: 4px 16px 16px; overflow-y: auto; }

.hidden { display: none !important; }

/* ---- 历史/收藏 ---- */
.his-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  background: #fff;
}
.his-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.his-meta { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.his-spoken {
  font-size: 13px;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.6;
  max-height: 96px;
  overflow: hidden;
}
.his-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---- 提示 toast ---- */
.toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #323234;
  color: #fff;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.22s ease;
  max-width: 90vw;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 空态 ---- */
.empty {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ---- 折叠（高级选项） ---- */
.collapse {
  background: #fbfbfd;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
.collapse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.collapse-body { padding: 0 16px 14px; }
.collapse-arrow { transition: transform 0.2s ease; color: var(--text-tertiary); font-size: 12px; }
.collapse.open .collapse-arrow { transform: rotate(180deg); }
.collapse-body .field { margin-bottom: 10px; }

.footer-note {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 28px 16px 40px;
}

.loading-dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
