/* MegaProduct — configurador en la ficha de producto */

.mp-configurator {
	margin: 0 0 1.5em;
}

/* El acento se hereda del tema; se puede sobrescribir por producto. */
.mp-configurator {
	--mp-accent: #1b8ac4;
	--mp-line: #d9dde1;
}

.mp-configurator .mp-section-title {
	margin: 0 0 1em;
	padding-bottom: 0.4em;
	border-bottom: 2px solid #222;
	font-size: 1.1em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

/* --- Preview compuesto por capas --- */

/* Se superpone a la imagen principal de la galería de WooCommerce. */
.woocommerce-product-gallery {
	position: relative;
}

.mp-preview {
	position: absolute;
	inset: 0;
	z-index: 5;
	pointer-events: none;
}

.mp-preview-layer {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.mp-preview-layer[hidden] {
	display: none !important;
}

/* Respaldo cuando no hay galería donde superponerlo. */
.mp-preview.mp-preview-inline {
	position: relative;
	inset: auto;
	width: 100%;
	max-width: 420px;
	aspect-ratio: 1 / 1;
	margin: 0 0 1.4em;
	border: 1px solid var( --mp-line );
	border-radius: 4px;
	overflow: hidden;
}

/* --- Título de grupo, común a medidas y opciones --- */

.mp-group-label {
	display: flex;
	align-items: center;
	gap: 0.35em;
	margin: 0 0 0.5em;
	padding-bottom: 0.3em;
	font-size: 0.95em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	border-bottom: 1px solid var( --mp-line );
}

.mp-group,
.mp-measures {
	position: relative;
	margin: 0 0 1.6em;
}

.mp-group-label .mp-group-name {
	position: relative;
	padding-bottom: 0.3em;
	box-shadow: 0 2px 0 var( --mp-accent );
}

.mp-measure-range {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	opacity: 0.85;
}

.mp-group-label .required {
	color: #b32d2e;
	border: 0;
	text-decoration: none;
}

.mp-help-toggle {
	padding: 0;
	border: 0;
	background: none;
	color: var( --mp-accent );
	font-size: 1em;
	line-height: 1;
	cursor: pointer;
}

.mp-group-note {
	margin: 0 0 0.7em;
	font-size: 0.9em;
	line-height: 1.4;
	color: #3d4852;
}

.mp-group-help {
	margin: 0 0 0.7em;
	padding: 0.7em 0.9em;
	border-left: 3px solid var( --mp-accent );
	background: #f4f8fb;
	font-size: 0.9em;
}

/* --- Medidas --- */

.mp-measure-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em 1.5em;
}

.mp-measure {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin: 0;
}

.mp-measure label {
	min-width: 3.5em;
	font-weight: 700;
}

.mp-measure input {
	width: 9em;
	padding: 0.5em 0.7em;
	border: 1px solid var( --mp-line );
	border-radius: 999px;
	text-align: right;
}

.mp-measure input:focus {
	border-color: var( --mp-accent );
	outline: none;
	box-shadow: 0 0 0 2px rgba( 27, 138, 196, 0.18 );
}

.mp-measure .mp-unit {
	opacity: 0.75;
}

/* --- Tarjetas con imagen --- */

.mp-cards-wrap {
	position: relative;
}

.mp-cards {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7em;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* En carrusel no se envuelve: se desplaza en horizontal. */
.mp-cards-carousel .mp-cards {
	flex-wrap: nowrap;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	padding-bottom: 0.5em;
}

.mp-cards-carousel .mp-card {
	scroll-snap-align: start;
	flex: 0 0 auto;
}

.mp-card-nav {
	position: absolute;
	top: 34px;
	z-index: 2;
	width: 28px;
	height: 28px;
	border: 1px solid var( --mp-line );
	border-radius: 50%;
	background: #fff;
	font-size: 1.1em;
	line-height: 1;
	cursor: pointer;
}

.mp-card-prev { left: -14px; }
.mp-card-next { right: -14px; }

.mp-card-nav[disabled] {
	opacity: 0.35;
	cursor: default;
}

.mp-card {
	position: relative;
}

.mp-card-item {
	display: block;
	width: 92px;
	cursor: pointer;
	text-align: center;
}

.mp-card-item input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.mp-card-media {
	display: block;
	height: 78px;
	border: 2px solid var( --mp-line );
	background-color: #fff;
	background-size: cover;
	background-position: center;
	transition: border-color 0.15s;
}

.mp-card-item:hover .mp-card-media {
	border-color: #a9b4bd;
}

.mp-card-item input:checked + .mp-card-media {
	border-color: var( --mp-accent );
	box-shadow: 0 0 0 1px var( --mp-accent );
}

.mp-card-item input:focus-visible + .mp-card-media {
	outline: 2px solid var( --mp-accent );
	outline-offset: 2px;
}

.mp-card-name {
	display: block;
	margin-top: 0.4em;
	font-size: 0.68em;
	line-height: 1.25;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	overflow-wrap: break-word;
}

/* La lupa solo aparece al pasar por encima, como en el original. */
.mp-card-zoom {
	position: absolute;
	top: 4px;
	right: 4px;
	display: none;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.9 );
	color: #222;
	cursor: pointer;
}

.mp-card:hover .mp-card-zoom {
	display: block;
}

/* Visor de imagen ampliada. */
.mp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 5vmin;
	background: rgba( 0, 0, 0, 0.75 );
}

.mp-lightbox img {
	max-width: 100%;
	max-height: 100%;
	box-shadow: 0 4px 30px rgba( 0, 0, 0, 0.4 );
}

/* --- Botones y radios --- */

/* Botones: dos columnas, píldora. Seleccionado relleno, resto con borde. */
.mp-options-botones {
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 0.5em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mp-options-radio {
	display: flex;
	flex-direction: column;
	gap: 0.3em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mp-option-item {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 0.4em;
	cursor: pointer;
}

.mp-options-botones .mp-option-item {
	padding: 0.6em 0.9em;
	border: 1px solid var( --mp-accent );
	border-radius: 999px;
	color: var( --mp-accent );
	font-size: 0.9em;
	text-align: center;
	transition: background 0.15s, color 0.15s;
}

.mp-options-botones .mp-option-item input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.mp-options-botones .mp-option-item:hover {
	background: rgba( 27, 138, 196, 0.08 );
}

.mp-options-botones .mp-option-item.is-selected {
	background: var( --mp-accent );
	color: #fff;
}

.mp-options-botones .mp-option-item.is-selected .mp-option-price {
	opacity: 0.9;
}

.mp-option-price {
	font-size: 0.85em;
	opacity: 0.7;
}

@media ( max-width: 420px ) {
	.mp-options-botones {
		grid-template-columns: 1fr;
	}
}

.mp-select {
	max-width: 100%;
	padding: 0.5em;
}

/* --- Opciones deshabilitadas por una regla --- */

.mp-option-off {
	display: none;
}

.mp-group-off {
	display: none;
}

.mp-rule-notices {
	margin: 0 0 1em;
	padding: 0.7em 0.9em;
	border-left: 3px solid #b8860b;
	background: #fdf6e3;
	font-size: 0.9em;
}

.mp-rule-notices ul {
	margin: 0;
	padding-left: 1.2em;
}

/* --- Resumen --- */

.mp-summary {
	margin: 1.4em 0;
	padding: 1em;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	background: #fafafa;
}

.mp-summary-price {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
}

.mp-summary-label {
	text-transform: uppercase;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	opacity: 0.7;
}

.mp-summary-total {
	font-size: 1.6em;
	font-weight: 700;
}

.mp-summary-errors {
	margin-bottom: 0.8em;
	color: #b32d2e;
	font-size: 0.9em;
}

.mp-summary-errors ul {
	margin: 0;
	padding-left: 1.2em;
}

.mp-breakdown {
	width: 100%;
	margin-top: 0.8em;
	border-collapse: collapse;
	font-size: 0.9em;
}

.mp-breakdown th,
.mp-breakdown td {
	padding: 0.35em 0;
	border-bottom: 1px solid #ececec;
	text-align: left;
	font-weight: 400;
}

.mp-breakdown td {
	text-align: right;
	white-space: nowrap;
}

.mp-breakdown-toggle {
	margin-top: 0.6em;
	font-size: 0.85em;
}

@media ( max-width: 480px ) {
	.mp-measure input {
		width: 6em;
	}

	.mp-swatch-box {
		width: 38px;
		height: 38px;
	}
}
