/**
 * Cookie Consent — banner, preferences dialog & floating button.
 * plg_system_cookieconsent
 *
 * Self-contained; inherits the site palette via a few CSS custom properties
 * with safe fallbacks, so it looks native but works on any template.
 *
 * @copyright (C) 2026 inextremis.be
 * @license   GNU General Public License version 2 or later; see LICENSE.txt
 */

.cc-root {
	--cc-bg: #ffffff;
	--cc-fg: #1a2433;
	--cc-muted: #5a6677;
	--cc-border: #e2e6ec;
	--cc-accent: var(--accent, #1f7a4d);
	--cc-accent-fg: #ffffff;
	--cc-radius: 14px;
	--cc-shadow: 0 18px 50px rgba(0, 0, 0, .28);

	position: fixed;
	z-index: 2147482000;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.5;
	color: var(--cc-fg);
}

.cc-root[hidden],
.cc-root [hidden] {
	display: none !important;
}

/* Interaction-blocking overlay (optional). */
.cc-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 16, 26, .55);
	z-index: -1;
}

.cc-block .cc-overlay { z-index: 0; }

/* --------------------------------------------------------------------- */
/* Banner                                                                */
/* --------------------------------------------------------------------- */
.cc-pos--bottom,
.cc-pos--bottom-left,
.cc-pos--bottom-right { inset: auto 0 0 0; }

.cc-banner {
	position: fixed;
	z-index: 2147482001;
	background: var(--cc-bg);
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	max-width: 760px;
	width: calc(100% - 2rem);
}

.cc-pos--bottom .cc-banner { left: 50%; bottom: 1rem; transform: translateX(-50%); }
.cc-pos--bottom-left .cc-banner { left: 1rem; bottom: 1rem; }
.cc-pos--bottom-right .cc-banner { right: 1rem; bottom: 1rem; }
.cc-pos--center .cc-banner { left: 50%; top: 50%; transform: translate(-50%, -50%); }

.cc-banner__inner {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1.25rem 1.4rem;
}

.cc-banner__title {
	margin: 0 0 .35rem;
	font-size: 1.15rem;
	font-weight: 700;
}

.cc-banner__desc {
	margin: 0;
	font-size: .95rem;
	color: var(--cc-muted);
}

.cc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	justify-content: flex-end;
}

@media (min-width: 720px) {
	.cc-banner__inner { flex-direction: row; align-items: center; }
	.cc-banner__text { flex: 1; }
	.cc-banner__actions { flex-shrink: 0; }
}

/* --------------------------------------------------------------------- */
/* Buttons                                                               */
/* --------------------------------------------------------------------- */
.cc-btn {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 10px;
	padding: .6rem 1.1rem;
	font-size: .92rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
	white-space: nowrap;
}

.cc-btn--primary {
	background: var(--cc-accent);
	color: var(--cc-accent-fg);
}

.cc-btn--primary:hover { filter: brightness(1.08); }

.cc-btn--ghost {
	background: transparent;
	color: var(--cc-fg);
	border-color: var(--cc-border);
}

.cc-btn--ghost:hover { background: rgba(0, 0, 0, .05); }

.cc-btn:focus-visible {
	outline: 2px solid var(--cc-accent);
	outline-offset: 2px;
}

.cc-link { color: var(--cc-accent); text-decoration: underline; }

/* --------------------------------------------------------------------- */
/* Preferences dialog                                                    */
/* --------------------------------------------------------------------- */
.cc-prefs {
	position: fixed;
	inset: 0;
	z-index: 2147482002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(10, 16, 26, .55);
}

.cc-prefs__panel {
	background: var(--cc-bg);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	width: min(560px, 100%);
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.cc-prefs__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.1rem 1.4rem;
	border-bottom: 1px solid var(--cc-border);
}

.cc-prefs__title { margin: 0; font-size: 1.2rem; font-weight: 700; }

.cc-prefs__close {
	border: 0;
	background: transparent;
	color: var(--cc-muted);
	cursor: pointer;
	display: inline-flex;
	padding: .25rem;
	border-radius: 8px;
}

.cc-prefs__close:hover { background: rgba(0, 0, 0, .06); color: var(--cc-fg); }

.cc-prefs__body {
	padding: 1rem 1.4rem;
	overflow-y: auto;
}

.cc-prefs__intro { margin: 0 0 1rem; color: var(--cc-muted); font-size: .92rem; }

.cc-cat {
	padding: .9rem 0;
	border-top: 1px solid var(--cc-border);
}

.cc-cat:first-of-type { border-top: 0; }

.cc-cat__head {
	display: flex;
	align-items: center;
	gap: .75rem;
}

.cc-cat__title { font-weight: 600; flex: 1; }

.cc-cat__always {
	font-size: .78rem;
	font-weight: 600;
	color: var(--cc-accent);
	text-transform: uppercase;
	letter-spacing: .03em;
}

.cc-cat__desc { margin: .45rem 0 0; font-size: .88rem; color: var(--cc-muted); }

.cc-prefs__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 1rem 1.4rem;
	border-top: 1px solid var(--cc-border);
}

.cc-prefs__foot-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* --------------------------------------------------------------------- */
/* Toggle switch                                                         */
/* --------------------------------------------------------------------- */
.cc-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	width: 46px;
	height: 26px;
	flex: 0 0 auto;
	cursor: pointer;
}

.cc-switch__input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.cc-switch::before {
	content: "";
	position: absolute;
	inset: 0;
	background: #c7ccd4;
	border-radius: 999px;
	transition: background .15s ease;
}

.cc-switch__dot {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .15s ease;
	z-index: 1;
}

.cc-switch__input:checked ~ .cc-switch__dot { transform: translateX(20px); }
.cc-switch:has(.cc-switch__input:checked)::before { background: var(--cc-accent); }

.cc-switch--locked::before { background: var(--cc-accent); opacity: .55; }
.cc-switch--locked .cc-switch__dot { transform: translateX(20px); }

.cc-switch__input:focus-visible ~ .cc-switch__dot {
	outline: 2px solid var(--cc-accent);
	outline-offset: 2px;
}

.cc-switch__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* --------------------------------------------------------------------- */
/* Floating re-open button                                               */
/* --------------------------------------------------------------------- */
.cc-fab {
	position: fixed;
	left: 1rem;
	bottom: 1rem;
	z-index: 2147481999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: var(--accent, #1f7a4d);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .26);
	transition: transform .15s ease;
}

.cc-fab[hidden] { display: none !important; }
.cc-fab:hover { transform: scale(1.06); }
.cc-fab:focus-visible { outline: 3px solid var(--accent, #1f7a4d); outline-offset: 2px; }

/* Keep the FAB clear of the accessibility launcher if both sit bottom-left. */
@media (max-width: 520px) {
	.cc-banner { width: calc(100% - 1rem); }
	.cc-banner__actions .cc-btn { flex: 1 1 auto; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
	.cc-btn, .cc-switch__dot, .cc-fab { transition: none; }
}
