/*
 * Cookie consent banner, preferences dialog, floating button and declaration.
 *
 * Everything is driven by the --vfc-* variables the plugin prints from its
 * settings (see includes/consent.php), so these rules carry no brand colors.
 *
 * Selectors start with an ID where the element is ours (#vf-consent,
 * #vf-consent-prefs) so a theme's own button, heading and input styles do not
 * leak in. Properties a theme commonly sets on buttons are set explicitly, and
 * the button colors are !important because themes often style every <button>
 * that way; extra CSS in the settings can use !important too to override them.
 */

#vf-consent,
#vf-consent-prefs,
#vf-consent-badge {
	box-sizing: border-box;
	font-family: var(--vfc-font, inherit);
	font-size: var(--vfc-size, 15px);
	line-height: 1.5;
	font-weight: 400;
	font-style: normal;
	text-align: left;
	text-transform: none;
	letter-spacing: normal;
	color: var(--vfc-text, #1a1a1a);
}
#vf-consent *,
#vf-consent-prefs *,
#vf-consent-badge * {
	box-sizing: border-box;
}
#vf-consent[hidden],
#vf-consent-prefs[hidden],
#vf-consent-badge[hidden],
#vf-consent [hidden],
#vf-consent-prefs [hidden] {
	display: none !important;
}

/* ---------- Banner ---------------------------------------------------- */

#vf-consent {
	position: fixed;
	z-index: 2147483000;
	margin: 0;
	padding: 0;
}
#vf-consent .vf-consent__box {
	background: var(--vfc-bg, #fff);
	box-shadow: var(--vfc-shadow, 0 4px 24px rgba(0, 0, 0, .25));
	padding: 20px 24px;
}

#vf-consent.vf-consent--bar-bottom { left: 0; right: 0; bottom: 0; }
#vf-consent.vf-consent--bar-top    { left: 0; right: 0; top: 0; }
#vf-consent.vf-consent--bar-bottom .vf-consent__box,
#vf-consent.vf-consent--bar-top .vf-consent__box {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 32px;
	border-radius: 0;
}
#vf-consent.vf-consent--bar-bottom .vf-consent__body,
#vf-consent.vf-consent--bar-top .vf-consent__body {
	flex: 1 1 420px;
	min-width: 0;
	max-width: 900px;
}

#vf-consent.vf-consent--box-left,
#vf-consent.vf-consent--box-right {
	bottom: 16px;
	width: calc(100% - 32px);
	max-width: 440px;
}
#vf-consent.vf-consent--box-left  { left: 16px; }
#vf-consent.vf-consent--box-right { right: 16px; }
#vf-consent.vf-consent--box-left .vf-consent__box,
#vf-consent.vf-consent--box-right .vf-consent__box,
#vf-consent.vf-consent--center .vf-consent__box {
	border-radius: var(--vfc-radius, 4px);
}

#vf-consent.vf-consent--center {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: var(--vfc-overlay, rgba(0, 0, 0, .5));
	overflow: auto;
}
#vf-consent.vf-consent--center[hidden] { display: none !important; }
#vf-consent.vf-consent--center .vf-consent__box {
	width: 100%;
	max-width: 560px;
}

#vf-consent .vf-consent__title,
#vf-consent-prefs .vf-consent__title {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	font-family: inherit;
	font-size: 1.25em;
	font-weight: 700;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
	color: var(--vfc-text, #1a1a1a);
}
#vf-consent .vf-consent__msg {
	margin: 0;
	color: var(--vfc-text, #1a1a1a);
}
#vf-consent .vf-consent__msg p { margin: 0 0 8px; }
#vf-consent .vf-consent__links {
	margin: 8px 0 0;
	padding: 0;
	font-size: .9em;
}
#vf-consent .vf-consent__links a + a { margin-left: 16px; }

#vf-consent a,
#vf-consent-prefs a {
	color: var(--vfc-link, #0066cc);
	text-decoration: underline;
}
#vf-consent a:hover,
#vf-consent-prefs a:hover {
	text-decoration: none;
}

#vf-consent .vf-consent__actions,
#vf-consent-prefs .vf-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
}
#vf-consent.vf-consent--box-left .vf-consent__actions,
#vf-consent.vf-consent--box-right .vf-consent__actions,
#vf-consent.vf-consent--center .vf-consent__actions {
	margin-top: 16px;
}

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

#vf-consent .vf-consent__btn,
#vf-consent-prefs .vf-consent__btn,
.vf-consent-status .vf-consent__btn,
.vf-consent-placeholder .vf-consent__btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-block;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	border: 2px solid var(--vfc-sec-border, #1a1a1a) !important;
	border-radius: var(--vfc-radius, 4px);
	background: var(--vfc-sec-bg, #fff) !important;
	color: var(--vfc-sec-text, #1a1a1a) !important;
	box-shadow: none;
	font-family: inherit;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: none;
}
#vf-consent .vf-consent__btn:hover,
#vf-consent-prefs .vf-consent__btn:hover,
.vf-consent-status .vf-consent__btn:hover,
.vf-consent-placeholder .vf-consent__btn:hover {
	filter: brightness(.94);
}
#vf-consent .vf-consent__btn--primary,
#vf-consent-prefs .vf-consent__btn--primary,
.vf-consent-status .vf-consent__btn--primary,
.vf-consent-placeholder .vf-consent__btn--primary {
	background: var(--vfc-accent, #1a1a1a) !important;
	border-color: var(--vfc-accent, #1a1a1a) !important;
	color: var(--vfc-accent-text, #fff) !important;
}
#vf-consent .vf-consent__btn:focus-visible,
#vf-consent-prefs .vf-consent__btn:focus-visible,
#vf-consent-prefs .vf-consent__close:focus-visible,
#vf-consent-badge:focus-visible,
.vf-consent-status .vf-consent__btn:focus-visible,
.vf-consent-placeholder .vf-consent__btn:focus-visible {
	outline: 3px solid var(--vfc-link, #0066cc);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	#vf-consent .vf-consent__actions .vf-consent__btn,
	#vf-consent-prefs .vf-consent__actions .vf-consent__btn {
		flex: 1 1 100%;
	}
}

/* ---------- Preferences dialog ---------------------------------------- */

#vf-consent-prefs {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: var(--vfc-overlay, rgba(0, 0, 0, .5));
}
#vf-consent-prefs .vf-consent__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 640px;
	max-height: 100%;
	background: var(--vfc-bg, #fff);
	border-radius: var(--vfc-radius, 4px);
	box-shadow: var(--vfc-shadow, 0 4px 24px rgba(0, 0, 0, .25));
}
#vf-consent-prefs .vf-consent__head {
	padding: 20px 56px 0 24px;
}
#vf-consent-prefs .vf-consent__scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 8px 24px 16px;
}
#vf-consent-prefs .vf-consent__foot {
	padding: 16px 24px;
	border-top: 1px solid rgba(128, 128, 128, .35);
}
#vf-consent-prefs .vf-consent__close {
	appearance: none;
	-webkit-appearance: none;
	position: absolute;
	top: 10px;
	right: 10px;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--vfc-radius, 4px);
	background: transparent !important;
	color: var(--vfc-text, #1a1a1a) !important;
	box-shadow: none;
	font-family: inherit;
	font-size: 28px;
	line-height: 40px;
	text-align: center;
	cursor: pointer;
}

#vf-consent-prefs .vf-consent__cat {
	margin: 0;
	padding: 16px 0;
	border-bottom: 1px solid rgba(128, 128, 128, .35);
}
#vf-consent-prefs .vf-consent__cat:last-child { border-bottom: 0; }
#vf-consent-prefs .vf-consent__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
#vf-consent-prefs .vf-consent__cat-name {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 700;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
	color: var(--vfc-text, #1a1a1a);
}
#vf-consent-prefs .vf-consent__cat-desc {
	margin: 6px 0 0;
	padding: 0;
	font-size: .93em;
}
#vf-consent-prefs .vf-consent__always {
	font-size: .85em;
	font-weight: 700;
	white-space: nowrap;
}
#vf-consent-prefs details {
	margin: 8px 0 0;
	font-size: .9em;
}
#vf-consent-prefs summary {
	cursor: pointer;
	color: var(--vfc-link, #0066cc);
}
#vf-consent-prefs details ul {
	margin: 8px 0 0;
	padding: 0 0 0 18px;
	list-style: disc;
}
#vf-consent-prefs details li {
	margin: 0 0 6px;
	padding: 0;
}

/* Switch */
#vf-consent-prefs .vf-consent__switch {
	position: relative;
	display: inline-block;
	flex: 0 0 auto;
	width: 48px;
	height: 26px;
	margin: 0;
	padding: 0;
	cursor: pointer;
}
#vf-consent-prefs .vf-consent__switch input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: pointer;
}
#vf-consent-prefs .vf-consent__slider {
	position: absolute;
	inset: 0;
	border-radius: 26px;
	background: #8a8a8a;
	pointer-events: none;
	transition: background-color .15s;
}
#vf-consent-prefs .vf-consent__slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s;
}
#vf-consent-prefs .vf-consent__switch input:checked + .vf-consent__slider {
	background: var(--vfc-accent, #1a1a1a);
}
#vf-consent-prefs .vf-consent__switch input:checked + .vf-consent__slider::before {
	transform: translateX(22px);
}
#vf-consent-prefs .vf-consent__switch input:focus-visible + .vf-consent__slider {
	outline: 3px solid var(--vfc-link, #0066cc);
	outline-offset: 2px;
}

/* ---------- Floating settings button ---------------------------------- */

#vf-consent-badge {
	appearance: none;
	-webkit-appearance: none;
	position: fixed;
	bottom: 16px;
	z-index: 2147482000;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px !important;
	height: 44px !important;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	min-height: 0 !important;
	min-width: 0 !important;
	background: var(--vfc-accent, #1a1a1a) !important;
	color: var(--vfc-accent-text, #fff) !important;
	box-shadow: var(--vfc-shadow, 0 4px 24px rgba(0, 0, 0, .25));
	cursor: pointer;
}
#vf-consent-badge.vf-consent-badge--left  { left: 16px; }
#vf-consent-badge.vf-consent-badge--right { right: 16px; }
#vf-consent-badge svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* ---------- Held-back embeds ------------------------------------------ */

iframe[hidden][data-vf-consent],
iframe[hidden][data-cookieconsent] {
	display: none !important;
}
.vf-consent-placeholder {
	box-sizing: border-box;
	margin: 0 0 1em;
	padding: 24px;
	border: 1px dashed rgba(128, 128, 128, .6);
	text-align: center;
}
.vf-consent-placeholder p { margin: 0 0 12px; }

/* ---------- Cookie declaration ([vf_cookie_declaration]) --------------- */

.vf-consent-declaration .vf-consent-status {
	margin: 0 0 24px;
	padding: 16px;
	border: 1px solid rgba(128, 128, 128, .5);
	border-radius: var(--vfc-radius, 4px);
}
.vf-consent-declaration .vf-consent-status p { margin: 0 0 8px; }
.vf-consent-declaration .vf-consent-status .vf-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}
.vf-consent-declaration__scroll {
	margin: 0 0 24px;
	overflow-x: auto;
}
.vf-consent-declaration table {
	width: 100%;
	border-collapse: collapse;
	font-size: .9em;
}
.vf-consent-declaration th,
.vf-consent-declaration td {
	padding: 8px 10px;
	border: 1px solid rgba(128, 128, 128, .4);
	text-align: left;
	vertical-align: top;
}
.vf-consent-declaration th {
	background: rgba(128, 128, 128, .12);
}

@media (prefers-reduced-motion: reduce) {
	#vf-consent-prefs .vf-consent__slider,
	#vf-consent-prefs .vf-consent__slider::before {
		transition: none;
	}
}
