/**
 * Avisos de WooCommerce como aviso flotante (toast) abajo a la izquierda.
 *
 * El contenedor `.woocommerce-notices-wrapper` se imprime dentro del flujo de la
 * página (encima de la ficha o del listado) y empuja el contenido. Aquí se saca
 * del flujo con `position: fixed`, así el mensaje «… se añadió al carrito» flota
 * sobre la página sin reservar espacio. Se ancla abajo a la izquierda porque la
 * esquina inferior derecha la ocupan el botón de WhatsApp y el carrito flotante.
 *
 * La tarjeta se estiliza sobre `.oz-wc-toast` (clase que añade el JS) y no sobre
 * `.woocommerce-message` directamente: las reglas de WooCommerce para esa clase
 * usan un solo selector de clase, así que con dos clases ganan siempre las de
 * aquí sin depender del orden en que se encolen las hojas de estilo ni de
 * `!important`. Sin JS los avisos siguen viéndose con el estilo de WooCommerce
 * dentro del contenedor flotante.
 *
 * No se carga en carrito, finalizar compra ni Mi cuenta: ahí los avisos son
 * parte del formulario y deben leerse en línea.
 */

/* Woo imprime el envoltorio aunque no haya avisos: sin esto queda una banda vacía. */
.woocommerce-notices-wrapper:empty {
	display: none !important;
}

.oz-wc-toasts,
.woocommerce-notices-wrapper {
	--oz-toast-ink: #1f2937;
	--oz-toast-muted: #6b7280;
	--oz-toast-line: #e3e8ef;
	--oz-toast-accent: #22a94b;
	--oz-toast-btn: #00a7a9;
	--oz-toast-btn-dark: #018e90;

	position: fixed;
	top: auto;
	bottom: clamp(16px, 2.6vw, 28px);
	left: clamp(16px, 2.6vw, 28px);
	right: auto;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: min(370px, calc(100vw - 32px));
	margin: 0;
	padding: 0;
	/* El contenedor no intercepta clics; cada aviso los recupera. */
	pointer-events: none;
}

.oz-wc-toasts .oz-wc-toast {
	pointer-events: auto;
	box-sizing: border-box;
	position: relative;
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr);
	align-items: start;
	column-gap: 14px;
	row-gap: 10px;
	width: 100%;
	margin: 0;
	padding: 18px 42px 18px 18px;
	list-style: none;
	background: #ffffff;
	color: var(--oz-toast-ink);
	border: 1px solid var(--oz-toast-line);
	border-top: 1px solid var(--oz-toast-line);
	border-left: 4px solid var(--oz-toast-accent);
	border-radius: 14px;
	box-shadow: 0 18px 40px rgba(1, 53, 106, 0.16);
	font-size: 15px;
	line-height: 1.45;
	text-align: left;
	overflow: hidden;
	animation: oz-wc-toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Icono de estado: primera celda de la rejilla, nunca encima del texto. */
.oz-wc-toasts .oz-wc-toast::before {
	content: "\2713";
	position: static;
	grid-column: 1;
	grid-row: 1 / span 2;
	align-self: start;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	background: var(--oz-toast-accent);
	color: #ffffff;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	text-indent: 0;
}

.oz-wc-toasts .oz-wc-toast.woocommerce-error {
	--oz-toast-accent: #dc2626;
}

.oz-wc-toasts .oz-wc-toast.woocommerce-error::before {
	content: "!";
}

.oz-wc-toasts .oz-wc-toast.woocommerce-info {
	--oz-toast-accent: #01356a;
}

.oz-wc-toasts .oz-wc-toast.woocommerce-info::before {
	content: "i";
	font-style: italic;
}

/* Texto del aviso (lo envuelve el JS) y <li> de `woocommerce-error`. */
.oz-wc-toasts .oz-wc-toast .oz-wc-toast__text,
.oz-wc-toasts .oz-wc-toast > li {
	grid-column: 2;
	align-self: center;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 14.5px;
	line-height: 1.45;
}

.oz-wc-toasts .oz-wc-toast .oz-wc-toast__text strong,
.oz-wc-toasts .oz-wc-toast > li strong {
	font-weight: 700;
}

/* «Ver carrito» y demás botones: siempre en su propia línea, bajo el texto. */
.oz-wc-toasts .oz-wc-toast .button {
	grid-column: 2;
	justify-self: start;
	display: inline-block;
	float: none;
	width: auto;
	min-height: 0;
	margin: 0;
	padding: 9px 18px;
	background: var(--oz-toast-btn);
	color: #ffffff;
	border: 0;
	border-radius: 999px;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	transition: background-color 0.18s ease;
}

.oz-wc-toasts .oz-wc-toast .button:hover,
.oz-wc-toasts .oz-wc-toast .button:focus {
	background: var(--oz-toast-btn-dark);
	color: #ffffff;
}

.oz-wc-toasts .oz-wc-toast .oz-wc-toast__close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--oz-toast-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.oz-wc-toasts .oz-wc-toast .oz-wc-toast__close:hover,
.oz-wc-toasts .oz-wc-toast .oz-wc-toast__close:focus-visible {
	background: rgba(1, 53, 106, 0.08);
	color: var(--oz-toast-ink);
}

/* Barra de tiempo restante hasta el cierre automático. */
.oz-wc-toasts .oz-wc-toast .oz-wc-toast__timer {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	transform-origin: left center;
	background: var(--oz-toast-accent);
	opacity: 0.3;
	animation: oz-wc-toast-timer linear both;
	animation-duration: var(--oz-toast-delay, 2s);
}

.oz-wc-toasts .oz-wc-toast:hover .oz-wc-toast__timer,
.oz-wc-toasts .oz-wc-toast:focus-within .oz-wc-toast__timer {
	animation-play-state: paused;
}

.oz-wc-toasts .oz-wc-toast--out {
	animation: oz-wc-toast-out 0.24s ease forwards;
}

@keyframes oz-wc-toast-in {
	from {
		opacity: 0;
		transform: translateX(-24px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes oz-wc-toast-out {
	from {
		opacity: 1;
		transform: none;
	}

	to {
		opacity: 0;
		transform: translateX(-24px);
	}
}

@keyframes oz-wc-toast-timer {
	from {
		transform: scaleX(1);
	}

	to {
		transform: scaleX(0);
	}
}

@media (max-width: 782px) {
	.oz-wc-toasts,
	.woocommerce-notices-wrapper {
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.oz-wc-toasts .oz-wc-toast,
	.oz-wc-toasts .oz-wc-toast--out {
		animation: none;
	}

	.oz-wc-toasts .oz-wc-toast .oz-wc-toast__timer {
		display: none;
	}
}
