/*
 * Donations & Fundraising: donation form (classic and block). Uses the theme's colours
 * (theme.json presets) when available, logical properties for RTL, and wraps on phones.
 */
.wcdf-donation-container {
	--wcdf-accent: var(--wp--preset--color--contrast, currentColor);
	--wcdf-accent-text: var(--wp--preset--color--base, #fff);
	--wcdf-border: color-mix(in srgb, currentColor 25%, transparent);
	--wcdf-muted: color-mix(in srgb, currentColor 70%, transparent);
	--wcdf-surface: color-mix(in srgb, currentColor 6%, transparent);
	--wcdf-radius: 4px;
	margin-block: 1em;
	max-width: 100%;
}
.wcdf-donation-container *,
.wcdf-donation-container *::before,
.wcdf-donation-container *::after {
	box-sizing: border-box;
}
.wcdf-visually-hidden,
.wcdf-hide {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}
.wcdf-donation-container fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
.wcdf-fixed-donation-type {
	margin-block: 10px;
}
.wcdf-donation-amount-label,
.wcdf-custom-donation-amount-label {
	display: block;
	margin-block-end: 4px;
	font-weight: 600;
}
.wcdf-dropdown-display {
	max-width: 100%;
	min-height: 2.5em;
}

/* Radios and amount buttons */
.wcdf-fixed-donation-inner.wcdf-display-radios,
.wcdf-fixed-donation-inner.wcdf-display-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 15px;
}
.wcdf-fixed-donation-inner.wcdf-display-radios label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 24px;
	cursor: pointer;
}
.wcdf-fixed-donation-inner.wcdf-display-buttons label {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 64px;
	min-height: 44px;
	padding: 8px 16px;
	border: 1px solid var(--wcdf-border);
	border-radius: var(--wcdf-radius);
	background: var(--wcdf-surface);
	color: inherit;
	cursor: pointer;
	line-height: 1.4;
	font-weight: 600;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.wcdf-fixed-donation-inner.wcdf-display-buttons label:hover {
	border-color: var(--wcdf-accent);
}
.wcdf-fixed-donation-inner.wcdf-display-buttons .wcdf-active,
.wcdf-fixed-donation-inner.wcdf-display-buttons label:has(input:checked) {
	background: var(--wcdf-accent);
	border-color: var(--wcdf-accent);
	color: var(--wcdf-accent-text);
}
.wcdf-fixed-donation-inner.wcdf-display-buttons label:focus-within,
.wcdf-cause-option:focus-within {
	outline: 2px solid var(--wcdf-accent);
	outline-offset: 2px;
}

/* Custom amount */
.wcdf-userdefined-donation-type {
	margin-block: 10px;
}
.wcdf-userdefined-donation-inner {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--wcdf-border);
	border-radius: var(--wcdf-radius);
	overflow: hidden;
}
.wcdf-userdefined-donation-inner:focus-within {
	outline: 2px solid var(--wcdf-accent);
	outline-offset: 1px;
}
.wcdf-custom-donation-amount {
	flex: 1 1 auto;
	min-width: 0;
}
.wcdf-custom-donation-amount input {
	width: 100%;
	min-height: 2.75em;
	border: 0 !important;
	box-shadow: none !important;
	background: none !important;
	outline: none;
}
.wcdf-custom-donation-amount input::-webkit-outer-spin-button,
.wcdf-custom-donation-amount input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.wcdf-custom-donation-amount input[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
}
.wcdf-donation-currency {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	min-width: 2.5em;
	padding-inline: 8px;
	background: var(--wcdf-surface);
	font-weight: 600;
}
.wcdf-amount-hint {
	margin: 4px 0 0;
	font-size: 0.875em;
	color: var(--wcdf-muted);
}

/* Causes: a radio group of cards */
.wcdf-cause-dropdown {
	margin-block: 15px;
}
.wcdf-choose-cause {
	display: block;
	margin-block-end: 6px;
	padding: 0;
	font-weight: 600;
}
.wcdf-cause-options {
	display: grid;
	gap: 8px;
}
.wcdf-cause-option {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px;
	border: 1px solid var(--wcdf-border);
	border-radius: var(--wcdf-radius);
	cursor: pointer;
}
.wcdf-cause-option:hover {
	background-color: var(--wcdf-surface);
}
.wcdf-cause-option.wcdf-selected,
.wcdf-cause-option:has(input:checked) {
	border-color: var(--wcdf-accent);
	box-shadow: inset 0 0 0 1px var(--wcdf-accent);
}
.wcdf-dropdown-icon,
.wcdf-cause-icon {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--wcdf-radius);
	flex: 0 0 auto;
}
.wcdf-cause-texts {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.wcdf-cause-title {
	font-weight: 600;
}
.wcdf-cause-description {
	font-size: 0.875em;
	color: var(--wcdf-muted);
}

/* Tribute */
.wcdf-tribute {
	margin-block: 12px;
}
.wcdf-tribute-toggle-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 24px;
	cursor: pointer;
}
.wcdf-tribute-fields {
	margin-block-start: 8px;
	padding: 10px;
	border-inline-start: 3px solid var(--wcdf-border);
}
.wcdf-tribute-fields[hidden] {
	display: none;
}
.wcdf-tribute-fields .wcdf-field {
	margin: 0 0 8px;
}
.wcdf-tribute-fields label {
	display: block;
	font-weight: 600;
	margin-block-end: 2px;
}
.wcdf-tribute-fields input,
.wcdf-tribute-fields select,
.wcdf-tribute-fields textarea {
	width: 100%;
}

/* Progress bar (unprefixed classes kept for themes that styled them) */
.progress-container.wcdf-progress,
.wcdf-progress {
	max-width: 500px;
	margin-block: 15px;
}
.wcdf-progress .progress-labels,
.wcdf-progress-labels {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 12px;
	margin-block-end: 5px;
	font-size: 14px;
	color: var(--wcdf-muted, #555);
}
.wcdf-progress .progress-bar,
.wcdf-progress-bar {
	background-color: var(--wcdf-surface, #e0e0e0);
	box-shadow: inset 0 0 0 1px var(--wcdf-border, transparent);
	height: 10px;
	border-radius: 5px;
	overflow: hidden;
	padding: 0;
	width: auto;
}
.wcdf-progress .progress-fill,
.wcdf-progress-fill {
	height: 100%;
	background-color: var(--wcdf-accent, #000);
	transition: width 0.4s ease-in-out;
}

/* Button, spinner, messages */
.wcdf-misc {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}
.wcdf-donation-button {
	margin-block-start: 10px;
	min-height: 44px;
}
.wcdf-loader {
	display: none;
	width: 20px;
	height: 20px;
	margin-block-start: 10px;
	border: 2px solid var(--wcdf-border);
	border-top-color: var(--wcdf-accent);
	border-radius: 50%;
	animation: wcdf-spin 0.8s linear infinite;
}
.wcdf-loader.is-active {
	display: inline-block;
}
@keyframes wcdf-spin {
	to {
		transform: rotate(360deg);
	}
}
p.wcdf-notification {
	flex: 1 0 100%;
	margin: 6px 0 0;
	display: none;
}
p.wcdf-notification.is-visible {
	display: block;
}
p.wcdf-notification.wcdf-error {
	color: #b32d2e;
}
p.wcdf-notification.wcdf-success {
	color: #00701a;
}
.wcdf-campaign-closed {
	margin-block: 1em;
	padding: 12px 16px;
	border-inline-start: 4px solid var(--wp--preset--color--contrast, currentColor);
	background: color-mix(in srgb, currentColor 6%, transparent);
}

/* Cart & Checkout blocks */
.wcdf-block-area {
	margin-block: 16px;
}
.wcdf-block-area .wcdf-donation-container + .wcdf-donation-container {
	margin-block-start: 24px;
	padding-block-start: 16px;
	border-block-start: 1px solid var(--wcdf-border);
}
.wcdf-area-summary {
	padding-inline: 16px;
}
.wcdf-donation-row td {
	padding: 0;
}

@media (prefers-reduced-motion: reduce) {
	.wcdf-loader {
		animation-duration: 2.4s;
	}
	.wcdf-progress-fill,
	.wcdf-fixed-donation-inner.wcdf-display-buttons label {
		transition: none;
	}
}
