/* 2026-10-26 下单弹窗 v2：只作用于 #shop-dialog（下单 / 收银 / 交付视图），商品列表不受影响。
   放在 custom-shop.hbs 最后加载；前面几层样式大量使用 !important，这里同样用
   「html body.is-shop-page #shop-dialog」前缀 + !important 收口。颜色全部走博客的 --fw-* 令牌，
   深色模式随主题自动切换。
   布局：整个弹窗单列滚动（不再有内层小滚动框），底部「确认订单」吸底。 */

html body.is-shop-page #shop-dialog {
  --ck-accent: var(--fw-primary, #e5484d);
  --ck-card: var(--fw-card, #fff);
  --ck-soft: color-mix(in srgb, var(--ck-accent) 6%, var(--ck-card));
  --ck-line: var(--fw-line, rgba(0,0,0,.08));
  --ck-text: var(--fw-text, #4b5563);
  --ck-deep: var(--fw-deep-text, #111827);
  width: min(560px, calc(100% - 32px)) !important;
  max-width: 560px !important;
  height: auto !important;
  max-height: min(88vh, 860px) !important;
  padding: 0 !important;
  overflow: hidden !important;
  color: var(--ck-text) !important;
  background: var(--ck-card) !important;
  border: 1px solid var(--ck-line) !important;
  border-radius: 22px !important;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .45) !important;
}
html body.is-shop-page #shop-dialog[open] { animation: ck-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes ck-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
html body.is-shop-page #shop-dialog::backdrop { background: rgba(10, 12, 20, .55) !important; backdrop-filter: blur(6px) !important; }

html body.is-shop-page #shop-dialog #shop-detail {
  display: block !important;
  height: auto !important;
  max-height: min(88vh, 860px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* 关闭按钮 */
html body.is-shop-page #shop-dialog .shop-close {
  top: 14px !important; right: 14px !important;
  width: 36px !important; height: 36px !important;
  display: grid !important; place-items: center !important;
  font-size: 22px !important; line-height: 1 !important;
  color: var(--ck-text) !important;
  background: color-mix(in srgb, var(--ck-card) 82%, transparent) !important;
  border: 1px solid var(--ck-line) !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
  transition: background-color .15s, color .15s, transform .15s !important;
}
html body.is-shop-page #shop-dialog .shop-close:hover { color: var(--ck-accent) !important; transform: rotate(90deg); }

/* ── 商品头部 ── */
html body.is-shop-page #shop-dialog .shop-detail-head {
  padding: 28px 28px 20px !important;
  background: linear-gradient(180deg, var(--ck-soft), var(--ck-card)) !important;
  border-bottom: 1px solid var(--ck-line) !important;
}
html body.is-shop-page #shop-dialog .shop-detail-head h2 {
  margin: 10px 48px 8px 0 !important;
  font-size: 1.45rem !important; line-height: 1.3 !important; font-weight: 800 !important;
  letter-spacing: -.02em !important; color: var(--ck-deep) !important;
}
html body.is-shop-page #shop-dialog .shop-detail-head p {
  margin: 0 !important;
  font-size: .9rem !important; line-height: 1.75 !important;
  color: var(--ck-text) !important;
  white-space: pre-line !important;   /* 后台填写的换行按行显示 */
}

/* ── 表单主体 ── */
html body.is-shop-page #shop-dialog .shop-checkout {
  display: block !important; height: auto !important; overflow: visible !important;
  margin: 0 !important; padding: 0 !important; background: transparent !important;
}
html body.is-shop-page #shop-dialog .shop-checkout-body {
  height: auto !important; max-height: none !important; overflow: visible !important;
  padding: 22px 28px 6px !important; background: transparent !important;
}
html body.is-shop-page #shop-dialog .shop-checkout-body > label,
html body.is-shop-page #shop-dialog .shop-credentials label {
  display: block !important;
  margin: 0 0 16px !important;
  font-size: .82rem !important; font-weight: 700 !important; letter-spacing: .02em !important;
  color: var(--ck-deep) !important;
}
html body.is-shop-page #shop-dialog .shop-checkout-body input:not([type=radio]):not([type=hidden]),
html body.is-shop-page #shop-dialog .shop-checkout-body textarea,
html body.is-shop-page #shop-dialog .shop-checkout-body select {
  display: block !important; width: 100% !important; box-sizing: border-box !important;
  margin-top: 7px !important; padding: 12px 14px !important;
  font: inherit !important; font-size: .95rem !important; font-weight: 500 !important;
  color: var(--ck-deep) !important;
  background: var(--ck-card) !important;
  border: 1.5px solid var(--ck-line) !important; border-radius: 12px !important;
  box-shadow: none !important; outline: none !important;
  transition: border-color .15s, box-shadow .15s !important;
}
html body.is-shop-page #shop-dialog .shop-checkout-body textarea { min-height: 88px !important; resize: vertical; }
html body.is-shop-page #shop-dialog .shop-checkout-body input:not([type=radio]):focus,
html body.is-shop-page #shop-dialog .shop-checkout-body textarea:focus {
  border-color: var(--ck-accent) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ck-accent) 14%, transparent) !important;
}
html body.is-shop-page #shop-dialog .shop-credentials {
  margin: 0 0 16px !important; padding: 16px !important;
  background: var(--ck-soft) !important;
  border: 1px solid color-mix(in srgb, var(--ck-accent) 18%, var(--ck-line)) !important;
  border-radius: 14px !important;
}
html body.is-shop-page #shop-dialog .shop-credentials > strong { display: block; color: var(--ck-deep) !important; font-size: .92rem !important; }
html body.is-shop-page #shop-dialog .shop-credentials > p { margin: 4px 0 12px !important; font-size: .82rem !important; line-height: 1.6 !important; }
html body.is-shop-page #shop-dialog .shop-credentials label:last-child { margin-bottom: 0 !important; }
html body.is-shop-page #shop-dialog .shop-checkout-body select { height: auto !important; cursor: pointer; }
html body.is-shop-page #shop-dialog .shop-checkout-body select option { color: var(--ck-deep); background: var(--ck-card); }
html body.is-shop-page #shop-dialog .shop-xgift-check {
  padding: 8px 14px !important; font-size: .82rem !important; font-weight: 700 !important;
  color: var(--ck-accent) !important; background: var(--ck-card) !important;
  border: 1.5px solid color-mix(in srgb, var(--ck-accent) 35%, var(--ck-line)) !important; border-radius: 10px !important;
  box-shadow: none !important; cursor: pointer !important;
}

/* ── 支付方式：整行可点，左名称右金额 ── */
html body.is-shop-page #shop-dialog .shop-methods {
  display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important;
  margin: 8px 0 14px !important;
}
html body.is-shop-page #shop-dialog .shop-method {
  position: relative !important;
  display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 12px !important;
  min-height: 0 !important; margin: 0 !important; padding: 13px 16px !important;
  font-weight: 600 !important; color: var(--ck-deep) !important;
  background: var(--ck-card) !important;
  border: 1.5px solid var(--ck-line) !important; border-radius: 14px !important;
  box-shadow: none !important; transform: none !important;
  cursor: pointer !important;
  transition: border-color .15s, background-color .15s !important;
}
html body.is-shop-page #shop-dialog .shop-method:hover { border-color: color-mix(in srgb, var(--ck-accent) 45%, var(--ck-line)) !important; }
html body.is-shop-page #shop-dialog .shop-method:has(input:checked) {
  background: var(--ck-soft) !important;
  border-color: var(--ck-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ck-accent) 12%, transparent) !important;
}
html body.is-shop-page #shop-dialog .shop-method span {
  display: flex !important; align-items: center !important; gap: 10px !important;
  min-width: 0 !important; font-size: .92rem !important; font-weight: 650 !important; line-height: 1.35 !important;
  color: var(--ck-deep) !important;
}
html body.is-shop-page #shop-dialog .shop-method input[type=radio] {
  flex: 0 0 auto !important; width: 18px !important; height: 18px !important; margin: 0 !important;
  accent-color: var(--ck-accent);
}
html body.is-shop-page #shop-dialog .shop-method strong {
  flex: 0 0 auto !important; white-space: nowrap !important;
  font-size: .98rem !important; font-weight: 800 !important; font-variant-numeric: tabular-nums;
  color: var(--ck-accent) !important;
}

/* ── 底部：吸底提交区 ── */
html body.is-shop-page #shop-dialog .shop-checkout-footer {
  position: sticky !important; bottom: 0 !important; z-index: 3 !important;
  height: auto !important;
  padding: 12px 28px 18px !important;
  background: color-mix(in srgb, var(--ck-card) 94%, transparent) !important;
  border-top: 1px solid var(--ck-line) !important;
  backdrop-filter: blur(10px);
}
html body.is-shop-page #shop-dialog .shop-turnstile { margin: 0 0 10px !important; display: flex; justify-content: center; }
html body.is-shop-page #shop-dialog .shop-turnstile:empty,
html body.is-shop-page #shop-dialog .shop-turnstile:not(:has(iframe)) { margin: 0 !important; }
html body.is-shop-page #shop-dialog .shop-submit,
html body.is-shop-page #shop-dialog .shop-paypal-button {
  display: flex !important; align-items: center !important; justify-content: center !important;
  width: 100% !important; height: 52px !important; margin: 0 !important; box-sizing: border-box !important;
  font-size: 1rem !important; font-weight: 800 !important; letter-spacing: .04em !important;
  color: #fff !important; text-decoration: none !important;
  background: var(--ck-accent) !important; background-image: none !important;
  border: 0 !important; border-radius: 14px !important;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--ck-accent) 70%, transparent) !important;
  cursor: pointer !important;
  transition: filter .15s, transform .15s !important;
}
html body.is-shop-page #shop-dialog .shop-submit:hover:not(:disabled),
html body.is-shop-page #shop-dialog .shop-paypal-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
html body.is-shop-page #shop-dialog .shop-submit:disabled { opacity: .65 !important; cursor: progress !important; transform: none !important; }
html body.is-shop-page #shop-dialog .shop-safe {
  margin: 10px 0 0 !important; text-align: center !important;
  font-size: .75rem !important; color: color-mix(in srgb, var(--ck-text) 75%, transparent) !important;
}
html body.is-shop-page #shop-dialog .shop-pay-error {
  margin: 0 0 10px !important; padding: 10px 14px !important;
  font-size: .85rem !important; font-weight: 600 !important; line-height: 1.5 !important;
  color: #c62828 !important;
  background: color-mix(in srgb, #e53935 9%, var(--ck-card)) !important;
  border: 1px solid color-mix(in srgb, #e53935 25%, transparent) !important;
  border-radius: 12px !important;
}

/* ── 收银 / 交付视图 ── */
html body.is-shop-page #shop-dialog .shop-pay-head {
  padding: 26px 28px 20px !important; text-align: center !important;
  color: var(--ck-deep) !important;
  background: linear-gradient(180deg, var(--ck-soft), var(--ck-card)) !important;
  border-bottom: 1px solid var(--ck-line) !important;
}
html body.is-shop-page #shop-dialog .shop-pay-head > span {
  display: inline-block !important; padding: 3px 10px !important;
  font-size: .72rem !important; font-weight: 700 !important; letter-spacing: .06em !important;
  color: var(--ck-accent) !important;
  background: color-mix(in srgb, var(--ck-accent) 11%, transparent) !important;
  border-radius: 999px !important;
}
html body.is-shop-page #shop-dialog .shop-pay-head h2 { margin: 10px 0 4px !important; font-size: 1.3rem !important; color: var(--ck-deep) !important; }
html body.is-shop-page #shop-dialog .shop-pay-head p { margin: 0 !important; font-size: .85rem !important; color: var(--ck-text) !important; }
html body.is-shop-page #shop-dialog .shop-pay-body { padding: 22px 28px 26px !important; text-align: center !important; color: var(--ck-text) !important; }
html body.is-shop-page #shop-dialog .shop-pay-amount {
  font-size: 2rem !important; font-weight: 900 !important; letter-spacing: -.02em !important;
  font-variant-numeric: tabular-nums; color: var(--ck-deep) !important;
}
html body.is-shop-page #shop-dialog .shop-pay-qr {
  display: block !important; width: 220px !important; height: 220px !important; max-width: 100% !important;
  margin: 18px auto !important; padding: 10px !important; box-sizing: border-box !important;
  background: #fff !important; border: 1px solid var(--ck-line) !important; border-radius: 18px !important;
}
html body.is-shop-page #shop-dialog .shop-pay-address {
  margin: 14px 0 !important; padding: 14px !important; text-align: left !important;
  background: var(--ck-soft) !important; border: 1px solid var(--ck-line) !important; border-radius: 14px !important;
}
html body.is-shop-page #shop-dialog .shop-pay-address strong { font-size: .8rem !important; color: var(--ck-deep) !important; }
html body.is-shop-page #shop-dialog #shop-wallet {
  margin: 6px 0 10px !important; font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: .82rem !important; line-height: 1.55 !important; word-break: break-all !important; color: var(--ck-deep) !important;
}
html body.is-shop-page #shop-dialog .shop-copy {
  width: 100% !important; padding: 9px !important; font-weight: 700 !important;
  color: var(--ck-accent) !important; background: var(--ck-card) !important;
  border: 1.5px solid color-mix(in srgb, var(--ck-accent) 35%, var(--ck-line)) !important; border-radius: 10px !important;
  cursor: pointer !important;
}
html body.is-shop-page #shop-dialog .shop-wait {
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 9px !important;
  margin: 16px 0 4px !important; font-size: .85rem !important; color: var(--ck-text) !important;
}
html body.is-shop-page #shop-dialog .shop-wait::before {
  content: "" !important; width: 9px !important; height: 9px !important; flex: 0 0 9px;
  border-radius: 50% !important; background: #16a34a !important;
  box-shadow: 0 0 0 5px rgba(22, 163, 74, .15) !important;
  animation: ck-pulse 1.4s ease-in-out infinite;
}
@keyframes ck-pulse { 50% { opacity: .35; } }
html body.is-shop-page #shop-dialog .shop-result-icon {
  display: grid !important; place-items: center !important;
  width: 60px !important; height: 60px !important; margin: 0 auto 10px !important;
  font-size: 30px !important; font-weight: 900 !important;
  color: #16a34a !important; background: rgba(22, 163, 74, .12) !important; border-radius: 50% !important;
}

/* ── 手机：底部抽屉 ── */
@media (max-width: 600px) {
  html body.is-shop-page #shop-dialog {
    width: 100% !important; max-width: 100% !important;
    max-height: 92vh !important; margin: auto 0 0 !important;
    border-radius: 22px 22px 0 0 !important; border-bottom: 0 !important;
  }
  html body.is-shop-page #shop-dialog[open] { animation: ck-up .25s cubic-bezier(.2,.8,.2,1); }
  @keyframes ck-up { from { transform: translateY(40px); opacity: .4; } }
  html body.is-shop-page #shop-dialog #shop-detail { max-height: 92vh !important; }
  html body.is-shop-page #shop-dialog .shop-detail-head { padding: 22px 18px 16px !important; }
  html body.is-shop-page #shop-dialog .shop-detail-head p { font-size: .85rem !important; }
  html body.is-shop-page #shop-dialog .shop-checkout-body { padding: 18px 18px 4px !important; }
  html body.is-shop-page #shop-dialog .shop-checkout-footer { padding: 10px 18px calc(14px + env(safe-area-inset-bottom)) !important; }
  html body.is-shop-page #shop-dialog .shop-pay-body { padding: 18px 18px 22px !important; }
  html body.is-shop-page #shop-dialog .shop-pay-qr { width: 200px !important; height: 200px !important; }
}
@media (prefers-reduced-motion: reduce) {
  html body.is-shop-page #shop-dialog[open], html body.is-shop-page #shop-dialog .shop-wait::before { animation: none !important; }
}
