/**
 * Mas Moda — Checkout UX
 * Sólo se aplica en la página de finalizar compra (body.mmcux-on).
 */

/* --------------------------------------------------------------------------
 * 1. Alineación de campos
 * ----------------------------------------------------------------------- */

/* Base: cada fila es una caja flexible en columna, así el input siempre
   queda pegado abajo aunque la etiqueta ocupe dos líneas. */
body.mmcux-on .woocommerce-checkout .form-row {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	margin: 0 0 16px;
	padding: 0;
}

body.mmcux-on .woocommerce-checkout .form-row label {
	display: block;
	margin: 0 0 6px;
	line-height: 1.3;
	font-weight: 600;
}

body.mmcux-on .woocommerce-checkout .form-row .woocommerce-input-wrapper {
	width: 100%;
}

/* Dos columnas (escritorio/tablet): las etiquetas de 1 y 2 líneas
   se igualan reservando alto para dos líneas. */
@media (min-width: 601px) {
	body.mmcux-equal-rows .woocommerce-checkout .form-row-first > label,
	body.mmcux-equal-rows .woocommerce-checkout .form-row-last > label {
		min-height: 2.6em; /* 2 líneas a line-height 1.3 */
		display: flex;
		align-items: flex-end;
	}
}

/* Móvil: una sola columna. Elimina de raíz el desencaje entre celdas. */
@media (max-width: 600px) {
	body.mmcux-single-column .woocommerce-checkout .form-row-first,
	body.mmcux-single-column .woocommerce-checkout .form-row-last,
	body.mmcux-single-column .woocommerce-checkout .form-row-wide,
	body.mmcux-single-column .woocommerce-checkout .form-row {
		float: none;
		width: 100%;
		clear: both;
	}

	body.mmcux-single-column .woocommerce-checkout .form-row label {
		min-height: 0;
	}

	/* El clearfix de temas que flotan las columnas deja huecos: lo anulamos. */
	body.mmcux-single-column .woocommerce-checkout .col2-set::after,
	body.mmcux-single-column .woocommerce-checkout .col2-set::before {
		content: none;
	}
}

/* --------------------------------------------------------------------------
 * 2. Campos: tamaño cómodo y sin zoom en iOS
 * ----------------------------------------------------------------------- */

body.mmcux-no-ios-zoom .woocommerce-checkout .form-row input.input-text,
body.mmcux-no-ios-zoom .woocommerce-checkout .form-row textarea,
body.mmcux-no-ios-zoom .woocommerce-checkout .form-row select,
body.mmcux-no-ios-zoom .woocommerce-checkout .select2-container .select2-selection__rendered {
	font-size: 16px; /* Safari hace zoom por debajo de 16px */
}

body.mmcux-polish .woocommerce-checkout .form-row input.input-text,
body.mmcux-polish .woocommerce-checkout .form-row textarea,
body.mmcux-polish .woocommerce-checkout .form-row select {
	width: 100%;
	min-height: 48px; /* objetivo táctil cómodo */
	padding: 12px 14px;
	border-radius: 8px;
	box-sizing: border-box;
	transition: border-color .15s ease, box-shadow .15s ease;
}

body.mmcux-polish .woocommerce-checkout .form-row textarea {
	min-height: 96px;
	line-height: 1.45;
}

body.mmcux-polish .woocommerce-checkout .form-row input.input-text:focus,
body.mmcux-polish .woocommerce-checkout .form-row textarea:focus,
body.mmcux-polish .woocommerce-checkout .form-row select:focus {
	outline: none;
	border-color: #b06b66;
	box-shadow: 0 0 0 3px rgba(176, 107, 102, .18);
}

/* Errores más claros que el rojo por defecto del tema. */
body.mmcux-polish .woocommerce-checkout .form-row.woocommerce-invalid input.input-text,
body.mmcux-polish .woocommerce-checkout .form-row.woocommerce-invalid select {
	border-color: #c0392b;
	background-color: #fff6f5;
}

body.mmcux-polish .woocommerce-checkout .form-row.woocommerce-validated input.input-text {
	border-color: #cfe3cf;
}

/* Asterisco de requerido menos agresivo. */
body.mmcux-polish .woocommerce-checkout .form-row .required {
	color: #c0392b;
	text-decoration: none;
	border: 0;
}

/* --------------------------------------------------------------------------
 * 3. Checkboxes que se ocultan
 * ----------------------------------------------------------------------- */

body.mmcux-on .mmcux-hidden {
	display: none !important;
}

/* Selectores conocidos de plugins de newsletter / opiniones.
   El checkbox de términos (#terms) nunca se toca. */
body.mmcux-on p.mailchimp-newsletter,
body.mmcux-on .woocommerce-checkout p#mailchimp_woocommerce_newsletter_field,
body.mmcux-on .woocommerce-checkout p#mc4wp-checkbox_field,
body.mmcux-on .woocommerce-checkout .mc4wp-checkbox-woocommerce,
body.mmcux-on .woocommerce-checkout p#trustedshops_optin_field,
body.mmcux-on .woocommerce-checkout p#reviews_optin_field,
body.mmcux-on .woocommerce-checkout p#review_reminder_field {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * 4. Resumen del pedido y botón
 * ----------------------------------------------------------------------- */

body.mmcux-polish .woocommerce-checkout #order_review_heading,
body.mmcux-polish .woocommerce-checkout h3 {
	margin-top: 32px;
}

body.mmcux-polish .woocommerce-checkout .shop_table th,
body.mmcux-polish .woocommerce-checkout .shop_table td {
	padding: 12px 0;
	vertical-align: middle;
}

body.mmcux-polish .woocommerce-checkout .shop_table .product-name {
	line-height: 1.4;
}

/* La miniatura que inyectan algunos temas se solapa con el texto. */
body.mmcux-polish .woocommerce-checkout .shop_table .product-name img {
	width: 44px;
	height: auto;
	float: left;
	margin: 0 10px 0 0;
	border-radius: 6px;
}

body.mmcux-polish .woocommerce-checkout .shop_table tfoot .order-total th,
body.mmcux-polish .woocommerce-checkout .shop_table tfoot .order-total td {
	font-size: 1.05em;
	padding-top: 14px;
}

body.mmcux-polish .woocommerce-checkout #place_order {
	width: 100%;
	min-height: 54px;
	font-size: 17px;
	border-radius: 8px;
}

/* Términos y condiciones: bien separado y legible. */
body.mmcux-polish .woocommerce-checkout .woocommerce-terms-and-conditions-wrapper {
	margin-bottom: 18px;
}

body.mmcux-polish .woocommerce-checkout .woocommerce-form__label-for-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	line-height: 1.4;
}

body.mmcux-polish .woocommerce-checkout .woocommerce-form__label-for-checkbox input[type="checkbox"] {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	flex: 0 0 auto;
}

/* Botón fijo al pie en móvil (opcional). */
@media (max-width: 600px) {
	body.mmcux-sticky-button .woocommerce-checkout #place_order {
		position: sticky;
		bottom: 12px;
		z-index: 5;
		box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	}
}

/* --------------------------------------------------------------------------
 * 5. Detalles de móvil
 * ----------------------------------------------------------------------- */

@media (max-width: 600px) {
	body.mmcux-polish .woocommerce-checkout .form-row {
		margin-bottom: 14px;
	}

	body.mmcux-polish .woocommerce-checkout .shop_table .product-name img {
		width: 38px;
	}

	/* Evita que el botón quede tapado por el widget flotante de WhatsApp. */
	body.mmcux-polish .woocommerce-checkout .form.checkout {
		padding-bottom: 72px;
	}
}
