/**
 * Delai-sait — forms: toasts, loading button, honeypot.
 * Uses theme CSS variables (declared in main.css).
 */

/* ---------------------------------------------------------------------
 * Honeypot
 * ------------------------------------------------------------------ */

.ds-hp {
	display: none !important;
	position: absolute !important;
	left: -9999px !important;
}

/* ---------------------------------------------------------------------
 * Toasts container
 * ------------------------------------------------------------------ */

.ds-toasts {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: min(380px, calc(100vw - 40px));
	pointer-events: none;
}

/* ---------------------------------------------------------------------
 * Toast
 * ------------------------------------------------------------------ */

.ds-toast {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	padding: 14px 16px;
	border-radius: 14px;
	background: var(--ds-card, #101827);
	color: var(--ds-fg, #f5f7fa);
	border: 1px solid var(--ds-line, rgba(255, 255, 255, 0.12));
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
	font-size: 14px;
	line-height: 1.45;
	pointer-events: auto;
	cursor: pointer;

	opacity: 0;
	transform: translateY(16px) scale(0.97);
	transition:
		opacity 0.3s ease,
		transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.ds-toast--out {
	opacity: 0 !important;
	transform: translateY(10px) scale(0.96) !important;
	transition:
		opacity 0.35s ease,
		transform 0.35s ease;
}

.ds-toast__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	margin-top: 1px;
	color: #fff;
}

.ds-toast__text {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
}

.ds-toast__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: -2px -4px 0 0;
	padding: 4px;
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: var(--ds-muted, rgba(245, 247, 250, 0.6));
	cursor: pointer;
	transition: color 0.2s ease, background 0.2s ease;
}

.ds-toast__close:hover {
	color: var(--ds-fg, #f5f7fa);
	background: rgba(255, 255, 255, 0.08);
}

/* Variants */

.ds-toast--success .ds-toast__icon {
	background: var(--ds-glacier, #2fbf71);
}

.ds-toast--error .ds-toast__icon {
	background: var(--ds-pulse, #e5484d);
}

.ds-toast--warning .ds-toast__icon {
	background: #f5a524;
}

.ds-toast--success {
	border-color: color-mix(in srgb, var(--ds-glacier, #2fbf71) 45%, transparent);
}

.ds-toast--error {
	border-color: color-mix(in srgb, var(--ds-pulse, #e5484d) 45%, transparent);
}

.ds-toast--warning {
	border-color: color-mix(in srgb, #f5a524 45%, transparent);
}

/* ---------------------------------------------------------------------
 * Loading button
 * ------------------------------------------------------------------ */

.ds-btn.is-loading {
	position: relative;
	pointer-events: none;
	color: transparent !important;
}

.ds-btn.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 1.1em;
	height: 1.1em;
	margin: -0.55em 0 0 -0.55em;
	border-radius: 50%;
	border: 2px solid currentColor;
	border-right-color: transparent;
	color: inherit;
	opacity: 0.9;
	animation: ds-spin 0.7s linear infinite;
}

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

/* Since color is transparent on the button, the spinner needs explicit color */

.ds-btn--primary.is-loading::after {
	color: #fff;
}

.ds-btn.is-loading:not(.ds-btn--primary)::after {
	color: var(--ds-fg, #f5f7fa);
}

/* ---------------------------------------------------------------------
 * Small screens
 * ------------------------------------------------------------------ */

@media (max-width: 600px) {
	.ds-toasts {
		right: 12px;
		bottom: 12px;
		left: 12px;
		max-width: none;
	}
}
