/* EU Withdrawal & Cancellation Form — front end
 *
 * Design note. What this plugin produces is a numbered, dated proof that a
 * consumer gave notice in time. So the interface is dressed as that artifact:
 * a docket. The reference is set in monospace at display size, micro-labels are
 * small caps, and the rule under the header is dashed like a perforation.
 * Everything else stays quiet so that one idea carries the page.
 *
 * No web fonts are loaded. A plugin whose subject is EU consumer law has no
 * business pulling fonts from a third-party server, and system stacks render
 * instantly everywhere.
 *
 * Everything is scoped under .drs-wd and resets what it inherits, because this
 * has to survive landing inside any theme.
 */

.drs-wd {
	/* The two accent values are written inline by PHP from the merchant's settings. */
	--drs-wd-primary: #1d4ed8;
	--drs-wd-primary-hover: #1740ac;
	--drs-wd-secondary: #14161c;

	--drs-wd-ink: #14161c;
	--drs-wd-paper: #ffffff;
	--drs-wd-wash: #f5f6f8;
	--drs-wd-rule: #e3e6eb;
	--drs-wd-perf: #c3c9d4;
	--drs-wd-muted: #626a78;
	--drs-wd-alert: #b42318;
	--drs-wd-alert-wash: #fdf2f1;

	--drs-wd-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
	--drs-wd-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	--drs-wd-radius: 10px;

	box-sizing: border-box;
	color: var(--drs-wd-ink);
	font-family: var(--drs-wd-sans);
	font-size: 16px;
	line-height: 1.6;
	text-align: left;
}

.drs-wd *,
.drs-wd *::before,
.drs-wd *::after {
	box-sizing: inherit;
}

/* ---------------------------------------------------------------- surfaces */

.drs-wd-form,
.drs-wd-success,
.drs-wdp-portal,
.drs-wd-unavailable {
	position: relative;
	width: 100%;
	max-width: 36rem;
	margin: 0 auto;
	padding: 2.25rem 2rem 2rem;
	background: var(--drs-wd-paper);
	border: 1px solid var(--drs-wd-rule);
	border-radius: var(--drs-wd-radius);
	box-shadow: 0 1px 2px rgba(20, 22, 28, 0.04), 0 8px 24px -18px rgba(20, 22, 28, 0.3);
}

/* The accent hairline on the top edge is the only place the merchant's colour
   appears unasked. */
.drs-wd-form::before,
.drs-wd-success::before,
.drs-wdp-portal::before {
	content: "";
	position: absolute;
	top: -1px;
	left: -1px;
	right: -1px;
	height: 3px;
	background: var(--drs-wd-primary);
	border-radius: var(--drs-wd-radius) var(--drs-wd-radius) 0 0;
}

/* ------------------------------------------------------------------ header */

.drs-wd-title {
	margin: 0 0 0.5rem;
	padding: 0;
	color: var(--drs-wd-secondary);
	font-family: var(--drs-wd-sans);
	font-size: 1.5rem;
	font-weight: 650;
	line-height: 1.25;
	letter-spacing: -0.015em;
}

.drs-wd-intro {
	margin: 0 0 1.75rem;
	color: var(--drs-wd-muted);
	font-size: 0.9375rem;
}

/* -------------------------------------------------------------- the docket
   Signature element. The reference is what the customer keeps, so it is set
   like something issued: monospace, tracked, above a perforated rule. */

.drs-wdp-portal .drs-wd-title,
.drs-wd-success .drs-wd-evidence strong {
	font-family: var(--drs-wd-mono);
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: 0.02em;
}

/* The docket header: eyebrow, reference, perforation. */
.drs-wd-docket {
	margin: 0 0 1.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 2px dashed var(--drs-wd-perf);
}

.drs-wd-docket .drs-wd-title {
	margin: 0;
}

.drs-wd-eyebrow {
	display: block;
	margin-bottom: 0.3rem;
	font-family: var(--drs-wd-mono);
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--drs-wd-muted);
}

.drs-wd-evidence {
	margin: 0 0 1.5rem;
	padding: 1.25rem;
	background: var(--drs-wd-wash);
	border: 2px dashed var(--drs-wd-perf);
	border-radius: var(--drs-wd-radius);
	text-align: center;
	font-family: var(--drs-wd-mono);
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--drs-wd-muted);
}

.drs-wd-evidence strong {
	display: block;
	margin-top: 0.5rem;
	color: var(--drs-wd-ink);
	text-transform: none;
	letter-spacing: 0.02em;
}

/* ------------------------------------------------------------ micro-labels */

.drs-wdp-status__name,
.drs-wdp-heading,
.drs-wd-fieldset legend {
	font-family: var(--drs-wd-mono);
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--drs-wd-muted);
}

.drs-wdp-heading {
	margin: 2rem 0 0.75rem;
}

/* ------------------------------------------------------------------ fields */

.drs-wd-field {
	display: block;
	margin: 0 0 1.25rem;
}

.drs-wd-field > label {
	display: block;
	margin-bottom: 0.4rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--drs-wd-ink);
}

.drs-wd-field input[type="text"],
.drs-wd-field input[type="email"],
.drs-wd-field input[type="number"],
.drs-wd-field input[type="file"],
.drs-wd-field select,
.drs-wd-field textarea,
.drs-wdp-portal textarea,
.drs-wdp-portal input[type="file"] {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0.7rem 0.8rem;
	border: 1px solid var(--drs-wd-rule);
	border-radius: 8px;
	background: var(--drs-wd-paper);
	color: var(--drs-wd-ink);
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.4;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;

	/* Themes routinely set a fixed height on form controls. Combined with the
	   padding above that clips the text, so the height is released and a floor
	   is set instead of a fixed value. */
	height: auto;
	min-height: 2.875rem;
}

/* A select also needs its native chrome normalised, or the theme's arrow sits
   on top of the label at this padding. The arrow is drawn as a background so no
   extra markup or image request is involved. */
.drs-wd-field select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding-right: 2.5rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23626a78' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.9rem center;
	background-size: 12px 8px;
	text-overflow: ellipsis;
}

/* A file input is a button plus a filename, so it needs room for both rather
   than the single-line height of a text field. */
.drs-wd-field input[type="file"],
.drs-wdp-portal input[type="file"] {
	padding: 0.6rem 0.8rem;
	line-height: 1.6;
}

.drs-wd-field textarea,
.drs-wdp-portal textarea {
	min-height: 6rem;
	line-height: 1.55;
	resize: vertical;
}

.drs-wd-field input:hover,
.drs-wd-field select:hover,
.drs-wd-field textarea:hover {
	border-color: #c8cdd6;
}

.drs-wd-field input:focus,
.drs-wd-field select:focus,
.drs-wd-field textarea:focus,
.drs-wdp-portal textarea:focus {
	outline: none;
	border-color: var(--drs-wd-primary);
	box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.drs-wd-required {
	color: var(--drs-wd-alert);
	font-weight: 400;
}

.drs-wd-hint {
	display: block;
	margin-top: 0.4rem;
	color: var(--drs-wd-muted);
	font-size: 0.8125rem;
	line-height: 1.5;
}

.drs-wd-field--inline label,
.drs-wd-field--check label {
	display: inline-flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0 1.25rem 0 0;
	font-size: 0.9375rem;
	font-weight: 400;
}

.drs-wd-field--check {
	padding: 1rem 1.125rem;
	background: var(--drs-wd-wash);
	border-radius: 8px;
}

.drs-wd-field--check input {
	margin-top: 0.28rem;
	flex: 0 0 auto;
}

/* ---------------------------------------------------------------- fieldset */

.drs-wd-fieldset {
	margin: 0 0 1.5rem;
	padding: 1.125rem 1.25rem 0.75rem;
	border: 1px solid var(--drs-wd-rule);
	border-radius: var(--drs-wd-radius);
}

.drs-wd-fieldset legend {
	padding: 0 0.45rem;
	margin-left: -0.45rem;
}

/* ------------------------------------------------------------- order lines */

.drs-wd-lines {
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.drs-wd-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	padding: 0.85rem 0;
	border-top: 1px solid var(--drs-wd-rule);
}

.drs-wd-line:first-child {
	border-top: 0;
}

.drs-wd-line-name {
	flex: 1 1 13rem;
	font-weight: 600;
	font-size: 0.9375rem;
}

.drs-wd-line-sku {
	font-family: var(--drs-wd-mono);
	font-size: 0.75rem;
	color: var(--drs-wd-muted);
}

.drs-wd-line-qty {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8125rem;
	color: var(--drs-wd-muted);
}

.drs-wd-line-qty input {
	width: 4.5rem;
	padding: 0.45rem 0.55rem;
	border: 1px solid var(--drs-wd-rule);
	border-radius: 7px;
	font-family: var(--drs-wd-mono);
	font-size: 0.9375rem;
	text-align: center;
}

.drs-wd-line-qty .drs-wd-hint {
	display: inline;
	margin: 0;
}

/* ---------------------------------------------------------------- messages */

.drs-wd-notice,
.drs-wd-errors {
	margin: 0 0 1.5rem;
	padding: 0.9rem 1.1rem;
	border-radius: 8px;
	background: var(--drs-wd-wash);
	border-left: 3px solid var(--drs-wd-primary);
	font-size: 0.9375rem;
}

.drs-wd-notice--manual {
	border-left-color: #d98b00;
}

.drs-wd-notice--success {
	border-left-color: #12805c;
}

.drs-wd-errors,
.drs-wd-notice--error {
	background: var(--drs-wd-alert-wash);
	border-left-color: var(--drs-wd-alert);
	color: #7a271a;
}

.drs-wd-errors ul {
	margin: 0;
	padding-left: 1.1rem;
}

/* ----------------------------------------------------------------- actions */

.drs-wd-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	margin: 1.75rem 0 0;
	padding-top: 1.5rem;
	border-top: 2px dashed var(--drs-wd-perf);
}

.drs-wd-button {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: 8px;
	background: var(--drs-wd-primary);
	color: #fff;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.12s ease, transform 0.06s ease;
}

.drs-wd-button:hover,
.drs-wd-button:focus {
	background: var(--drs-wd-primary-hover);
	color: #fff;
}

.drs-wd-button:active {
	transform: translateY(1px);
}

.drs-wd-button:focus-visible {
	outline: 2px solid var(--drs-wd-primary);
	outline-offset: 3px;
}

.drs-wd-back {
	color: var(--drs-wd-muted);
	font-size: 0.875rem;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ----------------------------------------------------------- portal: status
   Status answers the customer's first question, so it sits directly under the
   docket rule, before anything else. */

.drs-wdp-status {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.25rem 0 1.75rem;
}

.drs-wdp-status__item {
	flex: 1 1 9rem;
	padding: 0.8rem 0.95rem;
	background: var(--drs-wd-wash);
	border-radius: 8px;
}

.drs-wdp-status__name {
	display: block;
	margin-bottom: 0.2rem;
}

.drs-wdp-status__value {
	display: block;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--drs-wd-ink);
}

/* ------------------------------------------------------------ portal: facts */

.drs-wdp-facts {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.drs-wdp-facts th,
.drs-wdp-facts td {
	padding: 0.7rem 0;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--drs-wd-rule);
}

.drs-wdp-facts th {
	width: 55%;
	font-weight: 400;
	color: var(--drs-wd-muted);
}

/* Dates are data: monospace makes them scannable and ties them to the
   reference above. */
.drs-wdp-facts td {
	font-family: var(--drs-wd-mono);
	font-size: 0.875rem;
	font-weight: 500;
	text-align: right;
}

.drs-wdp-items {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9375rem;
}

.drs-wdp-items li {
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--drs-wd-rule);
}

.drs-wdp-items li:last-child {
	border-bottom: 0;
}

.drs-wdp-items a {
	color: var(--drs-wd-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.drs-wdp-items .drs-wd-hint {
	display: inline;
	margin-left: 0.5rem;
	font-family: var(--drs-wd-mono);
	font-size: 0.75rem;
}

/* ---------------------------------------------------------- portal: thread */

.drs-wdp-messages {
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.drs-wdp-message {
	margin: 0 0 0.6rem;
	padding: 0.85rem 1rem;
	background: var(--drs-wd-wash);
	border-radius: 10px 10px 10px 3px;
	font-size: 0.9375rem;
}

/* The customer's own messages sit right and mirror the corner, the one
   convention everyone already knows from messaging apps. */
.drs-wdp-message--customer {
	margin-left: 3rem;
	background: #eef2fd;
	border-radius: 10px 10px 3px 10px;
}

.drs-wdp-message__meta {
	display: block;
	margin-bottom: 0.25rem;
	font-family: var(--drs-wd-mono);
	font-size: 0.6875rem;
	letter-spacing: 0.04em;
	color: var(--drs-wd-muted);
}

.drs-wdp-message__body {
	display: block;
}

.drs-wdp-reply {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 2px dashed var(--drs-wd-perf);
}

.drs-wdp-reply .drs-wd-actions {
	margin-top: 1rem;
	padding-top: 0;
	border-top: 0;
}

/* ---------------------------------------------------------------- honeypot
   Moved out of view rather than display:none, which some bots skip. */

.drs-wd-trap {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ------------------------------------------------------------ entry points */

.drs-wd-footer-link,
.drs-wd-account-link,
.drs-wd-order-link,
.drs-wd-checkout-notice {
	margin: 1.25rem 0;
	font-size: 0.875rem;
}

.drs-wd-footer-link {
	text-align: center;
}

.drs-wd-footer-link a,
.drs-wd-account-link a,
.drs-wd-order-link a {
	color: var(--drs-wd-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.drs-wd-floating {
	position: fixed;
	bottom: 1.25rem;
	z-index: 9990;
	display: inline-flex;
	align-items: center;
	padding: 0.7rem 1.15rem;
	border-radius: 999px;
	background: var(--drs-wd-primary);
	color: #fff;
	font-family: var(--drs-wd-sans);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	box-shadow: 0 8px 24px -8px rgba(20, 22, 28, 0.45);
}

.drs-wd-floating:hover,
.drs-wd-floating:focus {
	background: var(--drs-wd-primary-hover);
	color: #fff;
}

.drs-wd-floating--right {
	right: 1.25rem;
}

.drs-wd-floating--left {
	left: 1.25rem;
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
	.drs-wd *,
	.drs-wd *::before,
	.drs-wd *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 640px) {
	.drs-wd-form,
	.drs-wd-success,
	.drs-wdp-portal,
	.drs-wd-unavailable {
		padding: 1.75rem 1.25rem 1.5rem;
		border-radius: 0;
		border-left: 0;
		border-right: 0;
	}

	.drs-wd-form::before,
	.drs-wd-success::before,
	.drs-wdp-portal::before {
		border-radius: 0;
	}

	.drs-wdp-portal .drs-wd-title,
	.drs-wd-success .drs-wd-evidence strong {
		font-size: 1.25rem;
	}

	.drs-wd-line {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.6rem;
	}

	/* flex-basis follows the main axis, so the 13rem that sets a minimum width
	   on desktop would set a 13rem minimum height here. */
	.drs-wd-line-name {
		flex: 0 0 auto;
	}

	.drs-wd-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.drs-wd-button {
		width: 100%;
		text-align: center;
	}

	.drs-wd-back {
		text-align: center;
	}

	.drs-wdp-message--customer {
		margin-left: 1.25rem;
	}

	.drs-wdp-facts th {
		width: 50%;
	}
}

/* ------------------------------------------------------------------- print
   The confirmation is evidence, so it has to print cleanly from any theme. */

@media print {
	.drs-wd-form,
	.drs-wd-success,
	.drs-wdp-portal {
		max-width: none;
		border: 0;
		box-shadow: none;
		padding: 0;
	}

	.drs-wd-actions,
	.drs-wdp-reply {
		display: none;
	}
}
