/* fix-cardfields.css
 * Authorize.Net card fields in the BLOCK checkout (plugin woo-authorize-net-gateway-aim).
 * The plugin draws a white box with inline dark text. Make it dark and readable.
 * Scope: .wc-block-checkout / .wp-block-woocommerce-checkout only.
 */
.wp-block-woocommerce-checkout .wc-block-authnet-gateway-container,
.wc-block-checkout .wc-block-authnet-gateway-container {
	padding: 8px 0 4px;
}

/* The wrapper that holds the card icon and the three inputs. */
.wc-block-checkout .wc-block-authnet-gateway-container > div,
.wc-block-checkout .wc-block-authnet-gateway-container > div > div {
	background: transparent !important;
	box-shadow: none !important;
}

.wc-block-checkout .wc-block-authnet-gateway-container > div > div {
	display: flex !important;
	align-items: center;
	gap: 8px;
	flex-wrap: nowrap;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	border: 0 !important;
	padding: 0 !important;
}

.wc-block-checkout .wc-block-authnet-gateway-container svg {
	flex: 0 0 auto;
}

/* The three inputs: card number, expiry, CVC. */
.wc-block-checkout #cardNumber,
.wc-block-checkout #expiryDate,
.wc-block-checkout #cvc {
	background-color: var(--jk-surface, #0e131b) !important;
	color: var(--jk-text, #ece3d1) !important;
	-webkit-text-fill-color: var(--jk-text, #ece3d1);
	caret-color: var(--jk-text, #ece3d1);
	border: 1px solid rgba(255, 255, 255, .18) !important;
	border-radius: 0 !important;
	padding: 12px 14px !important;
	height: auto !important;
	min-height: 48px;
	font-size: 16px;
	line-height: 1.2;
	box-sizing: border-box;
	outline: 0;
}

.wc-block-checkout #cardNumber { flex: 1 1 220px; min-width: 0; }
.wc-block-checkout #expiryDate { flex: 0 1 110px; min-width: 0; }
.wc-block-checkout #cvc        { flex: 0 1 90px;  min-width: 0; }

.wc-block-checkout #cardNumber::placeholder,
.wc-block-checkout #expiryDate::placeholder,
.wc-block-checkout #cvc::placeholder {
	color: var(--jk-text-muted, #93a0ac) !important;
	opacity: 1;
}

.wc-block-checkout #cardNumber:focus,
.wc-block-checkout #expiryDate:focus,
.wc-block-checkout #cvc:focus {
	border-color: var(--jk-lime, #20bdb8) !important;
	box-shadow: 0 0 0 1px var(--jk-lime, #20bdb8) !important;
}

.wc-block-checkout #cardNumber[aria-invalid="true"],
.wc-block-checkout #expiryDate[aria-invalid="true"],
.wc-block-checkout #cvc[aria-invalid="true"] {
	border-color: var(--jk-aqua, #fb4478) !important;
}

.wc-block-checkout #cardNumber:-webkit-autofill,
.wc-block-checkout #expiryDate:-webkit-autofill,
.wc-block-checkout #cvc:-webkit-autofill {
	-webkit-text-fill-color: var(--jk-text, #ece3d1);
	-webkit-box-shadow: 0 0 0 100rem var(--jk-surface, #0e131b) inset;
}

/* Labels and helper text in the payment panel. */
.wc-block-checkout .wc-block-components-radio-control-accordion-content,
.wc-block-checkout .wc-block-components-payment-method-label,
.wc-block-checkout .wc-block-authnet-gateway-container label,
.wc-block-checkout .wc-block-authnet-gateway-container p {
	color: var(--jk-text, #ece3d1) !important;
}

/* Gateway error text (for example a decline) stays readable on dark. */
.wc-block-checkout .wc-block-authnet-gateway-container .wc-block-components-validation-error,
.wc-block-checkout .wc-block-authnet-gateway-container .wc-block-components-validation-error p {
	color: var(--jk-aqua, #fb4478) !important;
}

@media (max-width: 480px) {
	.wc-block-checkout .wc-block-authnet-gateway-container > div > div { flex-wrap: wrap; }
	.wc-block-checkout #cardNumber { flex: 1 1 100%; }
	.wc-block-checkout #expiryDate,
	.wc-block-checkout #cvc { flex: 1 1 40%; }
}

/* The plugin renders the React expression `icons.length && <Icons/>`. With no icons it prints the
 * text "0" after the card container, inside the accordion content. Hide that text node only:
 * the wrapper gets font-size 0, the container and any other child get the normal size back. */
.wc-block-checkout .wc-block-components-radio-control-accordion-content:has(> .wc-block-authnet-gateway-container) {
	font-size: 0;
	line-height: 0;
}
.wc-block-checkout .wc-block-components-radio-control-accordion-content:has(> .wc-block-authnet-gateway-container) > * {
	font-size: 1rem;
	line-height: normal;
}
