/* =======================================================================
   Transpayrent checkout styles — SHARED by the block checkout form
   (#tpr-wrapper, rendered by checkout.js) and the classic/shortcode
   checkout form (#tpr-classic-wrapper, rendered by payment_fields() +
   checkout-classic.js).

   All component rules are scoped under BOTH id roots. Deliberately
   self-contained (fixed px sizes, own borders/backgrounds): the forms render
   inside arbitrary themes, and theme presets/resets vary too much to inherit
   from (e.g. Storefront: 26px preset font, borderless grey inputs). The id
   scoping also outranks theme element resets.
   ======================================================================= */

/* ---- isolation reset ----
   Neutralize the inherited/ambient theme styling that would distort our
   fixed-size layout, scoped to our two roots so nothing leaks OUT of the
   widget. We reset only geometry and text-SHAPING here — the properties themes
   most often override and that break layout (box model, font metrics, casing,
   spacing). Color/background are deliberately NOT reset: those stay
   theme/brand-aware (the buttons still pick up the theme's button color unless
   the merchant sets an explicit brand color).

   box-sizing on the whole subtree: every fixed px width/height in this file
   assumes border-box, so a theme's `content-box` (or a stray border) must not
   change our computed sizes. */
#tpr-wrapper,
#tpr-classic-wrapper,
#tpr-wrapper *,
#tpr-classic-wrapper *,
#tpr-wrapper *::before,
#tpr-wrapper *::after,
#tpr-classic-wrapper *::before,
#tpr-classic-wrapper *::after {
  box-sizing: border-box;
}

/* Text-shaping base — inherited by all descendants, so loose text (labels,
   descriptions, messages) can't pick up a theme's oversized font, uppercase
   transform, wide letter-spacing or italic. Elements themes target DIRECTLY
   (buttons, inputs) additionally re-declare these on themselves below, because
   a direct theme rule outranks an inherited value. */
#tpr-wrapper,
#tpr-classic-wrapper {
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
}

/* Headings: id-scoped so a theme's heading rules (e.g. a 26px/uppercase h3)
   can't blow these up — this is the exact class of bug seen before. */
#tpr-wrapper h3,
#tpr-classic-wrapper h3 {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  margin: 0 0 12px;
  padding: 0;
}

#tpr-wrapper .tpr-description,
#tpr-classic-wrapper .tpr-description {
  margin: 0 0 12px;
}

#tpr-wrapper .tpr-description-text,
#tpr-classic-wrapper .tpr-description-text {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  margin: 0;
}

/* ---- field rows ---- */
#tpr-wrapper .tpr-fields,
#tpr-classic-wrapper .tpr-fields {
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
}

#tpr-wrapper .tpr-line,
#tpr-classic-wrapper .tpr-line {
  display: flex;
  margin: 0 0 10px;
}

#tpr-wrapper .tpr-line > div,
#tpr-classic-wrapper .tpr-line > div {
  width: 100%;
}

#tpr-wrapper .tpr-line-reverse,
#tpr-classic-wrapper .tpr-line-reverse {
  display: flex;
  margin-bottom: 10px;
  flex-direction: row-reverse;
  align-items: center;
}

#tpr-wrapper .tpr-line-combo,
#tpr-classic-wrapper .tpr-line-combo {
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
}

#tpr-wrapper .tpr-line-combo > *,
#tpr-classic-wrapper .tpr-line-combo > * {
  flex: 1 1 0;
  min-width: 0;
}

/* ---- inputs ---- */
#tpr-wrapper input[type="text"],
#tpr-wrapper input[type="password"],
#tpr-classic-wrapper input[type="text"],
#tpr-classic-wrapper input[type="password"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  margin: 0;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 16px; /* >=16px so iOS Safari does not zoom the page on focus */
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  color: #2c2c2c;
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 5px;
  box-shadow: none;
  /* Strip the native control chrome (iOS inner shadow, theme appearance) so
     the field looks identical everywhere. */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: 0; /* some themes set min-height on inputs */
  max-width: none;
}

#tpr-wrapper .tpr-line-combo input,
#tpr-classic-wrapper .tpr-line-combo input {
  text-align: center;
}

#tpr-wrapper input[type="text"]:focus,
#tpr-wrapper input[type="password"]:focus,
#tpr-classic-wrapper input[type="text"]:focus,
#tpr-classic-wrapper input[type="password"]:focus {
  border-color: #50575e;
  outline: none;
  box-shadow: 0 0 0 1px #50575e;
}

#tpr-wrapper input::placeholder,
#tpr-classic-wrapper input::placeholder {
  color: #757575;
  opacity: 1;
}

#tpr-wrapper input.tpr-invalid,
#tpr-classic-wrapper input.tpr-invalid {
  border: 1px solid #cc1818;
  background-color: #fff0f0;
}

#tpr-wrapper span.required,
#tpr-classic-wrapper span.required {
  color: #cc1818;
}

#tpr-wrapper .tpr-field-error,
#tpr-classic-wrapper .tpr-field-error {
  color: #cc1818;
  margin-top: 4px;
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

/* ---- messages / loader ---- */
#tpr-wrapper #tpr-progress-message p,
#tpr-classic-wrapper #tpr-classic-message p {
  margin: 0 0 10px;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
}

#tpr-wrapper .tpr-loader,
#tpr-classic-wrapper .tpr-loader {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 12px;
}

#tpr-wrapper .tpr-loader p,
#tpr-classic-wrapper .tpr-loader p {
  margin: 0;
  font-size: 14px;
}

.tpr-spinner {
  margin-left: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  border: 3px solid;
  border-color: rgb(142, 180, 71) rgb(142, 180, 71) transparent transparent;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

.tpr-spinner::after,
.tpr-spinner::before {
  content: "";
  box-sizing: border-box;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  border: 3px solid;
  border-color: transparent transparent #ff3d00 #ff3d00;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  animation: rotationBack 0.5s linear infinite;
  transform-origin: center center;
}

.tpr-spinner::before {
  width: 12px;
  height: 12px;
  border-color: rgb(142, 180, 71) rgb(142, 180, 71) transparent transparent;
  animation: rotation 1.5s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes rotationBack {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(-360deg);
  }
}

/* ---- card logos ---- */
#tpr-wrapper #card-logos-container,
#tpr-classic-wrapper #tpr-classic-card-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

#tpr-classic-wrapper #tpr-classic-card-logos:empty {
  margin: 0;
}

#tpr-wrapper #card-logos-container img,
#tpr-classic-wrapper #tpr-classic-card-logos img {
  width: 42px;
  height: auto;
  margin: 0;
  padding: 0;
  border-radius: 3px;
}

#tpr-wrapper .tpr-logo,
#tpr-classic-wrapper .tpr-logo {
  width: 42px;
  padding-right: 10px;
}

/* ---- payment method selection ---- */
/* Google Pay / Apple Pay stack one per line, full width, like the other
   method buttons — side-by-side layouts made them overlap. */
#tpr-wrapper .tpr-pay-outer-methods,
#tpr-classic-wrapper .tpr-pay-outer-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#tpr-wrapper .tpr-pay-outer-methods > div,
#tpr-classic-wrapper .tpr-pay-outer-methods > div {
  width: 100% !important; /* wins over legacy inline width on the container */
}

/* The whole wallet group spaces to the next button by the same 8px rhythm. */
#tpr-wrapper .tpr-pay-outer-methods,
#tpr-classic-wrapper .tpr-pay-outer-methods {
  margin: 0 0 8px;
}

/* All method buttons share one geometry so the branded (Google/Apple) and
   own (Card/Wallet/MobilePay) buttons read as one set: same 40px height,
   4px radius, full width, 8px vertical rhythm, centered icon + label.
   40px/4px is Google Pay's own native size — the one button we cannot resize
   without breaking it — so everything else conforms to it.

   Geometry + text-shaping are pinned here so both checkout modes render
   identically and a theme's `.wp-element-button` rules (Card/Wallet carry that
   class for their COLOR) cannot change the size, casing, letter-spacing or the
   icon↔label spacing. The icon↔label distance is the flex `gap` — defined ONCE
   for every button, which is what fixes the block-vs-classic mismatch (it used
   to be an inline 5px on the block icons vs a 6px CSS padding on classic). */
#tpr-wrapper .tpr-pay-method-card,
#tpr-classic-wrapper .tpr-pay-method-card,
#tpr-wrapper .tpr-pay-method-mobilepay,
#tpr-classic-wrapper .tpr-pay-method-mobilepay {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin: 0 0 8px;
  padding: 0 12px;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  text-align: center;
  white-space: normal;
}

/* Card / Wallet are always in the DOM; shown as a flex row. Their COLOR stays
   theme-aware (via .wp-element-button) or brand-set (inline from settings) —
   only their geometry above is pinned. */
#tpr-wrapper .tpr-pay-method-card,
#tpr-classic-wrapper .tpr-pay-method-card {
  display: flex;
}

/* MobilePay carries its own brand colors and is revealed by JS (which sets
   display:flex); it has no .wp-element-button, so pin its border too. */
#tpr-wrapper .tpr-pay-method-mobilepay,
#tpr-classic-wrapper .tpr-pay-method-mobilepay {
  display: none;
  color: #fff;
  background-color: #5a78ff;
  border: 0;
}

/* Icons: fixed height, never flex-shrink; the button's `gap` owns the spacing
   (no per-icon padding/margin, so nothing can drift between the two modes). */
#tpr-wrapper .tpr-pay-method-card img,
#tpr-classic-wrapper .tpr-pay-method-card img,
#tpr-wrapper .tpr-pay-method-mobilepay img,
#tpr-classic-wrapper .tpr-pay-method-mobilepay img {
  flex: 0 0 auto;
  width: auto;
  height: 20px;
  max-width: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: middle;
}

/* MobilePay's wordmark logo reads better a touch taller. */
#tpr-wrapper .tpr-pay-method-mobilepay img,
#tpr-classic-wrapper .tpr-pay-method-mobilepay img {
  height: 24px;
}

#tpr-wrapper .tpr-pay-method-card-text,
#tpr-classic-wrapper .tpr-pay-method-card-text {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
}

/* "< back to payment method selection" */
#tpr-wrapper .tpr-pay-method-reset,
#tpr-classic-wrapper .tpr-pay-method-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin: 0 0 12px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 1px solid #c3c4c7;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
}

#tpr-wrapper .tpr-pay-method-reset:hover,
#tpr-classic-wrapper .tpr-pay-method-reset:hover {
  border-color: #50575e;
}

#tpr-wrapper .tpr-pay-method-reset-text,
#tpr-classic-wrapper .tpr-pay-method-reset-text {
  font-size: 14px;
  margin: 0;
}

/* ---- wallet cards ---- */
#tpr-wrapper .tpr-wallet-cards-container,
#tpr-classic-wrapper .tpr-wallet-cards-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

/* Scoped under both roots (not bare classes) so theme rules can't outrank
   these — the fixed 50%-width card grid is layout we must own. */
#tpr-wrapper .tpr-wallet-card,
#tpr-classic-wrapper .tpr-wallet-card {
  padding: 8px;
  width: calc(50% - 12px);
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid #c3c4c7;
  border-radius: 5px;
}

#tpr-wrapper .tpr-wallet-card-selected,
#tpr-classic-wrapper .tpr-wallet-card-selected {
  border: 2px solid #2e7d32;
  background-color: #f0fff0;
}

#tpr-wrapper .tpr-wallet-card > *,
#tpr-classic-wrapper .tpr-wallet-card > * {
  pointer-events: none;
}

#tpr-wrapper .tpr-wallet-card-logo,
#tpr-classic-wrapper .tpr-wallet-card-logo {
  width: auto;
  height: 32px !important;
  float: left;
  margin: 0;
  padding-right: 8px;
}

#tpr-wrapper .tpr-wallet-card-number,
#tpr-classic-wrapper .tpr-wallet-card-number {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
}

#tpr-wrapper .tpr-wallet-card-expiry,
#tpr-classic-wrapper .tpr-wallet-card-expiry {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: normal;
  text-transform: none;
}

/* ---- Google Pay / Apple Pay buttons ----
   Both are vendor-rendered; only make them full width and let each size its
   own height. Do NOT force a height on the Google Pay elements — GPay derives
   its loading placeholder's scale from the element height, so a forced height
   makes it flash an oversized button until its iframe swaps in.

   Apple Pay draws its button inside shadow DOM that ignores ordinary CSS — it
   is sized ONLY through its supported --apple-pay-button-* custom properties.
   The previous rule set `padding-top:5px` + `min-height:35px` on the host,
   which squeezed the shadow content and clipped ~5px off the bottom of the
   glyph, so it uses the custom properties instead. */
.gpay-card-info-container {
  min-width: 100px;
  width: 100%;
}

.gpay-button {
  width: 100% !important;
}

apple-pay-button {
  display: block;
  width: 100%;
  height: 40px;
  --apple-pay-button-width: 100%;
  --apple-pay-button-height: 40px;
  --apple-pay-button-border-radius: 4px;
}

/* ---- 3-D Secure / SDK containers ---- */
#tpr-container iframe {
  min-height: 300px;
  min-width: 650px;
}

.consumer-authentication {
  position: relative;
  transform: translate(50%, -110%);
  background: #fff;
  border-radius: 12px;
  width: min(420px, 95vw);
  height: min(620px, 95vh);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* MobilePay lightbox styles from Transpayrent documentation */
.payment-initialization {
  opacity: 1;
  margin: auto;
  margin-top: 20px;
  border: 0px;
  z-index: 10001;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.payment-initialization:not(:empty) {
  display: block; /* Show when it has content */
}
.payment-initialization.payment-method-202 {
  width: 375px;
  height: 600px;
}
/* Mobile full-screen optimization for payment initialization */
@media (max-width: 768px) {
  .payment-initialization {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    margin-top: 0 !important;
  }
  .payment-initialization.payment-method-202 {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
  }
}
/* Grey overlay backdrop for MobilePay */
.mobilepay-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: none;
}
.mobilepay-overlay.active {
  display: block;
}
/* MobilePay loader styles */
.mobilepay-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 10001;
  min-width: 200px;
  display: none;
}
.mobilepay-loader.active {
  display: block;
}
