/* VFX Payment — Premium Redesign 20261003
   Deep tonal surfaces, luminous accents, refined spacing, elevated visual hierarchy.
   Payment logic and QR generation remain unchanged. */

.vfx-payment {
  /* Token system */
  --surface-0: #05070c;
  --surface-1: #0a0e14;
  --surface-2: #0f1419;
  --surface-3: #161d26;
  --surface-4: #1e2836;
  --surface-5: #283448;
  
  --text-primary: #f5f8fb;
  --text-secondary: #c7d1db;
  --text-muted: #8a95a3;
  --text-subtle: #5d6977;
  
  --accent-cyan: #38bdf8;
  --accent-cyan-soft: #67d3ff;
  --accent-glow: rgba(56, 189, 248, 0.12);
  
  --line-subtle: rgba(255, 255, 255, 0.06);
  --line-medium: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.40);
  --shadow-glow: 0 0 24px var(--accent-glow);
  
  /* Base */
  color: var(--text-primary);
  padding: 20px 24px 32px !important;
  letter-spacing: -0.01em;
  font-feature-settings: "kern" 1, "liga" 1;
}

.vfx-payment .vfx-checkout {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 auto;
  max-width: 900px;
}

/* Header */
.vfx-payment .vfx-checkout-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 0 24px;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--line-medium);
  position: relative;
}

.vfx-checkout-header::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), transparent);
  opacity: 0.8;
}

.vfx-checkout-header::after {
  content: "VFX / PAYMENT";
  margin-left: auto;
  font: 600 10px/1.5 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.vfx-payment .vfx-checkout-header > div {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.vfx-payment .vfx-checkout-header button {
  margin: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-medium);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.vfx-payment .vfx-checkout-header button:hover {
  background: var(--surface-4);
  border-color: var(--line-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Content grid */
.vfx-payment .vfx-checkout-content {
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-rows: auto auto 1fr;
  column-gap: 48px;
  row-gap: 16px;
}

.vfx-checkout-content > div:first-child {
  grid-area: 1 / 1;
  min-width: 0;
}

/* Amount section */
.vfx-payment .vfx-amount-label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vfx-payment .vfx-amount {
  display: block;
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, #ffffff 0%, #c7d1db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Package info */
.vfx-payment .vfx-package {
  grid-area: 2 / 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 28px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.vfx-package > span:first-child {
  color: var(--text-muted);
  font-weight: 500;
}

.vfx-package > span:last-child {
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
  font-weight: 400;
}

/* Layout container */
.vfx-payment .vfx-payment-layout {
  display: contents !important;
}

/* QR area */
.vfx-payment .vfx-qr-area {
  grid-area: 1 / 2 / 4 / 3;
  min-width: 0;
  align-self: start;
}

.vfx-payment .vfx-qr-frame {
  width: 320px;
  height: 320px;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 24px;
  background: linear-gradient(145deg, #ffffff 0%, #f5f8fb 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
}

.vfx-payment .vfx-qr-frame:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow), 0 0 0 1px rgba(56, 189, 248, 0.2);
}

/* Scan line animation */
.vfx-payment .vfx-qr-frame::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0;
  animation: scanline 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes scanline {
  0%, 100% { top: 24px; opacity: 0; }
  10% { opacity: 0.6; }
  50% { top: calc(100% - 24px); opacity: 0.6; }
  90% { opacity: 0; }
}

/* Corner accents */
.vfx-payment .vfx-qr-frame::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid var(--accent-cyan);
  border-radius: 8px;
  opacity: 0.15;
  pointer-events: none;
}

.vfx-qr-frame > .m-qrcode,
.vfx-qr-frame > img:not(.absolute) {
  flex-shrink: 0;
  border-radius: 6px;
  position: relative;
  z-index: 1;
}

.vfx-payment .vfx-qr-frame > img.absolute {
  width: 40px;
  height: 40px;
  border: 4px solid white;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Scan label */
.vfx-payment .vfx-scan-label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.vfx-payment .vfx-scan-label::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Payment methods side */
.vfx-payment .vfx-payment-side {
  grid-area: 3 / 1;
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  min-width: 0;
  width: auto !important;
}

.vfx-payment .vfx-methods {
  order: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

/* Method cards */
.vfx-payment .vfx-method {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 72px;
  margin: 0;
  border: 1px solid var(--line-medium);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Method-specific colors */
.vfx-method:has(input[value="wxpay"]) {
  --method-accent: #07c160;
  --method-glow: rgba(7, 193, 96, 0.12);
  --method-surface: rgba(7, 193, 96, 0.04);
}

.vfx-method:has(input[value="alipay"]) {
  --method-accent: #1677ff;
  --method-glow: rgba(22, 119, 255, 0.12);
  --method-surface: rgba(22, 119, 255, 0.04);
}

/* Gradient accent line */
.vfx-payment .vfx-method::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--method-accent);
  opacity: 0;
  transition: opacity 0.25s;
}

.vfx-payment .vfx-method:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateX(2px);
}

.vfx-payment .vfx-method:has(input:checked) {
  border-color: var(--method-accent);
  background: linear-gradient(135deg, var(--method-surface), var(--surface-2));
  box-shadow: 0 4px 16px var(--method-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.vfx-payment .vfx-method:has(input:checked)::before {
  opacity: 1;
}

.vfx-payment .vfx-method:has(input:focus-visible) {
  outline: 2px solid var(--method-accent);
  outline-offset: 3px;
}

/* Radio input */
.vfx-payment .vfx-method input {
  position: absolute;
  right: 20px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--method-accent);
  cursor: pointer;
}

/* Label */
.vfx-payment .vfx-method label {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 72px;
  padding: 16px 52px 16px 20px;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.vfx-payment .vfx-method label img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin: 0 14px 0 0;
  filter: brightness(0.95);
  transition: filter 0.2s;
}

.vfx-payment .vfx-method:has(input:checked) label {
  color: var(--text-primary);
}

.vfx-payment .vfx-method:has(input:checked) label img {
  filter: brightness(1);
}

/* Countdown */
.vfx-payment .vfx-countdown {
  order: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 24px 0 0;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
  font-weight: 500;
  white-space: normal !important;
}

.vfx-payment .vfx-countdown-value {
  color: var(--accent-cyan);
  display: inline-block;
  min-width: 48px;
  width: auto;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.vfx-payment .vfx-countdown.is-urgent {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.04);
}

.vfx-payment .vfx-countdown.is-urgent .vfx-countdown-value {
  color: #fbbf24;
  animation: urgent-pulse 1s ease-in-out infinite;
}

@keyframes urgent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Focus states */
.vfx-payment button:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

/* Loading states */
.vfx-payment .vfx-qr-frame:has(.animate-pulse) {
  background: linear-gradient(145deg, #f0f4f8 0%, #e5eaf0 100%);
}

.vfx-payment .vfx-qr-frame .animate-pulse {
  background: linear-gradient(90deg, #dde4eb 0%, #c7d1db 50%, #dde4eb 100%) !important;
  background-size: 200% 100% !important;
  animation: loading-shimmer 1.5s ease-in-out infinite !important;
  border-radius: 6px;
}

@keyframes loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.vfx-payment .vfx-qr-frame .animate-spin {
  border: 3px solid #d5dde5;
  border-top-color: var(--accent-cyan);
}

.vfx-payment .vfx-qr-frame > .absolute:has(.animate-spin) {
  z-index: 2;
}

.vfx-payment:has(.vfx-qr-frame .animate-pulse) .vfx-countdown {
  opacity: 0.4;
  pointer-events: none;
}

.vfx-payment:has(.vfx-qr-frame .animate-pulse) .vfx-scan-label {
  font-size: 0;
}

.vfx-payment:has(.vfx-qr-frame .animate-pulse) .vfx-scan-label::before {
  display: none;
}

.vfx-payment:has(.vfx-qr-frame .animate-pulse) .vfx-scan-label::after {
  content: "正在生成支付码...";
  font-size: 14px;
  color: var(--text-muted);
  animation: loading-text 1.5s ease-in-out infinite;
}

@keyframes loading-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Responsive - tablet */
@media (max-width: 1100px) and (min-width: 701px) {
  .vfx-payment {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  .vfx-payment .vfx-checkout-content {
    column-gap: 32px;
  }
  
  .vfx-payment .vfx-qr-frame {
    width: 280px;
    height: 280px;
    padding: 20px;
  }
}

/* Responsive - mobile */
@media (max-width: 700px) {
  .vfx-payment {
    padding: 12px 12px 24px !important;
    max-height: none !important;
  }
  
  .vfx-payment .vfx-checkout-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    gap: 12px;
  }
  
  .vfx-checkout-header::before {
    width: 60px;
  }
  
  .vfx-checkout-header::after {
    font-size: 9px;
  }
  
  .vfx-payment .vfx-checkout-header > div {
    font-size: 16px;
  }
  
  .vfx-payment .vfx-checkout-header button {
    width: 36px;
    height: 36px;
  }
  
  .vfx-payment .vfx-checkout-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  
  .vfx-payment .vfx-amount {
    font-size: clamp(32px, 8vw, 40px);
  }
  
  .vfx-payment .vfx-package {
    margin-bottom: 16px;
    padding: 14px 16px;
  }
  
  .vfx-payment .vfx-payment-side {
    grid-area: 3 / 1;
  }
  
  .vfx-payment .vfx-methods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  
  .vfx-payment .vfx-method,
  .vfx-payment .vfx-method label {
    min-height: 64px;
  }
  
  .vfx-payment .vfx-method label {
    font-size: 13px;
    padding: 12px 32px 12px 12px;
  }
  
  .vfx-payment .vfx-method label img {
    width: 28px;
    height: 28px;
    margin-right: 10px;
  }
  
  .vfx-payment .vfx-method input {
    right: 12px;
    width: 16px;
    height: 16px;
  }
  
  .vfx-payment .vfx-countdown {
    justify-content: center;
    margin-top: 20px;
    padding: 14px 16px;
  }
  
  .vfx-payment .vfx-qr-area {
    grid-area: 4 / 1;
    justify-self: center;
    margin-top: 20px;
  }
  
  .vfx-payment .vfx-qr-frame {
    width: min(320px, calc(100vw - 48px));
    height: min(320px, calc(100vw - 48px));
  }
  
  .vfx-payment .vfx-scan-label {
    margin-top: 16px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .vfx-payment *,
  .vfx-payment *::before,
  .vfx-payment *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
