/*
 * Octoplug – EU Withdrawal Button: customer-facing styles.
 *
 * Namespaced under .octoplug-withdrawal / .opwb-*; typography is inherited
 * from the theme (no resets, no external fonts). Loaded conditionally on
 * My Account and on pages containing the withdrawal block/shortcode.
 *
 * Accessibility: touch targets >= 44px, inputs >= 16px (no iOS zoom),
 * focus ring never removed (outline + 2px offset), errors never color-only.
 */

.octoplug-withdrawal {
	box-sizing: border-box;
	max-width: 640px;
	margin: 24px 0;
	padding: 24px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

@supports (border-color: color-mix(in srgb, currentColor 20%, transparent)) {
	.octoplug-withdrawal {
		border-color: color-mix(in srgb, currentColor 20%, transparent);
	}
}

.octoplug-withdrawal *,
.octoplug-withdrawal *::before,
.octoplug-withdrawal *::after {
	box-sizing: inherit;
}

.octoplug-withdrawal h2,
.octoplug-withdrawal h3 {
	margin-top: 0;
}

.octoplug-withdrawal p:last-child {
	margin-bottom: 0;
}

/* Notices ---------------------------------------------------------------- */

.opwb-hint {
	font-size: 0.85em;
	opacity: 0.8;
}

.opwb-error {
	border: 1px solid #b32d2e;
	border-left-width: 4px;
	padding: 8px 12px;
	margin: 0 0 16px;
}

.opwb-banner {
	border: 1px solid #996800;
	border-left-width: 4px;
	padding: 8px 12px;
	margin: 0 0 16px;
}

/* Deadline passed: an explanation, never a dead end. */
.opwb-after-window p {
	margin: 0 0 8px;
}

.opwb-after-window p:last-child {
	margin-bottom: 0;
}

.opwb-after-window-line {
	display: block;
	margin-top: 4px;
}

/* "hide" mode: the way forward is a plain link and a disclosure, never a
 * button — the shopkeeper asked for the button to be gone, and that holds.
 * What must not hold is a promise with nothing behind it. */
.opwb-late-continue {
	margin: 12px 0 0;
	font-size: 0.95em;
}

.opwb-late-continue > summary {
	cursor: pointer;
	display: inline-block;
	margin-bottom: 8px;
}

.opwb-late-continue .opwb-hint {
	display: block;
	margin-top: 2px;
}

.opwb-outcome .opwb-outcome-title:focus {
	outline: 3px solid #1a1a1a;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #ffffff;
}

.opwb-check {
	font-weight: 700;
}

/* Item selection (partial withdrawal, whole rows) ------------------------- */

.opwb-items {
	border: 0;
	padding: 0;
	margin: 0 0 16px;
	min-width: 0;
}

.opwb-items legend {
	font-weight: 600;
	padding: 0;
	margin: 0 0 4px;
}

.opwb-items ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.opwb-items li {
	margin: 0;
}

.opwb-items li label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 400;
	margin: 0;
	padding: 8px 0;
	min-height: 44px;
}

.opwb-items input[type="checkbox"] {
	width: 20px;
	height: 20px;
	min-width: 20px;
	margin: 0 8px 0 0;
}

.opwb-qty {
	opacity: 0.8;
	white-space: nowrap;
}

/* Forms ------------------------------------------------------------------ */

.opwb-form .opwb-field {
	margin: 0 0 16px;
}

.opwb-form .opwb-field > label {
	display: block;
	font-weight: 600;
	margin: 0 0 4px;
}

.opwb-form input[type="text"],
.opwb-form input[type="email"],
.opwb-form textarea {
	width: 100%;
	max-width: 100%;
	font-size: 16px;
	min-height: 44px;
	padding: 8px 12px;
}

.opwb-form textarea {
	min-height: 88px;
}

.opwb-actions {
	margin: 16px 0 0;
}

.opwb-actions .opwb-back {
	margin-left: 16px;
	display: inline-block;
	min-height: 44px;
	line-height: 44px;
}

/* Honeypot: visually removed, skipped by keyboard and screen readers. */
.opwb-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Buttons ---------------------------------------------------------------- */

/* Shared a11y baseline for both style modes (theme .button / custom). */
.opwb-btn {
	display: inline-block;
	min-height: 44px;
	font-size: 16px;
	cursor: pointer;
	text-decoration: none;
}

/* Custom style mode: visual base; colors/radius are injected inline from settings. */
.octoplug-btn {
	background: #2271b1;
	color: #ffffff;
	border: 0;
	border-radius: 4px;
	padding: 10px 20px;
}

.octoplug-btn:hover {
	background: #135e96;
	color: #ffffff;
}

/* Symmetric padding on the plugin's own buttons. Higher specificity than the
 * theme's bare .button so a lopsided theme padding cannot leak through: the
 * order-list button and the two confirm buttons then render identically. */
.octoplug-withdrawal .opwb-btn,
.octoplug-withdrawal a.opwb-btn,
.octoplug-withdrawal button.opwb-btn {
	padding: 12px 24px;
}

/* Focus ring: never removed, and never invisible.
 *
 * currentColor was the bug: on the primary button the text is white, so the
 * ring was drawn white on the white page background — a 1:1 contrast on the
 * final, irreversible action of the whole product (WCAG 2.4.7).
 *
 * Two rings instead: a near-black outline that reads on light backgrounds and
 * a white halo just outside it that reads on dark ones. One of the two always
 * wins, whatever the theme puts behind the box. */
.octoplug-withdrawal a:focus-visible,
.octoplug-withdrawal button:focus-visible,
.octoplug-withdrawal input:focus-visible,
.octoplug-withdrawal select:focus-visible,
.octoplug-withdrawal textarea:focus-visible,
.octoplug-withdrawal summary:focus-visible,
.octoplug-withdrawal .opwb-btn:focus-visible {
	outline: 3px solid #1a1a1a;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #ffffff;
}

.octoplug-withdrawal .opwb-btn:focus,
.octoplug-withdrawal a:focus,
.octoplug-withdrawal button:focus,
.octoplug-withdrawal input:focus,
.octoplug-withdrawal select:focus,
.octoplug-withdrawal textarea:focus {
	outline: 3px solid #1a1a1a;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #ffffff;
}

/* Windows high-contrast mode: let the system colours win. */
@media (forced-colors: active) {
	.octoplug-withdrawal a:focus,
	.octoplug-withdrawal button:focus,
	.octoplug-withdrawal input:focus,
	.octoplug-withdrawal select:focus,
	.octoplug-withdrawal textarea:focus,
	.octoplug-withdrawal .opwb-btn:focus {
		outline-color: Highlight;
		box-shadow: none;
	}
}

/* Logged-in eligible orders list (dedicated page) -------------------------- */

.opwb-orders {
	list-style: none;
	margin: 0;
	padding: 0;
}

.opwb-orders li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.opwb-orders li:last-child {
	border-bottom: 0;
}

.opwb-order-meta {
	opacity: 0.8;
	font-size: 0.9em;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 480px) {
	.octoplug-withdrawal {
		padding: 16px;
	}

	.octoplug-withdrawal .opwb-btn {
		display: block;
		width: 100%;
		text-align: center;
	}

	.opwb-actions .opwb-back {
		margin-left: 0;
		display: block;
		text-align: center;
	}
}
