/* Preference center, revisit widget and interaction styles.
 * Shared panel styles live in banner-critical.css, inlined on the frontend. */
/* In the modal the legal links sit in the footer row, pushed to the end. */
#cookiecare-banner .cookiecare-modal-footer .cookiecare-legal {
	margin-block-start: 0;
	margin-inline-start: auto;
}

/*
 * Modal footer buttons share the panel's one-row rule: the modal is its own
 * size container and the buttons live in a `.cookiecare-actions` group, so
 * the container-query clamp below shrinks them instead of wrapping. The
 * legal links wrap onto their own line when the row is full.
 */
#cookiecare-banner .cookiecare-modal {
	container-type: inline-size;
}

#cookiecare-banner .cookiecare-modal-footer .cookiecare-actions {
	margin-block-start: 0;
}

@supports (font-size: 1cqw) {
	#cookiecare-banner .cookiecare-modal-footer .cookiecare-actions .cookiecare-btn {
		font-size: min(var(--cc-fs-btn, 14px), 2.6cqw);
	}
}

/* -----------------------------------------------------------------------
 * Preference-center modal.
 * -------------------------------------------------------------------- */

#cookiecare-banner .cookiecare-modal {
	position: fixed;
	inset-block-start: 50%;
	inset-inline: 0;
	z-index: 999999;
	display: flex;
	width: 640px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 64px);
	margin-inline: auto;
	background: var(--cc-bg);
	background-image: var(--cc-modal-bg-img, none);
	background-position: center;
	background-size: cover;
	color: var(--cc-text);
	border-radius: var(--cc-radius);
	border: 1px solid rgba(128, 128, 128, 0.35);
	border: 1px solid color-mix(in srgb, var(--cc-text) 22%, transparent);
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
	transform: translateY(-50%);
}

#cookiecare-banner .cookiecare-modal-inner {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-height: inherit;
}

#cookiecare-banner .cookiecare-modal:focus,
#cookiecare-banner .cookiecare-modal-inner:focus {
	outline: none;
}

#cookiecare-banner .cookiecare-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-block-end: 1px solid rgba(0, 0, 0, 0.1);
}

#cookiecare-banner .cookiecare-modal-heading {
	flex: 1 1 auto;
	min-width: 0;
}

/*
 * Decision-progress ring. Fill = categories decided (on OR off), driven by
 * banner.js via stroke-dashoffset (circumference 2π·20 ≈ 125.66).
 */
#cookiecare-banner .cookiecare-ring {
	position: relative;
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
}

#cookiecare-banner .cookiecare-ring svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

#cookiecare-banner .cookiecare-ring circle {
	fill: none;
	stroke-width: 4;
}

#cookiecare-banner .cookiecare-ring-track {
	stroke: rgba(0, 0, 0, 0.12);
}

#cookiecare-banner .cookiecare-ring-bar {
	stroke: var(--cc-btn-bg);
	stroke-linecap: round;
	stroke-dasharray: 125.66;
	stroke-dashoffset: 125.66;
	transition: stroke-dashoffset 0.35s ease;
}

#cookiecare-banner .cookiecare-ring-count {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 14px;
}

#cookiecare-banner .cookiecare-ring-total {
	margin-inline-start: 1px;
	font-size: 10px;
	font-weight: 400;
	opacity: 0.7;
}

#cookiecare-banner .cookiecare-modal-status {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.75;
}

#cookiecare-banner .cookiecare-modal-title {
	font-family: var(--cc-font-heading, inherit);
	font-size: calc(var(--cc-fs-title, 16px) + 2px);
	font-weight: 600;
}

#cookiecare-banner .cookiecare-modal-close {
	padding: 4px 8px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

#cookiecare-banner .cookiecare-modal-body {
	padding: 16px 20px;
	overflow-y: auto;
}

#cookiecare-banner .cookiecare-modal-intro {
	margin-block-end: 16px;
	font-size: 13px;
}

#cookiecare-banner .cookiecare-modal-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 16px 20px;
	border-block-start: 1px solid rgba(0, 0, 0, 0.1);
}

#cookiecare-banner .cookiecare-withdraw {
	margin-inline-start: auto;
}

/* --- Categories. --- */

#cookiecare-banner .cookiecare-category {
	margin-block-end: 10px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: var(--cc-radius);
}

#cookiecare-banner .cookiecare-category-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
}

#cookiecare-banner .cookiecare-category-name {
	flex: 1 1 auto;
	font-size: 14px;
	font-weight: 600;
}

#cookiecare-banner .cookiecare-always-active {
	flex: none;
	font-size: 12px;
	opacity: 0.75;
}

#cookiecare-banner .cookiecare-category-toggle {
	flex: none;
	padding: 4px;
	border: 0;
	background: none;
	color: var(--cc-btn-bg);
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
}

#cookiecare-banner .cookiecare-category-body {
	padding: 0 14px 12px;
	font-size: 13px;
}

#cookiecare-banner .cookiecare-category-description {
	margin-block-end: 8px;
}

/* --- Toggle switches (button[role="switch"]). --- */

#cookiecare-banner .cookiecare-switch {
	position: relative;
	flex: none;
	width: 40px;
	height: 22px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.15);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

#cookiecare-banner .cookiecare-switch-track {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
}

#cookiecare-banner .cookiecare-switch-track::after {
	content: "";
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #ffffff;
	transition: inset-inline-start 0.15s ease;
}

#cookiecare-banner .cookiecare-switch[aria-checked="true"] {
	border-color: var(--cc-btn-bg);
	background: var(--cc-btn-bg);
}

#cookiecare-banner .cookiecare-switch[aria-checked="true"] .cookiecare-switch-track::after {
	inset-inline-start: calc(100% - 18px);
}

#cookiecare-banner .cookiecare-switch:disabled {
	cursor: not-allowed;
	opacity: 0.7;
}

/* --- Per-category cookie table. --- */

#cookiecare-banner .cookiecare-cookie-table {
	width: 100%;
	margin-block-start: 8px;
	border-collapse: collapse;
	font-size: 12px;
}

#cookiecare-banner .cookiecare-cookie-table th,
#cookiecare-banner .cookiecare-cookie-table td {
	padding: 6px 8px;
	border-block-end: 1px solid rgba(0, 0, 0, 0.08);
	text-align: start;
	vertical-align: top;
}

#cookiecare-banner .cookiecare-cookie-table th {
	font-weight: 600;
	opacity: 0.8;
}

/* -----------------------------------------------------------------------
 * Revisit widget.
 * -------------------------------------------------------------------- */

#cookiecare-banner .cookiecare-revisit {
	position: fixed;
	inset-block-end: var(--cc-rv-y, 16px);
	z-index: 999998;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--cc-btn-bg);
	color: var(--cc-btn-text);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#cookiecare-banner .cookiecare-revisit-bottom-left {
	inset-inline-start: var(--cc-rv-x, 16px);
}

#cookiecare-banner .cookiecare-revisit-bottom-right {
	inset-inline-end: var(--cc-rv-x, 16px);
}

/* -----------------------------------------------------------------------
 * Responsive & motion preferences.
 * -------------------------------------------------------------------- */

@media (max-width: 600px) {
	/*
	 * Keep a viewport-relative clamp here. `max-width: none` used to drop the
	 * base-rule safety net while the layout `width` survived on specificity,
	 * which is what let the panel run off-screen.
	 */
	#cookiecare-banner .cookiecare-panel,
	#cookiecare-banner .cookiecare-modal {
		width: auto;
		max-width: calc(100vw - 24px);
	}

	/* Full-width on small screens, regardless of the configured position. */
	#cookiecare-banner.cookiecare-layout-box .cookiecare-panel,
	#cookiecare-banner.cookiecare-layout-popup .cookiecare-panel {
		inset-inline: 12px;
		margin-inline: 0;
	}

	#cookiecare-banner .cookiecare-modal {
		inset-inline: 12px;
		max-height: calc(100vh - 48px);
	}

	#cookiecare-banner.cookiecare-layout-bar .cookiecare-panel {
		padding: 14px;
	}

	/*
	 * Three long labels can never share one row on a phone-width modal —
	 * stack them full-width instead (the standard CMP pattern). The banner
	 * panel keeps its one-row clamp; only the modal footer stacks.
	 */
	#cookiecare-banner .cookiecare-modal-footer .cookiecare-actions {
		flex-wrap: wrap;
	}

	#cookiecare-banner .cookiecare-modal-footer .cookiecare-actions .cookiecare-btn {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	#cookiecare-banner *,
	#cookiecare-banner *::before,
	#cookiecare-banner *::after {
		transition: none !important;
	}
}

/* -----------------------------------------------------------------------
 * RTL ([dir="rtl"]): logical properties above already flip layout; these
 * cover text alignment and the remaining asymmetric pieces.
 * -------------------------------------------------------------------- */

[dir="rtl"] #cookiecare-banner {
	text-align: right;
}

[dir="rtl"] #cookiecare-banner .cookiecare-cookie-table th,
[dir="rtl"] #cookiecare-banner .cookiecare-cookie-table td {
	text-align: right;
}

[dir="rtl"] #cookiecare-banner .cookiecare-modal-close {
	margin-inline-start: auto;
}

/* --------------------------------------------------------------------------
 * Motion: a short entrance so the banner does not pop in, a press response on
 * the buttons, and a fade-out once a choice is made. Only opacity/transform
 * are animated, so nothing reflows and no layout shift is introduced.
 * Everything below is disabled under prefers-reduced-motion.
 * ----------------------------------------------------------------------- */

#cookiecare-banner .cookiecare-btn:active {
	transform: translateY(1px);
}

@keyframes cookiecare-enter {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

#cookiecare-banner .cookiecare-modal:not([hidden]),
#cookiecare-banner .cookiecare-revisit:not([hidden]) {
	animation: cookiecare-enter 0.24s ease-out both;
}

/* Center layouts carry their own translate; animating it would fight them. */
#cookiecare-banner .cookiecare-modal:not([hidden]) {
	animation-name: cookiecare-fade-in;
}

@keyframes cookiecare-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

#cookiecare-banner .cookiecare-panel.cookiecare-leaving,
#cookiecare-banner .cookiecare-modal.cookiecare-leaving,
#cookiecare-banner .cookiecare-revisit.cookiecare-leaving {
	animation: none;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

#cookiecare-banner .cookiecare-panel.cookiecare-leaving,
#cookiecare-banner .cookiecare-revisit.cookiecare-leaving {
	transform: translateY(8px);
}

@media (prefers-reduced-motion: reduce) {
	#cookiecare-banner .cookiecare-panel:not([hidden]),
	#cookiecare-banner .cookiecare-modal:not([hidden]),
	#cookiecare-banner .cookiecare-revisit:not([hidden]) {
		animation: none;
	}

	#cookiecare-banner .cookiecare-btn:active {
		transform: none;
	}

	#cookiecare-banner .cookiecare-panel.cookiecare-leaving,
	#cookiecare-banner .cookiecare-modal.cookiecare-leaving,
	#cookiecare-banner .cookiecare-revisit.cookiecare-leaving {
		transition: none;
		transform: none;
	}
}
