/* ═══════════════════════════════════════════
   PS CryptoPay v1.3 — Payment Page UX
   Mobile-first, 4 breakpoints, touch-optimized
   ═══════════════════════════════════════════ */

/* ── BASE: Mobile first (<480px) ── */

.pscp-payment-details { margin: 0 0 20px; font-family: system-ui, -apple-system, sans-serif; -webkit-text-size-adjust: 100%; width: 100%; }
.pscp-payment-details__title { display: none; }
.pscp-payment-card { width: 100%; }
.pscp-payment-details * { box-sizing: border-box; }

/* ── STEPPER ── */
.pscp-stepper { display: flex; align-items: center; margin-bottom: 16px; padding: 12px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; gap: 2px; overflow-x: auto; }
.pscp-step { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pscp-step-num { width: 24px; height: 24px; min-width: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; border: 2px solid #cbd5e1; color: #94a3b8; background: #fff; transition: all .3s; }
.pscp-step-text { font-size: 9px; font-weight: 600; color: #94a3b8; transition: color .3s; white-space: nowrap; }
.pscp-step.active .pscp-step-num { background: #f97316; border-color: #f97316; color: #fff; box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.pscp-step.active .pscp-step-text { color: #1e293b; font-weight: 700; }
.pscp-step.done .pscp-step-num { background: #059669; border-color: #059669; color: #fff; }
.pscp-step.done .pscp-step-text { color: #059669; }
.pscp-step-line { flex: 0 0 12px; height: 2px; background: #e2e8f0; }
.pscp-step-line.done { background: #059669; }

/* ── PROGRESS TIMER ── */
.pscp-progress-wrap { margin-bottom: 14px; }
.pscp-progress-bar { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.pscp-progress-fill { height: 100%; border-radius: 5px; transition: width 1s linear, background-color 5s; }
.pscp-progress-label { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.pscp-progress-label > span:first-child { font-size: 11px; font-weight: 600; color: #64748b; }
.pscp-progress-time { font-family: 'Courier New', monospace; font-size: 20px; font-weight: 900; letter-spacing: 2px; }

/* ── CARD: stacked on mobile ── */
.pscp-payment-card {
	display: flex; flex-direction: column; align-items: center; gap: 16px;
	background: #fff; border: 2px solid #e2e8f0; border-radius: 16px;
	padding: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}
.pscp-payment-left { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pscp-payment-right { width: 100%; min-width: 0; }

/* ── Badge ── */
.pscp-crypto-badge { display: inline-block; color: #fff; font-size: 11px; font-weight: 800; padding: 5px 14px; border-radius: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── QR ── */
.pscp-qr { position: relative; background: #f8fafc; border-radius: 12px; padding: 8px; border: 1px solid #e2e8f0; width: 100%; display: flex; justify-content: center; }
.pscp-qr img, .pscp-qr canvas { display: block !important; max-width: 100% !important; height: auto !important; }
.pscp-qr-hint { font-size: 10px; color: #94a3b8; text-align: center; margin-top: 6px; line-height: 1.4; }

/* ── Labels ── */
.pscp-label { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }

/* ── Amount ── */
.pscp-amount { font-size: 18px; font-weight: 900; color: #0f172a; font-family: 'Courier New', monospace; word-break: break-all; }

/* ── Address ── */
.pscp-address { display: block; font-size: 10px; color: #1e293b; background: #f8fafc; padding: 10px 12px; border-radius: 8px; border: 1px solid #e2e8f0; word-break: break-all; font-family: 'Courier New', monospace; line-height: 1.4; margin-bottom: 8px; -webkit-user-select: all; user-select: all; }
.pscp-addr-hi { color: #f97316; font-weight: 900; background: #fff7ed; padding: 1px 3px; border-radius: 2px; }

/* ── Buttons — touch-friendly 44px min ── */
.pscp-btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pscp-copy-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: #1e293b; color: #fff; border: none; padding: 10px 16px; min-height: 44px; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; transition: all .15s; text-decoration: none; flex: 1; text-align: center; -webkit-tap-highlight-color: transparent; }
.pscp-copy-btn:hover { background: #0f172a; }
.pscp-copy-btn:active { transform: scale(0.96); opacity: 0.9; }
.pscp-copy-btn:focus-visible { outline: 3px solid #f97316; outline-offset: 2px; }
.pscp-crypto-selector label:focus-within { border-color: #f97316 !important; box-shadow: 0 0 0 3px rgba(249,115,22,0.2); }
.pscp-crypto-selector input[type="radio"]:focus-visible { outline: 3px solid #f97316; outline-offset: 2px; }

/* ── Wallet buttons ── */
.pscp-wallet-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pscp-wallet-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 14px; min-height: 44px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #fff; text-decoration: none; transition: all .2s; -webkit-tap-highlight-color: transparent; }
.pscp-wallet-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.pscp-wallet-btn:active { transform: scale(0.97); }

/* ── Rate info ── */
.pscp-rate-info { font-size: 11px; color: #64748b; line-height: 1.5; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.pscp-rate-info strong { color: #0f172a; }
.pscp-rate-sources { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pscp-rate-source-tag { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }

/* ── Timer legacy ── */
.pscp-timer { font-size: 22px; font-weight: 900; color: #DC2626; font-family: 'Courier New', monospace; letter-spacing: 3px; }

/* ── Checking blockchain ── */
.pscp-checking { display: none; text-align: center; padding: 20px; margin-top: 12px; background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 2px solid #93c5fd; border-radius: 14px; }
.pscp-checking.visible { display: block; animation: pscp-fadeIn .3s ease; }
.pscp-checking-spinner { width: 36px; height: 36px; border: 3px solid #e2e8f0; border-top-color: #3b82f6; border-radius: 50%; animation: pscp-spin 1s linear infinite; margin: 0 auto 10px; }
.pscp-checking-text { font-size: 14px; font-weight: 700; color: #1e40af; }
.pscp-checking-sub { font-size: 12px; color: #64748b; margin-top: 4px; }

/* ── Note ── */
.pscp-note { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; font-size: 11px; line-height: 1.5; color: #475569; }

/* ── Checkout coin selector ── */
.pscp-crypto-selector { -webkit-tap-highlight-color: transparent; }
.pscp-crypto-selector label { -webkit-tap-highlight-color: transparent; }
.pscp-crypto-selector label:has(input:checked) { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2); }

/* ── Animations ── */
@keyframes pscp-spin { to { transform: rotate(360deg); } }
@keyframes pscp-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pscp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ═══════════════════════════════════════════
   BREAKPOINT: Small phones landscape (480px+)
   ═══════════════════════════════════════════ */
@media (min-width: 480px) {
	.pscp-stepper { padding: 14px; gap: 4px; }
	.pscp-step-num { width: 26px; height: 26px; min-width: 26px; font-size: 11px; }
	.pscp-step-text { font-size: 10px; }
	.pscp-step-line { flex: 0 0 20px; }
	.pscp-amount { font-size: 20px; }
	.pscp-address { font-size: 11px; }
	.pscp-wallet-grid { flex-direction: row; flex-wrap: wrap; }
	.pscp-wallet-btn { flex: 1; min-width: 120px; }
	.pscp-qr img, .pscp-qr canvas { max-width: 200px !important; }
}

/* ═══════════════════════════════════════════
   BREAKPOINT: Tablets + large phones (640px+)
   ═══════════════════════════════════════════ */
@media (min-width: 640px) {
	.pscp-payment-card { flex-direction: row; align-items: flex-start; padding: 20px; gap: 20px; }
	.pscp-payment-left { width: auto; flex-shrink: 0; }
	.pscp-payment-right { width: auto; }
	.pscp-qr { width: auto; }
	.pscp-qr img, .pscp-qr canvas { max-width: none !important; }
	.pscp-stepper { gap: 6px; }
	.pscp-step-num { width: 28px; height: 28px; min-width: 28px; font-size: 12px; }
	.pscp-step-text { font-size: 11px; }
	.pscp-step-line { flex: 0 0 30px; }
	.pscp-copy-btn { flex: none; }
	.pscp-wallet-btn { flex: none; min-width: auto; padding: 10px 16px; }
}

/* ═══════════════════════════════════════════
   BREAKPOINT: Desktop (900px+)
   ═══════════════════════════════════════════ */
@media (min-width: 900px) {
	.pscp-payment-card { padding: 24px; gap: 24px; }
	.pscp-amount { font-size: 22px; }
	.pscp-progress-time { font-size: 22px; }
	.pscp-timer { font-size: 26px; }
}

/* ═══════════════════════════════════════════
   BREAKPOINT: Wide desktop (1200px+)
   ═══════════════════════════════════════════ */
@media (min-width: 1200px) {
	.pscp-payment-card { max-width: 700px; }
	.pscp-stepper { max-width: 700px; }
	.pscp-progress-wrap { max-width: 700px; }
}

/* ═══════════════════════════════════════════
   SAFE AREA: iPhone notch + Android gesture
   ═══════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-bottom)) {
	.pscp-payment-details { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* ═══════════════════════════════════════════
   DARK MODE: respect system preference
   ═══════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
	.pscp-payment-card { background: #1e293b; border-color: #334155; }
	.pscp-payment-right .pscp-label { color: #64748b; }
	.pscp-amount { color: #f1f5f9; }
	.pscp-address { background: #0f172a; border-color: #334155; color: #e2e8f0; }
	.pscp-addr-hi { background: #431407; color: #fb923c; }
	.pscp-rate-info { background: #0f172a; border-color: #334155; color: #94a3b8; }
	.pscp-rate-info strong { color: #f1f5f9; }
	.pscp-stepper { background: #0f172a; border-color: #334155; }
	.pscp-step-text { color: #64748b; }
	.pscp-step.active .pscp-step-text { color: #f1f5f9; }
	.pscp-progress-bar { background: #334155; }
	.pscp-checking { background: linear-gradient(135deg, #0f172a, #1e293b); border-color: #334155; }
	.pscp-checking-text { color: #93c5fd; }
	.pscp-checking-sub { color: #94a3b8; }
	.pscp-note { background: #0f172a; border-color: #334155; color: #94a3b8; }
	.pscp-qr { background: #fff; } /* QR stays white for scan readability */
}

/* ═══════════════════════════════════════════
   REDUCED MOTION: respect accessibility
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
	.pscp-checking-spinner { animation: none; border-color: #3b82f6; }
	.pscp-copy-btn, .pscp-wallet-btn { transition: none; }
	.pscp-step-num { transition: none; }
	.pscp-progress-fill { transition: none; }
}

/* ═══════════════════════════════════════════
   SMALL MOBILE: auto-stack crypto selector
   ═══════════════════════════════════════════ */
@media (max-width: 400px) {
	.pscp-crypto-selector > div { flex-direction: column !important; }
	.pscp-crypto-selector label { width: 100%; }
	.pscp-payment-card { flex-direction: column !important; }
	.pscp-payment-left, .pscp-payment-right { width: 100%; }
	.pscp-btn-row { flex-direction: column; }
	.pscp-copy-btn { width: 100%; }
}

/* ═══════════════════════════════════════════
   PRINT: clean receipt
   ═══════════════════════════════════════════ */
@media print {
	.pscp-stepper, .pscp-progress-wrap, .pscp-copy-btn, .pscp-wallet-grid,
	.pscp-checking, .pscp-qr-hint { display: none !important; }
	.pscp-payment-card { box-shadow: none; border: 1px solid #000; }
	.pscp-qr { border: 1px solid #000; }
}
