/* =====================================================================
   Neelavra Foundation Forms · Public CSS
   Adds AJAX states, honeypot hiding, tier/payment selected states,
   a spinner animation, and graceful fallback styling for pages that
   do NOT have Tailwind loaded (so the forms still look presentable).
   ===================================================================== */

/* Honeypot: invisible to humans, visible enough to bots to fill. */
.nf-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Spinner */
.nf-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: nf-spin 0.7s linear infinite;
}
.nf-form.is-submitting .nf-spinner { display: inline-block; }
.nf-form.is-submitting .nf-submit-label { opacity: 0.7; }
.nf-form.is-submitting .nf-submit { pointer-events: none; opacity: 0.85; }

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

/* Status message */
.nf-message {
	display: none;
	margin-top: 12px;
	padding: 12px 14px;
	border-radius: 10px;
	font-size: 13.5px;
	line-height: 1.5;
	text-align: left;
}
.nf-message.show { display: block; }
.nf-message.success {
	background: #E8F3EE;
	color: #1B4332;
	border: 1px solid rgba(45, 106, 79, 0.25);
}
.nf-message.error {
	background: #FDECEC;
	color: #842029;
	border: 1px solid rgba(220, 53, 69, 0.25);
}

/* Tier & payment selected states (mirror original visual logic). */
.nf-donate-form .tier.selected,
.nf-donate-form .tier.is-selected {
	background: linear-gradient(180deg, #1E4E79, #143A5B);
	color: #fff;
	border-color: #1E4E79 !important;
}
.nf-donate-form .tier.selected .tier-amt,
.nf-donate-form .tier.is-selected .tier-amt { color: #FCD34D; }
.nf-donate-form .tier.selected .tier-label,
.nf-donate-form .tier.is-selected .tier-label { color: rgba(255, 255, 255, 0.85); }

.nf-donate-form .pay-method.selected,
.nf-donate-form .pay-method.is-selected {
	border-color: #1E4E79 !important;
	background: #F0F5FA;
}

/* Payment instructions reveal animation */
.nf-pay-instructions { transition: opacity .3s ease, transform .3s ease; }
.nf-pay-instructions.hidden { display: none; }
.nf-pay-instructions.is-revealed { opacity: 1; transform: translateY(0); }

/* =====================================================================
   Fallback styling: only applies when the page does NOT have Tailwind
   (e.g. the form is placed on a plain WordPress page). Detects by
   scoping to body:not(.nf-tailwind-active) — set automatically by JS.
   ===================================================================== */

body:not(.nf-tailwind-active) .nf-form {
	font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	color: #1E293B;
	max-width: 720px;
}

body:not(.nf-tailwind-active) .nf-input {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	font-size: 14px;
	background: #fff;
	box-sizing: border-box;
	transition: border-color .2s ease;
}
body:not(.nf-tailwind-active) .nf-input:focus {
	border-color: #1E4E79;
	outline: none;
	box-shadow: 0 0 0 3px rgba(30, 78, 121, 0.12);
}
body:not(.nf-tailwind-active) .nf-select {
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231E293B' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}
body:not(.nf-tailwind-active) .nf-textarea {
	min-height: 90px;
	resize: vertical;
}
body:not(.nf-tailwind-active) .nf-submit {
	width: 100%;
	background: #D97706;
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 12px 16px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: background-color .2s ease, transform .15s ease;
}
body:not(.nf-tailwind-active) .nf-submit:hover {
	background: #B45309;
	transform: translateY(-1px);
}
body:not(.nf-tailwind-active) .nf-checks {
	display: grid;
	gap: 6px;
	font-size: 13px;
}
body:not(.nf-tailwind-active) .nf-check {
	display: inline-flex;
	gap: 8px;
	align-items: flex-start;
	cursor: pointer;
}
body:not(.nf-tailwind-active) .nf-donate-form .nf-tiers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 10px;
	margin-top: 16px;
}
body:not(.nf-tailwind-active) .nf-donate-form .tier {
	border: 2px solid #e2e8f0;
	background: #fff;
	border-radius: 14px;
	padding: 14px;
	text-align: left;
	cursor: pointer;
}
body:not(.nf-tailwind-active) .nf-donate-form .nf-pay-methods {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-top: 12px;
}
@media (max-width: 640px) {
	body:not(.nf-tailwind-active) .nf-donate-form .nf-pay-methods {
		grid-template-columns: 1fr;
	}
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method {
	border: 2px solid #e2e8f0;
	background: #fff;
	border-radius: 12px;
	padding: 14px 16px;
	cursor: pointer;
	text-align: left;
	width: 100%;
	box-sizing: border-box;
	display: block;
	transition: border-color .2s ease, background-color .2s ease;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method:hover {
	border-color: #94A3B8;
}
/* Card head row (label + radio) — needs flex even without Tailwind. */
body:not(.nf-tailwind-active) .nf-donate-form .pay-method .flex {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-label {
	font-weight: 600;
	font-size: 14px;
	color: #1E293B;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-radio {
	width: 16px;
	height: 16px;
	border: 2px solid #CBD5E1;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
	transition: border-color .2s ease, background-color .2s ease;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method.selected .pay-method-radio,
body:not(.nf-tailwind-active) .nf-donate-form .pay-method.is-selected .pay-method-radio {
	border-color: #1E4E79;
	background: #1E4E79;
	box-shadow: inset 0 0 0 3px #fff;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-number {
	font-family: 'Lora', Georgia, serif;
	font-size: 18px;
	font-weight: 700;
	color: #1E4E79;
	margin-top: 6px;
	line-height: 1.3;
}
/* Bank details are multi-line — preserve line breaks, use sans font. */
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-bank {
	white-space: pre-line;
	font-family: system-ui, -apple-system, sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.55;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-empty {
	font-style: italic;
	color: #94A3B8;
	font-size: 12.5px;
	font-family: system-ui, -apple-system, sans-serif;
	font-weight: 400;
}
body:not(.nf-tailwind-active) .nf-donate-form .pay-method-type {
	font-size: 11.5px;
	color: #64748B;
	margin-top: 2px;
}

/* Responsive grid helpers when Tailwind absent. */
body:not(.nf-tailwind-active) .nf-form .grid {
	display: grid;
	gap: 12px;
}
body:not(.nf-tailwind-active) .nf-form .grid.sm\:grid-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 640px) {
	body:not(.nf-tailwind-active) .nf-form .grid.sm\:grid-cols-2 {
		grid-template-columns: 1fr;
	}
}

/* Reduce-motion friendliness. */
@media (prefers-reduced-motion: reduce) {
	.nf-spinner { animation-duration: 1.5s; }
	.nf-pay-instructions { transition: none; }
}
