/**
 * Hafez notifications: toasts (Toastify) and dialogs (SweetAlert2), see notify.js.
 *
 * Front: colours from the visual identity (--hafez-dp-*, written for
 * .hafez-notify-ui by Hafez_Notify), dark under html[data-dark-mode="true"].
 * Admin (.hafez-notify--admin): the panel palette, dark while the panel is
 * dark (.hafez_admin[data-hafez-scheme="dark"]). Type colours are fixed.
 */

.hafez-notify-ui {
	--hn-surface: var(--hafez-dp-box-bg, #ffffff);
	--hn-text: var(--hafez-dp-label, #2c2624);
	--hn-muted: var(--hafez-dp-help, #6e6560);
	--hn-border: var(--hafez-dp-box-border-color, #e6dfda);
	--hn-primary: var(--hafez-dp-primary-bg, #f15a24);
	--hn-primary-text: var(--hafez-dp-primary-text, #ffffff);
	--hn-primary-hover: var(--hafez-dp-primary-hover-bg, #d4471a);
	--hn-primary-hover-text: var(--hafez-dp-primary-hover-text, #ffffff);
	--hn-radius: var(--hafez-dp-radius-box, 14px);
	--hn-radius-btn: var(--hafez-dp-radius-button, 10px);
	--hn-font: var(--hafez-dp-font, var(--hafez-font, inherit));
	--hn-shadow: 0 10px 30px -8px rgba(30, 20, 15, 0.28), 0 2px 6px rgba(30, 20, 15, 0.08);
	--hn-success: #15803d;
	--hn-error: #b91c1c;
	--hn-warning: #b45309;
	--hn-info: #1d4ed8;
	--hn-backdrop: rgba(20, 14, 11, 0.45);
}

.hafez-notify--admin.hafez-notify-ui,
.hafez-notify--admin .hafez-notify-ui {
	--hn-surface: #ffffff;
	--hn-text: #2c2624;
	--hn-muted: #6e6560;
	--hn-border: #e6dfda;
	--hn-primary: #f15a24;
	--hn-primary-text: #ffffff;
	--hn-primary-hover: #d4471a;
	--hn-primary-hover-text: #ffffff;
	--hn-radius: 14px;
	--hn-radius-btn: 10px;
	--hn-font: "IRANSans", Tahoma, Arial, sans-serif;
}

/* Front dark mode (dark switcher, account skins). */
:is(html[data-dark-mode="true"], body[data-dark-mode="true"], body.hafez-dark) .hafez-notify-ui,
:is(html[data-dark-mode="true"], body[data-dark-mode="true"], body.hafez-dark) .hafez-swal .hafez-notify-ui,
/* «پیام‌های فروشگاه» preview in the panel («پیش‌نمایش در حالت تیره»). */
.hafez-notify-ui.hafez-notify--dark,
.hafez-notify--dark .hafez-notify-ui,
/* Panel dark mode. */
html:has(.hafez_admin[data-hafez-scheme="dark"]) .hafez-notify--admin.hafez-notify-ui,
html:has(.hafez_admin[data-hafez-scheme="dark"]) .hafez-notify--admin .hafez-notify-ui {
	--hn-surface: #241e1b;
	--hn-text: #f3ece7;
	--hn-muted: #b8aca3;
	--hn-border: #3b332e;
	--hn-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.35);
	--hn-success: #4ade80;
	--hn-error: #f87171;
	--hn-warning: #fbbf24;
	--hn-info: #60a5fa;
	--hn-backdrop: rgba(8, 6, 5, 0.66);
	color-scheme: dark;
}

html:has(.hafez_admin[data-hafez-scheme="dark"]) .hafez-notify--admin .hafez-notify-ui {
	--hn-primary: #c8461a;
	--hn-primary-hover: #b83f12;
}

/* -------------------------------------------------------------------------
 * Toasts
 * ---------------------------------------------------------------------- */

.toastify.hafez-toast {
	direction: rtl;
	text-align: right;
	display: block;
	width: max-content;
	min-width: 260px;
	max-width: min(420px, calc(100vw - 32px));
	padding: 0;
	color: var(--hn-text);
	background: var(--hn-surface);
	border: 1px solid var(--hn-border);
	border-inline-start: 4px solid var(--hn-accent, var(--hn-info));
	border-radius: var(--hn-radius);
	box-shadow: var(--hn-shadow);
	font-family: var(--hn-font);
	font-size: 14px;
	line-height: 1.7;
	cursor: default;
	transition: transform 0.35s cubic-bezier(0.215, 0.61, 0.355, 1), opacity 0.35s ease, top 0.35s ease, bottom 0.35s ease;
}

.toastify.hafez-toast--success { --hn-accent: var(--hn-success); }
.toastify.hafez-toast--error { --hn-accent: var(--hn-error); }
.toastify.hafez-toast--warning { --hn-accent: var(--hn-warning); }
.toastify.hafez-toast--info { --hn-accent: var(--hn-info); }

.hafez-toast__inner {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
}

.hafez-toast__icon {
	flex: 0 0 auto;
	display: inline-flex;
	margin-top: 2px;
	color: var(--hn-accent, var(--hn-info));
}

.hafez-toast__body {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

.hafez-toast__title {
	display: block;
	font-weight: 700;
}

.hafez-toast__text {
	color: inherit;
}

.hafez-toast__list {
	margin: 4px 0 0;
	padding: 0 18px 0 0;
	color: var(--hn-muted);
	font-size: 13px;
	list-style: disc;
}

.hafez-toast__list li {
	margin: 0;
}

.hafez-toast__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin: -2px 0 0 -4px;
	padding: 0;
	color: var(--hn-muted);
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	box-shadow: none;
}

.hafez-toast__close:hover,
.hafez-toast__close:focus-visible {
	color: var(--hn-text);
	background: color-mix(in srgb, var(--hn-text) 8%, transparent);
	outline: none;
}

.hafez-toast__close:focus-visible {
	box-shadow: 0 0 0 2px var(--hn-primary);
}

/* «پیام‌های فروشگاه»: links of a WooCommerce notice and its action buttons. */
.hafez-notify__link {
	display: inline;
	margin: 0;
	padding: 0;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	font-weight: 700;
	line-height: inherit;
	text-align: inherit;
	text-decoration: underline;
	text-decoration-color: var(--hn-accent, var(--hn-primary));
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
	cursor: pointer;
}

.hafez-notify__link:hover {
	color: var(--hn-accent, var(--hn-primary));
	background: none;
}

.hafez-notify__link:focus-visible {
	outline: 2px solid var(--hn-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

.hafez-toast__list .hafez-notify__link {
	font-weight: inherit;
	color: var(--hn-text);
}

.hafez-toast__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.toastify.hafez-toast .hafez-toast__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	margin: 0;
	padding: 6px 14px;
	color: var(--hn-primary-text);
	background: var(--hn-primary);
	border: 1px solid transparent;
	border-radius: var(--hn-radius-btn);
	box-shadow: none;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.toastify.hafez-toast .hafez-toast__action:hover {
	color: var(--hn-primary-hover-text);
	background: var(--hn-primary-hover);
}

.toastify.hafez-toast .hafez-toast__action--ghost {
	color: var(--hn-text);
	background: transparent;
	border-color: var(--hn-border);
}

.toastify.hafez-toast .hafez-toast__action--ghost:hover {
	color: var(--hn-text);
	background: color-mix(in srgb, var(--hn-text) 6%, transparent);
}

.toastify.hafez-toast .hafez-toast__action:focus-visible {
	outline: 2px solid var(--hn-primary);
	outline-offset: 2px;
}

.toastify.hafez-toast--no-close {
	cursor: pointer;
}

@media (max-width: 480px) {
	.toastify.hafez-toast {
		left: 0 !important;
		right: 0 !important;
		margin-inline: auto;
		width: auto;
		min-width: 0;
		max-width: calc(100vw - 24px);
		transform: none !important;
	}
}

.toastify.hafez-toast--still {
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.toastify.hafez-toast {
		transition: none;
	}
}

/* A WooCommerce / WordPress notice shown as a toast stays in the page for screen readers. */
.hafez-notify-sourced {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* -------------------------------------------------------------------------
 * Dialogs (SweetAlert2)
 * ---------------------------------------------------------------------- */

.swal2-container.hafez-swal {
	z-index: 2147483000;
	padding: 16px;
}

.swal2-container.hafez-swal.swal2-backdrop-show {
	background: var(--hn-backdrop, rgba(20, 14, 11, 0.45));
}

.hafez-swal .swal2-popup.hafez-swal__popup {
	direction: rtl;
	width: min(440px, 100%);
	padding: 24px 22px 20px;
	color: var(--hn-text);
	background: var(--hn-surface);
	border: 1px solid var(--hn-border);
	border-radius: var(--hn-radius);
	box-shadow: var(--hn-shadow);
	font-family: var(--hn-font);
	font-size: 15px;
}

.hafez-swal .hafez-swal__title {
	padding: 4px 0 0;
	color: var(--hn-text);
	font-family: inherit;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.6;
}

.hafez-swal .hafez-swal__text {
	margin: 10px 0 0;
	padding: 0;
	color: var(--hn-muted);
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.9;
	text-align: center;
	white-space: pre-line;
}

.hafez-swal .swal2-icon.hafez-swal__icon {
	margin: 4px auto 6px;
	transform: scale(0.8);
}

.hafez-swal .swal2-icon.swal2-success {
	border-color: var(--hn-success);
	color: var(--hn-success);
}

.hafez-swal .swal2-icon.swal2-success [class^="swal2-success-line"] {
	background-color: var(--hn-success);
}

.hafez-swal .swal2-icon.swal2-success .swal2-success-ring {
	border-color: color-mix(in srgb, var(--hn-success) 30%, transparent);
}

.hafez-swal .swal2-icon.swal2-success [class^="swal2-success-circular-line"],
.hafez-swal .swal2-icon.swal2-success .swal2-success-fix {
	background-color: var(--hn-surface);
}

.hafez-swal .swal2-icon.swal2-error {
	border-color: var(--hn-error);
	color: var(--hn-error);
}

.hafez-swal .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
	background-color: var(--hn-error);
}

.hafez-swal .swal2-icon.swal2-warning {
	border-color: var(--hn-warning);
	color: var(--hn-warning);
}

.hafez-swal .swal2-icon.swal2-info {
	border-color: var(--hn-info);
	color: var(--hn-info);
}

.hafez-swal .swal2-icon.swal2-question {
	border-color: var(--hn-primary);
	color: var(--hn-primary);
}

.hafez-swal .hafez-swal__actions {
	gap: 10px;
	margin: 20px 0 0;
	padding: 0;
}

.hafez-swal .hafez-swal__btn {
	min-width: 112px;
	margin: 0;
	padding: 10px 18px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.5;
	border: 1px solid transparent;
	border-radius: var(--hn-radius-btn);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hafez-swal .hafez-swal__btn--primary {
	color: var(--hn-primary-text);
	background: var(--hn-primary);
}

.hafez-swal .hafez-swal__btn--primary:hover {
	color: var(--hn-primary-hover-text);
	background: var(--hn-primary-hover);
}

.hafez-swal .hafez-swal__btn--danger {
	color: #ffffff;
	background: #b91c1c;
}

.hafez-swal .hafez-swal__btn--danger:hover {
	color: #ffffff;
	background: #991b1b;
}

.hafez-swal .hafez-swal__btn--ghost {
	color: var(--hn-text);
	background: transparent;
	border-color: var(--hn-border);
}

.hafez-swal .hafez-swal__btn--ghost:hover {
	background: color-mix(in srgb, var(--hn-text) 6%, transparent);
}

.hafez-swal .hafez-swal__btn:focus-visible {
	outline: 2px solid var(--hn-primary);
	outline-offset: 2px;
	box-shadow: none;
}

.hafez-swal .hafez-swal__footer {
	color: var(--hn-muted);
	border-top-color: var(--hn-border);
}

/* «پیام‌های فروشگاه» in a dialog: text, error list and a second action. */
.hafez-swal .hafez-swal__store {
	white-space: normal;
}

.hafez-swal .hafez-swal__store p {
	margin: 0;
	color: var(--hn-text);
}

.hafez-swal .hafez-swal__store .hafez-swal__list {
	display: inline-block;
	margin: 10px 0 0;
	padding: 0 20px 0 0;
	text-align: right;
	list-style: disc;
}

.hafez-swal .hafez-swal__store .hafez-swal__list li {
	margin: 2px 0;
}

.hafez-swal .hafez-swal__store .hafez-notify__link {
	color: var(--hn-text);
}

.hafez-swal .hafez-swal__store .hafez-swal__extra {
	display: block;
	margin: 14px auto 0;
}

/* Prize card of «گردونه شانس» inside the dialog. */
.hafez-swal .hafez-swal__code {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 14px auto 0;
	padding: 8px 10px;
	max-width: 100%;
	color: var(--hn-text);
	background: color-mix(in srgb, var(--hn-primary) 8%, var(--hn-surface));
	border: 1px dashed var(--hn-primary);
	border-radius: var(--hn-radius-btn);
	white-space: normal;
}

.hafez-swal .hafez-swal__code code {
	direction: ltr;
	color: inherit;
	background: none;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.hafez-swal .hafez-swal__code button {
	padding: 4px 10px;
	color: var(--hn-primary-text);
	background: var(--hn-primary);
	border: 0;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
	.hafez-swal .swal2-popup,
	.hafez-swal .swal2-icon,
	.hafez-swal .swal2-icon * {
		animation: none !important;
		transition: none !important;
	}
}
