/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: #080b12; color: #e2e8f0; min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; }
.main { max-width: 1100px; margin: 0 auto; padding: 12px 24px 80px; flex: 1; }
a { color: inherit; text-decoration: none; }
input, select, button, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f1420; }
::-webkit-scrollbar-thumb { background: #2a3050; border-radius: 3px; }

/* ===== PRODUCT GRID ===== */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 20px; }
.product-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 16px; overflow: hidden; transition: border-color .2s; animation: fadeUp .4s ease both; }
.product-card:hover { border-color: rgba(99,102,241,0.35); }
.product-image { width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: #0d1226; overflow: hidden; position: relative; }
.product-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-img-text { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 800; color: #fff; text-align: center; padding: 16px; line-height: 1.3; word-break: break-word; }
.product-body { padding: 18px; }
.product-name { font-size: 1rem; font-weight: 700; color: #e2e8f0; margin-bottom: 7px; line-height: 1.3; }
.product-desc { font-size: 0.8rem; color: #64748b; line-height: 1.55; margin-bottom: 16px; }
.product-footer { display: flex; align-items: center; justify-content: space-between; }
.product-price { font-size: 1.2rem; font-weight: 800; color: #fff; }
.buy-btn { background: #6366f1; border: none; border-radius: 10px; color: #fff; font-size: 0.82rem; font-weight: 700; padding: 9px 18px; cursor: pointer; transition: opacity .2s; }
.buy-btn:hover { opacity: .85; }
.buy-btn:active { opacity: 1; }

/* Skeleton */
.skeleton-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; height: 280px; animation: pulse 1.5s ease infinite; }
@keyframes pulse { 0%,100%{opacity:.4} 50%{opacity:.8} }

/* Empty */
.empty-state { text-align: center; padding: 80px 0; color: #475569; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); backdrop-filter: blur(8px); z-index: 300; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.modal-overlay.visible { opacity: 1; pointer-events: all; }
.modal { background: #0c1120; border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 36px; width: 92%; max-width: 440px; position: relative; transform: scale(.94) translateY(12px); transition: transform .3s; box-shadow: 0 24px 80px rgba(0,0,0,0.65); max-height: 90vh; overflow-y: auto; }
.modal-overlay.visible .modal { transform: scale(1) translateY(0); }
.modal-close { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.06); border: none; color: #94a3b8; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: .9rem; transition: background .2s, color .2s; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.modal-title { font-size: 1.25rem; font-weight: 800; color: #fff; margin-bottom: 6px; }
.modal-sub { color: #64748b; font-size: .85rem; line-height: 1.6; margin-bottom: 22px; }
.modal-note { font-size: .75rem; color: #374151; text-align: center; margin-top: 12px; }

/* Product header in modal */
.modal-product-header { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 12px; padding: 12px 14px; margin-bottom: 22px; }
.modal-product-icon { font-size: 1.8rem; }
.modal-product-name { font-size: .9rem; font-weight: 700; color: #e2e8f0; }
.modal-product-price { font-size: .8rem; color: #6366f1; font-weight: 600; }

/* Crypto options */
.crypto-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.crypto-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); border-radius: 12px; padding: 18px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: background .2s, border-color .2s, color .2s; color: #94a3b8; font-size: .85rem; font-weight: 600; }
.crypto-btn:hover { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.1); color: #a5b4fc; }
.crypto-icon { font-size: 2rem; }
.crypto-rate { font-size: .72rem; color: #475569; font-weight: 500; }

/* Step 2 — pay */
.pay-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.pay-currency-badge { background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; font-size: .75rem; font-weight: 700; border-radius: 8px; padding: 4px 12px; text-transform: uppercase; }
.pay-expires { font-size: .75rem; color: #ef4444; font-weight: 600; }
.qr-wrap { display: flex; justify-content: center; margin-bottom: 18px; }
.qr-wrap img { width: 180px; height: 180px; border-radius: 12px; border: 3px solid rgba(255,255,255,0.1); }
.pay-amount-box, .pay-address-box { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.pay-amount-label { font-size: .7rem; color: #475569; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 6px; }
.pay-amount-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pay-amount { font-size: 1.3rem; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.copy-amount-btn { background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: .8rem; font-weight: 700; transition: background .2s; white-space: nowrap; flex-shrink: 0; }
.copy-amount-btn:hover { background: rgba(99,102,241,0.35); }
.pay-address-row { display: flex; align-items: center; gap: 8px; }
.pay-address { font-size: .75rem; color: #94a3b8; word-break: break-all; flex: 1; }
.copy-btn { background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: .8rem; flex-shrink: 0; transition: background .2s; }
.copy-btn:hover { background: rgba(99,102,241,0.35); }
.pay-status-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .82rem; color: #64748b; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: #6366f1; box-shadow: 0 0 0 0 rgba(99,102,241,0.4); animation: pulseDot 1.8s infinite; flex-shrink: 0; }
@keyframes pulseDot { 0%{box-shadow:0 0 0 0 rgba(99,102,241,0.5)} 70%{box-shadow:0 0 0 10px rgba(99,102,241,0)} 100%{box-shadow:0 0 0 0 rgba(99,102,241,0)} }

/* Progress bar */
.pay-progress-wrap { height: 4px; background: rgba(255,255,255,0.06); border-radius: 4px; margin-bottom: 16px; overflow: hidden; }
.pay-progress-bar { height: 100%; border-radius: 4px; background: #6366f1; transition: width 1s linear, background-color .5s; }
.pay-progress-bar.urgency-med  { background: linear-gradient(90deg, #f59e0b, #f97316); }
.pay-progress-bar.urgency-high { background: linear-gradient(90deg, #ef4444, #dc2626); animation: pulse 1s ease infinite; }

/* Sent button */
.sent-btn { width: 100%; margin-top: 14px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; color: #94a3b8; padding: 11px; cursor: pointer; font-size: .85rem; font-weight: 600; transition: background .2s, color .2s; }
.sent-btn:hover { background: rgba(255,255,255,0.09); color: #fff; }

/* Processing view */
.processing-header { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 0 18px; text-align: center; }
.processing-spinner { width: 48px; height: 48px; border: 3px solid rgba(99,102,241,0.2); border-top-color: #6366f1; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* Warning banner */
.pay-warning { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 12px; padding: 12px 16px; font-size: .82rem; color: #fca5a5; line-height: 1.55; margin-top: 6px; }

/* Invoice */
.invoice-box { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 14px; margin-top: 14px; }
.invoice-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.invoice-title { font-size: .8rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.copy-invoice-btn { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.25); color: #a5b4fc; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: .75rem; font-weight: 600; transition: background .2s; }
.copy-invoice-btn:hover { background: rgba(99,102,241,0.3); }
.invoice-text { font-size: .72rem; color: #475569; white-space: pre; line-height: 1.65; font-family: 'Courier New', monospace; overflow-x: auto; }

/* Success */
.success-anim { display: flex; justify-content: center; margin-bottom: 22px; }
.success-circle { width: 80px; height: 80px; animation: popIn .5s cubic-bezier(.175,.885,.32,1.275); }
.success-ring { fill: none; stroke: #6366f1; stroke-width: 2; stroke-dasharray: 157; stroke-dashoffset: 157; animation: drawRing .6s ease forwards .2s; }
.success-check { fill: none; stroke: #a855f7; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: drawCheck .4s ease forwards .7s; }
.product-text-box { position: relative; background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.product-text-box pre { font-size: .85rem; color: #a5b4fc; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.copy-product-btn { position: absolute; top: 10px; right: 10px; background: rgba(99,102,241,0.25); border: 1px solid rgba(99,102,241,0.3); color: #a5b4fc; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: .75rem; font-weight: 600; transition: background .2s; }
.copy-product-btn:hover { background: rgba(99,102,241,0.4); }
.back-btn { width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; color: #94a3b8; padding: 12px; cursor: pointer; font-size: .9rem; font-weight: 600; transition: background .2s, color .2s; }
.back-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: rgba(12,17,32,0.96); border: 1px solid rgba(99,102,241,0.4); border-radius: 12px; padding: 11px 22px; font-size: .875rem; font-weight: 600; color: #e2e8f0; z-index: 400; opacity: 0; transition: all .35s cubic-bezier(.34,1.56,.64,1); white-space: nowrap; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== FOOTER ===== */
.footer { border-top: 1px solid rgba(255,255,255,0.06); text-align: center; padding: 22px; font-size: .78rem; color: #334155; }
.footer a { color: #475569; }
.footer a:hover { color: #94a3b8; }

/* ===== INITIAL HIDDEN STATES ===== */
#step2, #step3, #emptyState, #processingView, #payWarning { display: none; }
#themeCanvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* ===== ANIMATIONS ===== */
@keyframes fadeDown { from{opacity:0;transform:translateY(-14px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeUp   { from{opacity:0;transform:translateY(14px)}  to{opacity:1;transform:translateY(0)} }
@keyframes popIn    { from{opacity:0;transform:scale(.5)} to{opacity:1;transform:scale(1)} }
@keyframes drawRing { to{stroke-dashoffset:0} }
@keyframes drawCheck{ to{stroke-dashoffset:0} }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hero { padding: 60px 16px 48px; }
  .products-grid { grid-template-columns: 1fr; }
  .crypto-options { grid-template-columns: 1fr 1fr; }
  .modal { padding: 24px; }
}

/* ===== CARD ENTRY ===== */
.card-back-link { background: none; border: none; color: #64748b; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 0 0 16px; display: block; font-family: inherit; transition: color .2s; }
.card-back-link:hover { color: #94a3b8; }
.card-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-label { display: block; font-size: .72rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.card-input-wrap { position: relative; }
.card-input { width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); border-radius: 10px; color: #e2e8f0; font-size: .875rem; padding: 10px 34px 10px 12px; outline: none; transition: border-color .2s; }
.card-input.has-prefix { padding-left: 38px; }
.card-input:focus { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.04); }
.card-input.is-valid { border-color: rgba(16,185,129,0.45); }
.card-input.is-invalid { border-color: rgba(239,68,68,0.4); }
.card-prefix { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: .9rem; pointer-events: none; user-select: none; }
.card-status { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: .78rem; pointer-events: none; line-height: 1; }
.card-pay-btn { width: 100%; margin-top: 4px; }
.card-pay-btn:disabled { opacity: .35; cursor: not-allowed; }
#cardInvoiceBox { margin-top: 12px; display: block; }
#cardInvoiceText { color: #94a3b8; min-height: 132px; }
