/* =============================================================================
   DaruHast — Modern toast notifications for WooCommerce notices
   ---------------------------------------------------------------------------
   Replaces WooCommerce's default in-flow notices (the "product added to cart"
   bar that sticks under the header, etc.) with floating, app-style toasts:
   fixed on top of everything, slide in from the top, auto-dismiss after a few
   seconds (pause on hover), dismissible with a close button.

   Tokens mirror the checkout design system (woocommerce-checkout.css) but are
   self-contained here because notices appear site-wide, where that sheet is
   not loaded.
   ============================================================================= */

.dh-toasts {
	--dh-t-primary:       #23CEA9;
	--dh-t-primary-dark:  #1FB897;
	--dh-t-blue:          #2379CE;
	--dh-t-error:         #E04848;
	--dh-t-rich:          #1A1A1A;
	--dh-t-muted:         #5F6B7A;
	--dh-t-bg:            #FFFFFF;
	--dh-t-font:          "IranYekanX", sans-serif;

	position: fixed;
	top: max(18px, env(safe-area-inset-top));
	inset-inline: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding-inline: 16px;
	pointer-events: none; /* let clicks pass through the gaps */
	direction: rtl;
}

.dh-toast {
	pointer-events: auto;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	max-width: 420px;
	padding: 14px 16px;
	border-radius: 16px;
	background: var(--dh-t-bg);
	color: var(--dh-t-rich);
	font-family: var(--dh-t-font);
	font-size: 14.5px;
	line-height: 1.7;
	text-align: right;
	direction: rtl;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.06),
		0 18px 40px -16px rgba(16, 24, 40, 0.28);
	border: 1px solid rgba(16, 24, 40, 0.06);
	position: relative;
	overflow: hidden;
	/* enter state */
	opacity: 0;
	transform: translateY(-22px) scale(0.96);
	transition:
		opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.dh-toast.is-in {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.dh-toast.is-out {
	opacity: 0;
	transform: translateY(-22px) scale(0.96);
}

/* Accent strip on the inline-start edge (RTL = right) */
.dh-toast::before {
	content: "";
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	width: 4px;
	background: var(--dh-t-primary);
}

.dh-toast--error::before  { background: var(--dh-t-error); }
.dh-toast--info::before   { background: var(--dh-t-blue); }

/* Icon chip */
.dh-toast__icon {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 11px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: var(--dh-t-primary);
}

.dh-toast--error .dh-toast__icon { background: var(--dh-t-error); }
.dh-toast--info  .dh-toast__icon { background: var(--dh-t-blue); }

.dh-toast__icon svg { width: 19px; height: 19px; display: block; }

/* Body text + any inline WC buttons (e.g. "View cart") */
.dh-toast__body {
	flex: 1 1 auto;
	min-width: 0;
	padding-top: 3px;
	color: var(--dh-t-rich);
	font-weight: 600;
}

.dh-toast__body p { margin: 0; }

.dh-toast__body a.button,
.dh-toast__body a.wc-forward {
	display: inline-flex;
	align-items: center;
	margin-top: 8px;
	padding: 7px 16px !important;
	border-radius: 999px !important;
	background: var(--dh-t-blue) !important;
	color: #fff !important;
	border: 0 !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
	text-decoration: none !important;
	box-shadow: none !important;
	transition: background 0.2s ease;
}

.dh-toast__body a.button:hover,
.dh-toast__body a.wc-forward:hover {
	background: var(--dh-t-primary) !important;
	color: #fff !important;
}

/* Close button */
.dh-toast__close {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	margin: -2px -4px 0 0;
	padding: 0;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--dh-t-muted) !important;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.18s ease, color 0.18s ease;
}

.dh-toast__close:hover,
.dh-toast__close:focus {
	background: rgba(16, 24, 40, 0.06) !important;
	color: var(--dh-t-rich) !important;
}

/* Auto-dismiss progress bar */
.dh-toast__bar {
	position: absolute;
	inset-block-end: 0;
	inset-inline: 0;
	height: 3px;
	background: var(--dh-t-primary);
	opacity: 0.35;
	transform-origin: inline-start;
	transform: scaleX(1);
}

.dh-toast--error .dh-toast__bar { background: var(--dh-t-error); }
.dh-toast--info  .dh-toast__bar { background: var(--dh-t-blue); }

.dh-toast.is-counting .dh-toast__bar {
	transform: scaleX(0);
	transition: transform linear var(--dh-toast-duration, 4000ms);
}

.dh-toast.is-paused .dh-toast__bar {
	transition: none;
}

@media (max-width: 480px) {
	.dh-toasts { gap: 10px; }
	.dh-toast  { font-size: 14px; padding: 13px 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.dh-toast,
	.dh-toast.is-counting .dh-toast__bar {
		transition: opacity 0.2s linear;
	}
	.dh-toast.is-in,
	.dh-toast.is-out { transform: none; }
}
