/*
 * Ozeanic Upsell
 *
 * Prefijo `ozu-` para no chocar con las clases `wd-` de Woodmart ni `fkcart-`
 * y `wfacp-` de FunnelKit.
 *
 * Diseño: un solo color de marca (el primario de Woodmart, #0C6AC5 en
 * Ozeanic), rojo solo para la etiqueta del descuento y texto en gris oscuro.
 * El botón «Añadir» es secundario —borde de marca, fondo blanco— para no
 * competir con «Realizar pedido» ni con «Finalizar compra».
 *
 * Sobre los `!important`: el checkout de FunnelKit estiliza todo lo que hay
 * dentro de su formulario con selectores de ID (`body #wfacp-e-form select`,
 * `#wfacp-e-form a`, `#wfacp-e-form span.amount`…), que ninguna clase puede
 * superar. Se usan solo en el desplegable, el botón, el nombre, el título y
 * los precios: justo lo que FunnelKit pisaba.
 */

.ozu-offers,
.ozu-popup {
	--ozu-brand: var(--wd-primary-color, #0c6ac5);
	--ozu-brand-tint: #f3f8fd;
	--ozu-brand-line: #d4e4f5;
	--ozu-text: #1f2430;
	--ozu-muted: #6b7280;
	--ozu-border: #e3e8ef;
	--ozu-sale: #d92d20;
	--ozu-radius: 12px;
	--ozu-radius-sm: 8px;
}

/* Matices de marca a partir del color del tema, donde el navegador sabe mezclar. */
@supports (background: color-mix(in srgb, red 10%, white)) {
	.ozu-offers,
	.ozu-popup {
		--ozu-brand-tint: color-mix(in srgb, var(--ozu-brand) 5%, #fff);
		--ozu-brand-line: color-mix(in srgb, var(--ozu-brand) 22%, #fff);
	}
}

.ozu-offers {
	margin: 16px 0;
	color: var(--ozu-text);
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
}

.ozu-offers[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- título */

.ozu-offers .ozu-offers__title {
	display: flex !important;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px !important;
	padding: 0 !important;
	color: var(--ozu-text) !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
}

.ozu-offers__icon {
	flex: none;
	color: var(--ozu-brand);
}

/* ---------------------------------------------------------------- lista */

.ozu-offers .ozu-offers__list {
	display: grid;
	gap: 10px;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.ozu-offers .ozu-offer {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	margin: 0 !important;
	padding: 12px !important; /* `#wfacp-e-form li { padding: 0 }` en el checkout de FunnelKit */
	border: 1px solid var(--ozu-border);
	border-radius: var(--ozu-radius-sm);
	background: #fff;
	list-style: none !important;
}

.ozu-offers .ozu-offer::before,
.ozu-offers .ozu-offer::marker {
	content: none;
}

/* Imagen y etiqueta del descuento */
.ozu-offers .ozu-offer__image {
	position: relative;
	display: block;
	width: 64px;
	height: 64px;
	overflow: hidden;
	border-radius: var(--ozu-radius-sm);
	background: #f6f7f9;
}

.ozu-offers .ozu-offer__image img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	object-fit: cover;
}

.ozu-offers .ozu-offer__badge {
	position: absolute;
	top: 4px;
	left: 4px;
	padding: 2px 6px;
	border-radius: 999px;
	background: var(--ozu-sale);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.01em;
}

/* Cuerpo: nombre, opción y precio */
.ozu-offers .ozu-offer__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.ozu-offers a.ozu-offer__name {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	background: none !important;
	color: var(--ozu-text) !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	text-decoration: none !important;
}

.ozu-offers a.ozu-offer__name:hover {
	color: var(--ozu-brand) !important;
}

.ozu-offers select.ozu-offer__variation {
	display: block !important;
	width: 100% !important;
	max-width: 260px;
	height: 34px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 30px 0 10px !important;
	border: 1px solid #d5dbe3 !important;
	border-radius: var(--ozu-radius-sm) !important;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center !important;
	box-shadow: none !important;
	color: var(--ozu-text) !important;
	font-family: inherit !important;
	font-size: 13px !important;
	font-weight: 400 !important;
	line-height: 32px !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	cursor: pointer;
}

.ozu-offers select.ozu-offer__variation:hover {
	border-color: #b9c3cf !important;
}

.ozu-offers select.ozu-offer__variation:focus-visible {
	border-color: var(--ozu-brand) !important;
	outline: 2px solid var(--ozu-brand-line);
	outline-offset: 1px;
}

.ozu-offers .ozu-offer__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px;
	line-height: 1.2;
}

.ozu-offers .ozu-offer__price ins,
.ozu-offers .ozu-offer__price ins .amount,
.ozu-offers .ozu-offer__price ins bdi {
	background: none !important;
	color: var(--ozu-text) !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
}

.ozu-offers .ozu-offer__price del,
.ozu-offers .ozu-offer__price del .amount,
.ozu-offers .ozu-offer__price del bdi {
	color: var(--ozu-muted) !important;
	font-size: 13px !important;
	font-weight: 400 !important;
	opacity: 1 !important;
}

.ozu-offers .ozu-offer__price del {
	text-decoration: line-through !important;
}

/* Botón: secundario, borde de marca */
.ozu-offers button.ozu-offer__add {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	min-width: 88px;
	height: 38px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 16px !important;
	border: 1.5px solid var(--ozu-brand) !important;
	border-radius: var(--ozu-radius-sm) !important;
	background: #fff !important;
	box-shadow: none !important;
	color: var(--ozu-brand) !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.ozu-offers button.ozu-offer__add:hover {
	background: var(--ozu-brand) !important;
	color: #fff !important;
}

.ozu-offers button.ozu-offer__add:active {
	transform: scale(0.97);
}

.ozu-offers button.ozu-offer__add:focus-visible {
	outline: 2px solid var(--ozu-brand);
	outline-offset: 2px;
}

.ozu-offers button.ozu-offer__add.is-loading,
.ozu-offers button.ozu-offer__add:disabled {
	border-color: var(--ozu-brand-line) !important;
	background: var(--ozu-brand-tint) !important;
	color: var(--ozu-muted) !important;
	cursor: progress;
}

.ozu-offers .ozu-offers__error {
	margin: 8px 0 0 !important;
	color: var(--ozu-sale) !important;
	font-size: 13px !important;
}

/* ---------------------------------------------------------------- contextos */

/* Checkout: caja con un matiz de marca para que se lea como oferta. */
.ozu-offers--checkout {
	padding: 16px;
	border: 1px solid var(--ozu-brand-line);
	border-radius: var(--ozu-radius);
	background: var(--ozu-brand-tint);
}

/* Carrito lateral de FunnelKit: más compacto y con su margen lateral. */
.ozu-offers--side_cart {
	margin: 12px 16px;
	padding: 12px;
	border-radius: var(--ozu-radius);
	background: var(--ozu-brand-tint);
}

.ozu-offers--side_cart .ozu-offer {
	grid-template-columns: 52px minmax(0, 1fr) auto;
	gap: 10px;
	padding: 10px !important;
}

.ozu-offers--side_cart .ozu-offer__image {
	width: 52px;
	height: 52px;
}

.ozu-offers--side_cart button.ozu-offer__add {
	min-width: 0;
	height: 34px !important;
	padding: 0 12px !important;
	font-size: 13px !important;
}

/* Página de carrito: en escritorio, rejilla. */
@media (min-width: 768px) {
	.ozu-offers--cart .ozu-offers__list {
		grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	}
}

/* Pantallas estrechas: el botón baja a su propia fila, a todo el ancho. */
@media (max-width: 480px) {
	.ozu-offers .ozu-offer {
		grid-template-columns: 56px minmax(0, 1fr);
	}

	.ozu-offers .ozu-offer__image {
		width: 56px;
		height: 56px;
	}

	.ozu-offers button.ozu-offer__add {
		grid-column: 1 / -1;
		width: 100% !important;
	}

	.ozu-offers select.ozu-offer__variation {
		max-width: none;
	}
}

/* ---------------------------------------------------------------- ventana */

.ozu-popup {
	position: fixed;
	inset: 0;
	z-index: 100000; /* por encima de las capas de Woodmart y FunnelKit */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.ozu-popup[hidden] {
	display: none;
}

.ozu-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
}

.ozu-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 24px 20px 20px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
	color: var(--ozu-text);
	outline: none;
	animation: ozu-pop 0.18s ease-out;
}

@keyframes ozu-pop {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ozu-popup__dialog {
		animation: none;
	}
}

.ozu-popup .ozu-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px !important;
	height: 32px !important;
	min-height: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--ozu-muted) !important;
	font-size: 22px !important;
	line-height: 32px !important;
	cursor: pointer;
}

.ozu-popup .ozu-popup__close:hover {
	background: #f1f3f6 !important;
	color: var(--ozu-text) !important;
}

.ozu-popup .ozu-popup__title {
	margin: 0 36px 14px 0 !important;
	color: var(--ozu-text) !important;
	font-size: 18px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
}

.ozu-popup .ozu-offers {
	margin: 0;
}

/* La ventana ya lleva el título arriba. Sin esto se duplicaba tras añadir una
 * oferta, porque el bloque que devuelve el servidor trae el suyo. */
.ozu-popup .ozu-offers .ozu-offers__title {
	display: none !important;
}

.ozu-popup .ozu-popup__actions {
	display: flex;
	gap: 12px;
	justify-content: space-between;
	align-items: center;
	margin-top: 16px;
}

.ozu-popup .ozu-popup__continue {
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	color: var(--ozu-muted) !important;
	font-size: 14px !important;
	text-decoration: underline !important;
	text-transform: none !important;
	cursor: pointer;
}

.ozu-popup a.ozu-popup__checkout {
	display: inline-flex !important;
	align-items: center;
	height: 42px;
	padding: 0 20px !important;
	border-radius: var(--ozu-radius-sm) !important;
	background: var(--ozu-brand) !important;
	color: #fff !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
	text-transform: none !important;
}

html.ozu-popup-open {
	overflow: hidden;
}
