/**
 * LH Consent - styly banneru a modalu.
 *
 * Barvy/rádius jdou přepsat per web redefinicí proměnných:
 *   .lh-consent { --lh-c-primary: #c00; }
 * Font se dědí z tématu přes --font-sans (fallback Manrope/system).
 */

.lh-consent {
	--lh-c-bg: #ffffff;
	--lh-c-fg: #0b1220;
	--lh-c-muted: #5b6472;
	--lh-c-primary: #1e40af;
	--lh-c-primary-fg: #ffffff;
	--lh-c-border: #e3e8ef;
	--lh-c-track: #cbd2dd;
	--lh-c-radius: 14px;
	--lh-c-shadow: 0 10px 40px rgba(7, 16, 35, 0.18);
	--lh-c-font: var(--font-sans, "Manrope", "Helvetica Neue", system-ui, sans-serif);
	--lh-c-z: 2147483600;
}

.lh-consent,
.lh-consent *,
.lh-consent *::before,
.lh-consent *::after {
	box-sizing: border-box;
}

/* ---- Banner (neblokující) ---- */
.lh-consent__banner {
	position: fixed;
	left: 50%;
	bottom: clamp(12px, 3vw, 28px);
	transform: translateX(-50%);
	width: min(560px, calc(100vw - 24px));
	z-index: var(--lh-c-z);
	animation: lh-c-in 0.28s ease both;
}

.lh-consent__panel {
	background: var(--lh-c-bg);
	color: var(--lh-c-fg);
	font-family: var(--lh-c-font);
	border: 1px solid var(--lh-c-border);
	border-radius: var(--lh-c-radius);
	box-shadow: var(--lh-c-shadow);
	padding: clamp(18px, 4vw, 26px);
}

.lh-consent__title {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0 0 0.4em;
	color: var(--lh-c-fg);
	line-height: 1.3;
}

.lh-consent__text {
	font-size: 0.9rem;
	line-height: 1.55;
	margin: 0 0 1.1em;
	color: var(--lh-c-muted);
}

.lh-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* ---- Tlačítka ---- */
.lh-consent__btn {
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	padding: 11px 16px;
	border-radius: 10px;
	border: 1px solid var(--lh-c-border);
	background: transparent;
	color: var(--lh-c-fg);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.lh-consent__btn:hover {
	background: color-mix(in srgb, var(--lh-c-fg) 7%, transparent);
}

.lh-consent__btn:active {
	transform: translateY(1px);
}

.lh-consent__btn--primary {
	background: var(--lh-c-primary);
	border-color: var(--lh-c-primary);
	color: var(--lh-c-primary-fg);
}

.lh-consent__btn--primary:hover {
	background: color-mix(in srgb, var(--lh-c-primary) 88%, #000);
}

/* Volby souhlasu (Přijmout / Odmítnout) - obě plná a se ZÁMĚRNĚ stejnou
   vizuální váhou, ať ani jedna není "lákavější" (GDPR: rovnocenné volby). */
.lh-consent__btn--choice {
	background: var(--lh-c-primary);
	border-color: var(--lh-c-primary);
	color: var(--lh-c-primary-fg);
	font-weight: 700;
	flex: 1 1 auto;
	min-width: 8.5em;
}

.lh-consent__btn--choice:hover {
	background: color-mix(in srgb, var(--lh-c-primary) 88%, #000);
}

.lh-consent__btn--ghost {
	border-color: transparent;
	color: var(--lh-c-muted);
	margin-left: auto;
}

.lh-consent__btn--ghost:hover {
	background: color-mix(in srgb, var(--lh-c-fg) 6%, transparent);
	color: var(--lh-c-fg);
}

/* ---- Modal (native <dialog>) ---- */
.lh-consent__modal {
	/* Centrování vynucené explicitně - globální reset tématu může na <dialog>
	   vynulovat margin a tím zabít defaultní `margin:auto` centrování. */
	position: fixed;
	inset: 0;
	margin: auto;
	width: min(540px, calc(100vw - 24px));
	max-height: min(86vh, 720px);
	padding: 0;
	border: none;
	background: transparent;
	color: var(--lh-c-fg);
	overflow: visible;
}

.lh-consent__modal::backdrop {
	background: rgba(7, 16, 35, 0.45);
}

.lh-consent__modal .lh-consent__panel {
	max-height: inherit;
	overflow-y: auto;
}

.lh-consent__modal[open] {
	animation: lh-c-in 0.24s ease both;
}

/* ---- Kategorie / přepínače ---- */
.lh-consent__cats {
	list-style: none;
	margin: 0 0 1.2em;
	padding: 0;
	display: grid;
	gap: 14px;
}

.lh-consent__cat {
	border: 1px solid var(--lh-c-border);
	border-radius: 12px;
	padding: 14px 16px;
}

.lh-consent__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.lh-consent__switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.95rem;
}

.lh-consent__checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.lh-consent__track {
	position: relative;
	flex: none;
	width: 40px;
	height: 22px;
	border-radius: 999px;
	background: var(--lh-c-track);
	transition: background 0.18s ease;
}

.lh-consent__track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.18s ease;
}

.lh-consent__checkbox:checked + .lh-consent__track {
	background: var(--lh-c-primary);
}

.lh-consent__checkbox:checked + .lh-consent__track::after {
	transform: translateX(18px);
}

.lh-consent__checkbox:disabled + .lh-consent__track {
	opacity: 0.55;
	cursor: not-allowed;
}

.lh-consent__checkbox:focus-visible + .lh-consent__track {
	outline: 2px solid var(--lh-c-primary);
	outline-offset: 3px;
}

.lh-consent__cat-label {
	color: var(--lh-c-fg);
}

.lh-consent__badge {
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--lh-c-muted);
	white-space: nowrap;
}

.lh-consent__cat-desc {
	margin: 0.6em 0 0;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--lh-c-muted);
}

/* ---- Tlačítko pro znovuotevření ---- */
.lh-consent__reopen {
	position: fixed;
	left: clamp(12px, 3vw, 24px);
	bottom: clamp(12px, 3vw, 24px);
	z-index: var(--lh-c-z);
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: 1px solid var(--lh-c-border);
	background: var(--lh-c-bg);
	color: var(--lh-c-primary);
	box-shadow: var(--lh-c-shadow);
	cursor: pointer;
	transition: transform 0.15s ease;
}

.lh-consent__reopen:hover {
	transform: scale(1.06);
}

/* ---- Společný focus ---- */
.lh-consent__btn:focus-visible,
.lh-consent__reopen:focus-visible {
	outline: 2px solid var(--lh-c-primary);
	outline-offset: 2px;
}

/* ---- Dark mode - téma řídí [data-theme="dark"] na <html> ---- */
[data-theme="dark"] .lh-consent {
	--lh-c-bg: #111827;
	--lh-c-fg: #e6ebf2;
	--lh-c-muted: #9aa5b5;
	--lh-c-border: #283142;
	--lh-c-track: #3a4356;
	--lh-c-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ---- Pohyb ---- */
@keyframes lh-c-in {
	from { opacity: 0; transform: translate(-50%, 12px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

.lh-consent__modal[open] {
	animation-name: lh-c-in-center;
}

@keyframes lh-c-in-center {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.lh-consent__banner,
	.lh-consent__modal[open],
	.lh-consent__btn,
	.lh-consent__track,
	.lh-consent__track::after,
	.lh-consent__reopen {
		animation: none !important;
		transition: none !important;
	}
}
