/*
 * Notificaciones flotantes de WooCommerce (toasts) con los estilos del sitio.
 * El JS (js/notices.js) mueve los avisos al contenedor #gd-toasts.
 */

#gd-toasts {
	--gd-toast-offset: 110px;
	--gd-toast-error: var(--e-global-color-e34f9f1, #E86737);
	--gd-toast-success: var(--e-global-color-primary, #21B354);
	--gd-toast-info: var(--e-global-color-secondary, #344896);
	--gd-toast-title: var(--e-global-color-ab9bd15, #191919);
	--gd-toast-text: var(--e-global-color-24d9a75, #3A3A3A);

	position: fixed;
	top: var(--gd-toast-offset);
	right: 24px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: min(420px, calc(100vw - 32px));
	pointer-events: none;
}

#gd-toasts:empty {
	display: none;
}

/* Tarjeta */
#gd-toasts .gd-toast {
	--gd-toast-color: var(--gd-toast-info);

	position: relative;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 16px 48px 16px 60px;
	list-style: none;
	background: #FFFFFF;
	border: 1px solid color-mix(in srgb, var(--gd-toast-color) 35%, transparent);
	border-radius: 16px;
	box-shadow: 0 14px 36px rgba(25, 25, 25, 0.14), 0 2px 6px rgba(25, 25, 25, 0.06);
	color: var(--gd-toast-text);
	font-family: "Stack Sans Text", sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	text-align: left;
	overflow: hidden;
	pointer-events: auto;
	animation: gd-toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

#gd-toasts .gd-toast.woocommerce-error,
#gd-toasts .gd-toast.is-error {
	--gd-toast-color: var(--gd-toast-error);
}

#gd-toasts .gd-toast.woocommerce-message,
#gd-toasts .gd-toast.is-success {
	--gd-toast-color: var(--gd-toast-success);
}

/* Franja de color a la izquierda */
#gd-toasts .gd-toast::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 5px;
	background: var(--gd-toast-color);
}

/* Icono circular (reemplaza el icono de WooCommerce) */
#gd-toasts .gd-toast::before {
	content: "i";
	position: absolute;
	top: 14px;
	left: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin: 0;
	border-radius: 50%;
	background: var(--gd-toast-color);
	color: #FFFFFF;
	font-family: "Zalando Sans SemiExpanded", sans-serif;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}

#gd-toasts .gd-toast.woocommerce-error::before,
#gd-toasts .gd-toast.is-error::before {
	content: "!";
}

#gd-toasts .gd-toast.woocommerce-message::before,
#gd-toasts .gd-toast.is-success::before {
	content: "\2713";
}

/* Contenido */
#gd-toasts .gd-toast li {
	margin: 0;
	padding: 0;
	list-style: none;
}

#gd-toasts .gd-toast li + li {
	margin-top: 6px;
}

#gd-toasts .gd-toast strong {
	color: var(--gd-toast-title);
	font-weight: 600;
}

#gd-toasts .gd-toast a:not(.button) {
	color: inherit;
	font-size: inherit;
	line-height: inherit;
	text-decoration: none;
}

#gd-toasts .gd-toast a:not(.button):hover,
#gd-toasts .gd-toast a:not(.button):focus-visible {
	color: var(--gd-toast-title);
	text-decoration: underline;
	text-decoration-color: var(--gd-toast-color);
	text-underline-offset: 3px;
}

/* Botón dentro del aviso (p. ej. "Ver carrito") */
#gd-toasts .gd-toast .button {
	float: none;
	display: inline-block;
	margin: 0 0 8px;
	padding: 8px 18px;
	border: 0;
	border-radius: 40px;
	background: linear-gradient(171deg, #21B354 5%, #054A20 100%);
	color: #FFFFFF;
	font-family: "Zalando Sans SemiExpanded", sans-serif;
	font-size: 13px;
	line-height: 1;
	text-decoration: none;
}

#gd-toasts .gd-toast .button:hover {
	opacity: 0.9;
}

/* Botón cerrar (anula los estilos globales de botones de Elementor) */
#gd-toasts .gd-toast .gd-toast__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	background-image: none;
	box-shadow: none;
	color: var(--e-global-color-text, #7A7A7A);
	font-family: Arial, sans-serif;
	font-size: 20px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

#gd-toasts .gd-toast .gd-toast__close:hover,
#gd-toasts .gd-toast .gd-toast__close:focus-visible {
	background: color-mix(in srgb, var(--gd-toast-color) 12%, transparent);
	color: var(--gd-toast-title);
	outline: none;
}

/* Barra de tiempo para los avisos que se cierran solos */
#gd-toasts .gd-toast .gd-toast__progress {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 3px;
	background: var(--gd-toast-color);
	opacity: 0.35;
	transform-origin: left center;
	animation: gd-toast-progress var(--gd-toast-duration, 6s) linear forwards;
}

#gd-toasts .gd-toast:hover .gd-toast__progress {
	animation-play-state: paused;
}

/* Salida */
#gd-toasts .gd-toast.gd-toast--leaving {
	animation: gd-toast-out 0.25s ease-in forwards;
}

@keyframes gd-toast-in {
	from { opacity: 0; transform: translateX(24px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@keyframes gd-toast-out {
	to { opacity: 0; transform: translateX(24px) scale(0.98); }
}

@keyframes gd-toast-progress {
	from { transform: scaleX(1); }
	to   { transform: scaleX(0); }
}

/* Móvil */
@media (max-width: 767px) {
	#gd-toasts {
		--gd-toast-offset: 80px;
		right: 16px;
		left: 16px;
		width: auto;
	}

	#gd-toasts .gd-toast {
		padding: 14px 44px 14px 54px;
		font-size: 13px;
	}

	#gd-toasts .gd-toast::before {
		top: 12px;
		left: 16px;
		width: 24px;
		height: 24px;
	}

	@keyframes gd-toast-in {
		from { opacity: 0; transform: translateY(-16px); }
		to   { opacity: 1; transform: none; }
	}

	@keyframes gd-toast-out {
		to { opacity: 0; transform: translateY(-16px); }
	}
}

@media (prefers-reduced-motion: reduce) {
	#gd-toasts .gd-toast,
	#gd-toasts .gd-toast.gd-toast--leaving {
		animation-duration: 0.01s;
	}
}
