/*!
 * HotToastJS v1.0.0 (https://github.com/mr-teslaa/hottoastjs)
 * Copyright 2026 Hossain Foysal (https://hossainfoysal.com)
 * Licensed under MIT (https://github.com/mr-teslaa/hottoastjs/blob/main/LICENSE)
 */

/* ============================================================
   RBF Hot Toast — react-hot-toast style notifications
   Vanilla JS, no dependencies. Light + dark mode aware.
   ============================================================ */

.hot-toast-container {
	position: fixed;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 8px;
	pointer-events: none;
	max-width: min(350px, calc(100vw - 32px));
}

/* Align toasts toward their screen edge (RHT behavior) */
.hot-toast-container[class*="top-right"],
.hot-toast-container[class*="bottom-right"] { align-items: flex-end; }
.hot-toast-container[class*="top-left"],
.hot-toast-container[class*="bottom-left"] { align-items: flex-start; }
.hot-toast-container[class*="center"] { align-items: center; }

.hot-toast-container.pos-top-right { top: 16px; right: 16px; }
.hot-toast-container.pos-top-center { top: 16px; left: 50%; transform: translateX(-50%); }
.hot-toast-container.pos-top-left { top: 16px; left: 16px; }
.hot-toast-container.pos-bottom-right { bottom: 16px; right: 16px; flex-direction: column-reverse; }
.hot-toast-container.pos-bottom-center { bottom: 16px; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }
.hot-toast-container.pos-bottom-left { bottom: 16px; left: 16px; flex-direction: column-reverse; }

/* ---------- Toast card ---------- */
.hot-toast {
	pointer-events: auto;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: fit-content;
	max-width: 100%;
	background-color: #ffffff;
	color: #333333;
	padding: 14px 16px;
	border-radius: 10px;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
	font-size: 14px;
	line-height: 1.45;
	font-family: inherit;
	cursor: pointer;
	overflow: hidden;
	transform-origin: center;
	will-change: transform, opacity, height;
}

html.dark-mode .hot-toast {
	background-color: #2a2a2a;
	color: #f0f0f0;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 3px 3px rgba(0, 0, 0, 0.3);
}

/* ---------- Radius variants (opt-in via `radius` option) ---------- */
.hot-toast.radius-pill { border-radius: 999px; padding-inline: 22px; }
.hot-toast.radius-semi { border-radius: 6px; }
.hot-toast.radius-none { border-radius: 0; }

/* ---------- Entrance / exit animations (RHT spring feel) ---------- */
@keyframes hot-toast-enter {
	0% { opacity: 0; transform: scale(0.8) translateY(-16px); }
	40% { opacity: 1; }
	60% { transform: scale(1.02) translateY(2px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes hot-toast-exit {
	to { opacity: 0; transform: scale(0.85) translateY(-12px); }
}

.hot-toast.entering { animation: hot-toast-enter 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) both; }
.hot-toast.exiting { animation: hot-toast-exit 0.25s cubic-bezier(0.4, 0, 1, 1) both; }

/* Bottom positions enter from below */
.hot-toast-container[class*="pos-bottom"] .hot-toast.entering {
	animation-name: hot-toast-enter-bottom;
}

@keyframes hot-toast-enter-bottom {
	0% { opacity: 0; transform: scale(0.8) translateY(16px); }
	40% { opacity: 1; }
	60% { transform: scale(1.02) translateY(-2px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}

.hot-toast-container[class*="pos-bottom"] .hot-toast.exiting {
	animation-name: hot-toast-exit-bottom;
}

@keyframes hot-toast-exit-bottom {
	to { opacity: 0; transform: scale(0.85) translateY(12px); }
}

/* ---------- Icon ---------- */
.hot-toast-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	transform-origin: center;
	animation: ht-zoom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.hot-toast-icon svg { display: block; width: 100%; height: 100%; }

/* Icon zoom-in (RHT style: scale 0 -> overshoot -> 1) */
@keyframes ht-zoom {
	0% { transform: scale(0); opacity: 0; }
	60% { transform: scale(1.15); opacity: 1; }
	80% { transform: scale(0.95); }
	100% { transform: scale(1); opacity: 1; }
}

/* Animated checkmark draw-in */
.hot-toast-icon .ht-draw {
	stroke-dasharray: 24;
	stroke-dashoffset: 24;
	animation: ht-draw 0.35s cubic-bezier(0.65, 0, 0.45, 1) 0.15s forwards;
}

@keyframes ht-draw { to { stroke-dashoffset: 0; } }

/* Glyph pop for warning / info marks */
.hot-toast-icon .ht-pop {
	transform-origin: center;
	animation: ht-pop 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) 0.2s both;
}

@keyframes ht-pop {
	0% { transform: scale(0); }
	100% { transform: scale(1); }
}

/* Loading spinner */
.hot-toast-icon .ht-spin {
	transform-origin: center;
	animation: ht-spin 0.75s linear infinite;
}

@keyframes ht-spin { to { transform: rotate(360deg); } }

/* Emoji icon zoom handled by .hot-toast-emoji animation below */
.hot-toast-emoji {
	flex-shrink: 0;
	font-size: 18px;
	line-height: 20px;
	margin-top: 1px;
	transform-origin: center;
	animation: ht-zoom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---------- Body text ---------- */
.hot-toast-message { flex: 1; word-break: break-word; white-space: pre-line; }

/* ---------- Close button (visible on hover) ---------- */
.hot-toast-close {
	flex-shrink: 0;
	background: none;
	border: none;
	padding: 0;
	margin-left: 4px;
	font-size: 16px;
	line-height: 1;
	color: #999999;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease;
}

html.dark-mode .hot-toast-close { color: #888888; }

.hot-toast:hover .hot-toast-close { opacity: 1; }
.hot-toast-close:hover { color: #333333; }
html.dark-mode .hot-toast-close:hover { color: #ffffff; }

/* ---------- Loading toast: disable pointer dismiss ---------- */
.hot-toast.loading { cursor: default; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.hot-toast.entering,
	.hot-toast.exiting,
	.hot-toast-icon,
	.hot-toast-emoji,
	.hot-toast-icon .ht-draw,
	.hot-toast-icon .ht-pop,
	.hot-toast-icon .ht-spin {
		animation-duration: 0.01s;
		animation-iteration-count: 1;
	}
}
