/* ========== 全局基础（商务蓝灰配色） ========== */
:root {
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --border-subtle: #e5e7eb;
  --border-strong: #d1d5db;
  --text-main: #0f172a;
  --text-subtle: #6b7280;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #e0ecff;
  --danger: #e11d48;
  --radius-card: 16px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.16);
  --shadow-light: 0 10px 24px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100dvh;
  overscroll-behavior-x: none;
}


body {
  margin: 0;
  font-family: "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  background: linear-gradient(135deg, #f3f4f6 0%, #ffffff 40%, #e5e7eb 100%);
  color: var(--text-main);
}

/* ========== 应用布局 ========== */
.app {
  max-width: 960px;
  margin: 32px auto 40px;
  padding: 0 16px 40px;
}

/* 头部 + 品牌区 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  /* 让左侧 logo 与右侧标题文字顶部对齐 */
  align-items: flex-start;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 轻微下移，避免与标题顶部“贴得太紧” */
  margin-top: 2px;
}

/* 左上角 Logo 图片（替换原文字 Logo） */
.brand-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
  /* 轻微阴影，让深色线条在浅色背景上更清晰 */
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.18));
}

.brand-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 18px;
  background: radial-gradient(circle at 0% 0%, #eff6ff 0, #1d4ed8 40%, #0f172a 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.08em;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.45);
  border: 1px solid rgba(191, 219, 254, 0.6);
}

.brand-text h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #0f172a;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-subtle);
}

/* ========== 顶部状态提示条（高亮通知条风格） ========== */
.status-text {
  font-size: 13px;
  max-width: 360px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(249, 250, 251, 0.9);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: background-color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease, transform 0.12s ease;
}

.status-text::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
  flex-shrink: 0;
}

/* 默认 / 普通提示 */
.status-text.status-normal {
  color: #4b5563;
  border-color: #e5e7eb;
  background: #f9fafb;
}

/* 成功提示：绿色更显眼 */
.status-text.status-success {
  color: #166534;
  border-color: #bbf7d0;
  background: #ecfdf5;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.2);
}

.status-text.status-success::before {
  background: #22c55e;
}

/* 错误提示：红色 */
.status-text.status-error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
  box-shadow: 0 10px 24px rgba(248, 113, 113, 0.22);
}

.status-text.status-error::before {
  background: #ef4444;
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 18px 20px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-light);
  backdrop-filter: blur(6px);
  transition: box-shadow 0.18s ease, transform 0.18s ease,
    border-color 0.18s ease, background-color 0.18s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(37, 99, 235, 0.45);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
}

/* ========== 表单 ========== */
label {
  font-size: 14px;
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  color: #111827;
}

.required {
  color: var(--danger);
  font-size: 12px;
  margin-left: 2px;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-size: 14px;
  outline: none;
  background-color: #f9fafb;
  transition: border-color 0.16s ease, box-shadow 0.16s ease,
    background-color 0.16s ease, transform 0.08s ease;
}

input[type="text"]:hover,
input[type="number"]:hover {
  border-color: #cbd5f5;
  background-color: #ffffff;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25),
    0 0 0 6px rgba(191, 219, 254, 0.7);
  background-color: #ffffff;
  transform: translateY(-1px);
}

input::placeholder {
  color: #9ca3af;
}

.hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-subtle);
}

/* ========== 按钮 ========== */
.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: var(--text-main);
  transition: background-color 0.16s ease, transform 0.16s ease,
    box-shadow 0.16s ease, border-color 0.16s ease, opacity 0.1s ease;
  white-space: nowrap;
  user-select: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.9);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: #374151;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn.big {
  width: 100%;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
}

.btn.huge {
  padding: 12px 32px;
  font-size: 17px;
  font-weight: 600;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-dark), #0284c7);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* ========== 行布局 & 辅助类 ========== */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.align-center {
  align-items: center;
}
.mt-8 {
  margin-top: 8px;
}
.mt-16 {
  margin-top: 16px;
}
.center {
  text-align: center;
}

/* ========== 类型按钮 ========== */
.type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== 推荐标题 chips ========== */
.chips {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips span {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, transform 0.1s ease,
    border-color 0.16s ease, box-shadow 0.16s ease;
}

.chips span:hover {
  background: #e0edff;
  border-color: rgba(129, 140, 248, 0.7);
  box-shadow: 0 6px 14px rgba(148, 163, 184, 0.5);
  transform: translateY(-1px);
}

/* ========== 小圆 Loading：只显示百分比，无圈 ========== */
.loading-mini {
  display: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  min-width: 36px;
  text-align: center;
}

/* ========== 提纲区域头部（新增） ========== */
.outline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.outline-header h2 {
  margin: 0;
}

/* ========== 插入选项容器（新增） ========== */
.insert-options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 插入选项开关按钮样式（新增） */
.insert-toggle-btn {
  position: relative;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.insert-toggle-btn:hover {
  background: #eef2ff;
  border-color: #94a3b8;
}

/* 激活状态 */
.insert-toggle-btn.active,
.insert-toggle-btn[data-active="true"] {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.insert-toggle-btn.active:hover,
.insert-toggle-btn[data-active="true"]:hover {
  background: linear-gradient(135deg, var(--primary-dark), #2563eb);
}

/* ========== 提纲列表 ========== */
.outline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.outline-item {
  display: flex;
  align-items: center;
  gap: 6px;
}


.outline-item input {
  flex: 1;
  min-width: 0;
}

.outline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}


.outline-footer {
  margin-top: 8px;
}

/* ========== 论文生成进度容器（放在“论文要求”卡片里） ========== */
.paper-progress-host {
  margin-top: 10px;
}

/* ========== 提纲区域：折叠/展开动画（生成论文后自动收起） ========== */
#outline-section.collapsible {
  overflow: hidden;
  max-height: var(--outline-max-h, 99999px); /* 由 JS 动态计算，避免移动端内容被裁切 */
  opacity: 1;
  transition: max-height 0.38s ease, opacity 0.28s ease,
    margin 0.38s ease, padding 0.38s ease;
}

#outline-section.collapsible.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* 计时文字：直接隐藏，避免出现"计时未开始"等提示 */
.timer-text {
  display: none;
}

/* ========== 右下角论文生成进度小卡片 ========== */
.full-loading {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  background: rgba(255, 255, 255, 0.98);
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}

.loader {
  display: none;
}

#full-progress-text {
  margin: 0;
  font-size: 14px;
  color: #111827;
}

/* ========== 查询论文记录区域 ========== */
.card-record-panel {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.card-record-result {
  margin-top: 4px;
}

.card-record-info {
  font-size: 13px;
  color: #111827;
  margin-bottom: 6px;
}

.card-record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== 结果区 Word 图标 ========== */
.result {
  text-align: center;
}

.word-icon {
  width: 72px;
  height: 88px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 800;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 32px rgba(59, 130, 246, 0.4);
}

/* ========== 挂在按钮下面的论文进度区 ========== */
.paper-progress {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(249, 250, 251, 0.95);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.paper-progress-icon {
  width: 40px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-progress-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.paper-progress-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.paper-progress-percent {
  font-size: 13px;
  color: var(--primary-dark);
}

.paper-progress-hint {
  font-size: 12px;
  color: var(--text-subtle);
}

/* 小屏时让进度区更紧凑 */
@media (max-width: 768px) {
  .paper-progress {
    padding: 8px 10px;
  }

  .paper-progress-icon {
    width: 34px;
    height: 42px;
    font-size: 20px;
  }

  .paper-progress-title {
    font-size: 13px;
  }

  .paper-progress-percent,
  .paper-progress-hint {
    font-size: 12px;
  }
}

/* ========== 公共隐藏类 ========== */
.hidden {
  display: none !important;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .app {
    margin-top: 18px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .status-text {
    max-width: 100%;
  }

  .card {
    padding: 16px 14px 18px;
    border-radius: 14px;
  }

  .row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .btn.big {
    width: 100%;
  }

  .full-loading {
    right: 12px;
    bottom: 12px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  #full-progress-text {
    font-size: 13px;
  }

  /* 插入选项容器响应式 */
  .outline-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .insert-options-container {
    width: 100%;
    justify-content: flex-start;
  }

  /* iOS: avoid focus-zoom on inputs (font-size < 16px triggers zoom) */
  input, textarea, select { font-size: 16px; }

  /* Outline editor: mobile-first tidy layout */
  .outline-item { flex-wrap: wrap; align-items: center; }
  .outline-item input { flex: 1 1 100%; min-width: 0; }
  .outline-actions { width: 100%; display: flex; gap: 8px; justify-content: flex-end; }
  .outline-actions .btn.small.ghost { width: auto; padding: 6px 10px; font-size: 13px; line-height: 1.2; }
}

@media (max-width: 480px) {
  .brand {
    align-items: flex-start;
  }

  .brand-logo-img {
    width: 40px;
    height: 40px;
  }

  .brand-logo-mark {
    padding: 8px 12px;
    font-size: 14px;
  }

  .brand-text h1 {
    font-size: 22px;
  }
}

/* ============================
   小卡片式论文类型按钮
   ============================ */

.type-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.type-card-btn {
  width: 100%;
  padding: 16px 10px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #0f172a;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, transform 0.12s ease;
}

.type-card-btn:hover {
  background: #eef2ff;
  border-color: #94a3b8;
  box-shadow: 0 4px 10px rgba(33, 56, 110, 0.12);
  transform: translateY(-2px);
}

.type-card-btn.active {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #ffffff;
  border-color: #1e40af;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .type-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .type-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== 居中 Toast 提示（队列 + 柔和动画） ========== */

.status-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  min-width: 260px;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  color: #ffffff;
  background: #3B82F6; /* 默认普通提示：蓝色 */
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none; /* 隐藏时不挡点击 */
  z-index: 9999;
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(.18, .9, .25, 1);
}

/* 三种状态颜色 */
.status-normal {
  background: #3B82F6; /* 信息：蓝 */
}

.status-success {
  background: #16A34A; /* 成功：绿 */
}

.status-error {
  background: #DC2626; /* 错误：红 */
}

/* 出现（柔和） */
.status-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto; /* 显示时可以 hover 暂停 */
}

/* 消失：轻微上移 + 渐隐（500ms） */
.status-hide {
  opacity: 0;
  transform: translate(-50%, calc(-50% - 10px)) scale(0.95);
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

/* 针对小屏设备（最大宽度768px） */
@media (max-width: 768px) {
  .app {
    max-width: 100%;
    margin: 0;
    padding: 12px 12px 16px;
  }

/* 调整头部布局 */
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .status-text {
    max-width: 100%;
  }

  /* 修改卡片的 padding 和圆角 */
  .card {
    padding: 16px 14px 18px;
    border-radius: 14px;
  }

  .row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .btn.big {
    width: 100%;
  }

  /* Mobile：保持主要 CTA 按钮更易点击；不要强制 ghost 按钮全宽（提纲行内按钮需要紧凑） */
  .btn.huge {
    width: 100%;
  }

.full-loading {
    right: 12px;
    bottom: 12px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  #full-progress-text {
    font-size: 13px;
  }

  /* 调整论文类型按钮的布局 */
  .type-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* 提纲编辑：移动端避免横向溢出，输入框优先，按钮放到下一行右侧 */
  .outline-item {
    flex-wrap: wrap;
  }
  .outline-item input {
    flex: 1 1 100%;
  }
  .outline-actions {
    flex: 0 0 100%;
    justify-content: flex-end;
    gap: 8px;
  }
  .outline-actions .btn.small {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* 顶部插入选项按钮：更紧凑 */
  .insert-toggle-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

}


@media (max-width: 480px) {
  .brand {
    align-items: flex-start;
  }

  .brand-logo-mark {
    padding: 8px 12px;
    font-size: 14px;
  }

  .brand-text h1 {
    font-size: 22px;
  }
}

/* 左下角二维码样式（只在PC端显示） */
#qr-code-container {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 9999;
  display: block;
}

#qr-code-container img {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

#qr-text {
  position: absolute;
  bottom: -30px;
  left: 0;
  font-size: 12px;
  color: #333;
  text-align: center;
  font-weight: bold;
  width: 100%;
  margin-top: 5px;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 5px 10px;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 手机端样式：隐藏二维码并显示按钮 */
@media (max-width: 768px) {
  #qr-code-container {
    display: none;
  }

  #customer-service-btn {
    display: block;
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    padding: 12px 24px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    z-index: 9999;
  }
}

/* ICP 备案信息（页面底部） */
.icp-footer {
  margin-top: 18px;
  padding: 14px 16px;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  word-break: break-word;
}

.icp-footer .icp-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.icp-footer .sep {
  opacity: 0.7;
}

.icp-footer .icp-link {
  color: inherit;
  text-decoration: none;
}

.icp-footer .icp-link:hover {
  text-decoration: underline;
}
