/* CashPay public payment UI */

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

html, body {
  margin: 0;
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  background: #f5f5f7;
  color: #111827;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

button, input, select, textarea {
  font-family: inherit;
  font-weight: inherit;
}

input::placeholder { font-weight: 500; }

h1, h2, h3, h4, h5, h6 { font-weight: 800; }

a { color: inherit; text-decoration: none; }

/* ── Layout ── */

.page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

.page--center {
  align-items: center;
}

.card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  position: relative;
}

.card--border {
  border: 1px solid #f3f4f6;
}

.card-notch {
  width: 3rem;
  height: 0.25rem;
  background: #d1d5db;
  border-radius: 9999px;
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
}

.center { text-align: center; }

/* ── Pay page ── */

.user-title {
  text-align: center;
  margin-bottom: 0.75rem;
}

.user-title h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.user-title .name { color: #00b341; }

.badge-secure {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #f0fdf4;
  color: #00b341;
  font-size: 0.875rem;
  font-weight: 800;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
}

.brand-card {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-card img {
  border-radius: 0.75rem;
}

.brand-title {
  margin-top: 0.75rem;
  font-size: 1.125rem;
  font-weight: 900;
  color: #030712;
  letter-spacing: -0.025em;
}

.brand-sub {
  font-size: 0.875rem;
  color: #9ca3af;
}

.amount-panel {
  background: rgba(220, 252, 231, 0.7);
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.amount-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: #00b341;
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.amount-btn {
  padding: 0.75rem 0.5rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  border: 1px solid #bbf7d0;
  background: #fff;
  color: #030712;
}

.amount-btn:hover {
  background: #f0fdf4;
  border-color: #86efac;
}

.amount-btn.is-active {
  background: #00d54b;
  border-color: #00d54b;
  color: #fff;
}

.amount-btn.is-active:hover {
  background: #00c044;
  border-color: #00c044;
}

.amount-btn.is-hidden {
  display: none;
}

.btn-more-toggle {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.625rem;
  border: none;
  border-radius: 9999px;
  background: #bbf7d0;
  color: #00b341;
  font-weight: 800;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-more-toggle:hover {
  background: #86efac;
}

.custom-amount {
  margin-top: 0.75rem;
  position: relative;
}

.custom-amount-prefix {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #00b341;
  font-weight: 800;
}

.custom-amount input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.25rem;
  border-radius: 9999px;
  border: 1px solid #bbf7d0;
  background: #fff;
  color: #030712;
  font-weight: 800;
  outline: none;
}

.custom-amount input:focus {
  border-color: #00d54b;
}

.custom-amount input::placeholder {
  color: #9ca3af;
}

.form-error {
  color: #ef4444;
  font-size: 0.875rem;
  text-align: center;
  margin: 0 0 0.75rem;
}

.form-error.is-hidden {
  display: none;
}

.btn-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  border-radius: 9999px;
  padding: 1rem;
  background: #00d54b;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
  box-shadow: 0 0 20px rgba(0, 213, 75, 0.35);
}

.btn-pay:hover { background: #00c044; }

.btn-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-pay--inline {
  width: auto;
  padding: 0.75rem 2rem;
  box-shadow: none;
}

.btn-pay--link {
  box-shadow: 0 0 20px rgba(0, 213, 75, 0.35);
}

.btn-pay img {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  box-shadow: 0 0 0 2px #fff;
}

.footer-note {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.footer-note .ring-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  display: inline-block;
}

.footer-note strong {
  color: #6b7280;
  font-weight: 700;
}

/* ── Invoice page ── */

.countdown {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
}

.countdown-label {
  color: rgba(180, 83, 9, 0.7);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.countdown-time {
  color: #92400e;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.amount-due-label {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 0.25rem;
}

.amount-due-value {
  font-size: 2.25rem;
  font-weight: 900;
  color: #00d54b;
  margin: 0;
}

.amount-due-hint {
  font-size: 0.875rem;
  color: #9ca3af;
  margin: 0.25rem 0 0;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.qr-box {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.qr-box.is-dim {
  opacity: 0.4;
}

.qr-box canvas,
.qr-box img {
  display: block;
  border-radius: 0;
}

.qr-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.qr-logo img {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  background: #fff;
  padding: 2px;
}

.info-block {
  background: #f9fafb;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.info-block--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.info-block--bolt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.field-label {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0;
}

.field-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  color: #1f2937;
  font-weight: 600;
  margin: 0;
}

.field-value--truncate {
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pill-awaiting {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  flex-shrink: 0;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem auto 0;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: #6b7280;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s;
}

.btn-copy:hover { color: #00b341; }

.invoice-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0.75rem 0 0;
}

.invoice-actions .is-hidden { display: none; }

/* ── Paid / expired / error / 404 ── */

.state-card {
  padding: 2rem 1.5rem;
  text-align: center;
}

.success-icon {
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  background: #00d54b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
  margin: 0 auto 1rem;
  line-height: 1;
}

.state-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 0.25rem;
}

.state-amount {
  font-size: 2.25rem;
  font-weight: 900;
  color: #00d54b;
  margin: 0.75rem 0;
}

.state-muted {
  color: #9ca3af;
  font-size: 0.875rem;
  margin: 0 0 1.5rem;
}

.state-error {
  color: #ef4444;
  font-weight: 700;
  margin: 0 0 1rem;
}

.not-found-code {
  font-size: 3.75rem;
  font-weight: 900;
  color: #d1d5db;
  margin: 0 0 0.5rem;
  line-height: 1;
}

.not-found-text {
  color: #6b7280;
  margin: 0 0 1.5rem;
}

/* ── Loading ── */

.loading-screen {
  text-align: center;
}

.loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid #e5e7eb;
  border-top-color: #00d54b;
  border-radius: 9999px;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

.loading-label {
  color: #6b7280;
  font-weight: 700;
  margin: 0;
}

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

.spacer-top { margin-top: 1.5rem; }
.spacer-bottom { margin-bottom: 1rem; }
