/**
 * Layout fixes for the Adyen card component.
 * Themes commonly set width/display on inputs that breaks Adyen's flex layout.
 *
 * @license GPL-2.0-or-later
 */

.sac-card-container {
	display: block;
	width: 100%;
	max-width: 100%;
}

/* Field row (number, expiry, cvc, holder name) */
.sac-card-container .adyen-checkout__field {
	width: 100% !important;
	max-width: 100% !important;
	margin-bottom: 12px !important;
	box-sizing: border-box !important;
}

/* Wrappers that hold brand-icon + iframe horizontally */
.sac-card-container .adyen-checkout__input-wrapper,
.sac-card-container .adyen-checkout__card__cardNumber__input {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
}

/* The actual input shell - force flex with centered vertical alignment */
.sac-card-container .adyen-checkout__input,
.sac-card-container .adyen-checkout__field--cardNumber .adyen-checkout__input,
.sac-card-container .adyen-checkout__field--expiryDate .adyen-checkout__input,
.sac-card-container .adyen-checkout__field--cvc .adyen-checkout__input {
	display: flex !important;
	align-items: center !important;
	width: 100% !important;
	min-width: 0 !important;
	max-width: 100% !important;
	height: auto !important;
	min-height: 44px !important;
	padding: 6px 12px !important;
	line-height: 1.4 !important;
	box-sizing: border-box !important;
}

/* Any icon inside an input field - kill Adyen's absolute positioning,
   let flex/align-items center handle vertical alignment */
.sac-card-container [class*="brandIcon"],
.sac-card-container [class*="__icon"],
.sac-card-container .adyen-checkout__card__cardNumber__brandIcon,
.sac-card-container .adyen-checkout__field__cvc--hint__wrapper,
.sac-card-container .adyen-checkout__card__exp-date__hint__wrapper {
	position: relative !important;
	top: auto !important;
	right: auto !important;
	bottom: auto !important;
	left: auto !important;
	transform: none !important;
	align-self: center !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	flex-shrink: 0 !important;
}

.sac-card-container .adyen-checkout__card__cardNumber__brandIcon {
	margin-right: 8px !important;
	margin-left: 0 !important;
}

/* Adyen renders the secured number / expiry / cvc through iframes */
.sac-card-container .adyen-checkout__field iframe {
	flex: 1 1 auto !important;
	width: 100% !important;
	min-width: 0 !important;
	max-width: 100% !important;
	height: 32px !important;
	display: block !important;
	border: 0 !important;
	align-self: center !important;
}

/* Two-column row: expiry + cvc.
   v6 wraps these in `.adyen-checkout__card__exp-cvc`. We flex-row that
   wrapper so the two fields share a line. */
.sac-card-container .adyen-checkout__card__exp-cvc {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	gap: 12px !important;
	width: 100% !important;
}

.sac-card-container .adyen-checkout__card__exp-cvc > .adyen-checkout__field {
	flex: 1 1 0 !important;
	min-width: 0 !important;
	width: 50% !important;
	margin-bottom: 0 !important;
}

/* Fallback if the wrapper is missing: force each field to half width.
   Higher specificity via double-class to beat the generic `.adyen-checkout__field` rule. */
.sac-card-container .adyen-checkout__field.adyen-checkout__field--expiryDate,
.sac-card-container .adyen-checkout__field.adyen-checkout__field--securityCode {
	display: inline-block !important;
	width: calc(50% - 6px) !important;
	max-width: calc(50% - 6px) !important;
	box-sizing: border-box !important;
	vertical-align: top !important;
}

.sac-card-container .adyen-checkout__field.adyen-checkout__field--expiryDate {
	margin-right: 8px !important;
}

/* ---- Accepted-brand logos under the cardNumber field ------------------- */
/* The SVGs Adyen serves include a built-in gray rounded frame that cannot
   be removed via CSS. We hide the row in the classic checkout only - the
   block checkout keeps the list because it sits nicely there.
   The small brand icon inside the number field (Visa/MC pictogram on the
   left) still works in both views. */

.sac-card-container--classic .adyen-checkout__card__brands {
	display: none !important;
}

/* ---- Labels ----------------------------------------------------------- */

.sac-card-container .adyen-checkout__label {
	display: block !important;
	width: 100% !important;
}

.sac-card-container .adyen-checkout__label__text {
	display: block !important;
	margin: 0 0 4px !important;
	font-size: 13px !important;
	line-height: 1.4 !important;
}

/* ---- Validation states ------------------------------------------------ */

.sac-card-container .adyen-checkout__input--error,
.sac-card-container .adyen-checkout__input--invalid {
	border-color: #dc3232 !important;
}

.sac-card-container .adyen-checkout__error-text {
	display: block !important;
	margin-top: 4px !important;
	font-size: 12px !important;
	color: #dc3232 !important;
}

/* ---- Hide the Drop-in's own Pay button ------------------------------- *
 * WooCommerce already shows "Zahlungspflichtig bestellen" / "Place order"
 * below the form. Two Pay buttons confuse customers. The JS config also
 * sets showPayButton: false but this CSS keeps it hidden even if a future
 * SDK version regresses the option name.
 */
.sac-card-container .adyen-checkout__button--pay,
.sac-card-container .adyen-checkout__button--type-pay-button,
.sac-card-container button.adyen-checkout__button--pay {
	display: none !important;
}

/* ---- Visual highlight for the currently-selected payment method ------- *
 * Adyen marks the selected panel with `--selected` (and sometimes
 * `--open`) on the wrapper. The default styling is very subtle; bump it
 * up with a clearer border + soft accent shadow so it's obvious to the
 * shopper which method they're paying with.
 */
.sac-card-container .adyen-checkout__payment-method {
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.sac-card-container .adyen-checkout__payment-method--selected,
.sac-card-container .adyen-checkout__payment-method--open,
.sac-card-container .adyen-checkout__payment-method.adyen-checkout__payment-method--selected {
	border-color: #111 !important;
	border-width: 2px !important;
	box-shadow: 0 0 0 4px rgba(17, 17, 17, .06) !important;
	background-color: #fafafa !important;
}

/* Unselected methods get a slightly muted appearance so the selected one
   stands out by contrast. */
.sac-card-container .adyen-checkout__payment-method:not(.adyen-checkout__payment-method--selected):not(.adyen-checkout__payment-method--open) {
	opacity: 0.85;
}
.sac-card-container .adyen-checkout__payment-method:not(.adyen-checkout__payment-method--selected):not(.adyen-checkout__payment-method--open):hover {
	opacity: 1;
	border-color: #888 !important;
}

/* Direct Card/Twint components are mounted without Drop-in chrome. Defensively
   hide Adyen's payment-method header and the mandatory-fields instruction in
   case the component still renders them; our own labels are shown instead. */
.sac-card-container .adyen-checkout__payment-method__header,
.sac-card-container .adyen-checkout-form-instruction {
	display: none !important;
}

/* Twint has no visible content. Keep the marker invisible and collapse the
   empty selected-content area WooCommerce Blocks renders, so the method row
   does not grow taller when Twint is selected. */
.sac-twint-mount {
	display: none;
}
.wc-block-components-radio-control-accordion-content:has(.sac-twint-mount) {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}
