/*
 * Payment Page Consent Fields
 *
 * Priority for every value:
 *   1. Consent Fields → Appearance overrides   (--twf-ppc-*)
 *   2. Computed from the form's own native label/input at runtime
 *      (--twf-ppc-auto-*, set by consent.js), so whatever CSS the site
 *      uses to style Payment Page, these match it
 *   3. Payment Page's widget variables, then sensible defaults
 */

.twf-ppc {
	--twf-ppc-_label-font: var( --twf-ppc-label-font, var( --twf-ppc-auto-label-font, var( --payment-page-element-form-label-font-family, inherit ) ) );
	--twf-ppc-_label-weight: var( --twf-ppc-label-weight, var( --twf-ppc-auto-label-weight, var( --payment-page-element-form-label-font-weight, 700 ) ) );
	--twf-ppc-_label-size: var( --twf-ppc-label-size, var( --twf-ppc-auto-label-size, var( --payment-page-element-form-label-font-size, 16px ) ) );
	--twf-ppc-_label-color: var( --twf-ppc-label-color, var( --twf-ppc-auto-label-color, var( --payment-page-element-form-label-color, inherit ) ) );
	--twf-ppc-_label-spacing: var( --twf-ppc-auto-label-spacing, normal );
	--twf-ppc-_body-font: var( --twf-ppc-body-font, var( --twf-ppc-auto-body-font, var( --payment-page-element-form-input-font-family, inherit ) ) );
	--twf-ppc-_body-weight: var( --twf-ppc-body-weight, var( --twf-ppc-auto-body-weight, 400 ) );
	--twf-ppc-_body-size: var( --twf-ppc-body-size, var( --twf-ppc-auto-body-size, var( --payment-page-element-form-input-font-size, 15px ) ) );
	--twf-ppc-_body-color: var( --twf-ppc-body-color, var( --twf-ppc-auto-body-color, var( --payment-page-element-form-input-color, inherit ) ) );
	--twf-ppc-_radius: var( --twf-ppc-radius, var( --payment-page-element-form-input-container-border-radius, 10px ) );
	--twf-ppc-_border: var( --twf-ppc-border, var( --payment-page-element-form-input-container-border, 1px solid rgba( 0, 0, 0, 0.2 ) ) );

	font-family: var( --twf-ppc-_body-font );
	font-weight: var( --twf-ppc-_body-weight );
	font-size: var( --twf-ppc-_body-size );
	color: var( --twf-ppc-_body-color );
	line-height: 1.45;
	text-transform: none;
}

/* Field container: keep Payment Page's border/radius/background, just let it grow. */
[data-payment-page-component-payment-form-section="field"][data-twf-ppc] {
	box-sizing: border-box !important;
	height: auto !important;
	min-height: 0 !important;
	padding: 14px 15px 16px !important;
	display: block !important;
	cursor: default;
}

/* Payment Page's own label is the field's data key: keep it in the DOM, show ours instead. */
[data-payment-page-component-payment-form-section="field"][data-twf-ppc] > label {
	display: none !important;
}

/* Reset anything theme/Payment Page label rules push onto our nested labels. */
.twf-ppc label {
	position: static !important;
	width: auto !important;
	height: auto !important;
	display: inline !important;
	margin: 0 !important;
	padding: 0 !important;
	transform: none !important;
	cursor: pointer;
	font: inherit !important;
	color: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: inherit !important;
	white-space: normal !important;
	overflow: visible !important;
	pointer-events: auto !important;
}

/* Field label: the widget's label typography and colour. */
.twf-ppc .twf-ppc__label,
.twf-ppc label.twf-ppc__label {
	display: block !important;
	margin: 0 0 10px !important;
	font-family: var( --twf-ppc-_label-font ) !important;
	font-weight: var( --twf-ppc-_label-weight ) !important;
	font-size: var( --twf-ppc-_label-size ) !important;
	color: var( --twf-ppc-_label-color ) !important;
	text-transform: var( --twf-ppc-auto-label-transform, var( --payment-page-element-form-label-text-transform, none ) ) !important;
	letter-spacing: var( --twf-ppc-_label-spacing ) !important;
	font-style: normal !important;
	line-height: 1.3 !important;
	white-space: pre-line !important;
	overflow-wrap: anywhere;
	cursor: default;
}

.twf-ppc__label--req::after {
	content: " *";
}

/* Body copy: questions, declarations, options. */
.twf-ppc__q {
	margin: 0 0 10px !important;
	padding: 0 !important;
	font: inherit !important;
	color: inherit !important;
	white-space: pre-line;
}

.twf-ppc__opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
}

.twf-ppc__opt {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.twf-ppc label.twf-ppc__check {
	display: flex !important;
	align-items: flex-start;
	gap: 10px;
}

.twf-ppc__check span {
	white-space: pre-line;
}

.twf-ppc input[type="radio"],
.twf-ppc input[type="checkbox"] {
	opacity: 1 !important;
	position: static !important;
	width: 18px !important;
	height: 18px !important;
	min-width: 18px;
	margin: 0 !important;
	padding: 0 !important;
	cursor: pointer;
	flex: 0 0 auto;
	-webkit-appearance: auto !important;
	appearance: auto !important;
	accent-color: var( --twf-ppc-_label-color );
}

.twf-ppc__check input[type="checkbox"] {
	margin-top: 0.15em !important;
}

/* Dropdowns and text boxes: the widget's field border and radius. */
.twf-ppc select,
.twf-ppc textarea {
	box-sizing: border-box !important;
	margin: 0 !important;
	font-family: var( --twf-ppc-_body-font ) !important;
	font-weight: var( --twf-ppc-_body-weight ) !important;
	font-size: var( --twf-ppc-_body-size ) !important;
	color: var( --twf-ppc-_body-color ) !important;
	background-color: var( --payment-page-element-form-input-container-background, #fff ) !important;
	border: var( --twf-ppc-_border ) !important;
	box-shadow: none !important;
	outline: none;
	opacity: 1 !important;
	position: static !important;
}

.twf-ppc select:focus-visible,
.twf-ppc textarea:focus-visible {
	outline: none;
	box-shadow: 0 0 0 1px var( --twf-ppc-_label-color ) !important;
}

.twf-ppc textarea {
	display: block;
	width: 100% !important;
	min-height: 110px;
	padding: 12px 16px !important;
	border-radius: min( var( --twf-ppc-_radius ), 22px ) !important;
	resize: vertical;
	line-height: 1.45 !important;
}

.twf-ppc__date {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.twf-ppc__date select {
	flex: 1 1 70px;
	min-width: 0 !important;
	width: auto !important;
	height: 46px !important;
	padding: 0 34px 0 14px !important;
	border-radius: var( --twf-ppc-_radius ) !important;
	line-height: 44px !important;
	cursor: pointer;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	/* Chevron drawn in the text colour. */
	background-image:
		linear-gradient( 45deg, transparent 50%, currentColor 50% ),
		linear-gradient( 135deg, currentColor 50%, transparent 50% ) !important;
	background-position:
		calc( 100% - 20px ) 50%,
		calc( 100% - 14px ) 50% !important;
	background-size: 6px 6px, 6px 6px !important;
	background-repeat: no-repeat !important;
}

.twf-ppc__date select.twf-ppc__day {
	flex: 1 1 64px;
}

.twf-ppc__date select.twf-ppc__month {
	flex: 2 1 100px;
}

.twf-ppc__date select.twf-ppc__year {
	flex: 1 0 92px;
	min-width: 92px !important;
}

.twf-ppc__err {
	margin: 8px 0 0 !important;
	color: var( --payment-page-status-danger-color, #b32d2e );
	font-size: 0.875em;
}
