/**
 * Origen - Venta por Unidad de Medida
 * Estilos del frontend.
 */

:root {
	--ovm-accent: #4b7f52;
	--ovm-accent-soft: #eef5ee;
	--ovm-border: #dcdfda;
	--ovm-text: #2f3630;
	--ovm-muted: #6d7670;
	--ovm-radius: 10px;
}

.ovm-box {
	border: 1px solid var(--ovm-border);
	border-radius: var(--ovm-radius);
	padding: 16px;
	margin: 0 0 18px;
	background: #fff;
	max-width: 420px;
	color: var(--ovm-text);
}

.ovm-box.ovm-box--off .ovm-total-value:empty::before {
	content: '';
}

.ovm-label {
	display: block;
	font-weight: 600;
	margin: 0 0 8px;
	font-size: 1rem;
}

.ovm-label-unit {
	font-weight: 400;
	color: var(--ovm-muted);
}

/* Botones de cantidad rapida */
.ovm-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 10px;
}

.ovm-presets:empty {
	display: none;
}

.ovm-box button.ovm-preset {
	display: inline-block;
	width: auto;
	min-height: 0;
	height: auto;
	margin: 0;
	background: #fff;
	border: 1px solid var(--ovm-border);
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 0.85rem;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	color: var(--ovm-text);
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ovm-box button.ovm-preset:hover {
	border-color: var(--ovm-accent);
	background: #fff;
}

.ovm-box button.ovm-preset.is-active {
	background: var(--ovm-accent-soft);
	border-color: var(--ovm-accent);
	color: var(--ovm-accent);
	font-weight: 600;
}

/* Campo de cantidad */
.ovm-box .ovm-input-wrap {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	border: 1px solid var(--ovm-border);
	border-radius: var(--ovm-radius);
	overflow: hidden;
	background: #fff;
	max-width: 260px;
}

.ovm-box .ovm-input-wrap > * {
	margin: 0;
	float: none;
}

.ovm-box button.ovm-step {
	display: block;
	width: 42px;
	flex: 0 0 42px;
	height: auto;
	min-height: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #f6f7f5;
	color: var(--ovm-text);
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	padding: 0;
}

.ovm-box button.ovm-step:hover {
	background: var(--ovm-accent-soft);
	color: var(--ovm-accent);
}

.ovm-box input.ovm-amount[type='number'] {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: auto;
	min-height: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	text-align: center;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
	padding: 10px 4px;
	background: transparent;
	box-shadow: none;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ovm-box input.ovm-amount[type='number']::-webkit-outer-spin-button,
.ovm-box input.ovm-amount[type='number']::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.ovm-box input.ovm-amount:focus {
	outline: none;
}

.ovm-unit-suffix {
	display: flex;
	align-items: center;
	padding: 0 10px 0 0;
	color: var(--ovm-muted);
	font-size: 0.9rem;
	white-space: nowrap;
}

.ovm-help {
	margin: 8px 0 0;
	font-size: 0.82rem;
	color: var(--ovm-muted);
}

.ovm-help:empty {
	display: none;
}

/* Importe calculado */
.ovm-total {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px dashed var(--ovm-border);
}

.ovm-total-label {
	display: block;
	font-size: 0.9rem;
	line-height: 1.3;
	color: var(--ovm-muted);
}

.ovm-total-value {
	display: block;
	font-size: 1.45rem;
	font-weight: 700;
	color: var(--ovm-accent);
	line-height: 1.2;
}

.ovm-total-value:empty {
	min-height: 1.45rem;
}

/* Precio por unidad junto al precio del producto */
.ovm-unit {
	font-size: 0.8em;
	font-weight: 400;
	color: var(--ovm-muted);
	white-space: nowrap;
}

/* Oculta el selector de cantidad estandar cuando manda la medida */
form.cart.ovm-hide-qty .quantity {
	display: none !important;
}

/* Carrito */
.ovm-cart-qty {
	display: flex;
	align-items: center;
	gap: 6px;
	justify-content: center;
}

.ovm-cart-qty input.ovm-cart-input {
	width: 6em;
	max-width: 100%;
	text-align: center;
}

.ovm-cart-unit {
	color: var(--ovm-muted);
	font-size: 0.9em;
}

.ovm-cart-amount {
	font-weight: 600;
}

@media (max-width: 480px) {
	.ovm-box {
		padding: 14px;
	}

	.ovm-total-value {
		font-size: 1.3rem;
	}
}
