/* ============================================================
   payment.css — 支付页样式（Stripe Checkout 风格的清爽卡片设计）
   ============================================================ */

:root {
  --purple: #635bff;          /* Stripe 标志性的品牌紫 */
  --purple-dark: #5851d8;
  --navy: #32325d;            /* Stripe 风格的深藏青 */
  --ink: #3c4257;             /* 正文 */
  --muted: #8898aa;           /* 次要文字 */
  --bg: #f6f9fc;              /* Stripe 页面经典的蓝灰底色 */
  --border: #e6ebf1;
  --red: #fa755a;             /* 错误色 */
  --red-bg: #fef1ee;
  --green: #0e9f6e;
  --amber-bg: #fff4e5;
  --amber: #8a6d1a;
  --radius: 12px;
  --shadow: 0 6px 12px -4px rgba(50, 50, 93, .12), 0 3px 7px -3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.checkout {
  max-width: 460px;
  margin: 40px auto 60px;
  padding: 0 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  text-align: center;
}

.logo {
  font-weight: 800;
  font-size: 26px;
  color: var(--navy);
}

.secure {
  font-size: 13px;
  color: var(--muted);
}

/* 白色主面板 */
.panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.merchant {
  font-weight: 600;
  font-size: 15px;
  display: block;
  color: var(--navy);
}

.desc {
  font-size: 13px;
  color: var(--muted);
}

/* 表单 */
.field {
  display: block;
  margin-bottom: 18px;
}

.label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7c93;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: block;
}

input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input::placeholder { color: #b7c1cd; }

input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, .15);
}

input.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(250, 117, 90, .15);
}

.row {
  display: flex;
  gap: 16px;
}

.row .field { flex: 1; }

/* 卡号右侧的卡种徽标（注意：类名用 card-brand，不能和顶部品牌区 .brand 冲突） */
.card-brand {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .5px;
  pointer-events: none;
}

.card-brand.visa {
  color: #1a1f71;
  font-style: italic;
  font-family: Georgia, serif;
}

.card-brand.mastercard { display: flex; align-items: center; gap: 0; }
.card-brand.mastercard .mc-circle {
  width: 20px; height: 20px; border-radius: 50%;
}
.card-brand.mastercard .mc-circle.red { background: #eb001b; }
.card-brand.mastercard .mc-circle.orange { background: #f79e1b; margin-left: -8px; mix-blend-mode: multiply; }

.card-brand.amex {
  background: #2e77bc;
  color: #fff;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: Verdana, sans-serif;
  font-style: normal;
}

.card-brand.discover {
  background: #f6f7f8;
  color: #ff6600;
  border: 1px solid #ffb380;
  padding: 2px 5px;
  border-radius: 3px;
  font-style: normal;
}

.card-brand.unionpay {
  background: #0e47a5;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-style: normal;
}

/* 错误提示 */
.form-error {
  background: var(--red-bg);
  color: var(--red);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

/* 支付按钮 */
.pay-btn {
  width: 100%;
  padding: 14px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .05s;
}

.pay-btn:hover { background: var(--purple-dark); }
.pay-btn:active { transform: scale(.995); }
.pay-btn:disabled { opacity: .6; cursor: default; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.fine {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.6;
}

/* ============ 弹窗（验证码 / 结果） ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(50, 50, 93, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}

/* 关键：作者样式里的 display:flex 会覆盖 hidden 属性自带的 display:none，
   必须用这条规则把 hidden 状态抢回来，否则弹窗会一直挡在页面上 */
.overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  width: min(92vw, 420px);
  box-shadow: 0 15px 35px -10px rgba(50, 50, 93, .4);
  animation: pop .18s ease-out;
}

@keyframes pop {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(99, 91, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 14px;
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 20px;
  color: var(--navy);
  text-align: center;
}

.otp-desc {
  font-size: 14px;
  color: #6b7c93;
  line-height: 1.7;
  text-align: center;
  margin: 0;
}

/* 验证码输入框（单个整框直接输入） */
.otp-input {
  margin: 22px 0 0;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .25em;
  text-indent: .25em; /* 抵消末尾多余的字符间距，让内容视觉居中 */
  padding: 14px 10px;
}

.otp-error {
  color: var(--red);
  font-size: 13.5px;
  text-align: center;
  margin-top: 10px;
}

.otp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.countdown { font-size: 12.5px; color: var(--muted); }

.link-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px;
}

.link-btn:disabled { color: var(--muted); cursor: default; }

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-btn { flex: 1; width: auto; }

.ghost-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s;
}

.ghost-btn:hover { border-color: #cbd5e0; }

/* 结果页 */
.result { text-align: center; }

.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 16px;
}

.result-icon.ok   { background: #e6f7f0; }
.result-icon.fail { background: var(--red-bg); }

.result h2 { margin-bottom: 8px; }

#result-desc {
  font-size: 14px;
  color: #6b7c93;
  line-height: 1.7;
  margin: 0 0 20px;
}

/* 错误抖动动画（验证码输错时） */
.shake { animation: shake .3s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* 小屏适配 */
@media (max-width: 420px) {
  .otp-input { font-size: 20px; }
}
