/* ============================================================================
 *  Epsopay — hosted payment page  ("Forest Noir")
 *  Deep pine ink · luminous signal-green · brass detail.
 *  Fraunces display · Inter body · JetBrains Mono numerals.
 *  Every class is prefixed pp-* and driven by app.js (brand-neutral logic).
 * ========================================================================== */

:root {
  --bg:          #08110d;
  --bg-alt:      #0b1611;
  --panel:       #0f1c16;
  --panel-2:     #16271e;
  --panel-3:     #1b3126;

  --ink:         #eef2ea;
  --ink-dim:     #a9bcae;
  --ink-faint:   #6f8478;
  --line:        rgba(168, 200, 180, 0.14);
  --line-soft:   rgba(168, 200, 180, 0.07);
  --rule:        rgba(168, 200, 180, 0.26);

  --green-deep:  #1d5c47;
  --green:       #2bbd7e;
  --green-lit:   #3ddc84;
  --green-soft:  rgba(61, 220, 132, 0.12);
  --green-glow:  rgba(61, 220, 132, 0.40);

  --brass:       #e0ad55;
  --brass-soft:  rgba(224, 173, 85, 0.14);

  --warn:        #f0b34e;
  --warn-soft:   rgba(240, 179, 78, 0.12);
  --danger:      #ef6b6b;
  --paper-ink:   #06180f;

  --r:    12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow:    0 40px 90px -42px rgba(0, 0, 0, 0.85);
  --shadow-sm: 0 8px 30px -12px rgba(0, 0, 0, 0.6);
  --glint:     inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --ease-out:    cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 620px at 50% -8%, rgba(61, 220, 132, 0.09), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
  opacity: 0.035; mix-blend-mode: overlay;
}

/* ------------------------------- shell --------------------------------- */
.pp-shell {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 18px 28px;
}

.pp-brandbar {
  width: 100%; max-width: 460px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 22px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--green-lit), var(--green-deep));
  color: var(--paper-ink); font-family: var(--font-display); font-weight: 600; font-size: 18px;
  box-shadow: var(--glint);
}
.brand__name { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.3px; }
.pp-brandbar__badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.6px;
  color: var(--ink-dim); text-transform: uppercase;
}
.pp-brandbar__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-lit); box-shadow: 0 0 0 4px var(--green-soft);
}

.pp-root { width: 100%; max-width: 460px; flex: 1; display: flex; align-items: flex-start; }

.pp-foot {
  margin-top: 22px; text-align: center;
  font-size: 12px; color: var(--ink-faint);
}
.pp-foot b { color: var(--ink-dim); font-weight: 600; }

/* -------------------------------- card --------------------------------- */
.pp-card {
  width: 100%;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), var(--glint);
  padding: 26px 24px;
  animation: pp-rise 0.4s var(--ease-out) both;
}
.pp-card--center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
@keyframes pp-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ----------------------------- typography ------------------------------ */
.pp-title { font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -0.6px; margin: 2px 0 0; }
.pp-title--sm { font-size: 21px; }
.pp-subtitle { color: var(--ink-dim); font-size: 15px; margin: 0; max-width: 34ch; }
.pp-fineprint { color: var(--ink-faint); font-size: 12.5px; margin: 4px 0 0; line-height: 1.5; }
.pp-link { color: var(--green-lit); text-decoration: none; border-bottom: 1px solid var(--green-soft); }
.pp-link:hover { border-color: var(--green-lit); }

/* ------------------------------- header -------------------------------- */
.pp-head { margin-bottom: 18px; }
.pp-head__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pp-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--green-lit);
}
.pp-amount { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 12px 0 6px; }
.pp-amount__val { font-family: var(--font-mono); font-weight: 600; font-size: 34px; letter-spacing: -1px; color: var(--ink); }
.pp-ref { font-size: 12.5px; color: var(--ink-faint); }
.pp-ref__id { font-family: var(--font-mono); color: var(--ink-dim); }

.pp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px;
  padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--green-soft); color: var(--green-lit);
  border: 1px solid rgba(61, 220, 132, 0.22);
}

/* -------------------------------- timer -------------------------------- */
.pp-timer {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  color: var(--ink-dim);
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(7, 18, 12, 0.5); border: 1px solid var(--line);
}
.pp-timer__ic { width: 15px; height: 15px; color: var(--ink-faint); display: inline-flex; }
.pp-timer__ic svg { width: 100%; height: 100%; }
.pp-timer--low { color: var(--brass); border-color: var(--brass-soft); }
.pp-timer--low .pp-timer__ic { color: var(--brass); }
.pp-timer--crit { color: var(--danger); border-color: rgba(239, 107, 107, 0.28); animation: pp-pulse 1.4s ease-in-out infinite; }
.pp-timer--crit .pp-timer__ic { color: var(--danger); }
@keyframes pp-pulse { 50% { opacity: 0.55; } }

/* ----------------------------- instrument ------------------------------ */
.pp-instrument { display: flex; flex-direction: column; gap: 18px; }
.pp-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pp-qr {
  background: #ffffff; padding: 14px; border-radius: var(--r);
  width: 210px; height: 210px; display: grid; place-items: center;
  box-shadow: 0 10px 30px -14px rgba(0,0,0,0.7);
}
.pp-qr__svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.pp-qr__hint { color: var(--ink-dim); font-size: 13px; text-align: center; margin: 0; }

.pp-details {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(7, 18, 12, 0.35);
  overflow: hidden;
}
.pp-kv {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
}
.pp-kv:last-child { border-bottom: 0; }
.pp-kv__label { font-size: 12.5px; color: var(--ink-faint); flex-shrink: 0; }
.pp-kv__valwrap { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pp-kv__val { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); word-break: break-all; text-align: right; }
.pp-copy {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--ink-dim);
  transition: color .15s, border-color .15s, background .15s;
}
.pp-copy:hover { color: var(--green-lit); border-color: rgba(61,220,132,0.3); }
.pp-copy__ic { width: 15px; height: 15px; display: inline-flex; }
.pp-copy__ic svg { width: 100%; height: 100%; }
.pp-copy.is-copied { color: var(--paper-ink); background: var(--green-lit); border-color: var(--green-lit); }

/* -------------------------------- notes -------------------------------- */
.pp-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.45;
  margin-top: 16px;
}
.pp-note--info { background: var(--brass-soft); border: 1px solid rgba(224,173,85,0.24); color: #f3e2c0; }
.pp-note--ok   { background: var(--green-soft); border: 1px solid rgba(61,220,132,0.24); color: #cdeede; }
.pp-note__ic   { width: 17px; height: 17px; flex-shrink: 0; color: var(--green-lit); margin-top: 1px; }
.pp-note__ic svg { width: 100%; height: 100%; }
.pp-note__dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 4px;
  background: var(--brass); box-shadow: 0 0 0 4px var(--brass-soft);
  animation: pp-pulse 1.4s ease-in-out infinite;
}

/* --------------------------------- UTR --------------------------------- */
.pp-utr { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.pp-utr--collapsed .pp-utr__panel { display: none; }
.pp-utr__toggle {
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; padding: 4px 0; color: var(--green-lit);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
}
.pp-utr__toggle::after { content: '  ›'; color: var(--ink-faint); }
.pp-utr__toggle.is-open::after { content: ''; }
.pp-utr__panel { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------- inputs -------------------------------- */
.pp-input__label { font-size: 12.5px; color: var(--ink-dim); font-weight: 500; }
.pp-input {
  width: 100%; font-family: var(--font-mono); font-size: 15px;
  padding: 13px 15px; border-radius: var(--r);
  border: 1px solid var(--rule); background: rgba(7, 18, 12, 0.5); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.pp-input::placeholder { color: var(--ink-faint); }
.pp-input:focus { outline: none; border-color: var(--green-lit); box-shadow: 0 0 0 3px var(--green-soft); }
.pp-input__err { color: var(--danger); font-size: 12.5px; margin: 0; }

.pp-amount-input {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: rgba(7, 18, 12, 0.5); padding: 6px 14px; margin: 6px 0;
}
.pp-amount-input:focus-within { border-color: var(--green-lit); box-shadow: 0 0 0 3px var(--green-soft); }
.pp-amount-input__cur { font-family: var(--font-mono); font-size: 24px; color: var(--ink-dim); }
.pp-input--amount { border: 0; background: none; box-shadow: none; padding: 10px 4px; font-size: 26px; font-weight: 600; }
.pp-input--amount:focus { box-shadow: none; }

/* ------------------------------- buttons ------------------------------- */
.pp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 13px 20px; border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .2s, background .2s;
}
.pp-btn:active { transform: translateY(1px); }
.pp-btn:disabled { opacity: 0.6; cursor: default; }
.pp-btn--block { width: 100%; }
.pp-btn--primary {
  background: linear-gradient(180deg, #6ef0a8 0%, #3ddc84 46%, #23b56a 100%);
  color: var(--paper-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 12px 26px -12px var(--green-glow);
}
.pp-btn--primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 16px 32px -12px var(--green-glow); }
.pp-btn--ghost {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015));
  border-color: var(--rule); color: var(--ink);
}
.pp-btn--ghost:hover { border-color: rgba(61,220,132,0.4); box-shadow: 0 0 0 3px var(--green-soft); }
.pp-btn--upi {
  background: rgba(7, 18, 12, 0.5); border-color: var(--rule); color: var(--ink); font-size: 14px; padding: 11px 18px;
}
.pp-btn--upi:hover { border-color: rgba(61,220,132,0.4); }
.pp-btn__ic { width: 17px; height: 17px; display: inline-flex; }
.pp-btn__ic svg { width: 100%; height: 100%; }

/* ------------------------------- secure -------------------------------- */
.pp-secure {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-faint);
}
.pp-secure__ic { width: 14px; height: 14px; display: inline-flex; color: var(--green); }
.pp-secure__ic svg { width: 100%; height: 100%; }

/* ------------------------------ hero/result ---------------------------- */
.pp-hero {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-soft); border: 1px solid rgba(61,220,132,0.3);
  animation: pp-pop 0.45s var(--ease-out) both;
}
.pp-hero--ok { box-shadow: 0 0 0 8px rgba(61,220,132,0.06); }
@keyframes pp-pop { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.pp-hero-icon { width: 30px; height: 30px; color: var(--green-lit); display: inline-flex; }
.pp-hero-icon svg { width: 100%; height: 100%; }
.pp-hero-icon--warn { width: 46px; height: 46px; color: var(--warn); }

.pp-receipt {
  width: 100%; margin-top: 6px;
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: rgba(7, 18, 12, 0.35);
}
.pp-receipt__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
}
.pp-receipt__row:last-child { border-bottom: 0; }
.pp-receipt__label { font-size: 12.5px; color: var(--ink-faint); }
.pp-receipt__val { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); }

.pp-progress { width: 100%; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.pp-progress__bar { height: 100%; width: 0; background: var(--green-lit); animation: pp-fill 2.5s linear forwards; }
@keyframes pp-fill { to { width: 100%; } }

/* ------------------------------- choices ------------------------------- */
.pp-choices { display: flex; flex-direction: column; gap: 10px; }
.pp-choice {
  display: flex; align-items: center; gap: 13px; width: 100%; cursor: pointer;
  padding: 14px 16px; border-radius: var(--r); text-align: left;
  background: rgba(7, 18, 12, 0.35); border: 1px solid var(--line); color: var(--ink);
  transition: border-color .15s, background .15s, transform .12s;
}
.pp-choice:hover { border-color: rgba(61,220,132,0.4); background: var(--green-soft); }
.pp-choice:active { transform: translateY(1px); }
.pp-choice__logo { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; background: #fff; padding: 3px; }
.pp-choice__logo--ph {
  background: var(--panel-3); color: var(--green-lit); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 18px; padding: 0;
}
.pp-choice__name { flex: 1; font-weight: 600; font-size: 15px; }
.pp-choice__arrow { width: 18px; height: 18px; color: var(--ink-faint); display: inline-flex; }
.pp-choice__arrow svg { width: 100%; height: 100%; }

/* ------------------------------- spinner ------------------------------- */
.pp-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--green-lit);
  animation: pp-spin 0.8s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-loading-text { color: var(--ink-dim); font-size: 14px; margin: 0; }

/* ------------------------------ responsive ----------------------------- */
@media (max-width: 420px) {
  .pp-card { padding: 22px 18px; }
  .pp-amount__val { font-size: 30px; }
  .pp-qr { width: 190px; height: 190px; }
}

/* --- Desktop / wide viewports -------------------------------------------
 * The interactive checkout (a .pp-flow card) widens and lays the QR beside
 * the payment details so the whole thing fits on one screen without
 * scrolling. Result/success/error cards (no .pp-flow) stay narrow & centred.
 * ------------------------------------------------------------------------ */
@media (min-width: 640px) {
  /* keep the brandbar, card and footer the same width as the wide card */
  .pp-shell:has(.pp-flow) .pp-brandbar,
  .pp-shell:has(.pp-flow) .pp-root { max-width: 640px; }

  /* centre the card vertically when it fits; `safe` avoids clipping tall content */
  .pp-shell:has(.pp-flow) .pp-root { align-items: safe center; }

  .pp-card:has(.pp-flow) { padding: 30px 34px; }

  /* QR and the copyable details sit side-by-side instead of stacked */
  .pp-flow .pp-instrument {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 28px;
    align-items: start;
  }
  .pp-flow .pp-qr-wrap { align-self: start; }
  .pp-flow .pp-details { align-self: start; }
}

/* On very wide screens give the two panes a touch more room */
@media (min-width: 900px) {
  .pp-shell:has(.pp-flow) .pp-brandbar,
  .pp-shell:has(.pp-flow) .pp-root { max-width: 680px; }
  .pp-flow .pp-instrument { column-gap: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
