/* BDM Product Controls — cards de tier + color picker en página de producto */

/* ============================================================
 * Cards de cantidad/descuento
 * Layout: grilla auto-fit, mínimo 110px, gap consistente con el mockup.
 * ============================================================ */
.bdm-tiers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 12px;
	margin: 0 0 16px;
}

.bdm-tier {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 18px 12px 14px;
	background: #fff;
	border: 1.5px solid var(--rule, #E6E6E6);
	border-radius: 10px;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
	text-align: center;
}

.bdm-tier:hover {
	border-color: var(--brand-blue, #050EFF);
}

.bdm-tier--selected {
	border-color: var(--brand-blue, #050EFF);
	background: var(--brand-blue-50, #EDEEFF);
	box-shadow: 0 0 0 2px var(--brand-blue, #050EFF) inset;
}

.bdm-tier__badge {
	position: absolute;
	top: -8px;
	right: 10px;
	background: var(--sale, #E11D2A);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	padding: 3px 8px;
	border-radius: 999px;
	letter-spacing: .02em;
	white-space: nowrap;
}

.bdm-tier__qty {
	font-size: 22px;
	font-weight: 800;
	line-height: 1.1;
	color: var(--ink, #0A0A0A);
}

.bdm-tier--selected .bdm-tier__qty {
	color: var(--brand-blue, #050EFF);
}

.bdm-tier__unit {
	font-size: 13px;
	color: var(--mute, #6B6B6B);
	font-weight: 500;
}

/* ============================================================
 * Display: precio por unidad + total
 * ============================================================ */
.bdm-unit-price {
	font-weight: 700;
	color: var(--ink-2, #2A2A2A);
}

.bdm-cart-total {
	font-weight: 800;
	color: inherit;
}

/* Total regular tachado (al lado del total con descuento) */
.bdm-regular-total {
	text-decoration: line-through;
	color: var(--mute, #6B6B6B);
	font-weight: 600;
}
.bdm-regular-total--hidden {
	display: none;
}

/* Cantidad bloqueada en el carrito (paquete cerrado) */
.bdm-locked-qty {
	display: inline-block;
	padding: 8px 14px;
	background: var(--paper-cool, #F4F5F7);
	border-radius: 8px;
	font-weight: 700;
	color: var(--ink, #0A0A0A);
	white-space: nowrap;
}

/* ============================================================
 * Color picker
 * ============================================================ */
.bdm-color-picker {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin: 16px 0;
}

.bdm-color-picker__label {
	font-weight: 700;
	font-size: 14px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ink, #0A0A0A);
}

.bdm-color-picker__selected-name {
	font-size: 14px;
	color: var(--mute, #6B6B6B);
	min-width: 60px;
}

.bdm-color-picker__swatches {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.bdm-color-swatch {
	width: var(--bdm-swatch-size, 28px);
	height: var(--bdm-swatch-size, 28px);
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, .15);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
	cursor: pointer;
	padding: 0;
	transition: transform 120ms ease, box-shadow 120ms ease;
}

.bdm-color-swatch:hover {
	transform: scale(1.08);
}

.bdm-color-swatch--selected {
	box-shadow:
		inset 0 0 0 2px #fff,
		0 0 0 2px var(--brand-blue, #050EFF);
}

/* Borde más visible para colores muy claros */
.bdm-color-swatch[style*="#fff"],
.bdm-color-swatch[style*="#ffffff"] {
	border-color: var(--rule, #e6e6e6);
}

/* Error: cuando se intenta agregar al carrito sin elegir color */
.bdm-color-picker--error {
	animation: bdm-shake .3s;
}
.bdm-color-picker--error .bdm-color-picker__label {
	color: var(--sale, #E11D2A);
}

@keyframes bdm-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

/* ============================================================
 * Ocultar el input cantidad nativo de Woo cuando las tiers están presentes.
 * Las tiers ARE el selector de cantidad.
 * ============================================================ */
.bdm-tiers ~ form.cart .quantity,
form.cart .quantity:has(~ .bdm-tiers),
.bdm-product-controls-page form.cart .quantity {
	display: none !important;
}

/* ============================================================
 * Carrito — meta de línea y subtotal con descuento
 * ============================================================ */

/* Cada dato de meta (Color, Ahorrás) en su propia línea */
.woocommerce-cart-form .variation,
.woocommerce-cart-form dl.variation {
	margin: 6px 0 0;
}
.woocommerce-cart-form dl.variation dt,
.woocommerce-cart-form dl.variation dd {
	display: block;
	float: none;
	margin: 2px 0;
	padding: 0;
}
.woocommerce-cart-form dl.variation dd p { margin: 0; }

.bdm-price-per-ref {
	color: var(--mute, #6B6B6B);
	font-size: 12px;
}

/* Subtotal con descuento */
.bdm-sub-regular {
	color: var(--mute, #6B6B6B);
	font-size: 13px;
	margin-right: 4px;
}
.bdm-sub-disc {
	text-decoration: none;
	font-weight: 700;
	color: var(--ink, #0A0A0A);
}

.bdm-cart-qty-label {
	display: inline-block;
	padding: 6px 10px;
	background: var(--paper-cool, #F4F5F7);
	border-radius: 6px;
	font-weight: 600;
	white-space: nowrap;
}

/* Rango de precios en página de producto */
.bdm-price-range {
	font-size: 18px;
	font-weight: 700;
	color: var(--ink, #0A0A0A);
}
.bdm-price-range__sep {
	color: var(--mute, #6B6B6B);
	margin: 0 2px;
}

/* Precio en carrito: tachado + con descuento */
.bdm-price-regular {
	color: var(--mute, #6B6B6B);
	font-size: 13px;
	margin-right: 4px;
}
.bdm-price-disc {
	text-decoration: none;
	font-weight: 700;
	color: var(--ink, #0A0A0A);
}

/* "Ahorrás" en el carrito con color de éxito (token --success de Core Framework).
   El tema pinta .woocommerce-Price-amount > bdi con #363636 y le gana a una
   clase simple, así que apuntamos directo al bdi interno con alta especificidad. */
.woocommerce .bdm-savings,
.woocommerce-cart-form .bdm-savings,
dd.variation-Ahorrs .bdm-savings,
.bdm-savings,
.bdm-savings .woocommerce-Price-amount,
.bdm-savings .woocommerce-Price-amount.amount,
.bdm-savings bdi {
	color: var(--success, #1e8a4a) !important;
	font-weight: 700 !important;
}

/* Mensaje "¡Ahorrás $X!" en la página de producto */
.bdm-savings-msg {
	display: inline-block;
	color: var(--success, #1e8a4a);
	font-weight: 800;
	font-size: 15px;
}
.bdm-savings-msg--hidden {
	display: none;
}

/* ============================================================
 * Mobile: que las 4 tiers entren en una sola fila
 * ============================================================ */
@media (max-width: 600px) {
	.bdm-tiers {
		grid-template-columns: repeat(4, 1fr);
		gap: 6px;
	}
	.bdm-tier {
		padding: 12px 4px 10px;
		border-radius: 8px;
		border-width: 1px;
	}
	.bdm-tier__qty {
		font-size: 15px;
	}
	.bdm-tier__unit {
		font-size: 10px;
		line-height: 1.2;
	}
	.bdm-tier__badge {
		top: -7px;
		right: 3px;
		font-size: 9px;
		padding: 2px 5px;
	}
	.bdm-tier--selected {
		box-shadow: 0 0 0 1.5px var(--brand-blue, #050EFF) inset;
	}
}

/* Pantallas muy chicas (ej. 360px): apretar un poco más */
@media (max-width: 360px) {
	.bdm-tier { padding: 10px 2px 8px; }
	.bdm-tier__qty { font-size: 13px; }
	.bdm-tier__unit { font-size: 9px; }
}
