/**
 * Green Lion — cookie consent (inc/gl-consent.php, assets/js/gl-consent.js). Nov 2026.
 * Bottom bar (non-blocking) + preferences dialog. Plain CSS, scoped to .gl-cc.
 * Sits below the login modal (999999) and search overlay (99999).
 */

.gl-cc {
	--cc-green: var(--gl-green, #00bf1f);
	--cc-green-hover: #00a81b;
	--cc-ink: #111613;
	--cc-body: #374151;
	--cc-muted: #6b7280;
	--cc-line: #e5e7eb;
	--cc-soft: #e6f7eb;
	font-family: var(--gl-font, 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
	font-size: 14px;
	line-height: 1.5;
	color: var(--cc-body);
}
.gl-cc[hidden],
.gl-cc [hidden] { display: none !important; }
.gl-cc *,
.gl-cc *::before,
.gl-cc *::after { box-sizing: border-box; }
.gl-cc p { margin: 0; }

/* ---------- bar ---------- */
.gl-cc__bar {
	position: fixed;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 99990;
	max-width: 1100px;
	margin-inline: auto;
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 18px 22px;
	background: #fff;
	border: 1px solid var(--cc-line);
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(17, 22, 19, .18);
	transform: translateY(calc(100% + 24px));
	opacity: 0;
	transition: transform .3s ease, opacity .3s ease;
	padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
.gl-cc.is-visible .gl-cc__bar { transform: none; opacity: 1; }

.gl-cc__copy { flex: 1 1 auto; min-width: 0; }
.gl-cc__title { font-weight: 600; font-size: 15px; color: var(--cc-ink); margin-bottom: 2px !important; }
.gl-cc__text a,
.gl-cc__prefs a { color: var(--cc-ink); text-decoration: underline; text-underline-offset: 2px; }
.gl-cc__text a:hover { color: var(--cc-green-hover); }

.gl-cc__actions {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	align-items: center;
}

/* ---------- buttons (equal weight for accept / reject) ---------- */
.gl-cc__btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0 18px;
	border: 1.5px solid transparent;
	border-radius: 10px;
	font: inherit;
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .2s, border-color .2s, color .2s;
	text-transform: none;
	letter-spacing: 0;
}
.gl-cc__btn--primary { background: var(--cc-green); color: var(--cc-ink); }
.gl-cc__btn--primary:hover { background: var(--cc-green-hover); color: var(--cc-ink); }
.gl-cc__btn--line { background: #fff; border-color: var(--cc-ink); color: var(--cc-ink); }
.gl-cc__btn--line:hover { background: var(--cc-ink); color: #fff; }
.gl-cc__btn--ghost { background: transparent; color: var(--cc-ink); text-decoration: underline; text-underline-offset: 3px; padding: 0 10px; }
.gl-cc__btn--ghost:hover { color: var(--cc-green-hover); background: transparent; }
.gl-cc__btn:focus-visible,
.gl-cc__x:focus-visible,
.gl-cc__switch input:focus-visible + span,
.gl-cc-open:focus-visible { outline: 2px solid var(--cc-green); outline-offset: 2px; }

/* ---------- preferences dialog ---------- */
.gl-cc__overlay {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 99994;
	background: rgba(17, 22, 19, .5);
}
.gl-cc__prefs {
	position: fixed;
	z-index: 99995;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 32px);
	max-width: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(17, 22, 19, .3);
	outline: none;
}
.gl-cc__prefs-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid var(--cc-line);
}
.gl-cc__prefs-title { font-weight: 600; font-size: 18px; color: var(--cc-ink); }
.gl-cc__x {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--cc-ink);
	cursor: pointer;
}
.gl-cc__x:hover { background: var(--cc-soft); }
.gl-cc__prefs-body {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 22px;
}
.gl-cc__cat { padding: 14px 0; border-bottom: 1px solid var(--cc-line); }
.gl-cc__cat:last-child { border-bottom: 0; }
.gl-cc__cat p { color: var(--cc-muted); font-size: 13px; margin-top: 4px; }
.gl-cc__cat-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0;
	cursor: pointer;
}
.gl-cc__cat-name { font-weight: 600; color: var(--cc-ink); }
.gl-cc__always {
	font-size: 12px;
	font-weight: 600;
	color: #0b7a1d;
	background: var(--cc-soft);
	padding: 4px 10px;
	border-radius: 999px;
}

/* toggle switch — the real checkbox stays in the a11y tree */
.gl-cc__switch { position: relative; flex: 0 0 auto; width: 44px; height: 24px; }
.gl-cc__switch input {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}
.gl-cc__switch span {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	border-radius: 999px;
	background: #cbd5d0;
	transition: background-color .2s;
}
.gl-cc__switch span::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .2s;
}
.gl-cc__switch input:checked + span { background: var(--cc-green); }
.gl-cc__switch input:checked + span::after { transform: translateX(20px); }

.gl-cc__prefs-foot {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	padding: 16px 22px;
	border-top: 1px solid var(--cc-line);
}

html.gl-cc-locked,
html.gl-cc-locked body { overflow: hidden; }

/* re-open link (footer / shortcode) */
.gl-cc-open {
	appearance: none;
	-webkit-appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* ---------- tablet ---------- */
/* Sit above the floating bottom nav (gl-header.css .gl-fnav, ≤1024px) so it stays usable. */
@media (max-width: 1024px) {
	.gl-cc__bar {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
		bottom: calc(var(--gl-fnav-h, 72px) + 28px + env(safe-area-inset-bottom, 0px));
	}
	.gl-cc__actions { justify-content: flex-end; }
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
	.gl-cc__bar {
		left: 10px;
		right: 10px;
		padding: 16px;
		max-height: calc(100vh - var(--gl-fnav-h, 72px) - 120px);
		overflow-y: auto;
	}
	.gl-cc__text { font-size: 13px; }
	.gl-cc__actions { display: grid; grid-template-columns: 1fr 1fr; }
	.gl-cc__actions .gl-cc__btn--ghost { grid-column: 1 / -1; order: 3; min-height: 32px; }
	.gl-cc__actions .gl-cc__btn { width: 100%; white-space: normal; text-align: center; }

	.gl-cc__prefs {
		top: auto;
		bottom: 0;
		left: 0;
		transform: none;
		width: 100%;
		max-width: none;
		border-radius: 16px 16px 0 0;
		max-height: calc(100vh - 48px);
		max-height: calc(100dvh - 48px);
	}
	.gl-cc__prefs-foot {
		flex-direction: column-reverse;
		padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
	.gl-cc__prefs-foot .gl-cc__btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.gl-cc__bar,
	.gl-cc__switch span,
	.gl-cc__switch span::after { transition: none; }
}
