/**
 * Public styles for WCHF Regular Giving.
 *
 * Minimal, theme-friendly styles for the donor verification and update
 * forms. Designed to inherit from the host theme where possible — only
 * the structural and state styles are opinionated.
 *
 * @package MeasureTwice\MT_WCHF_Regular_Giving
 * @since   1.0.0
 */

.wchf-verify-wrap {
	max-width: 560px;
	margin: 0 auto;
}

.wchf-verify-section {
	margin-bottom: 32px;
	padding: 20px 24px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
}

.wchf-verify-section h2,
.wchf-verify-section h3 {
	margin-top: 0;
}

.wchf-verify-donor-id {
	background: #fafafa;
}

.wchf-form-row {
	margin-bottom: 16px;
}

.wchf-form-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.wchf-form-row input[type="email"],
.wchf-form-row input[type="text"],
.wchf-form-row input[type="date"],
.wchf-form-row select {
	width: 100%;
	padding: 10px 12px;
	font-size: 16px;
	border: 1px solid #c0c0c0;
	border-radius: 4px;
	box-sizing: border-box;
}

.wchf-form-row input:focus,
.wchf-form-row select:focus {
	outline: 2px solid #005a9c;
	outline-offset: 1px;
}

.wchf-button {
	display: inline-block;
	padding: 12px 24px;
	font-size: 16px;
	font-weight: 600;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.wchf-button-primary {
	background: #005a9c;
	color: #fff;
}

.wchf-button-primary:hover:not(:disabled) {
	background: #004577;
}

.wchf-button-secondary {
	background: #f0f0f0;
	color: #333;
	border: 1px solid #c0c0c0;
}

.wchf-button-secondary:hover:not(:disabled) {
	background: #e6e6e6;
}

.wchf-button:disabled,
.wchf-busy {
	opacity: 0.6;
	cursor: not-allowed;
}

/*
 * Busy state: a spinner to the left of the label.
 *
 * SKY API calls regularly run past 10 seconds. A button that only
 * greys out reads as broken — testers pressed them repeatedly, which
 * is how a single amount change became several. Kept more opaque than
 * a plain disabled button so the spinner stays legible.
 */
.wchf-button.wchf-busy {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	opacity: 0.8;
}

.wchf-button.wchf-busy::before {
	content: "";
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wchf-spin 0.6s linear infinite;
}

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

/*
 * Slowed rather than stopped: the spinner is the only signal that the
 * request is still running, so removing it would leave nothing.
 */
@media ( prefers-reduced-motion: reduce ) {
	.wchf-button.wchf-busy::before {
		animation-duration: 2.4s;
	}
}

.wchf-verify-result {
	margin-top: 12px;
	min-height: 1.2em;
}

.wchf-verify-result-success {
	color: #2a7d2a;
}

.wchf-verify-result-error {
	color: #b32d2e;
}

.wchf-verify-notice {
	padding: 12px 16px;
	margin-bottom: 20px;
	border-radius: 4px;
}

.wchf-verify-notice-error {
	background: #fdecea;
	color: #b32d2e;
	border: 1px solid #f5b5b1;
}

.wchf-verify-already {
	padding: 16px;
	background: #f0f6e8;
	border: 1px solid #b8d68a;
	border-radius: 4px;
}

/* Verify panel toggle link (Phase 7 refactor). Sits below each form
 * with a small grey explainer + bold link to flip to the other panel. */
.wchf-verify-toggle {
	margin-top: 20px;
	font-size: 14px;
	color: #555;
	text-align: center;
}

.wchf-verify-toggle-link {
	font-weight: 600;
	color: #005a9c;
	text-decoration: underline;
}

.wchf-verify-toggle-link:hover,
.wchf-verify-toggle-link:focus {
	color: #003a66;
}

/* Dashboard (Phase 7 refactor). */
.wchf-dashboard-wrap {
	max-width: 960px;
	margin: 0 auto;
}

.wchf-dashboard-card {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	margin: 0 0 24px;
	padding: 24px;
	background: #f4f4f4;
	border-radius: 6px;
}

.wchf-dashboard-card-body {
	flex: 1 1 60%;
	min-width: 280px;
}

.wchf-dashboard-card-body h3 {
	margin: 0 0 16px;
	font-size: 22px;
}

.wchf-dashboard-card-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 0 0 auto;
	align-self: flex-end;
}

.wchf-dashboard-summary {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 16px;
	margin: 0;
}

.wchf-dashboard-summary dt {
	font-weight: 600;
	color: #555;
}

.wchf-dashboard-summary dd {
	margin: 0;
	word-break: break-word;
}

@media ( max-width: 600px ) {
	.wchf-dashboard-card-actions {
		align-self: stretch;
	}
	.wchf-dashboard-card-actions .wchf-button {
		text-align: center;
	}
}

/* Update form (Phase 4). */
.wchf-update-wrap {
	max-width: 640px;
	margin: 0 auto;
}

.wchf-update-header {
	margin-bottom: 24px;
}

.wchf-update-header h2 {
	margin: 0 0 4px;
}

.wchf-dashboard-links {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	margin-top: 16px;
}

.wchf-dashboard-links a {
	color: #005a9c;
	text-decoration: underline;
}

.wchf-dashboard-links a:hover {
	color: #003a66;
}

.wchf-update-greeting {
	margin: 0;
	color: #555;
	font-size: 14px;
}

.wchf-signout-link {
	margin-left: 12px;
	font-size: 13px;
	color: #005a9c;
	text-decoration: underline;
}

.wchf-signout-link:hover {
	color: #003a66;
}

.wchf-update-section {
	margin: 0 0 24px;
	padding: 20px 24px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
}

.wchf-update-section legend {
	font-weight: 600;
	padding: 0 6px;
}

.wchf-form-row-group {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.wchf-form-row-group .wchf-form-row {
	flex: 1 1 160px;
}

.wchf-form-row-group .wchf-form-row-narrow {
	flex: 0 1 120px;
}

.wchf-update-note {
	margin: 8px 0 0;
	font-size: 13px;
	color: #777;
}

.wchf-update-result {
	margin-top: 16px;
}

.wchf-update-result-success,
.wchf-update-result-warning,
.wchf-update-result-error,
.wchf-update-result-info {
	padding: 14px 18px;
	border-radius: 4px;
	border: 1px solid transparent;
}

.wchf-update-result-success {
	background: #f0f6e8;
	border-color: #b8d68a;
	color: #2a5a0e;
}

.wchf-update-result-warning {
	background: #fff9c4;
	border-color: #f9a825;
	color: #6a5900;
}

.wchf-update-result-error {
	background: #fdecea;
	border-color: #f5b5b1;
	color: #b32d2e;
}

.wchf-update-result-info {
	background: #e9f4fb;
	border-color: #b7d8e8;
	color: #1e6091;
}

.wchf-update-change-list {
	margin: 8px 0 0;
	padding-left: 20px;
}

.wchf-update-change-list li {
	margin-bottom: 4px;
}

.wchf-update-before {
	text-decoration: line-through;
	color: #888;
}

.wchf-update-after {
	font-weight: 600;
}

.wchf-update-change-error {
	margin-top: 4px;
	font-size: 13px;
	color: #b32d2e;
}

/* Communication preferences (Phase 7). Per-category rows with inline
 * checkboxes for the channels that are valid for that category — only
 * the supported (channel, category) tuples render, so the donor never
 * sees a Mail option for Newsletter (which is Email-only) or similar.
 * On narrow mobile the row wraps so the label sits above the options. */
.wchf-consent-list {
	display: flex;
	flex-direction: column;
	margin-top: 8px;
}

.wchf-consent-row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 0;
	border-bottom: 1px solid #e0e0e0;
}

.wchf-consent-row:last-child {
	border-bottom: none;
}

.wchf-consent-row-label {
	flex: 0 0 140px;
	font-weight: 500;
}

.wchf-consent-row-options {
	display: flex;
	flex-wrap: wrap;
	gap: 16px 24px;
	flex: 1;
}

.wchf-consent-option {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	min-height: 44px;
}

.wchf-consent-option input[type="checkbox"] {
	width: 20px;
	height: 20px;
}

@media ( max-width: 480px ) {
	.wchf-consent-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	.wchf-consent-row-label {
		flex: 0 0 auto;
	}
}

/* Keyboard focus indicator — overrides any host-theme reset that
 * removes outline:none. Applies across all interactive elements in the
 * donor flows so keyboard users can always see where focus is. */
.wchf-update-form :focus-visible,
.wchf-amount-input :focus-visible,
.wchf-payment-option :focus-visible,
.wchf-button:focus-visible {
	outline: 2px solid #005a9c;
	outline-offset: 2px;
}

.wchf-update-error {
	padding: 16px;
	background: #fdecea;
	border: 1px solid #f5b5b1;
	border-radius: 4px;
	color: #b32d2e;
}

.wchf-update-not-signed-in {
	padding: 20px 24px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
}

/* Payment method update form (Phase 5 + Phase 7 refactor).
 *
 * Two-column layout: radio cards on the left, current-gift summary in
 * a dark sidebar on the right. Stacks vertically below 720px so the
 * sidebar drops under the radios on mobile. */
.wchf-payment-wrap {
	max-width: 960px;
	margin: 0 auto;
}

.wchf-payment-layout {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 24px;
	align-items: stretch;
}

@media ( max-width: 720px ) {
	.wchf-payment-layout {
		grid-template-columns: 1fr;
	}
}

.wchf-payment-main {
	background: #f4f4f4;
	border-radius: 6px;
	padding: 24px;
}

.wchf-payment-main h3 {
	margin: 0 0 16px;
	font-size: 22px;
}

.wchf-payment-options {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 24px;
}

.wchf-payment-radio-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: #fff;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	cursor: pointer;
}

.wchf-payment-radio-card:hover {
	border-color: #005a9c;
}

.wchf-payment-radio-card input[type="radio"] {
	width: 20px;
	height: 20px;
	accent-color: #005a9c;
	flex-shrink: 0;
}

.wchf-payment-radio-card-label {
	font-weight: 500;
}

.wchf-payment-radio-card:has( input[type="radio"]:checked ) {
	border-color: #005a9c;
	box-shadow: 0 0 0 1px #005a9c inset;
}

.wchf-payment-action-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	margin-top: 8px;
}

.wchf-payment-result {
	margin-top: 16px;
}

.wchf-payment-sidebar {
	background: #2a2f3a;
	color: #fff;
	border-radius: 6px;
	padding: 24px;
	display: flex;
	flex-direction: column;
}

.wchf-payment-sidebar h3 {
	margin: 0 0 16px;
	font-size: 22px;
	color: #fff;
}

.wchf-payment-sidebar .wchf-payment-summary {
	flex: 1;
}

.wchf-payment-sidebar .wchf-payment-summary dt {
	color: rgba( 255, 255, 255, 0.7 );
}

.wchf-payment-sidebar .wchf-payment-summary dd {
	color: #fff;
}

.wchf-payment-sidebar-link {
	display: inline-block;
	margin-top: 16px;
	color: #fff;
	text-decoration: underline;
	font-weight: 600;
}

.wchf-payment-sidebar-link:hover,
.wchf-payment-sidebar-link:focus {
	color: #cfe1f2;
}

.wchf-payment-summary {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 16px;
	margin: 0;
}

.wchf-payment-summary dt {
	font-weight: 600;
	color: #555;
}

.wchf-payment-summary dd {
	margin: 0;
}

.wchf-update-note-warning {
	color: #b32d2e;
}

/* Amount change form (Phase 6). */
.wchf-amount-wrap {
	max-width: 640px;
	margin: 0 auto;
}

/* DD-specific notice that sets expectations about the bank-detail
 * re-confirmation step before the donor starts filling in the form.
 * Sits above the form so it's visible from page load. */
.wchf-amount-dd-notice {
	padding: 14px 18px;
	margin: 0 0 20px;
	background: #e9f4fb;
	border: 1px solid #b7d8e8;
	border-radius: 4px;
	color: #1e6091;
}

.wchf-amount-dd-notice p {
	margin: 0;
}

.wchf-amount-dd-confirm-note {
	margin: 8px 0 16px;
	font-size: 14px;
	color: #1e6091;
}

.wchf-amount-input {
	display: flex;
	align-items: stretch;
	max-width: 220px;
	border: 1px solid #c0c0c0;
	border-radius: 4px;
	overflow: hidden;
}

.wchf-amount-input:focus-within {
	outline: 2px solid #005a9c;
	outline-offset: 1px;
}

.wchf-amount-input-prefix {
	padding: 10px 12px;
	background: #f0f0f0;
	color: #555;
	font-weight: 600;
	border-right: 1px solid #c0c0c0;
}

.wchf-amount-input input {
	flex: 1;
	padding: 10px 12px;
	font-size: 16px;
	border: none;
	outline: none;
	box-sizing: border-box;
	min-width: 0;
}

.wchf-amount-validation {
	margin-top: 12px;
	min-height: 1.2em;
	font-size: 14px;
}

.wchf-amount-validation-error {
	color: #b32d2e;
}

.wchf-amount-validation-info {
	color: #1e6091;
}

.wchf-amount-confirm-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	align-items: center;
}

.wchf-amount-result {
	margin-top: 16px;
}

/* Developer cheat sheet — only rendered when WP_DEBUG is true. */
.wchf-verify-cheatsheet {
	margin-top: 40px;
	padding: 16px 20px;
	background: #fff9c4;
	border: 2px dashed #f9a825;
	border-radius: 6px;
	font-size: 13px;
	color: #333;
}

.wchf-verify-cheatsheet h3 {
	margin: 0 0 4px;
	font-size: 14px;
}

.wchf-verify-cheatsheet-note {
	margin: 0 0 12px;
	font-size: 12px;
	color: #6a5900;
}

.wchf-verify-cheatsheet table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 12px;
	background: #fff;
}

.wchf-verify-cheatsheet th,
.wchf-verify-cheatsheet td {
	padding: 6px 8px;
	text-align: left;
	border-bottom: 1px solid #f0e6a0;
	font-size: 12px;
}

.wchf-verify-cheatsheet th {
	background: #fdf5b4;
	font-weight: 600;
}

.wchf-verify-cheatsheet code {
	font-size: 12px;
	padding: 1px 4px;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 3px;
}

.wchf-verify-cheatsheet-tips {
	margin: 0;
	font-size: 12px;
	line-height: 1.5;
}
