/* ============================================
   BaseService Payment UI — Industrial Dark Theme
   ============================================ */

:root {
  --bg: #080a0f;
  --surface: #0e1118;
  --surface-2: #141922;
  --border: #1f2733;
  --border-bright: #2e3d52;
  --accent: #4af0b0;
  --accent-dim: rgba(74, 240, 176, 0.12);
  --accent-glow: rgba(74, 240, 176, 0.35);
  --text: #e8edf5;
  --text-muted: #5a6880;
  --text-soft: #8b9ab0;
  --error: #ff5c5c;
  --error-dim: rgba(255, 92, 92, 0.12);
  --warning: #f0b44a;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 12px;
  --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Background texture ---- */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

/* ---- Layout ---- */
header, main, footer { position: relative; z-index: 1; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  background: rgba(8, 10, 15, 0.6);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.logo-icon {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  animation: spin 12s linear infinite;
}

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

.chain-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Hero ---- */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 80px 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
}

.hero {
  text-align: center;
  max-width: 580px;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(74, 240, 176, 0.2);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(42px, 7vw, 72px);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  display: inline-block;
}

h1 em::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.subtitle {
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.7;
  max-width: 460px;
  margin: 0 auto;
}

/* ---- Payment Card ---- */
.card-wrapper {
  position: relative;
  width: 100%;
  max-width: 460px;
}

.card-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(ellipse at 50% 100%, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 36px 36px 32px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

/* ---- Steps ---- */
.step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.step.hidden { display: none; }

.card-icon {
  font-size: 48px;
  color: var(--accent);
  opacity: 0.8;
  margin-bottom: 4px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.step p {
  color: var(--text-soft);
  font-size: 14px;
  max-width: 300px;
  line-height: 1.6;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hint strong { color: var(--warning); }

/* ---- Wallet Info ---- */
.wallet-info {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.wallet-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-family: var(--font-mono);
}

.wallet-addr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
}

/* ---- Fee Display ---- */
.fee-display {
  width: 100%;
  background: var(--accent-dim);
  border: 1px solid rgba(74, 240, 176, 0.2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.fee-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.fee-amount {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.fee-usd {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ---- Breakdown ---- */
.fee-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}

.breakdown-row:last-child { border-bottom: none; }

.breakdown-row .mono {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 11px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 13px 24px;
  width: 100%;
  text-decoration: none;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}

.btn:hover::after { opacity: 0.06; }
.btn:active::after { opacity: 0.12; }

.btn-primary {
  background: var(--accent);
  color: #050a08;
  font-weight: 600;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 36px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-pay {
  background: var(--accent);
  color: #050a08;
  font-weight: 700;
  font-size: 15px;
  padding: 15px 24px;
  box-shadow: 0 0 28px var(--accent-glow);
  letter-spacing: 0.01em;
}

.btn-pay:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 40px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  padding: 9px 20px;
}

.btn-ghost:hover { border-color: var(--border-bright); color: var(--text-soft); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-arrow { transition: transform 0.15s; }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* ---- Processing ---- */
.spinner-wrap {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}

.spinner {
  width: 100%;
  height: 100%;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin-fast 0.8s linear infinite;
}

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

.tx-hash {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tx-hash a { color: var(--accent); text-decoration: none; }
.tx-hash a:hover { text-decoration: underline; }

/* ---- Success ---- */
.success-icon {
  width: 60px;
  height: 60px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 4px;
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

/* ---- Error Banner ---- */
.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--error-dim);
  border: 1px solid rgba(255, 92, 92, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--error);
}

.error-banner.hidden { display: none; }

.error-banner button {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* ---- Info Row ---- */
.info-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 460px;
}

.info-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.2s;
}

.info-tile:hover { border-color: var(--border-bright); }

.info-icon { font-size: 22px; margin-bottom: 8px; }

.info-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.info-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 28px 40px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

footer a {
  color: var(--text-soft);
  text-decoration: none;
}

footer a:hover { color: var(--accent); }

.mono { font-family: var(--font-mono); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  header { padding: 16px 20px; }
  main { padding: 50px 20px 40px; gap: 40px; }
  .card { padding: 28px 22px; }
  h1 { font-size: 38px; }
  footer { flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
}

/* ---- Fade-in animation on load ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero { animation: fadeUp 0.6s ease both; }
.card-wrapper { animation: fadeUp 0.6s 0.15s ease both; }
.info-row { animation: fadeUp 0.6s 0.25s ease both; }
