/**
 * Toast Notifications — stroble.ai
 *
 * Zamiana domyślnych WooCommerce notices (.woocommerce-message, .woocommerce-error,
 * .woocommerce-info) na floating toasty w prawym dolnym rogu.
 *
 * Uniwersalny mechanizm — działa na każdej stronie (sklep, koszyk, checkout,
 * single product itd.). Vanilla JS, bez zależności.
 *
 * @package stroble
 */

/* ------------------------------------------------------------ */
/* Container — fixed bottom right                               */
/* ------------------------------------------------------------ */
#stroble-toast-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 420px;
	pointer-events: none;
}

/* ------------------------------------------------------------ */
/* Single toast                                                 */
/* ------------------------------------------------------------ */
.stroble-toast {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-width: 320px;
	max-width: 420px;
	padding: 16px 20px;
	background: #FFFFFF;
	border-radius: var(--stroble-radius-md, 8px);
	box-shadow: 0 8px 30px rgba(21, 21, 21, 0.14);
	transform: translateX(120%);
	opacity: 0;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
	pointer-events: auto;
	border-left: 4px solid var(--stroble-color-brown, #B38271);
	font-family: var(--stroble-font-body, 'Poppins', sans-serif);
}

.stroble-toast.is-visible {
	transform: translateX(0);
	opacity: 1;
}

/* ------------------------------------------------------------ */
/* Toast types                                                  */
/* ------------------------------------------------------------ */
.stroble-toast--success {
	border-left-color: #2E9A5C;
}

.stroble-toast--success .stroble-toast__icon {
	color: #2E9A5C;
}

.stroble-toast--error {
	border-left-color: #E14B4B;
}

.stroble-toast--error .stroble-toast__icon {
	color: #E14B4B;
}

.stroble-toast--warning {
	border-left-color: #E8A33D;
}

.stroble-toast--warning .stroble-toast__icon {
	color: #E8A33D;
}

.stroble-toast--info {
	border-left-color: var(--stroble-color-brown, #B38271);
}

.stroble-toast--info .stroble-toast__icon {
	color: var(--stroble-color-brown, #B38271);
}

/* ------------------------------------------------------------ */
/* Icon                                                         */
/* ------------------------------------------------------------ */
.stroble-toast__icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 2px;
}

.stroble-toast__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ------------------------------------------------------------ */
/* Message                                                      */
/* ------------------------------------------------------------ */
.stroble-toast__message {
	flex: 1;
	font-size: 14px;
	font-weight: var(--stroble-fw-regular, 400);
	line-height: 1.5;
	color: var(--stroble-color-text, #393D46);
}

.stroble-toast__message a {
	color: var(--stroble-color-brown, #B38271);
	font-weight: var(--stroble-fw-semibold, 600);
	text-decoration: underline;
	transition: color 0.2s ease;
}

.stroble-toast__message a:hover {
	color: var(--stroble-color-brown-dark, #875849);
}

/* Lista błędów wewnątrz toasta (np. walidacja checkoutu) */
.stroble-toast__message ul,
.stroble-toast-error-list {
	margin: 0;
	padding: 0 0 0 16px;
	list-style: disc;
}

.stroble-toast__message ul li,
.stroble-toast-error-list li {
	margin: 4px 0;
	font-size: 13px;
	line-height: 1.4;
}

/* ------------------------------------------------------------ */
/* Close button                                                 */
/* ------------------------------------------------------------ */
.stroble-toast__close {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	padding: 0;
	margin: -4px -8px -4px 4px;
	background: none;
	border: none;
	border-radius: 4px;
	font-size: 22px;
	line-height: 1;
	color: var(--stroble-color-text-light, #878D9D);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stroble-toast__close:hover {
	background: var(--stroble-color-bg-alt, #F6F6F8);
	color: var(--stroble-color-text, #393D46);
}

/* ------------------------------------------------------------ */
/* Hide original WooCommerce notices (używamy toastów)          */
/* ------------------------------------------------------------ */
.woocommerce-NoticeGroup,
.woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-notices-wrapper .woocommerce-info:not(.cart-empty),
.woocommerce > .woocommerce-error,
.woocommerce > .woocommerce-message,
.woocommerce > .woocommerce-info:not(.cart-empty) {
	display: none !important;
}

/* Zachowaj komunikat "Twój koszyk jest pusty" — to nie notice, to hero strony */
.woocommerce-info.cart-empty {
	display: block !important;
}

/* ------------------------------------------------------------ */
/* Responsive                                                   */
/* ------------------------------------------------------------ */
@media (max-width: 480px) {
	#stroble-toast-container {
		bottom: 16px;
		right: 16px;
		left: 16px;
		max-width: none;
	}

	.stroble-toast {
		min-width: 0;
		padding: 14px 16px;
	}
}
