/* ============================================================
   nowpayments.io checkout visual replica
   Design tokens measured from nowpayments' own payment-page.css
   (fetched 2026-11-25 from /css/payment-page.css?v=779b73...)
   ============================================================ */
:root {
  /* buttons (verbatim from nowpayments --btn-primary-*) */
  --btn-primary-bg: #3962ea;
  --btn-primary-bg-hover: #4f78ff;
  --btn-primary-bg-active: #173fc1;
  --btn-primary-text: #ffffff;
  --btn-primary-light-blue-bg: #f2f7ff;
  --btn-primary-light-blue-text: #3962ea;

  /* fonts (verbatim) */
  --font-family-primary: "Source Sans Pro", sans-serif;
  --font-family-secondary: "Work Sans", sans-serif;
  --text-xs-size: 12px;
  --text-sm-size: 14px;
  --text-md-size: 16px;
  --text-md-lg-size: 18px;
  --text-lg-size: 20px;
  --text-xl-size: 24px;
  --text-sm-line-height: 20px;
  --text-md-line-height: 24px;
  --text-lg-line-height: 28px;

  /* invoice light theme (verbatim from .invoice_light) */
  --invoice-bg-primary: #ffffff;
  --invoice-bg-secondary: #f9f9f9;
  --invoice-bg-tertiary: #fafafa;
  --invoice-border-color-primary: #545454;
  --invoice-border-color-secondary: #9696a5;
  --invoice-text-primary: #1b1e22;
  --invoice-text-secondary: #9696a5;
  --invoice-text-tertiary: #545454;
  --invoice-text-fourth: #7e7e7e;

  /* measured card geometry: .invoice__content{max-width:448px;radius:16px;shadow} */
  --card-radius: 16px;
  --card-shadow: 0 0 16px 0 rgba(219, 219, 219, 0.5019607843);
  --card-width: 448px;
  --ok: #086400;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--invoice-bg-secondary);
  color: var(--invoice-text-primary);
  font-family: var(--font-family-primary);
  font-size: var(--text-md-size);
  line-height: var(--text-md-line-height);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- card ---------- */
.invoice {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--card-width);
}
.invoice__invoice-toolbar { min-height: 24px; margin-bottom: 8px; }
.invoice-toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.lang-switch {
  font-size: var(--text-sm-size);
  color: var(--invoice-text-tertiary);
  font-family: var(--font-family-secondary);
  font-weight: 500;
}
.invoice__content {
  overflow: hidden;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  background: var(--invoice-bg-primary);
  padding: 16px 16px 24px;
}
.invoice__details { border-radius: var(--card-radius); padding: 8px 8px 0; }
.invoice__additions { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

/* ---------- status rail ---------- */
.transaction-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 0 4px;
  margin-bottom: 16px;
  width: 100%;
  overflow: hidden;
}
.transaction-status__item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 16px;
  color: var(--invoice-text-secondary);
  white-space: nowrap;
  min-width: 0;
  flex: 0 1 auto;
}
.transaction-status__item__name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.transaction-status__item_active { color: var(--invoice-text-primary); font-weight: 600; }
.transaction-status__item_completed { color: var(--ok); }
.transaction-status__line {
  flex: 0 1 22px;
  height: 2px;
  min-width: 6px;
  border-radius: 2px;
  background: #e7e7ee;
}
.ts-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #efeff4;
  flex: 0 0 auto;
  position: relative;
}
.transaction-status__item_completed .ts-icon { background: rgba(8, 100, 0, .1); }
.transaction-status__item_active .ts-icon { background: rgba(23, 63, 193, .1); }
.ts-icon::after {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: #c3c3d0;
}
.transaction-status__item_active .ts-icon::after { background: #173fc1; }
.transaction-status__item_completed .ts-icon::after { background: var(--ok); }
.ts-icon[data-icon="success"].is-done::after,
.ts-icon.is-done::after {
  content: "";
  width: 9px; height: 5px;
  border-radius: 0;
  background: transparent;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translate(1px, -1px);
  color: var(--ok);
}

/* ---------- headings ---------- */
.state-title {
  margin: 4px 0 2px;
  font-size: var(--text-xl-size);
  line-height: 32px;
  font-weight: 700;
  text-align: center;
}
.state-subtitle {
  margin: 0 0 16px;
  text-align: center;
  font-size: var(--text-sm-size);
  color: var(--invoice-text-tertiary);
}
.state-subtitle b { color: var(--invoice-text-primary); font-weight: 600; }

/* ---------- QR ---------- */
.qr-block { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 16px; }
.qr-frame {
  padding: 8px;
  border: 1px solid #ececf2;
  border-radius: 8px;
  background: #fff;
}
.qr-code { width: 168px; height: 168px; display: block; }
.qr-code img, .qr-code canvas { width: 168px; height: 168px; display: block; }
.qr-tabs { display: inline-flex; background: var(--invoice-bg-secondary); border-radius: 8px; padding: 2px; }
.qr-tab {
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: var(--text-xs-size);
  color: var(--invoice-text-tertiary);
  padding: 6px 12px; border-radius: 6px;
}
.qr-tab.is-active { background: #fff; color: var(--invoice-text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---------- fields ---------- */
.field {
  border: 1px solid #ececf2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--invoice-bg-tertiary);
}
.field__label { font-size: var(--text-xs-size); color: var(--invoice-text-secondary); margin-bottom: 2px; }
.field__row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.field__value {
  font-size: var(--text-md-size);
  font-weight: 600;
  color: var(--invoice-text-primary);
  word-break: break-all;
  flex: 1 1 auto;
}
.field__value_mono { font-family: var(--font-family-secondary); font-size: var(--text-sm-size); font-weight: 500; }
.copy-btn {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  background: var(--btn-primary-light-blue-bg) no-repeat center;
  position: relative;
}
.copy-btn::after {
  content: "";
  position: absolute; inset: 0;
  background: no-repeat center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%233962ea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='9' width='12' height='12' rx='2'/><path d='M5 15V5a2 2 0 0 1 2-2h10'/></svg>");
}
.copy-btn.is-copied { background: rgba(8,100,0,.1); }

/* ---------- timer ---------- */
.timer-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 12px 0 4px;
  font-size: var(--text-xs-size);
  color: var(--invoice-text-secondary);
}
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--btn-primary-bg); text-decoration: underline;
}
.simple-timer__seconds {
  font-family: var(--font-family-secondary);
  font-weight: 600;
  font-size: var(--text-sm-size);
  color: var(--invoice-text-primary);
  background: var(--invoice-bg-secondary);
  border-radius: 6px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.payid-line {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: var(--text-xs-size);
  color: var(--invoice-text-secondary);
  padding: 6px 0 0;
}
.payid-line__value { font-family: var(--font-family-secondary); color: var(--invoice-text-tertiary); word-break: break-all; }

/* ---------- notices ---------- */
.notice {
  margin-top: 16px;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: var(--text-xs-size);
  line-height: var(--text-sm-line-height);
  background: var(--invoice-bg-secondary);
  color: var(--invoice-text-tertiary);
}
.notice_bottom { background: var(--btn-primary-light-blue-bg); color: #27467e; }
.notice_success { background: #f4faf6; color: #2c5f3f; }
.keynotes { margin-top: 16px; }
.keynotes__title { font-size: var(--text-sm-size); margin: 0 0 6px; font-weight: 600; }
.keynotes__list { margin: 0; padding-left: 18px; color: var(--invoice-text-tertiary); font-size: var(--text-xs-size); line-height: var(--text-sm-line-height); }

/* ---------- processing ---------- */
.step_processing, .step_success { text-align: center; padding: 8px 0 4px; }
.spinner-wrap { display: flex; justify-content: center; margin: 8px 0 12px; }
.spinner {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid #e7ecfa;
  border-top-color: var(--btn-primary-bg);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.step__title { font-size: var(--text-lg-size); line-height: var(--text-lg-line-height); margin: 0 0 6px; font-weight: 700; }
.step__text { margin: 0 auto 8px; font-size: var(--text-sm-size); color: var(--invoice-text-tertiary); max-width: 360px; }
.step__text_sub { color: var(--invoice-text-secondary); }
.progress { height: 6px; border-radius: 3px; background: #eef0f6; overflow: hidden; margin: 16px 0 6px; }
.progress__bar {
  height: 100%; width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--btn-primary-bg), var(--btn-primary-bg-hover));
  transition: width .6s ease;
}
.progress__meta { display: flex; justify-content: space-between; font-size: var(--text-xs-size); color: var(--invoice-text-secondary); }

/* ---------- success ---------- */
.success-icon { display: flex; justify-content: center; margin: 4px 0 10px; }
.success-icon__circle { stroke: var(--ok); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw-circle .7s ease forwards; }
.success-icon__check { stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw-check .5s .55s ease forwards; }
@keyframes draw-circle { to { stroke-dashoffset: 0; } }
@keyframes draw-check { to { stroke-dashoffset: 0; } }

/* ---------- details ---------- */
.details { margin-top: 20px; border-top: 1px solid #f0f0f4; padding-top: 12px; }
.details__title { font-size: var(--text-sm-size); font-weight: 600; margin: 0 0 8px; }
.details__list { margin: 0; }
.details__row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: var(--text-xs-size);
  padding: 7px 0;
  border-bottom: 1px solid #f6f6f9;
}
.details__row:last-child { border-bottom: 0; }
.details__row dt { color: var(--invoice-text-secondary); margin: 0; }
.details__row dd { margin: 0; color: var(--invoice-text-primary); font-weight: 500; text-align: right; word-break: break-all; max-width: 68%; }
.details__row_pending { display: none; }
.details__row_pending.is-visible { display: flex; }

/* ---------- footer ---------- */
.terms-footer { margin: 0; font-size: 11px; line-height: 16px; color: var(--invoice-text-secondary); text-align: center; }
.terms-footer .link { color: var(--invoice-text-tertiary); text-decoration: underline; }
.powered {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: var(--text-xs-size); color: var(--invoice-text-secondary);
  font-family: var(--font-family-secondary);
}
.powered .logo { font-weight: 700; color: var(--invoice-text-primary); letter-spacing: -.2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #1b1e22; color: #fff; font-size: var(--text-xs-size);
  padding: 8px 14px; border-radius: 8px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 40;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive (nowpayments is responsive) ---------- */
@media (max-width: 520px) {
  .page { padding: 16px 12px 40px; }
  .invoice__content { padding: 12px 12px 20px; border-radius: 14px; }
  .state-title { font-size: var(--text-lg-size); line-height: 28px; }
  .transaction-status { gap: 2px; }
  .transaction-status__item__name { font-size: 10px; }
  .ts-icon { width: 16px; height: 16px; }
  .qr-code, .qr-code img, .qr-code canvas { width: 148px; height: 148px; }
  .details__row dd { max-width: 60%; }
}
@media (max-width: 380px) {
  .transaction-status__item__name { display: none; }
  .transaction-status__item { gap: 0; }
}
