/**
 * ProSafe Consent
 *
 * The banner's measurements are taken from the site's existing banner so the
 * replacement is not a visible change: 450px card in the bottom-left, 3px
 * radius, 0 0 9px shadow, amber heading on white, dark navy button.
 */

:root {
	--ps-consent-ink: #4d4d4d;
	--ps-consent-navy: #10212e;
	--ps-consent-amber: #f7a92e;
	--ps-consent-surface: #fff;
	--ps-consent-line: #e3e3e3;
	--ps-consent-font: Tahoma, Verdana, Arial, "Open Sans", sans-serif;
}

/* ---------- banner ----------
 *
 * A bar across the full width of the viewport, pinned to the bottom. The
 * contractor's version was a 450px card in the bottom-LEFT corner, which on a
 * right-to-left site puts it on the wrong side and reads as an afterthought.
 *
 * On the specificity here: the theme's rtl.css carries
 *   #privacy_policy_popup_close #privacy_policy_popup button.consent_btn
 * at two-ID weight, forcing a navy background on every button in the banner.
 * A plain .consent_btn--ghost rule loses to it, which is what made the second
 * button navy text on navy ground, and unreadable. Matching that weight is not
 * enough either: at equal specificity the later sheet wins, and rtl.css loads
 * after this one. The ghost rules therefore name both classes, which puts them
 * one class ahead. The stylesheet also declares rtl.css as a dependency so the
 * order is at least predictable.
 */

#privacy_policy_popup_close {
	position: fixed;
	z-index: 99998;
	inset: auto 0 0 0;
	pointer-events: none;
}
#privacy_policy_popup_close[hidden] { display: none; }

#privacy_policy_popup_close #privacy_policy_popup {
	position: static;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px 32px;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 16px clamp(16px, 4vw, 48px);
	background: var(--ps-consent-surface);
	color: var(--ps-consent-ink);
	border-radius: 0;
	border-top: 3px solid var(--ps-consent-amber);
	box-shadow: 0 -2px 14px rgba(0, 0, 0, .18);
	font-family: var(--ps-consent-font);
	font-size: 12px;
	line-height: 1.2;
	text-align: right;
	pointer-events: auto;
}

#privacy_policy_popup .consent_copy {
	flex: 1 1 420px;
	min-width: 0;
	text-align: right;
}

#privacy_policy_popup_close #privacy_policy_popup .popup_header h2 {
	margin: 0;
	padding: 0;
	color: var(--ps-consent-amber);
	font-family: var(--ps-consent-font);
	font-size: 19px;
	font-weight: 700;
	line-height: 1.2;
	text-align: right;
}

#privacy_policy_popup .popup_content_holder { margin: 0; }

#privacy_policy_popup .popup_notice {
	padding: 5px 0 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ps-consent-ink);
	text-align: right;
	max-width: 86ch;
}

#privacy_policy_popup .consent_actions {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

/* Base button. The theme pins the background, so colour is set at its weight. */
#privacy_policy_popup_close #privacy_policy_popup button.consent_btn {
	display: inline-block;
	padding: 9px 26px;
	margin: 0;
	background-color: var(--ps-consent-navy);
	color: #fff;
	border: 1px solid var(--ps-consent-navy);
	border-radius: 3px;
	font-family: var(--ps-consent-font);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	text-align: center;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
#privacy_policy_popup_close #privacy_policy_popup button.consent_btn:hover {
	background-color: #1b3346;
}

/* The reject button: outlined, navy text on white. This is the rule that has
 * to out-weigh rtl.css, or the text disappears into the background. */
#privacy_policy_popup_close #privacy_policy_popup button.consent_btn.consent_btn--ghost {
	background-color: #fff;
	color: var(--ps-consent-navy);
	border-color: var(--ps-consent-navy);
}
#privacy_policy_popup_close #privacy_policy_popup button.consent_btn.consent_btn--ghost:hover {
	background-color: #eef1f4;
	color: var(--ps-consent-navy);
}

#privacy_policy_popup_close #privacy_policy_popup button.consent_btn:focus-visible {
	outline: 2px solid var(--ps-consent-amber);
	outline-offset: 2px;
}

#privacy_policy_popup .links_wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 16px;
	justify-content: flex-start;
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.4;
}
/* rtl.css paints a navy background on every <a> inside the banner. */
#privacy_policy_popup_close #privacy_policy_popup .links_wrap a {
	background-color: transparent;
	color: var(--ps-consent-amber);
	text-decoration: underline;
}
#privacy_policy_popup_close #privacy_policy_popup .links_wrap a:hover {
	background-color: transparent;
	text-decoration: none;
}

@media (max-width: 782px) {
	#privacy_policy_popup_close #privacy_policy_popup {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 16px 18px;
	}
	/* flex: 1 1 420px makes the copy block grow in a column too, which left a
	 * dead gap above the buttons on a phone. In column mode it sizes to content. */
	#privacy_policy_popup .consent_copy { flex: 0 0 auto; }
	#privacy_policy_popup .consent_actions { justify-content: stretch; }
	#privacy_policy_popup_close #privacy_policy_popup button.consent_btn { flex: 1 1 auto; }
	#privacy_policy_popup .popup_notice { font-size: 12.5px; }
	#privacy_policy_popup_close #privacy_policy_popup .popup_header h2 { font-size: 17px; }
}

/* ---------- settings panel ---------- */

.prosafe-consent-settings {
	font-family: var(--ps-consent-font);
	color: var(--ps-consent-ink);
	max-width: 760px;
	margin: 24px 0;
}

.prosafe-consent-row {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 18px 0;
	border-bottom: 1px solid var(--ps-consent-line);
}
.prosafe-consent-row:first-child { border-top: 1px solid var(--ps-consent-line); }

.prosafe-consent-text h3 {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	color: var(--ps-consent-navy);
}
.prosafe-consent-text p {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
}
.prosafe-consent-always {
	margin-right: 8px;
	font-size: 12px;
	font-weight: 400;
	color: var(--ps-consent-amber);
}

/* switch */
.prosafe-consent-switch {
	position: relative;
	flex: 0 0 auto;
	width: 46px;
	height: 26px;
	margin-top: 2px;
}
.prosafe-consent-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}
.prosafe-consent-slider {
	position: absolute;
	inset: 0;
	background: #c9ced3;
	border-radius: 26px;
	transition: background .18s ease;
	pointer-events: none;
}
.prosafe-consent-slider::before {
	content: "";
	position: absolute;
	top: 3px;
	right: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	transition: transform .18s ease;
}
.prosafe-consent-switch input:checked + .prosafe-consent-slider { background: var(--ps-consent-amber); }
.prosafe-consent-switch input:checked + .prosafe-consent-slider::before { transform: translateX(-20px); }
.prosafe-consent-switch input:disabled + .prosafe-consent-slider { background: #b6bcc2; }
.prosafe-consent-switch input:disabled { cursor: default; }
.prosafe-consent-switch input:focus-visible + .prosafe-consent-slider {
	outline: 2px solid var(--ps-consent-navy);
	outline-offset: 2px;
}

.prosafe-consent-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 22px;
}
.prosafe-consent-saved {
	margin: 12px 0 0;
	font-size: 14px;
	color: #1d7a3c;
}
.prosafe-consent-saved[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
	.consent_btn,
	.prosafe-consent-slider,
	.prosafe-consent-slider::before { transition: none; }
}
