/* StratSapien Web App - Tailwind-inspired custom styles */
/* Teal brand palette inherited from main site */

:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --yellow-500: #eab308;
  --amber-500: #f59e0b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* List styling for reports */
#report-body ul, #report-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
#report-body li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
#report-body ul ul, #report-body ol ol, #report-body ul ol, #report-body ol ul {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-left: 1.5rem;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal-700);
  text-decoration: none;
}
.logo:hover { color: var(--teal-600); }
.header-nav { display: flex; align-items: center; gap: 1rem; }
.header-nav a {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.875rem;
}
.header-nav a:hover { color: var(--teal-600); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary {
  background: var(--teal-600);
  color: white;
}
.btn-primary:hover { background: var(--teal-700); }
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--teal-500); color: var(--teal-600); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Cards */
.card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
}
.card-hover:hover {
  border-color: var(--teal-300);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-teal { background: var(--teal-100); color: var(--teal-800); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-200); }

/* Steps / Progress */
.step-list { list-style: none; }
.step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.step-num-done { background: var(--teal-100); color: var(--teal-700); }
.step-num-current { background: var(--teal-600); color: white; }
.step-num-pending { background: var(--gray-200); color: var(--gray-500); }
.step-num-current { background: var(--teal-500); color: white; animation: pulse 1.5s ease infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal-400), var(--teal-600)); border-radius: 4px; transition: width 0.5s ease; }

/* Inline spinner */
.spinner-inline {
  display: inline-block; width: 1rem; height: 1rem;
  border: 2px solid var(--gray-200); border-top-color: var(--teal-600);
  border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle;
}

/* Loading spinner */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--gray-200);
  border-top-color: var(--teal-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 0 0.75rem; }
  .header-inner { flex-direction: column; gap: 0.5rem; }
  .header-nav { flex-wrap: wrap; justify-content: center; }
  .card { padding: 1rem; }
  .btn { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
  .mode-grid { grid-template-columns: 1fr !important; }
  .dashboard-item { flex-direction: column; align-items: flex-start !important; }
  textarea.form-input { min-height: 120px; }
  footer .text-sm { font-size: 0.75rem; }

  /* 下拉菜单：小屏贴边显示 */
  .dropdown-menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
  }

  /* 报告页：按钮组垂直排列 */
  .report-actions {
    flex-direction: column;
    width: 100%;
  }
  .report-actions .btn { width: 100%; }

  /* 报告页按钮组 */
  .report-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

  /* 进度条文字截断 */
  #progress-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 步骤列表紧凑 */
  .step-list .step-item { gap: 0.5rem; padding: 0.5rem 0; }
}

@media (max-width: 480px) {
  .hero-section { padding: 1.5rem 0 !important; }
  .hero-section h1 { font-size: 1.5rem !important; }
  .comparison-table { overflow-x: auto; display: block; }
  #report-body { font-size: 0.8125rem; }
  footer { padding: 1rem 0 !important; font-size: 0.75rem !important; }
  .site-footer { padding: 1rem 0 !important; font-size: 0.75rem !important; }
}

/* Utility: mode selection grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* Dropdown menu */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 180px;
  padding: 0.5rem 0;
  z-index: 200;
  max-width: 90vw;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  color: var(--gray-700);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}
/* 手机号显示为 block（非链接文本） */
.dropdown-menu .dropdown-phone {
  display: block;
  width: 100%;
  padding: 0.25rem 1rem;
  text-align: left;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: var(--gray-50);
  color: var(--teal-600);
}
.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 0.25rem 0;
}
.dropdown-phone {
  font-size: 0.75rem;
  color: var(--gray-400);
}
.dropdown-logout {
  color: var(--red-600);
}
.quota-badge {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 400;
  display: inline;
}

/* Markdown report tables — 手机端可横向滚动 */
#report-body table,
.step-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}
/* 报告表格容器 — 小屏横向滚动 */
#report-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#report-body th,
#report-body td,
.step-content th,
.step-content td {
  border: 1px solid var(--gray-200);
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
}
#report-body th,
.step-content th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}
#report-body tr:nth-child(even),
.step-content tr:nth-child(even) {
  background: #fafafa;
}
#report-body tr:hover,
.step-content tr:hover {
  background: var(--gray-50);
}

/* Markdown report headings */
#report-body h1,
.step-content h1 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; }
#report-body h2,
.step-content h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
#report-body h3,
.step-content h3 { font-size: 1.125rem; margin: 1rem 0 0.5rem; }
#report-body h4,
.step-content h4 { font-size: 1rem; margin: 0.75rem 0 0.5rem; }

/* Markdown report blockquotes */
#report-body blockquote,
.step-content blockquote {
  border-left: 3px solid var(--teal-500);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: var(--gray-50);
  border-radius: 0 4px 4px 0;
  color: var(--gray-600);
}

/* Markdown report horizontal rules */
#report-body hr,
.step-content hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 1.5rem 0;
}

/* Markdown report code */
#report-body code,
.step-content code {
  background: var(--gray-100);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.8125rem;
}

/* Markdown report block code */
#report-body pre,
.step-content pre {
  background: var(--gray-50);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
}
#report-body pre code,
.step-content pre code {
  background: none;
  padding: 0;
}

/* Markdown report images */
#report-body img,
.step-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

/* Markdown report lists */
#report-body ul,
#report-body ol,
.step-content ul,
.step-content ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
#report-body li,
.step-content li {
  margin: 0.25rem 0;
}

/* Back-to-top button — 默认隐藏，滚动后显示 */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--teal-600);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 999;
  transition: opacity 0.2s, transform 0.2s;
}
.back-to-top:hover { background: var(--teal-700); transform: scale(1.1); }
.back-to-top.show { display: flex; align-items: center; justify-content: center; }

/* 手机端按钮稍大，更易点击 */
@media (max-width: 640px) {
  .back-to-top { width: 2.75rem; height: 2.75rem; bottom: 1rem; right: 1rem; font-size: 1.25rem; }
}

/* 退出确认模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  text-align: center;
}
.modal-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--teal-700); }
.modal-card p { margin: 0 0 1rem; font-size: 0.875rem; color: var(--gray-500); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: center; }

/* Mode card feature tags */
.mode-features {
    font-size: 0.7rem;
    color: var(--teal-600, #0d9488);
    font-weight: 500;
}

/* ========== Help Center Styles ========== */

/* 标题间距 */
.help-center h1 {
    font-size: 1.75rem;
    color: var(--teal-700);
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--teal-200);
}
.help-center h2 {
    font-size: 1.375rem;
    color: var(--teal-700);
    margin: 2rem 0 0.75rem;
}
.help-center h3 {
    font-size: 1.125rem;
    color: var(--gray-800);
    margin: 1.5rem 0 0.5rem;
}

/* 段落间距 */
.help-center p {
    margin: 0.75rem 0;
}

/* 列表缩进 */
.help-center ul,
.help-center ol {
    padding-left: 1.5rem;
    margin: 0.75rem 0;
}
.help-center li {
    margin-bottom: 0.375rem;
    line-height: 1.7;
}

/* 表格优化 — 更宽更舒适 */
.help-center table {
    margin: 1.25rem 0;
    font-size: 0.875rem;
    border-radius: 6px;
    overflow: hidden;
}
.help-center th {
    background: var(--teal-50);
    color: var(--teal-800);
    font-weight: 600;
    padding: 0.75rem 1rem;
}
.help-center td {
    padding: 0.625rem 1rem;
    line-height: 1.6;
}

/* 引用块 */
.help-center blockquote {
    border-left: 3px solid var(--teal-500);
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: 0 6px 6px 0;
    color: var(--gray-600);
    line-height: 1.7;
}

/* 代码 */
.help-center code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.8125rem;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
}

/* 链接 */
.help-center a {
    color: var(--teal-600);
    text-decoration: underline;
    text-decoration-color: var(--teal-200);
    transition: color 0.15s;
}
.help-center a:hover {
    color: var(--teal-800);
    text-decoration-color: var(--teal-600);
}

/* 分隔线 */
.help-center hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 2rem 0;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .help-center h1 { font-size: 1.5rem; }
    .help-center h2 { font-size: 1.25rem; }
    .help-center h3 { font-size: 1rem; }
    .help-center table { font-size: 0.75rem; }
    .help-center th,
    .help-center td { padding: 0.5rem 0.625rem; }
}
