/* WP EU Withdrawal Button - frontend (WCAG 2.2 AA) */

:root {
	--wpeuw-accent: #0f766e;
	--wpeuw-accent-text: #ffffff;
	--wpeuw-text: #0f172a;
	--wpeuw-muted: #64748b;
	--wpeuw-border: #cbd5e1;
	--wpeuw-bg: #f8fafc;
	--wpeuw-error: #b91c1c;
	--wpeuw-error-bg: #fee2e2;
	--wpeuw-success: #047857;
	--wpeuw-success-bg: #d1fae5;
	--wpeuw-radius: 8px;
}

.wpeuw-form-wrap {
	max-width: 760px;
	margin: 32px auto;
	padding: 32px;
	background: #ffffff;
	border: 1px solid var(--wpeuw-border);
	border-radius: var(--wpeuw-radius);
	color: var(--wpeuw-text);
	font-size: 16px;
	line-height: 1.55;
}

/* Globalne wymuszenie hidden - nasze klasy .wpeuw-help / .wpeuw-eligibility itp.
   ustawiają display: block, co normalnie nadpisuje atrybut hidden z HTML.
   Dzięki tej regule toggle przez JS (element.hidden = true/false) działa zawsze. */
.wpeuw-form-wrap [hidden],
.wpeuw-form [hidden] {
	display: none !important;
}

.wpeuw-form-head {
	margin-bottom: 24px;
}

.wpeuw-form-title {
	font-size: 28px;
	margin: 0 0 8px;
	color: var(--wpeuw-text);
}

.wpeuw-form-lead {
	margin: 0;
	color: var(--wpeuw-muted);
	font-size: 15px;
}

.wpeuw-stepper ol {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: flex;
	gap: 12px;
	counter-reset: wpeuw;
}

.wpeuw-stepper li {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: var(--wpeuw-bg);
	border-radius: var(--wpeuw-radius);
	color: var(--wpeuw-muted);
	font-weight: 500;
	font-size: 14px;
}

.wpeuw-stepper li span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #e2e8f0;
	color: var(--wpeuw-text);
	font-weight: 700;
}

.wpeuw-stepper li.is-active {
	background: var(--wpeuw-accent);
	color: #fff;
}

.wpeuw-stepper li.is-active span {
	background: #fff;
	color: var(--wpeuw-accent);
}

.wpeuw-form fieldset {
	border: 1px solid var(--wpeuw-border);
	border-radius: var(--wpeuw-radius);
	padding: 16px 20px 20px;
	margin: 0 0 20px;
}

.wpeuw-form legend {
	padding: 0 8px;
	font-weight: 600;
	color: var(--wpeuw-text);
}

.wpeuw-field {
	margin-bottom: 16px;
}

.wpeuw-field label,
.wpeuw-label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--wpeuw-text);
}

.wpeuw-required {
	color: var(--wpeuw-error);
	margin-left: 4px;
}

.wpeuw-field input[type="text"],
.wpeuw-field input[type="email"],
.wpeuw-field input[type="tel"],
.wpeuw-field input[type="number"],
.wpeuw-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--wpeuw-border);
	border-radius: var(--wpeuw-radius);
	font-size: 16px;
	font-family: inherit;
	color: var(--wpeuw-text);
	background: #fff;
	min-height: 44px; /* WCAG 2.5.8 target size */
	box-sizing: border-box;
}

.wpeuw-field textarea {
	min-height: 88px;
	resize: vertical;
}

.wpeuw-field input:focus,
.wpeuw-field textarea:focus,
.wpeuw-form select:focus,
.wpeuw-button:focus,
.wpeuw-button-primary:focus,
.wpeuw-button-secondary:focus {
	outline: 3px solid #fbbf24;
	outline-offset: 2px;
}

.wpeuw-help {
	display: block;
	margin-top: 6px;
	font-size: 13px;
	color: var(--wpeuw-muted);
}

.wpeuw-radio-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wpeuw-radio-group label {
	font-weight: normal;
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.wpeuw-checkbox {
	display: grid;
	grid-template-columns: 18px 1fr;
	align-items: start;
	column-gap: 10px;
	font-weight: 500;
	cursor: pointer;
	padding: 12px;
	background: var(--wpeuw-bg);
	border-radius: var(--wpeuw-radius);
	line-height: 1.5;
}

.wpeuw-checkbox input[type="checkbox"] {
	position: relative;
	top: 4px;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--wpeuw-accent);
}

.wpeuw-checkbox > span {
	min-width: 0;
}

.wpeuw-checkbox-field {
	margin: 24px 0;
}

.wpeuw-info {
	padding: 12px 16px;
	background: #fef9c3;
	border: 1px solid #facc15;
	border-radius: var(--wpeuw-radius);
	color: #713f12;
	margin: 16px 0;
	font-size: 14px;
}

.wpeuw-alert {
	padding: 12px 16px;
	border-radius: var(--wpeuw-radius);
	margin: 0 0 20px;
	font-size: 15px;
}

.wpeuw-alert-error {
	background: var(--wpeuw-error-bg);
	color: var(--wpeuw-error);
	border: 1px solid #fca5a5;
}

.wpeuw-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: flex-end;
	align-items: center;
	margin-top: 24px;
}

.wpeuw-button,
.wpeuw-button-primary,
.wpeuw-button-secondary {
	display: inline-block;
	padding: 12px 20px;
	border-radius: var(--wpeuw-radius);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	border: 2px solid transparent;
	font-family: inherit;
	min-height: 44px;
	line-height: 1.2;
	text-decoration: none;
	text-align: center;
}

.wpeuw-button,
.wpeuw-button-primary {
	background: var(--wpeuw-accent);
	color: var(--wpeuw-accent-text);
}

.wpeuw-button:hover,
.wpeuw-button-primary:hover {
	filter: brightness(0.92);
}

.wpeuw-button-secondary {
	background: #fff;
	color: var(--wpeuw-text);
	border-color: var(--wpeuw-border);
}

.wpeuw-button-secondary:hover {
	background: var(--wpeuw-bg);
}

.wpeuw-step-title {
	font-size: 20px;
	margin: 0 0 8px;
	color: var(--wpeuw-text);
}

.wpeuw-summary {
	display: grid;
	grid-template-columns: minmax(180px, max-content) 1fr;
	column-gap: 16px;
	row-gap: 8px;
	background: var(--wpeuw-bg);
	border-radius: var(--wpeuw-radius);
	padding: 16px;
	margin: 16px 0;
}

.wpeuw-summary dt {
	font-weight: 600;
	color: var(--wpeuw-muted);
}

.wpeuw-summary dd {
	margin: 0;
}

.wpeuw-honeypot {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.wpeuw-success {
	text-align: center;
	padding: 24px;
}

.wpeuw-success-icon {
	color: var(--wpeuw-success);
	background: var(--wpeuw-success-bg);
	border-radius: 50%;
	padding: 12px;
}

.wpeuw-success h1 {
	font-size: 24px;
	margin: 16px 0 8px;
	color: var(--wpeuw-text);
}

.wpeuw-success .wpeuw-summary {
	text-align: left;
	max-width: 480px;
	margin: 24px auto;
}

@media (max-width: 600px) {
	.wpeuw-form-wrap {
		padding: 20px;
		margin: 16px;
	}
	.wpeuw-form-title {
		font-size: 22px;
	}
	.wpeuw-stepper ol {
		flex-direction: column;
	}
	.wpeuw-actions {
		justify-content: stretch;
	}
	.wpeuw-actions .wpeuw-button,
	.wpeuw-actions .wpeuw-button-primary,
	.wpeuw-actions .wpeuw-button-secondary {
		width: 100%;
	}
	.wpeuw-summary {
		grid-template-columns: 1fr;
	}
	.wpeuw-summary dt {
		margin-top: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation: none !important;
		transition: none !important;
	}
}

.wpeuw-wc-order-block {
	margin-top: 32px;
	padding: 20px;
	background: var(--wpeuw-bg);
	border-radius: var(--wpeuw-radius);
}

.wpeuw-wc-order-block h2 {
	margin-top: 0;
	font-size: 18px;
}

/* Lookup pane */
.wpeuw-lookup-fieldset {
	background: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
	border-color: #bae6fd;
}

.wpeuw-field-row {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr auto;
	gap: 12px;
	align-items: end;
}

.wpeuw-field-self-end {
	align-self: end;
}

@media (max-width: 720px) {
	.wpeuw-field-row { grid-template-columns: 1fr; }
}

.wpeuw-lookup-status {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: var(--wpeuw-radius);
	font-size: 14px;
}

.wpeuw-lookup-status-info    { background: #e0f2fe; color: #075985; }
.wpeuw-lookup-status-success { background: var(--wpeuw-success-bg); color: var(--wpeuw-success); }
.wpeuw-lookup-status-error   { background: var(--wpeuw-error-bg); color: var(--wpeuw-error); }

.wpeuw-eligibility {
	margin-top: 12px;
	padding: 12px 14px;
	border-radius: var(--wpeuw-radius);
	font-size: 14px;
	line-height: 1.5;
}

.wpeuw-eligibility-ok   { background: var(--wpeuw-success-bg); color: #064e3b; border: 1px solid #6ee7b7; }
.wpeuw-eligibility-bad  { background: var(--wpeuw-error-bg);   color: #7f1d1d; border: 1px solid #fca5a5; }
.wpeuw-eligibility-info { background: #e0f2fe;                 color: #075985; border: 1px solid #7dd3fc; }

/* Items list (checkboxes) */
.wpeuw-items-list .wpeuw-help { margin-top: 0; }

.wpeuw-items-actions {
	margin-bottom: 8px;
	font-size: 13px;
	color: var(--wpeuw-muted);
}

.wpeuw-link {
	background: none;
	border: 0;
	padding: 0;
	color: var(--wpeuw-accent);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
}

.wpeuw-link:hover { filter: brightness(0.85); }

.wpeuw-items {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--wpeuw-border);
	border-radius: var(--wpeuw-radius);
	background: #fff;
}

.wpeuw-items li + li { border-top: 1px solid var(--wpeuw-border); }

.wpeuw-item-row {
	display: grid;
	grid-template-columns: 20px 1fr auto auto;
	align-items: center;
	column-gap: 14px;
	row-gap: 4px;
	padding: 12px 16px;
	font-weight: 500;
	cursor: pointer;
	min-height: 48px;
}

.wpeuw-item-row input.wpeuw-item-check[type="checkbox"] {
	position: relative;
	top: 4px;
	width: 18px;
	height: 18px;
	margin: 0 5px 0 0;
	padding: 0;
	accent-color: var(--wpeuw-accent);
	cursor: pointer;
}

.wpeuw-item-name {
	font-weight: 600;
	color: var(--wpeuw-text);
	min-width: 0;
	overflow-wrap: anywhere;
}

.wpeuw-item-sku {
	font-size: 12px;
	color: var(--wpeuw-muted);
	font-weight: 400;
	white-space: nowrap;
}

.wpeuw-item-qty {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--wpeuw-muted);
	white-space: nowrap;
}

/* Wysoka specyficzność, by nadpisać generyczny .wpeuw-field input[type="number"] */
.wpeuw-form .wpeuw-item-row input.wpeuw-item-quantity[type="number"] {
	width: 60px;
	padding: 4px 6px;
	border: 1px solid var(--wpeuw-border);
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	min-height: 32px;
	height: 32px;
	line-height: 1;
	text-align: center;
	box-sizing: border-box;
	margin: 0 5px;
	background: #fff;
	color: var(--wpeuw-text);
}

.wpeuw-items-manual {
	margin-top: 16px;
}

.wpeuw-items-manual summary {
	cursor: pointer;
	font-size: 13px;
	color: var(--wpeuw-muted);
	padding: 6px 0;
}

.wpeuw-items-manual textarea {
	width: 100%;
	margin-top: 8px;
	padding: 10px 12px;
	border: 1px solid var(--wpeuw-border);
	border-radius: var(--wpeuw-radius);
	font-family: inherit;
	font-size: 15px;
	min-height: 80px;
	box-sizing: border-box;
}

/* Field-level error */
.wpeuw-field-error {
	color: var(--wpeuw-error);
	font-weight: 500;
}

/* GDPR section */
.wpeuw-gdpr-fieldset {
	background: #f8fafc;
}

.wpeuw-gdpr-text {
	font-size: 13px;
	line-height: 1.55;
	color: var(--wpeuw-muted);
	margin: 0 0 12px;
}

@media (max-width: 600px) {
	.wpeuw-item-row {
		grid-template-columns: auto 1fr;
	}
	.wpeuw-item-sku,
	.wpeuw-item-qty {
		grid-column: 2 / -1;
	}
}

/* Turnstile captcha */
.wpeuw-turnstile-field {
	display: flex;
	justify-content: center;
	margin: 16px 0 8px;
}

.wpeuw-turnstile-field .cf-turnstile {
	min-height: 65px;
}

/* Screen reader only */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}
