/* ==========================================================================
   KLG Toast — top-center, Flowbite-inspired
   ========================================================================== */

.klg-toast-container {
	position: fixed;
	top: 1.5rem;
	left: 50%;
	transform: translateX(-50%);
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	width: max-content;
	max-width: calc(100vw - 2rem);
	pointer-events: none;
}

.klg-toast {
	pointer-events: auto;
	display: flex;
	align-items: flex-start;
	gap: 0.875rem;
	min-width: 320px;
	max-width: 480px;
	padding: 0.875rem 1rem;
	background: #ffffff;
	color: #1f2937;
	font-size: 0.875rem;
	line-height: 1.4;
	border: 1px solid #e5e7eb;
	border-radius: 0.625rem;
	box-shadow:
		0 10px 15px -3px rgba(0, 0, 0, 0.08),
		0 4px 6px -4px rgba(0, 0, 0, 0.08);
	animation: klg-toast-in 0.25s ease-out;
}

.klg-toast--exit {
	animation: klg-toast-out 0.2s ease-in forwards;
}

@keyframes klg-toast-in {
	from {
		opacity: 0;
		transform: translateY(-12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes klg-toast-out {
	from {
		opacity: 1;
		transform: translateY(0);
	}
	to {
		opacity: 0;
		transform: translateY(-12px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.klg-toast,
	.klg-toast--exit {
		animation: none;
	}
}

/* Icon (square chip) */
.klg-toast__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 0.5rem;
	background: #f3f4f6;
	color: #6b7280;
}

.klg-toast__icon svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* Body */
.klg-toast__body {
	flex: 1 1 auto;
	min-width: 0;
}

.klg-toast__title {
	font-weight: 600;
	color: #111827;
	margin-bottom: 0.125rem;
}

.klg-toast__message {
	color: #1f2937;
	word-break: break-word;
}

/* Close button */
.klg-toast__close {
	flex: 0 0 auto;
	margin-left: 0.5rem;
	width: 1.75rem;
	height: 1.75rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: transparent;
	color: #9ca3af;
	border-radius: 0.375rem;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.klg-toast__close:hover {
	background: #f3f4f6;
	color: #111827;
}

.klg-toast__close svg {
	width: 1.125rem;
	height: 1.125rem;
}

/* ---------- Variants ---------- */

.klg-toast--success .klg-toast__icon {
	color: #16a34a;
	background: #dcfce7;
}

.klg-toast--danger .klg-toast__icon {
	color: #dc2626;
	background: #fee2e2;
}

.klg-toast--warning .klg-toast__icon {
	color: #d97706;
	background: #fef3c7;
}

.klg-toast--info .klg-toast__icon {
	color: #2563eb;
	background: #dbeafe;
}

.klg-toast--upload .klg-toast__icon {
	color: #2563eb;
	background: #dbeafe;
}

.klg-toast--confirm .klg-toast__icon {
	color: #4f46e5;
	background: #e0e7ff;
}

/* ---------- Upload (progress) ---------- */

.klg-toast__progress {
	margin-top: 0.5rem;
	width: 100%;
	height: 0.375rem;
	background: #e5e7eb;
	border-radius: 9999px;
	overflow: hidden;
}

.klg-toast__progress-bar {
	height: 100%;
	width: 0%;
	background: #2563eb;
	border-radius: inherit;
	transition: width 0.2s ease-out;
}

.klg-toast__meta {
	margin-top: 0.25rem;
	font-size: 0.75rem;
	color: #6b7280;
}

/* ---------- Confirm (action buttons) ---------- */

.klg-toast__actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.625rem;
	justify-content: flex-end;
}

.klg-toast__btn {
	padding: 0.375rem 0.75rem;
	font-size: 0.8125rem;
	font-weight: 500;
	border: 1px solid #e5e7eb;
	background: #ffffff;
	color: #374151;
	border-radius: 0.375rem;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.klg-toast__btn:hover {
	background: #f9fafb;
}

.klg-toast__btn--primary {
	background: #2563eb;
	border-color: #2563eb;
	color: #ffffff;
}

.klg-toast__btn--primary:hover {
	background: #1d4ed8;
	border-color: #1d4ed8;
}

.klg-toast__btn--danger {
	background: #dc2626;
	border-color: #dc2626;
	color: #ffffff;
}

.klg-toast__btn--danger:hover {
	background: #b91c1c;
	border-color: #b91c1c;
}

/* Mobile */
@media (max-width: 480px) {
	.klg-toast {
		min-width: 0;
		width: calc(100vw - 2rem);
	}
}
