/* ───────────────────────────────────────────────────────────────────────────
   Caramba CyberSource — checkout card fields.

   The card fields are styled to match the Tanta Dinamita / WooCommerce Blocks
   checkout inputs (same height, border, radius, typography). Values are FIXED
   here (not read from the DOM at runtime) so they always apply regardless of
   load order — a runtime "inherit any theme" mode is a separate backlog item.

   Label stays ABOVE the field (the theme's floating-label is backlog). Because
   the label is outside the box, the height is fixed and vertical padding is 0 so
   the text/placeholder centres in the box — we do NOT copy the theme input's
   asymmetric 24px-top padding (that space is reserved for its floating label).

   The hosted iframes (card number, security code) can't be styled from here;
   only their CONTAINER. Their inner text is styled via the Microform SDK styles
   object (see src/blocks/index.js / checkout-microform.js), fed the same values.
   ─────────────────────────────────────────────────────────────────────────── */

/* Theme-matched tokens (Tanta Dinamita checkout). */
:root {
	--cybs-field-height: 50px;
	--cybs-field-border: 1px solid color(srgb 0.168627 0.176471 0.184314 / 0.8);
	--cybs-field-radius: 4px;
	--cybs-field-bg: #fff;
	--cybs-field-color: rgb(43, 45, 47);
	--cybs-field-font-size: 16px;
	--cybs-field-font-weight: 700;
	--cybs-field-pad-x: 12px;
	--cybs-placeholder-color: #767676;
}

.caramba-cybs-payment-fields,
.caramba-cybs-blocks-fields {
	margin: 0 0 1rem;
	padding: 0;
	border: 0;
}

.caramba-cybs-payment-fields .form-row,
.caramba-cybs-blocks-fields .caramba-cybs-field-group {
	margin-bottom: 0.9rem;
}

.caramba-cybs-blocks-fields label,
.caramba-cybs-payment-fields .caramba-cybs-field-group > label {
	display: block;
	font-size: 0.875em;
	margin-bottom: 0.3rem;
	color: inherit;
}

/* ── One uniform box for every field ───────────────────────────────────────
   Same height/border/radius/background so cardholder, the iframe containers
   and the selects read as one consistent set. */
.caramba-cybs-hosted-field,
.caramba-cybs-text-input,
.caramba-cybs-select {
	display: block;
	width: 100%;
	box-sizing: border-box;
	height: var(--cybs-field-height);
	border: var(--cybs-field-border);
	border-radius: var(--cybs-field-radius);
	background: var(--cybs-field-bg);
	color: var(--cybs-field-color);
	font-family: inherit;
	font-size: var(--cybs-field-font-size);
	font-weight: var(--cybs-field-font-weight);
}

/* Real inputs/selects: no vertical padding → the text centres in the fixed
   height; horizontal padding matches the theme. */
.caramba-cybs-text-input,
.caramba-cybs-select {
	padding: 0 var(--cybs-field-pad-x);
	line-height: normal;
}

/* Placeholder reads as a hint (label is above the field, not floating). */
.caramba-cybs-text-input::placeholder {
	color: var(--cybs-placeholder-color);
	font-weight: 400;
}

/* The theme/WC has a `select` rule that beats the base .caramba-cybs-select
   (font-size, background-image, padding). Raise specificity here so the expiry
   dropdowns keep our font-size AND custom chevron. */
.caramba-cybs-blocks-fields .caramba-cybs-select,
.caramba-cybs-payment-fields .caramba-cybs-select {
	font-size: var(--cybs-field-font-size);
	padding-right: 34px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%232b2d2f' stroke-width='1.5' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--cybs-field-pad-x) center;
	background-size: 12px 8px;
}

/* ── Selects: remove the native arrow, draw a theme-consistent chevron ──────*/
.caramba-cybs-select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding-right: 34px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%232b2d2f' stroke-width='1.5' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--cybs-field-pad-x) center;
	background-size: 12px 8px;
	cursor: pointer;
}

/* ── Hosted-field iframe containers ─────────────────────────────────────────
   The SDK iframe fills the box. The Microform ignores `padding` in its styles
   object, so we inset the iframe via the CONTAINER's horizontal padding to give
   the card number / CVV the same left padding as the other fields. */
.caramba-cybs-hosted-field {
	padding: 0 var(--cybs-field-pad-x);
	overflow: hidden;
}

.caramba-cybs-hosted-field iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ── Focus: one consistent ring for every field ────────────────────────────*/
.caramba-cybs-hosted-field:focus-within,
.caramba-cybs-text-input:focus,
.caramba-cybs-select:focus {
	outline: none;
	border-color: var(--cybs-field-color);
	box-shadow: 0 0 0 1px var(--cybs-field-color);
}

/* ── Expiry + CVV row ──────────────────────────────────────────────────────*/
.caramba-cybs-expiry-cvv-row {
	display: flex;
	gap: 1rem;
}

.caramba-cybs-expiry {
	flex: 1 1 60%;
}

.caramba-cybs-cvv {
	flex: 1 1 40%;
}

.caramba-cybs-expiry-selects {
	display: flex;
	gap: 0.5rem;
}

.caramba-cybs-expiry-selects .caramba-cybs-select {
	flex: 1;
}

/* ── Errors / consent / loading / editor placeholder ───────────────────────*/
.caramba-cybs-errors[hidden] {
	display: none;
}

.caramba-cybs-errors {
	margin: 0 0 1rem;
}

.caramba-cybs-consent-row label {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
}

.caramba-cybs-consent-row input {
	margin-top: 0.25rem;
}

.caramba-cybs-secure-context-notice {
	margin-bottom: 1rem;
}

.caramba-cybs-loading {
	color: #666;
	font-style: italic;
	margin: 0.5rem 0;
}

.caramba-cybs-edit-placeholder {
	padding: 0.75rem;
	border: 1px dashed #c7cdd4;
	border-radius: 4px;
	color: #666;
	font-style: italic;
}
