/* ============================================================
   Finda 业务站对接示例站 —— 样式
   无构建步骤：纯手写 CSS，深色 Hero + 白卡片，移动端优先
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --accent: #10b981;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-sub: #6b7280;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }
code { font-family: var(--font-mono); font-size: .9em; background: #eef1f8; padding: 1px 5px; border-radius: 5px; }
.mono { font-family: var(--font-mono); }

/* ---------- header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 800; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-sub); letter-spacing: .04em; }
.main-nav { display: flex; gap: 6px; }
.main-nav a {
  text-decoration: none; color: var(--text-sub); font-size: 14px; font-weight: 500;
  padding: 7px 13px; border-radius: 8px;
}
.main-nav a:hover { background: #f1f3f9; color: var(--text); }
.main-nav a.active { background: #eef0fe; color: var(--primary); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4f46e5 100%);
  color: #fff; border-radius: 20px; padding: 40px 36px; margin: 28px 0;
}
.hero-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: #a5b4fc; margin: 0 0 10px; }
.hero h1 { font-size: 30px; line-height: 1.25; margin: 0 0 12px; }
.hero-desc { color: #c7d2fe; font-size: 15px; margin: 0; max-width: 46ch; }
.hero-card {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px; padding: 22px; backdrop-filter: blur(4px);
}
.plan-price { font-size: 34px; font-weight: 800; }
.plan-price span { font-size: 15px; font-weight: 500; color: #c7d2fe; }
.plan-price .currency { font-size: 18px; font-weight: 600; color: #c7d2fe; margin-right: 4px; }
.plan-product { margin: 6px 0 12px; font-size: 14.5px; color: #e0e7ff; font-weight: 600; }
.plan-points { margin: 14px 0 0; padding: 0; list-style: none; color: #e0e7ff; font-size: 14px; }
.plan-points li { padding: 4px 0; }
.plan-points li::before { content: "✓ "; color: #34d399; font-weight: 700; }

/* ---------- cards & forms ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px; margin-bottom: 22px;
}
.card-muted { background: #fafbfe; }
.card-title h2 { margin: 0 0 4px; font-size: 19px; }
.card-title p { margin: 0 0 14px; color: var(--text-sub); font-size: 13.5px; }

.form-row { margin-bottom: 16px; }
.form-row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }
input[type="text"], input[type="number"], input[type="email"] {
  width: 100%; padding: 10px 12px; border: 1px solid #d3d9e4; border-radius: 9px;
  font-size: 14.5px; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .13); }
.hint { margin: 5px 0 0; font-size: 12px; color: var(--text-sub); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid #d3d9e4; background: #fff;
  color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f3f4f8; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-warn { background: #fff7ed; border-color: #fcd34d; color: #b45309; }
.btn-warn:hover { background: #ffedd5; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.inline-form { display: inline-block; }

/* ---------- mode toggle (单次支付 / 试用订阅) ---------- */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 22px; }
.mode-tab {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1.5px solid #d3d9e4; border-radius: 11px; text-decoration: none; color: var(--text);
  background: #fff; transition: border-color .15s, background .15s, box-shadow .15s;
}
.mode-tab:hover { border-color: var(--primary); background: #f8fafc; }
.mode-tab.active { border-color: var(--primary); background: #eef0fe; box-shadow: 0 0 0 3px rgba(79, 70, 229, .10); }
.mode-tab-title { font-size: 15px; font-weight: 700; }
.mode-tab-desc { font-size: 12.5px; color: var(--text-sub); }
.mode-tab.active .mode-tab-desc { color: var(--primary); }

@media (max-width: 720px) {
  .mode-toggle { grid-template-columns: 1fr; }
}

/* ---------- order result ---------- */
.order-status-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.order-no { font-size: 21px; font-weight: 700; margin: 0; word-break: break-all; }
.label { font-size: 12px; color: var(--text-sub); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }
.badge {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-mode { background: #eef0fe; color: var(--primary); margin-right: 4px; }
.badge-stack { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.sub-id { color: var(--primary); font-weight: 700; }
.subscription-banner { background: linear-gradient(135deg, #eef0fe 0%, #ecfdf5 100%); border-color: #c7d2fe; color: #1e1b4b; }
.order-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 20px; margin-bottom: 20px; }
.order-grid .label { display: block; }
.order-grid > div { min-width: 0; }
.order-grid .mono { overflow-wrap: anywhere; }
.checkout-url-box { background: #f6f8fc; border: 1px dashed #c7d0e0; border-radius: 10px; padding: 12px 14px; margin-bottom: 20px; }
.url-line { display: flex; align-items: center; gap: 10px; }
.url-line code { flex: 1; overflow-wrap: anywhere; background: transparent; padding: 0; font-size: 13.5px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.paid-banner {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 12px 14px; font-size: 14px;
}
.flush-details { margin-top: 12px; font-size: 13px; }
.flush-details pre { background: #0f172a; color: #cbd5e1; border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12.5px; }

/* ---------- notifications ---------- */
.notify-item { border: 1px solid var(--border); border-radius: 11px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.notify-item summary {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; list-style: none;
}
.notify-item summary::-webkit-details-marker { display: none; }
.notify-item summary:hover { background: #f8fafc; }
.notify-event { font-weight: 700; font-size: 13.5px; color: var(--primary); background: #eef0fe; padding: 3px 9px; border-radius: 999px; }
.notify-order { font-size: 13px; }
.notify-time { margin-left: auto; color: var(--text-sub); font-size: 12.5px; }
.notify-body { border-top: 1px solid var(--border); padding: 14px 16px; }
.json-block {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
}
.empty-box { text-align: center; color: var(--text-sub); padding: 26px 0 10px; }
.empty-box p { margin: 4px 0; }

/* ---------- flash ---------- */
.flash { border-radius: 11px; padding: 13px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.flash-line { margin-top: 4px; opacity: .9; }
.flash-line code { background: rgba(0,0,0,.06); }

/* ---------- flow steps ---------- */
.flow-steps { margin: 0; padding-left: 20px; font-size: 14px; }
.flow-steps li { padding: 5px 0; }
.flow-steps code { background: #eef1f8; }

/* ---------- 极简「支付」按钮首页 ---------- */
.hero-simple { margin: 22px 0 18px; }
.pay-card { padding: 24px 28px 22px; }
.pay-summary { list-style: none; padding: 0; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 11px; background: #fafbfe; overflow: hidden; }
.pay-summary li { display: flex; gap: 12px; align-items: baseline; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.pay-summary li:last-child { border-bottom: none; }
.pay-summary .label { min-width: 88px; margin: 0; }
.pay-summary .mono { font-family: var(--font-mono); font-size: 13px; color: var(--text); word-break: break-all; }
.pay-email-row { margin-bottom: 14px; }
.btn-pay { padding: 15px; font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.pay-hint { margin: 14px 0 0; color: var(--text-sub); font-size: 12.5px; line-height: 1.6; }
.pay-hint code { background: #eef1f8; padding: 1px 5px; border-radius: 4px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 30px; padding: 22px 0 30px; color: var(--text-sub); font-size: 13px; }
.site-footer p { margin: 3px 0; }
.footer-sub code { background: transparent; color: var(--text-sub); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding: 28px 22px; }
  .hero h1 { font-size: 24px; }
  .form-row-split { grid-template-columns: 1fr; gap: 0; }
  .order-grid { grid-template-columns: 1fr 1fr; }
  .notify-item summary { flex-wrap: wrap; }
  .notify-time { margin-left: 0; width: 100%; }
}

/* ---------- 商品目录卡片网格（从中控 /api/products 拉） ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 4px 0 18px;
}
.product-card {
  position: relative;
  display: block;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: #fff;
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s, transform .05s;
  user-select: none;
}
.product-card:hover {
  border-color: var(--primary);
  background: #fafbff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .08);
}
.product-card:active { transform: translateY(1px); }
.product-card.is-selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #eef0fe 0%, #f5f3ff 100%);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
.product-card.is-selected::after {
  content: "";
  position: absolute; top: 10px; right: 10px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .2);
}
.product-radio {
  position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}
.product-card-top { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.product-card-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 4px 0 6px; line-height: 1.35;
}
.product-card-desc {
  font-size: 12.5px; color: var(--text-sub); line-height: 1.5;
  margin: 0 0 12px; min-height: 36px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-price {
  display: flex; align-items: baseline; gap: 4px;
  font-size: 24px; font-weight: 800; color: var(--text);
  margin-bottom: 10px;
}
.product-card-price .currency { font-size: 14px; font-weight: 600; color: var(--text-sub); margin-right: 2px; }
.product-card-price .period { font-size: 12.5px; font-weight: 500; color: var(--text-sub); margin-left: 4px; }
.product-card-meta {
  list-style: none; padding: 0; margin: 0 0 12px;
  border-top: 1px dashed var(--border); padding-top: 10px;
}
.product-card-meta li {
  display: flex; gap: 8px; align-items: baseline; padding: 3px 0;
  font-size: 12.5px;
}
.product-card-meta li > span { color: var(--text-sub); min-width: 64px; }
.product-card-meta li code { font-size: 11.5px; word-break: break-all; }
.product-card-pick {
  text-align: center; font-size: 13px; font-weight: 700;
  color: var(--primary);
  padding: 7px 10px; border-radius: 8px;
  background: #eef0fe; transition: background .15s, color .15s;
}
.product-card.is-selected .product-card-pick { background: var(--primary); color: #fff; }

.badge-channel { font-size: 11.5px; letter-spacing: .04em; }
.badge-stripe { background: #635bff; color: #fff; }
.badge-antom { background: #1677ff; color: #fff; }
.badge-fastspring { background: #7c3aed; color: #fff; }
.badge-mode-sub { background: #ecfdf5; color: #047857; }
.badge-mode-pay { background: #fef3c7; color: #92400e; }

.pay-form-section { margin-top: 4px; }
.empty-state {
  text-align: center; padding: 32px 12px;
  color: var(--text-sub); font-size: 14px;
  background: #fafbfe; border: 1px dashed #d3d9e4; border-radius: 12px;
}
.empty-state p { margin: 6px 0; }
.empty-state .hint { font-size: 12.5px; }

@media (max-width: 540px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-card-desc { min-height: 0; -webkit-line-clamp: 3; }
}
