/* ─────────────────────────────────────────────
   QRIS Generator — Dark Fintech Aesthetic
   Fonts: Space Mono (numbers/code) + DM Sans (body)
───────────────────────────────────────────── */

:root {
  --bg:         #080d18;
  --surface:    #0e1525;
  --surface2:   #141d30;
  --border:     #1e2d47;
  --border2:    #253550;
  --accent:     #00e676;
  --accent2:    #00c853;
  --accent-dim: rgba(0, 230, 118, 0.12);
  --accent-glow:rgba(0, 230, 118, 0.25);
  --text:       #e8edf5;
  --text-muted: #5a7090;
  --text-soft:  #8ba0bc;
  --danger:     #ff5252;
  --warning:    #ffd740;
  --radius:     16px;
  --radius-sm:  10px;
  --mono:       'Space Mono', monospace;
  --sans:       'DM Sans', sans-serif;
  --shadow:     0 24px 64px rgba(0,0,0,0.6);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Background ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,230,118,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,230,118,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-glow {
  position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,230,118,0.06) 0%, transparent 70%);
}

/* ── Balance Badge (fixed top-right) ── */
.balance-badge {
  position: fixed;
  top: 20px; right: 24px;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 10px 20px;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px var(--border2);
  backdrop-filter: blur(12px);
  transition: box-shadow 0.3s;
}
.balance-badge:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px var(--accent), 0 0 20px var(--accent-glow);
}
.balance-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  opacity: 0.7;
}
.balance-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  transition: all 0.4s;
}
.balance-value.updated {
  color: #fff;
  text-shadow: 0 0 12px var(--accent);
}

/* ── Main Container ── */
.container {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  display: flex; flex-direction: column; gap: 28px;
}

/* ── Header ── */
.header {
  display: flex; align-items: center; gap: 16px;
  animation: fadeUp 0.6s ease both;
}
.logo-mark { flex-shrink: 0; filter: drop-shadow(0 0 12px var(--accent-glow)); }
.header-text h1 {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text);
}
.header-text h1 .accent {
  font-weight: 600;
  color: var(--accent);
}
.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

/* ── Main Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp 0.6s 0.1s ease both;
  transition: border-color 0.3s;
}
.card:focus-within {
  border-color: var(--border2);
}
.card-inner { padding: 32px; display: flex; flex-direction: column; gap: 20px; }

/* ── Field Label ── */
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Input Group ── */
.input-group {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input-prefix {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-muted);
  padding: 0 14px;
  border-right: 1px solid var(--border);
  line-height: 52px;
  user-select: none;
}
.nominal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  padding: 14px 16px;
  letter-spacing: -0.02em;
  width: 100%;
}
.nominal-input::placeholder { color: var(--border2); font-weight: 400; }

/* ── Fee Preview ── */
.fee-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s, transform 0.3s;
}
.fee-preview.visible { opacity: 1; transform: translateY(0); }
.fee-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  color: var(--text-soft);
}
.fee-row span:last-child { font-family: var(--mono); font-size: 12px; }
.fee-divider { border-top: 1px solid var(--border); }
.fee-total {
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
.fee-total span:last-child {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

/* ── Generate Button ── */
.btn-generate {
  width: 100%;
  background: var(--accent);
  color: #020b07;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  position: relative; overflow: hidden;
}
.btn-generate::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.btn-generate:hover:not(:disabled)::before { opacity: 1; }
.btn-generate:hover:not(:disabled) {
  background: #1ffb82;
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-generate:active:not(:disabled) { transform: translateY(0); }
.btn-generate:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-generate.loading { pointer-events: none; }
.btn-icon { font-size: 18px; transition: transform 0.2s; }
.btn-generate:hover:not(:disabled) .btn-icon { transform: translateX(4px); }

/* Loading spinner inside button */
.btn-generate.loading .btn-text::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
.btn-generate.loading .btn-icon { display: none; }

/* ── Note ── */
.note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

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

/* ─────────────────────────────────────────────
   MODAL OVERLAY
───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 13, 24, 0.88);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  opacity: 1; pointer-events: all;
}

.modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 100%; max-width: 400px;
  padding: 32px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px var(--border);
  transform: scale(0.93) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}
.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

/* ── Close Button ── */
.modal-close {
  position: absolute; top: 20px; right: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  width: 34px; height: 34px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}
.modal-close:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }

/* ── Modal Header ── */
.modal-header { margin-bottom: 20px; }
.modal-badge {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0,230,118,0.2);
  border-radius: 20px;
  padding: 4px 10px;
}
.modal-title {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── QR Wrapper ── */
.qr-wrapper {
  position: relative;
  width: 200px; height: 200px;
  margin: 0 auto 20px;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 4px var(--surface), 0 0 0 5px var(--border);
}
.qr-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  background: #fff;
  color: #444;
  font-size: 12px;
  z-index: 2;
}
.qr-loading.hidden { display: none; }
.qr-image {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.4s;
}
.qr-image.loaded { opacity: 1; }

/* ── Spinner ── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #ddd;
  border-top-color: #00c853;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Payment Details ── */
.payment-details {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
  font-size: 13px;
}
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-row span:last-child { font-family: var(--mono); font-size: 12px; }
.detail-highlight {
  color: var(--text);
  font-weight: 600;
  background: var(--accent-dim);
}
.detail-highlight span:last-child { color: var(--accent); font-size: 14px; }
.detail-id span:last-child {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ── Status Bar ── */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-soft);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.status-dot.success { background: var(--accent); animation: none; }
.status-dot.error   { background: var(--danger); animation: none; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,215,64,0.5); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(255,215,64,0); }
}
.status-pulse { margin-left: auto; }
#statusText { flex: 1; }

/* ── Success Overlay (inside modal) ── */
.success-overlay {
  position: absolute; inset: 0;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  padding: 40px 32px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
  z-index: 20;
}
.success-overlay.active {
  opacity: 1; pointer-events: all;
}
.success-icon { animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }
.success-overlay h3 {
  font-size: 22px; font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.success-overlay p {
  font-size: 14px; color: var(--text-soft);
  text-align: center; max-width: 260px;
  line-height: 1.6;
}
.btn-close-success {
  margin-top: 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,230,118,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  padding: 12px 32px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-close-success:hover {
  background: var(--accent);
  color: #020b07;
}

/* ─────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 72px 16px 40px; }
  .balance-badge { top: 12px; right: 12px; padding: 8px 14px; }
  .balance-value { font-size: 13px; }
  .card-inner { padding: 22px; }
  .nominal-input { font-size: 18px; }
  .modal { padding: 24px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
