/* MV Price Calculator.
   The !important guards keep themes and other add-on plugins (which often
   style every button/input inside form.cart) from restyling the calculator,
   and the 100% flex-basis forces it onto its own full-width row when the
   theme lays the cart form out as flex columns. */

/* This stylesheet only loads on products with the calculator enabled, so we
   can force the whole product form to stack top-to-bottom there: calculator
   first (order -1), other add-on fields below, Add to cart at the bottom. */
form.cart {
	display: flex !important;
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	align-items: stretch !important;
}

form.cart > * {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	/* Neutralize column sizing the theme gave its side-by-side layout,
	   which would otherwise become a huge height when stacked. */
	flex: 0 0 auto !important;
	min-height: 0 !important;
	height: auto !important;
}

form.cart .mpc-calc {
	order: -1;
}

form.cart .single_add_to_cart_button {
	display: block;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	margin-top: 10px;
	align-self: stretch;
}

.mpc-calc {
	display: block;
	width: 100% !important;
	max-width: 100%;
	flex: 1 1 100% !important;
	float: none;
	clear: both;
	margin: 14px 0 1.2em;
	padding: 16px;
	border: 1px solid #ddd;
	border-radius: 10px;
	background: #fafafa;
	text-align: left;
	box-sizing: border-box;
}

.mpc-calc *,
.mpc-calc *::before,
.mpc-calc *::after {
	box-sizing: border-box;
}

.mpc-row {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	flex-wrap: wrap;
}

.mpc-field {
	margin-top: 10px;
}

.mpc-calc .mpc-field label {
	display: block;
	width: auto;
	font-size: 0.85em;
	font-weight: 600;
	margin: 0 0 4px;
}

.mpc-grow {
	flex: 1 1 180px;
	min-width: 150px;
}

.mpc-calc input[type="number"],
.mpc-calc select {
	display: block;
	width: 100% !important;
	max-width: 100%;
	min-height: 0;
	height: auto;
	padding: 8px 10px !important;
	border: 1px solid #ccc !important;
	border-radius: 6px !important;
	background: #fff !important;
	color: #222 !important;
	font-size: 15px;
	line-height: 1.3;
	box-shadow: none !important;
	margin: 0;
}

/* Width × Height + Unit on one line. */
.mpc-size {
	display: grid;
	grid-template-columns: minmax(80px, 1fr) 14px minmax(80px, 1fr) minmax(70px, 100px);
	gap: 8px;
	align-items: end;
}

.mpc-size .mpc-field {
	margin-top: 10px;
}

.mpc-x {
	padding-bottom: 10px;
	color: #888;
	text-align: center;
}

.mpc-hint {
	font-size: 0.8em;
	color: #777;
	margin: 4px 0 0;
	padding: 0;
}

.mpc-chips {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap !important;
	gap: 6px;
	margin: 0 0 8px;
}

/* "Recommended sizes / quantities" heading above a chips row. */
.mpc-calc .mpc-field label.mpc-chips-label {
	margin-top: 12px;
}

/* Chips are small pills — guard hard against theme button styles. */
.mpc-calc button.mpc-chip {
	display: inline-block !important;
	flex: 0 0 auto !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: none;
	min-height: 0 !important;
	height: auto !important;
	padding: 6px 14px !important;
	margin: 0 !important;
	border: 1px solid #ccc !important;
	border-radius: 999px !important;
	background: #fff !important;
	color: #333 !important;
	font-size: 13px !important;
	font-weight: 400 !important;
	line-height: 1.2 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-align: center;
	box-shadow: none !important;
	cursor: pointer;
}

.mpc-calc button.mpc-chip:hover {
	border-color: #888 !important;
}

.mpc-calc button.mpc-chip.active {
	background: #222 !important;
	border-color: #222 !important;
	color: #fff !important;
}

/* Quantity custom input doesn't need to be full width. */
.mpc-calc input#mpc_qty {
	max-width: 160px;
}

.mpc-price {
	margin-top: 14px;
	padding: 12px 14px;
	border-radius: 8px;
	background: #fff;
	border: 1px solid #e3e3e3;
	min-height: 54px;
}

/* Element + classes selector keeps theme "p.price" colour rules winning on
   colour, while we control the box-level spacing. */
.mpc-calc p.mpc-price-amt {
	font-size: 1.6em;
	font-weight: 700;
	line-height: 1.2;
	margin: 0 !important;
	padding: 0 !important;
}

.mpc-price-per {
	font-size: 0.85em;
	color: #666;
}

.mpc-price-msg {
	font-size: 0.9em;
	color: #666;
}

.mpc-price-msg.mpc-err {
	color: #b32d2e;
	font-weight: 600;
}

.mpc-note {
	font-size: 0.8em;
	color: #777;
	margin: 10px 0 0;
	padding: 0;
}

.single_add_to_cart_button.mpc-disabled {
	opacity: 0.5;
	pointer-events: none;
}

@media (max-width: 480px) {
	.mpc-size {
		grid-template-columns: 1fr 14px 1fr;
	}
	.mpc-size .mpc-unit {
		grid-column: 1 / -1;
	}
}
