/**
 * AUXI-Pedido mínimo 2.2.0
 *
 * 1) Precio: precio por unidad + total del pedido mínimo.
 * 2) Botones «−» / «+» del campo de cantidad.
 * 3) Bloque resumen bajo el botón: pedido mínimo + total, en un solo contenedor.
 * 4) Arreglo del bloque del total del tema (respaldo) y ocultado de duplicados.
 * 5) Panel de diagnóstico (?pm_debug=1).
 */

/* -------------------------------------------------------------------------
 * 1. PRECIO (unidad + total del mínimo)
 * ------------------------------------------------------------------------- */
.pm-precio-wrap {
	display: block;
	line-height: 1.55;
}

.pm-precio-wrap .pm-precio-unidad {
	display: block;
	color: #8a8a8a;
	font-size: .85em;
	font-weight: 400;
}

.pm-precio-wrap .pm-precio-unidad .woocommerce-Price-amount {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
}

.pm-precio-wrap .pm-precio-unidad del,
.pm-precio-wrap .pm-precio-unidad ins {
	text-decoration: none;
}

.pm-precio-wrap .pm-precio-total {
	display: block;
}

.pm-precio-wrap .pm-pack-label {
	display: inline;
	color: #6b6b6b;
	font-size: .72em;
	font-weight: 400;
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
 * 2. BOTONES «−» / «+» DEL CAMPO DE CANTIDAD
 *    - Grises, con alta prioridad (el tema suele pintar los button de form.cart).
 *    - Separados del botón «Añadir al carrito» con un margen.
 * ------------------------------------------------------------------------- */
.pm-qty {
	display: inline-flex;
	align-items: stretch;
	justify-content: flex-start;
	vertical-align: middle;
	box-sizing: border-box;
	max-width: 100%;
	margin-right: .85rem;
}

body .pm-qty .pm-qty__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4em;
	min-width: 2.4em;
	padding: 0;
	margin: 0;
	background: #f2f2f2 !important;
	background-image: none !important;
	border: 1px solid #d0d0d0 !important;
	border-radius: 3px;
	box-shadow: none !important;
	color: #333 !important;
	text-shadow: none !important;
	text-decoration: none !important;
	font-family: inherit;
	font-size: 1.15em;
	font-weight: 600;
	line-height: 1;
	box-sizing: border-box;
	cursor: pointer;
	user-select: none;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color .15s ease, border-color .15s ease;
}

body .pm-qty .pm-qty__btn:hover,
body .pm-qty .pm-qty__btn:focus {
	background: #e4e4e4 !important;
	border-color: #bcbcbc !important;
	color: #333 !important;
}

body .pm-qty .pm-qty__btn:active {
	background: #dcdcdc !important;
	border-color: #b3b3b3 !important;
}

body .pm-qty .pm-qty__btn:focus-visible {
	outline: 2px solid #7a1f7a;
	outline-offset: 1px;
}

body .pm-qty .pm-qty__btn:disabled {
	background: #f7f7f7 !important;
	border-color: #e2e2e2 !important;
	color: #a5a5a5 !important;
	opacity: 1 !important;
	cursor: not-allowed;
}

body .pm-qty .pm-qty__btn--menos {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

body .pm-qty .pm-qty__btn--mas {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

/* El input queda en medio, pegado a los botones y con el mismo alto. */
body .pm-qty input.qty,
body .pm-qty .qty {
	box-sizing: border-box;
	width: 4.2em !important;
	min-width: 0 !important;
	margin: 0 !important;
	border-radius: 0 !important;
	text-align: center !important;
	font-family: inherit;
	-moz-appearance: textfield;
	appearance: textfield;
}

body .pm-qty input[type="number"]::-webkit-outer-spin-button,
body .pm-qty input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* En móvil el margen de separación molesta menos pequeño. */
@media (max-width: 480px) {
	.pm-qty {
		margin-right: .6rem;
	}
}

/* -------------------------------------------------------------------------
 * 3. BLOQUE RESUMEN: pedido mínimo + total en un solo contenedor
 *    - width 100% + max-width 100% => siempre dentro de la columna del producto.
 *    - flex 1 1 100% => si el contenedor es flex, salta a su propia línea.
 * ------------------------------------------------------------------------- */
.pm-resumen {
	display: flex;
	flex: 1 1 100%;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: .35rem 1.25rem;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 12px 0 0;
	padding: 10px 14px;
	background: #faf7fb;
	border: 1px solid #e7d9ec;
	border-radius: 4px;
	color: inherit;
	font-size: .95em;
	line-height: 1.35;
	text-align: left;
	overflow-wrap: anywhere;
}

.pm-resumen__min,
.pm-resumen__total {
	flex: 0 1 auto;
	min-width: 0;
}

.pm-resumen__min strong,
.pm-resumen__total strong {
	font-weight: 700;
}

.pm-resumen__importe {
	font-size: 1.15em;
	font-weight: 700;
	color: inherit;
	white-space: nowrap;
}

.pm-resumen__sufijo {
	font-size: .8em;
	font-weight: 400;
	color: #6b6b6b;
	white-space: nowrap;
}

/* En pantallas estrechas, cada dato en su línea y alineado a la izquierda. */
@media (max-width: 560px) {
	.pm-resumen {
		justify-content: flex-start;
		gap: .3rem;
		text-align: left;
	}

	.pm-resumen__min,
	.pm-resumen__total {
		flex: 1 1 100%;
	}
}

/* -------------------------------------------------------------------------
 * 4. AVISO SEPARADO (opcional: filtro pedido_minimo_aviso_separado)
 * ------------------------------------------------------------------------- */
.pm-aviso-minimo {
	display: block;
	flex: 1 1 100%;
	box-sizing: border-box;
	width: auto;
	max-width: 100%;
	margin: 10px auto 0;
	padding: 8px 14px;
	background: #fff3cd;
	border: 1px solid #f0d9a0;
	border-left: 4px solid #e67e22;
	border-radius: 3px;
	color: #7d4e00;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------------
 * 5. ARREGLO DEL BLOQUE DEL TOTAL DEL TEMA (respaldo)
 * ------------------------------------------------------------------------- */
.pm-bar-guard {
	flex-wrap: wrap !important;
	overflow: visible !important;
}

.pm-total-guard {
	box-sizing: border-box;
	min-width: 0 !important;
	max-width: 100% !important;
	white-space: normal !important;
	overflow-wrap: anywhere;
	word-wrap: break-word;
	line-height: 1.35;
	text-align: center !important;
}

.pm-total-guard--flex {
	flex: 1 1 100% !important;
	margin-top: .35rem;
}

.pm-total-guard--grid {
	grid-column: 1 / -1 !important;
	margin-top: .35rem;
}

.pm-total-guard--block {
	display: block !important;
	clear: both !important;
	width: 100% !important;
}

.pm-z-guard {
	z-index: 5000 !important;
}

/* Duplicado del tema oculto, porque el plugin ya pinta el suyo. */
.pm-original-oculto {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * 6. PANEL DE DIAGNÓSTICO (?pm_debug=1)
 * ------------------------------------------------------------------------- */
.pm-debug {
	position: fixed;
	z-index: 2147483000;
	top: 10px;
	left: 10px;
	width: min(560px, 92vw);
	padding: 10px;
	background: #fff;
	border: 2px solid #7a1f7a;
	border-radius: 6px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
	font: 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #222;
}

.pm-debug strong {
	display: block;
	margin-bottom: 6px;
	color: #7a1f7a;
}

.pm-debug__texto {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin-bottom: 6px;
	font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: pre;
}

.pm-debug button {
	cursor: pointer;
	padding: 4px 12px;
	border: 0;
	border-radius: 3px;
	background: #7a1f7a;
	color: #fff;
	font-weight: 600;
}
