/**
 * BuddyPilot Withdrawal - frontend styles.
 *
 * Loaded conditionally on cart, checkout, my-account, and shortcode
 * pages by Frontend\AssetLoader (added in a later step).
 *
 * Tested for WCAG 2.2 AA color contrast (text 4.5:1, UI components 3:1).
 */

/* Consent checkbox at checkout (Krok 3) */
.buddypilot-withdrawal-consent-wrapper {
	margin: 1em 0;
	padding: 1em;
	background: #fffbeb;
	border-left: 4px solid #f59e0b;
	border-radius: 4px;
}

.buddypilot-withdrawal-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	cursor: pointer;
	line-height: 1.5;
}

.buddypilot-withdrawal-consent-label input[type="checkbox"] {
	flex: 0 0 auto;
	min-width: 1.25em;
	min-height: 1.25em;
	margin-top: 0.15em;
}

.buddypilot-withdrawal-consent-text {
	flex: 1 1 auto;
}

.buddypilot-withdrawal-required-indicator {
	color: #b91c1c;
	font-weight: bold;
	margin-left: 0.2em;
}

.buddypilot-withdrawal-consent-help {
	margin: 0.6em 0 0 1.85em;
	font-size: 0.85em;
	color: #4b5563;
}

/* Focus indicator: 3:1 contrast against background (WCAG 2.2 SC 2.4.13) */
.buddypilot-withdrawal-consent-label input[type="checkbox"]:focus-visible {
	outline: 3px solid #1d4ed8;
	outline-offset: 2px;
}

/* Forced colors mode (Windows High Contrast, macOS Increase Contrast) */
@media ( forced-colors: active ) {
	.buddypilot-withdrawal-consent-wrapper {
		border: 1px solid CanvasText;
		border-left-width: 4px;
		background: Canvas;
	}

	.buddypilot-withdrawal-consent-help {
		color: CanvasText;
	}

	.buddypilot-withdrawal-required-indicator {
		color: CanvasText;
	}

	.buddypilot-withdrawal-consent-label input[type="checkbox"]:focus-visible {
		outline: 3px solid Highlight;
	}
}

/* Reduced motion: no animations on consent (none currently, but safe default for future). */
@media ( prefers-reduced-motion: reduce ) {
	.buddypilot-withdrawal-consent-wrapper,
	.buddypilot-withdrawal-consent-label,
	.buddypilot-withdrawal-consent-label input[type="checkbox"] {
		transition: none;
		animation: none;
	}
}

/*
 * View-order page section (Krok 6).
 *
 * Intentionally unboxed: WooCommerce renders the addresses in a
 * neighbouring <section class="woocommerce-customer-details"> which
 * many themes already wrap with their own background/padding. Adding
 * a second box here makes the layout look nested. We only enforce
 * vertical spacing and let the theme's typography handle the rest.
 */
.buddypilot-withdrawal-view-order-actions {
	margin: 2.5em 0 1.5em;
}

.buddypilot-withdrawal-view-order-actions .buddypilot-withdrawal-section-heading {
	margin: 0 0 0.5em;
}

.buddypilot-withdrawal-view-order-actions .buddypilot-withdrawal-section-intro {
	margin: 0 0 1.25em;
	line-height: 1.5;
}

.buddypilot-withdrawal-withdraw-button {
	display: inline-block;
}

/*
 * Withdrawal form (Krok 6: step-select + step-confirm).
 */
.buddypilot-withdrawal-form,
.buddypilot-withdrawal-confirmation {
	margin: 1.5em 0;
}

.buddypilot-withdrawal-form-header h2 {
	margin: 0 0 0.5em;
}

.buddypilot-withdrawal-form-intro {
	margin: 0 0 1.5em;
	line-height: 1.5;
}

.buddypilot-withdrawal-error-notice {
	margin: 0 0 1.5em;
	padding: 1em;
	border-left: 4px solid #b91c1c;
	background: #fef2f2;
	color: #7f1d1d;
}

.buddypilot-withdrawal-empty-notice {
	padding: 1em;
	background: #f3f4f6;
	border-left: 4px solid #6b7280;
}

.buddypilot-withdrawal-items-fieldset {
	margin: 0 0 1.5em;
	padding: 0;
	border: 0;
}

.buddypilot-withdrawal-items-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.buddypilot-withdrawal-item {
	margin: 0.5em 0;
	padding: 0.75em 1em;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	background: #fff;
}

.buddypilot-withdrawal-item.is-excluded {
	opacity: 0.7;
	background: #f9fafb;
}

.buddypilot-withdrawal-item-label {
	display: flex;
	align-items: flex-start;
	gap: 0.75em;
	cursor: pointer;
	line-height: 1.4;
}

.buddypilot-withdrawal-item.is-excluded .buddypilot-withdrawal-item-label {
	cursor: not-allowed;
}

.buddypilot-withdrawal-item-label input[type="checkbox"] {
	flex: 0 0 auto;
	min-width: 1.25em;
	min-height: 1.25em;
	margin-top: 0.15em;
}

.buddypilot-withdrawal-item-name {
	font-weight: bold;
}

.buddypilot-withdrawal-item-meta {
	display: block;
	margin-top: 0.2em;
	font-size: 0.9em;
	color: #4b5563;
}

.buddypilot-withdrawal-item-desc {
	margin: 0.4em 0 0 1.85em;
	font-size: 0.85em;
	color: #6b7280;
}

.buddypilot-withdrawal-item-excluded-badge {
	display: inline-block;
	padding: 0.1em 0.5em;
	border-radius: 3px;
	background: #fde68a;
	color: #78350f;
	font-size: 0.85em;
}

.buddypilot-withdrawal-reason-wrapper,
.buddypilot-withdrawal-refund-account-wrapper {
	margin: 1.5em 0;
}

.buddypilot-withdrawal-reason-label,
.buddypilot-withdrawal-refund-account-label {
	display: block;
	margin-bottom: 0.4em;
	font-weight: bold;
}

.buddypilot-withdrawal-reason-wrapper textarea,
.buddypilot-withdrawal-refund-account-wrapper input[type="text"] {
	width: 100%;
	padding: 0.5em;
	border: 1px solid #d1d5db;
	border-radius: 4px;
}

.buddypilot-withdrawal-reason-wrapper textarea {
	min-height: 6em;
}

.buddypilot-withdrawal-form-help {
	margin: 0.4em 0 0;
	font-size: 0.85em;
	color: #4b5563;
}

.buddypilot-withdrawal-form-actions {
	display: flex;
	gap: 0.75em;
	margin-top: 1.5em;
}

.buddypilot-withdrawal-summary {
	margin: 0 0 1.5em;
	padding: 1em 1.25em;
	background: #f9fafb;
	border-radius: 4px;
}

.buddypilot-withdrawal-summary-heading {
	margin: 0 0 0.5em;
	font-size: 1em;
}

.buddypilot-withdrawal-summary-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.buddypilot-withdrawal-summary-list li {
	padding: 0.5em 0;
	border-bottom: 1px solid #e5e7eb;
}

.buddypilot-withdrawal-summary-list li:last-child {
	border-bottom: 0;
}

.buddypilot-withdrawal-summary-item-name {
	display: block;
	font-weight: bold;
}

.buddypilot-withdrawal-summary-item-meta {
	display: block;
	margin-top: 0.2em;
	font-size: 0.9em;
	color: #4b5563;
}

.buddypilot-withdrawal-disclaimer {
	margin: 0 0 1.5em;
	padding: 1em 1.25em;
	border-left: 4px solid #1d4ed8;
	background: #f9fafb;
}

.buddypilot-withdrawal-disclaimer-heading {
	margin: 0 0 0.5em;
	font-size: 1em;
	font-weight: bold;
}

.buddypilot-withdrawal-disclaimer p {
	margin: 0.4em 0 0;
	line-height: 1.5;
}

.buddypilot-withdrawal-disclaimer-source {
	margin-top: 0.75em;
	font-size: 0.85em;
	color: #6b7280;
}

/*
 * My Account > Withdrawals: status pill in the list table.
 */
.buddypilot-withdrawal-status-pill {
	display: inline-block;
	padding: 0.15em 0.6em;
	border-radius: 999px;
	font-size: 0.85em;
	font-weight: 600;
	line-height: 1.4;
}

.buddypilot-withdrawal-status-pill--open {
	background: #dbeafe;
	color: #1e3a8a;
}

.buddypilot-withdrawal-status-pill--closed {
	background: #d1fae5;
	color: #065f46;
}

.buddypilot-withdrawal-declaration-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75em 1em;
	margin: 0 0 1.25em;
}

.buddypilot-withdrawal-declaration-header h2 {
	margin: 0;
}

.buddypilot-withdrawal-declaration-header p {
	margin: 0;
}

.buddypilot-withdrawal-declaration-meta {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 12em, 1fr ) );
	gap: 0.5em 1.5em;
	margin: 0 0 1.5em;
	padding: 0;
}

.buddypilot-withdrawal-declaration-meta div {
	margin: 0;
}

.buddypilot-withdrawal-declaration-meta dt {
	margin: 0;
	font-size: 0.85em;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.buddypilot-withdrawal-declaration-meta dd {
	margin: 0.15em 0 0;
}

/*
 * Already-withdrawn marker on the regular WC view-order item rows.
 */
.buddypilot-withdrawal-order-item--declared {
	opacity: 0.55;
}

.buddypilot-withdrawal-order-item-badge {
	display: table;
	margin: 0.35em 0 0;
	padding: 0.1em 0.55em;
	border-radius: 999px;
	background: #fef3c7;
	color: #92400e;
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
}

a.buddypilot-withdrawal-order-item-badge:hover,
a.buddypilot-withdrawal-order-item-badge:focus {
	background: #fde68a;
	color: #78350f;
	text-decoration: underline;
}

/*
 * Quantity input on step-select rows. Sized to fit a 3-digit number
 * and aligned with the item name without breaking flex layout.
 */
.buddypilot-withdrawal-item-qty {
	width: 4.5em;
	min-height: 32px;
	margin-right: 0.6em;
	padding: 0.4em 0.5em;
	text-align: center;
}

.buddypilot-withdrawal-item-qty--disabled {
	display: inline-block;
	width: 4.5em;
	margin-right: 0.6em;
	color: #9ca3af;
	text-align: center;
}

/* Confirmation page */
.buddypilot-withdrawal-confirmation-meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.4em 1em;
	margin: 1em 0 1.5em;
}

.buddypilot-withdrawal-confirmation-meta dt {
	font-weight: bold;
}

.buddypilot-withdrawal-confirmation-meta dd {
	margin: 0;
}

.buddypilot-withdrawal-next-steps {
	margin: 1.5em 0;
}

.buddypilot-withdrawal-next-steps ol {
	margin-left: 1.5em;
}

/* Focus visible (WCAG 2.4.13) */
.buddypilot-withdrawal-form input[type="checkbox"]:focus-visible,
.buddypilot-withdrawal-form button:focus-visible,
.buddypilot-withdrawal-form .button:focus-visible,
.buddypilot-withdrawal-form a.button:focus-visible,
.buddypilot-withdrawal-form input[type="text"]:focus-visible,
.buddypilot-withdrawal-form textarea:focus-visible,
.buddypilot-withdrawal-confirmation a.button:focus-visible {
	outline: 3px solid #1d4ed8;
	outline-offset: 2px;
}

/* Forced colors */
@media ( forced-colors: active ) {
	.buddypilot-withdrawal-view-order-actions,
	.buddypilot-withdrawal-item,
	.buddypilot-withdrawal-summary,
	.buddypilot-withdrawal-disclaimer,
	.buddypilot-withdrawal-error-notice,
	.buddypilot-withdrawal-empty-notice {
		border: 1px solid CanvasText;
		background: Canvas;
	}

	.buddypilot-withdrawal-form input[type="checkbox"]:focus-visible,
	.buddypilot-withdrawal-form button:focus-visible {
		outline: 3px solid Highlight;
	}
}

/* Reduced motion */
@media ( prefers-reduced-motion: reduce ) {
	.buddypilot-withdrawal-form *,
	.buddypilot-withdrawal-confirmation * {
		transition: none !important;
		animation: none !important;
	}
}
