/**
 * KindLumen Donation Forms — front-end styles.
 *
 * Deliberately minimal: the form itself is styled inside KindLumen. These rules
 * only handle the responsive wrapper, the loading state, and a fallback link.
 * No theme element selectors are touched.
 */

.kindlumen-form-wrapper {
	position: relative;
	width: 100%;
	margin: 0 auto;
}

.kindlumen-form-iframe {
	display: block;
	width: 100%;
	border: 0;
	margin: 0;
	background: transparent;
	color-scheme: light;
	transition: opacity 0.2s ease;
}

/* While JS is loading the form, hide the iframe and show the spinner. Without
   JavaScript these classes are never added, so the iframe stays visible. */
.kindlumen-form-wrapper.is-loading:not(.is-loaded) .kindlumen-form-iframe {
	opacity: 0;
}

.kindlumen-form-wrapper.is-loaded .kindlumen-form-iframe {
	opacity: 1;
}

.kindlumen-form-loading {
	display: none;
}

.kindlumen-form-wrapper.is-loading:not(.is-loaded) .kindlumen-form-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	pointer-events: none;
}

.kindlumen-form-spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid rgba(15, 23, 42, 0.15);
	border-top-color: rgba(15, 23, 42, 0.55);
	animation: kindlumen-form-spin 0.8s linear infinite;
}

.kindlumen-form-loading-text {
	font-size: 0.85em;
	opacity: 0.7;
}

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

@media (prefers-reduced-motion: reduce) {
	.kindlumen-form-spinner {
		animation-duration: 2s;
	}

	.kindlumen-form-iframe {
		transition: none;
	}
}

.kindlumen-form-fallback {
	margin: 10px 0 0;
	font-size: 0.85em;
	text-align: center;
	opacity: 0.75;
}

.kindlumen-form-fallback a {
	color: inherit;
}

/* When the form reports an error, make the fallback link more prominent. */
.kindlumen-form-wrapper.is-error .kindlumen-form-fallback {
	opacity: 1;
	font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Donate button (popup trigger)
 * ------------------------------------------------------------------ */

.kindlumen-donate {
	margin: 0;
}

.kindlumen-align-center {
	text-align: center;
}

.kindlumen-align-right {
	text-align: right;
}

.kindlumen-align-left {
	text-align: left;
}

.kindlumen-donate-button {
	--kindlumen-accent: #5c60ff;
	display: inline-block;
	background: var(--kindlumen-accent);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 13px 28px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.15;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.55);
	transition: transform 0.12s ease, filter 0.12s ease;
}

.kindlumen-donate-button.kindlumen-size-small {
	padding: 9px 20px;
	font-size: 14px;
}

.kindlumen-donate-button.kindlumen-size-large {
	padding: 16px 36px;
	font-size: 18px;
}

.kindlumen-donate-button,
.kindlumen-donate-button:link,
.kindlumen-donate-button:visited {
	color: #fff;
	text-decoration: none;
}

.kindlumen-donate-button:hover,
.kindlumen-donate-button:focus {
	filter: brightness(1.06);
	transform: translateY(-1px);
	color: #fff;
	text-decoration: none;
}

.kindlumen-donate-button:active {
	transform: translateY(0);
}

.kindlumen-donate-button:focus-visible {
	outline: 3px solid rgba(92, 96, 255, 0.45);
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Menu / link donate trigger — a clean, compact button by default.
 * Handles classic menus (class on the <li>, link is a child) and block
 * themes / plain links (class on the <a> itself). `!important` overrides
 * theme menu-link styles — including forced tall heights/line-heights that
 * would otherwise stretch it into a blob — so it stays a tidy button.
 * Color follows the configured button color via --kindlumen-df-accent.
 * ------------------------------------------------------------------ */
a.kindlumen-donate-trigger,
button.kindlumen-donate-trigger,
.kindlumen-donate-trigger > a,
.kindlumen-donate-trigger > button {
	display: inline-block !important;
	vertical-align: middle;
	width: auto !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 8px 16px !important;
	background: var(--kindlumen-df-accent, #5c60ff) !important;
	color: #fff !important;
	border: 0 !important;
	border-radius: 6px !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	text-transform: none !important;
	text-decoration: none !important;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none !important;
	transition: filter 0.12s ease;
}

a.kindlumen-donate-trigger:hover,
button.kindlumen-donate-trigger:hover,
.kindlumen-donate-trigger > a:hover,
.kindlumen-donate-trigger > button:hover,
a.kindlumen-donate-trigger:focus,
.kindlumen-donate-trigger > a:focus {
	color: #fff !important;
	filter: brightness(0.94);
	text-decoration: none !important;
}

/* ------------------------------------------------------------------ *
 * Popup modal
 * ------------------------------------------------------------------ */

.kindlumen-modal-backdrop {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
	padding: clamp(16px, 4vh, 36px) clamp(12px, 2vw, 24px);
	background: rgba(6, 10, 24, 0.52);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	backdrop-filter: blur(16px) saturate(140%);
	z-index: 2147483646;
	opacity: 0;
	transition: opacity 0.22s ease;
}

.kindlumen-modal-backdrop.is-open {
	opacity: 1;
}

.kindlumen-modal-shell {
	position: relative;
	width: min(1024px, 100%);
	height: min(700px, calc(100dvh - clamp(32px, 8vh, 72px)));
	min-height: min(700px, calc(100dvh - clamp(32px, 8vh, 72px)));
	opacity: 0;
	transform: translateY(10px) scale(0.98);
	transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}

.kindlumen-modal-backdrop.is-open .kindlumen-modal-shell {
	opacity: 1;
	transform: none;
}

.kindlumen-modal-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	background: transparent;
	opacity: 0;
	transition: opacity 0.25s ease;
	z-index: 2;
}

.kindlumen-modal-shell.is-ready .kindlumen-modal-frame {
	opacity: 1;
}

.kindlumen-modal-loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 1;
	transition: opacity 0.25s ease;
	pointer-events: none;
	z-index: 1;
}

.kindlumen-modal-shell.is-ready .kindlumen-modal-loader {
	opacity: 0;
}

.kindlumen-modal-loader .kindlumen-form-spinner {
	width: 42px;
	height: 42px;
	border-color: rgba(255, 255, 255, 0.32);
	border-top-color: #fff;
}

.kindlumen-modal-close {
	position: absolute;
	top: -12px;
	right: -12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	color: #0e192c;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
	z-index: 3;
}

@media (max-width: 640px) {
	.kindlumen-modal-backdrop {
		align-items: flex-start;
		padding: 16px 10px;
	}

	.kindlumen-modal-shell {
		width: 100%;
		height: calc(100dvh - 32px);
		min-height: calc(100dvh - 32px);
	}

	.kindlumen-modal-close {
		top: 8px;
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kindlumen-modal-backdrop,
	.kindlumen-modal-shell,
	.kindlumen-modal-frame,
	.kindlumen-modal-loader,
	.kindlumen-donate-button {
		transition: none;
	}
}

/* Admin-only setup notice rendered in place of the form. */
.kindlumen-form-notice {
	border: 1px solid rgba(15, 23, 42, 0.12);
	border-left: 4px solid #5c60ff;
	border-radius: 8px;
	background: rgba(92, 96, 255, 0.04);
	padding: 14px 18px;
	margin: 0 0 1em;
	font-size: 0.95em;
}

.kindlumen-form-notice p {
	margin: 0 0 0.5em;
}

.kindlumen-form-notice p:last-child {
	margin-bottom: 0;
}

.kindlumen-form-notice-hint {
	font-size: 0.85em;
	opacity: 0.7;
}

/* Campaign card: the card paints its own surface, so the wrapper stays flat. */
.kindlumen-form-wrapper.kindlumen-card-wrapper {
	background: transparent;
	border: 0;
	box-shadow: none;
	padding: 0;
}

.kindlumen-card-wrapper .kindlumen-form-iframe {
	display: block;
	border: 0;
	background: transparent;
}
