/**
 * Tárcás fizetés — the Apple Pay / Google Pay strip at the top of RCP's gateway block (118).
 *
 * Enqueued from inc/Membership/WalletPayments.php beside wallet-payments.js. NEVER the theme's
 * globals.css.
 */

/* Until the Express Checkout Element reports a wallet, the strip takes no space and is not
 * seen — Stripe measures the iframe at mount, so it stays in the flow rather than display:none.
 * With no wallet the script removes the strip entirely. */
.reborn-wallet {
	height: 0;
	overflow: hidden;
	visibility: hidden;
}

/* visibility: inherit, never visible — step 1 of the partition hides the whole gateway block
 * with visibility: hidden, and a visible child would put the wallet iframe back in the tab
 * order and the accessibility tree while the block is clipped to zero height. */
.reborn-wallet.is-ready {
	height: auto;
	overflow: visible;
	visibility: inherit;
	margin-bottom: 20px;
}

/* The account page (118N): with more than one membership RCP prints a membership switcher
 * ("Level A | Level B") right above the update-card form, and the strip is the form's first
 * child, so the buttons sat flush under it. Only then, space them off it; with one membership
 * the form starts at the card's own padding and needs nothing. */
.rcp-update-payment-method-membership-menu ~ #rcp_update_card_form .reborn-wallet.is-ready {
	margin-top: 24px;
}

/* Stripe tags every mount host .StripeElement, and RCP's rcpStripeUpdateElementStyles() writes a
 * global .StripeElement rule copying the card-name input's border, background and padding onto it —
 * meant for its own card field. The wallet buttons are not an input, so undo that box here. */
.reborn-wallet__buttons.StripeElement {
	border: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border-radius: 0 !important;
}

/* Stripe sizes its iframe `calc(100% + 8px)` with `margin: -4px` (room for focus rings), and
 * Elementor's `.elementor iframe { max-width: 100% }` clamped that back, so the buttons ended 8px
 * short of every other field on the form. */
.reborn-wallet .reborn-wallet__buttons iframe {
	max-width: none;
}

/* Scoped under the gateway block's id: the theme's form rules zero a <p>'s margin with more
 * specificity than a bare class has. #rcp_update_card_form is the same strip mounted on the
 * account page's update-card form (118N), which has no #rcp_gateway_extra_fields wrapper. */
#rcp_gateway_extra_fields .reborn-wallet__divider,
#rcp_update_card_form .reborn-wallet__divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 20px 0 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
	color: var(--color-neutral-500);
}

.reborn-wallet__divider::before,
.reborn-wallet__divider::after {
	content: "";
	flex: 1 1 24px;
	border-top: 1px solid currentColor;
	opacity: 0.4;
}

/* On a phone the text almost fills the row, and the two rules left over are a few pixels each: they
 * read as en dashes, not as the line that separates the buttons from the card fields. They stay
 * from tablet width up, where they have room to be one. */
@media (max-width: 767px) {
	#rcp_gateway_extra_fields .reborn-wallet__divider,
	#rcp_update_card_form .reborn-wallet__divider {
		justify-content: center;
	}

	.reborn-wallet__divider::before,
	.reborn-wallet__divider::after {
		display: none;
	}
}

/* --- the armed state (118E) ------------------------------------------------------
 * After an approval the buttons and the divider give way to one status row. The element is
 * not kept for later — stepping out re-mounts a fresh one — so display:none is safe here.
 * Scoped under the block's id to outrank the divider's own display:flex rule above. */
#rcp_gateway_extra_fields .reborn-wallet.is-armed .reborn-wallet__buttons,
#rcp_gateway_extra_fields .reborn-wallet.is-armed .reborn-wallet__divider,
#rcp_update_card_form .reborn-wallet.is-armed .reborn-wallet__buttons,
#rcp_update_card_form .reborn-wallet.is-armed .reborn-wallet__divider {
	display: none;
}

#rcp_gateway_extra_fields .reborn-wallet__armed,
#rcp_update_card_form .reborn-wallet__armed {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	margin: 0;
	padding: 12px 0;
	font-size: 16px;
	line-height: 1.4;
}

.reborn-wallet__armed-label {
	font-weight: 700;
}

/* A link in looks, a button in behaviour — it acts on the form, it goes nowhere. */
#rcp_gateway_extra_fields .reborn-wallet__cancel,
#rcp_update_card_form .reborn-wallet__cancel {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	/* The theme uppercases buttons; this one reads as a link. */
	text-transform: none;
	letter-spacing: normal;
	text-decoration: underline;
	cursor: pointer;
}

/* The pre-check's notice sits under the field it names, spaced like RCP's own. */
.rcp_form p.reborn-wallet__field-error {
	margin: 6px 0 10px;
}


/* The coupon note (118I) is news, not a fault: RCP's success shape in its "Érvényes" green. */
.rcp_form p.rcp_success.reborn-wallet__field-note {
	border-color: #42961e;
	background: #eef7ea;
}

/*
 * A consent wrap (`p#rcp_agree_to_*_wrap`) carries the theme's bottom padding and margin, and
 * its label another 8px, which left a blank line between the checkbox and its notice. Close
 * that gap only while the notice is there; without :has() the notice just sits lower.
 */
.rcp_form p:has(+ p.reborn-wallet__field-error) {
	padding-bottom: 0;
	margin-bottom: 0;
}

.rcp_form p:has(+ p.reborn-wallet__field-error) > label {
	padding-bottom: 0;
}

/* --- the hold fallback (118W) ------------------------------------------------------
 * When a wallet trial's 0 Ft check is refused, the strip asks for a released authorisation
 * and offers the same wallet once more, at the hold amount, with the typed card as the way
 * out. Scoped under the block's id like the rest, to outrank the theme's paragraph rules. */
#rcp_gateway_extra_fields .reborn-wallet__hold,
#rcp_update_card_form .reborn-wallet__hold {
	margin: 4px 0 0;
	padding: 16px;
	border: 1px solid #d8d9db;
	border-radius: 6px;
}

#rcp_gateway_extra_fields .reborn-wallet__hold-intro,
#rcp_update_card_form .reborn-wallet__hold-intro {
	margin: 0 0 12px;
	padding: 0;
	font-size: 15px;
	line-height: 1.5;
}

#rcp_gateway_extra_fields .reborn-wallet__hold-status,
#rcp_update_card_form .reborn-wallet__hold-status {
	margin: 8px 0 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.4;
}

#rcp_gateway_extra_fields .reborn-wallet__hold-status:empty,
#rcp_update_card_form .reborn-wallet__hold-status:empty {
	display: none;
}

#rcp_gateway_extra_fields .reborn-wallet__hold .reborn-wallet__cancel,
#rcp_update_card_form .reborn-wallet__hold .reborn-wallet__cancel {
	margin-top: 12px;
}

/* Once the second approval is given, only the status line stays. The button host is collapsed,
 * not display:none: the Express Checkout iframe finishes the approval it just started. */
#rcp_gateway_extra_fields .reborn-wallet__hold.is-working .reborn-wallet__hold-intro,
#rcp_update_card_form .reborn-wallet__hold.is-working .reborn-wallet__hold-intro,
#rcp_gateway_extra_fields .reborn-wallet__hold.is-working .reborn-wallet__cancel,
#rcp_update_card_form .reborn-wallet__hold.is-working .reborn-wallet__cancel {
	display: none;
}

#rcp_gateway_extra_fields .reborn-wallet__hold.is-working .reborn-wallet__hold-buttons,
#rcp_update_card_form .reborn-wallet__hold.is-working .reborn-wallet__hold-buttons {
	height: 0;
	overflow: hidden;
	visibility: hidden;
}

#rcp_gateway_extra_fields .reborn-wallet__hold.is-working .reborn-wallet__hold-status,
#rcp_update_card_form .reborn-wallet__hold.is-working .reborn-wallet__hold-status {
	margin: 0;
}

.reborn-wallet__hold-buttons.StripeElement {
	border: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border-radius: 0 !important;
}
