/* Buy flow — the external buyer's checkout shell.
 *
 * These pages are reached from a seller's own website by buyers who have
 * never heard of UseThatApp. The design mirrors the structure of a hosted
 * payment page (the pattern buyers already trust): the seller's app is the
 * only branded, colorful thing on the page; UseThatApp appears the way a
 * payment processor appears — small, quiet, in the fine print, linked to
 * its terms. No site nav, no marketing footer, no analytics, no framework.
 *
 * Type is the system stack on purpose: it is the native register of every
 * payment sheet the buyer has used, and it costs zero requests.
 */

:root {
  --buy-paper: #f7f7f5;
  --buy-card: #ffffff;
  --buy-ink: #1c1f23;
  --buy-muted: #6a7076;
  --buy-line: #e7e6e2;
  --buy-dots: #c9c7c1;
  --buy-input-border: #d5d4d0;
  --buy-action: #0073e6;
  --buy-action-down: #005bb5;
  --buy-ok: #188653;
  --buy-warn: #9a6700;
  --buy-danger: #b42318;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.buy-body {
  background: var(--buy-paper);
  color: var(--buy-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.buy-main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 8vh, 72px) 16px 40px;
}

/* ---- the card ---------------------------------------------------------- */

.buy-card {
  width: 100%;
  max-width: 420px;
  background: var(--buy-card);
  border: 1px solid var(--buy-line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
              0 8px 24px rgba(16, 24, 40, 0.06);
}

/* Identity row: the app the buyer already knows, first thing on the page. */

.buy-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.buy-id-icon,
.buy-id-tile {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}

.buy-id-icon { object-fit: cover; }

/* Fallback when the app has no artwork: a letter tile, so the identity row
   never collapses to bare text. */
.buy-id-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--buy-ink);
  color: var(--buy-paper);
  font-size: 20px;
  font-weight: 600;
}

.buy-id-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.buy-id-sub {
  font-size: 13px;
  color: var(--buy-muted);
}

/* The ledger row: plan … dotted leader … price. A receipt line, because
   that is what this page is in the middle of producing. */

.buy-ledger {
  margin: 18px 0;
  padding: 14px 0;
  border-top: 1px solid var(--buy-line);
  border-bottom: 1px solid var(--buy-line);
}

.buy-ledger-row {
  display: flex;
  align-items: baseline;
  font-size: 15px;
  font-weight: 600;
}

.buy-ledger-dots {
  flex: 1;
  margin: 0 10px;
  border-bottom: 1px dotted var(--buy-dots);
  transform: translateY(-4px);
}

.buy-ledger-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.buy-ledger-amount small {
  font-size: 12px;
  font-weight: 500;
  color: var(--buy-muted);
}

.buy-ledger-sub {
  margin-top: 4px;
  text-align: right;
  font-size: 12px;
  color: var(--buy-muted);
}

/* ---- form -------------------------------------------------------------- */

.buy-form-heading {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.buy-field { margin-bottom: 14px; }

.buy-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.buy-input {
  width: 100%;
  /* 16px keeps iOS from zooming the viewport on focus. */
  font-size: 16px;
  font-family: inherit;
  color: var(--buy-ink);
  background: #fff;
  border: 1px solid var(--buy-input-border);
  border-radius: 8px;
  padding: 10px 12px;
}

.buy-input:focus {
  outline: none;
  border-color: var(--buy-action);
  box-shadow: 0 0 0 3px rgba(0, 115, 230, 0.15);
}

.buy-grid {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 12px;
}

.buy-error {
  margin-top: 5px;
  font-size: 13px;
  color: var(--buy-danger);
}

.buy-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--buy-action);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.buy-btn:hover { background: var(--buy-action-down); }
.buy-btn:active { transform: translateY(1px); }

.buy-btn:focus-visible,
.buy-input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--buy-action);
  outline-offset: 2px;
}

.buy-btn--quiet {
  display: inline-block;
  width: auto;
  color: var(--buy-ink);
  background: #fff;
  border: 1px solid var(--buy-input-border);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
}

.buy-btn--quiet:hover { background: var(--buy-paper); }

/* The expectation-setter under the button: names the next handoff so the
   Stripe page is never a surprise. */
.buy-next-step {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--buy-muted);
}

/* ---- notes and fine print ---------------------------------------------- */

.buy-note {
  border: 1px solid var(--buy-line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--buy-muted);
}

.buy-note--ok    { border-color: rgba(24, 134, 83, 0.35); color: var(--buy-ok); }
.buy-note--warn  { border-color: rgba(154, 103, 0, 0.35); color: var(--buy-warn); }
.buy-note--danger{ border-color: rgba(180, 35, 24, 0.35); color: var(--buy-danger); }

.buy-fine {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--buy-muted);
}

.buy-fine a,
.buy-foot a,
.buy-signin a,
.buy-next-step a {
  color: var(--buy-muted);
  text-decoration: underline;
}

.buy-signin {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--buy-muted);
}

/* The processor strip: UseThatApp named the way a processor is named. */

.buy-foot {
  width: 100%;
  max-width: 420px;
  margin-top: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--buy-muted);
}

.buy-foot-links { margin-top: 4px; }

/* ---- status pages (success / pending / confirm / error) ---------------- */

.buy-status { text-align: center; }

.buy-status h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.buy-status p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--buy-muted);
}

.buy-glyph { margin: 6px auto 0; width: 44px; height: 44px; }

.buy-spin {
  width: 32px;
  height: 32px;
  margin: 8px auto 0;
  border: 3px solid var(--buy-line);
  border-top-color: var(--buy-action);
  border-radius: 50%;
  animation: buy-spin 0.8s linear infinite;
}

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

.buy-divider {
  border: 0;
  border-top: 1px solid var(--buy-line);
  margin: 20px 0 14px;
}

/* Queued Django messages, consumed quietly above the card. */
.buy-messages {
  width: 100%;
  max-width: 420px;
  margin: 0 0 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--buy-muted);
}

/* ---- entrance auth pages (allauth layouts/entrance.html) --------------- */
/* Same shell as the buy pages; these pages ARE UseThatApp, so the card
   carries a small identity header: the logo plus a verified-domain chip
   (the same trust device as the OAuth consent pages) — the question a
   buyer asks on an auth page is "where am I typing my password?". */

.buy-auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.buy-auth-logo { height: 24px; width: auto; }

.buy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--buy-muted);
  border: 1px solid var(--buy-line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.buy-chip svg { width: 12px; height: 12px; }

.buy-auth h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 6px;
}

.buy-auth p {
  font-size: 13.5px;
  color: var(--buy-muted);
  margin: 0 0 14px;
}

.buy-auth p a,
.buy-auth-link {
  color: var(--buy-action);
  text-decoration: underline;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.buy-auth hr {
  border: 0;
  border-top: 1px solid var(--buy-line);
  margin: 16px 0;
}

.buy-auth-actions { margin-top: 4px; }
.buy-auth-actions .buy-btn + .buy-btn { margin-top: 10px; }

.buy-help {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--buy-muted);
}

/* Internal auth shell: the same card, centered inside the site chrome
   (base.html provides nav/footer; this only positions the card). */
.buy-auth-wrap {
  display: flex;
  justify-content: center;
  padding: 48px 16px 64px;
}

@media (prefers-reduced-motion: reduce) {
  .buy-spin { animation: none; }
  .buy-btn { transition: none; }
}

@media (max-width: 480px) {
  .buy-main { padding-top: 20px; }
  .buy-card { padding: 20px 16px; }
}
