/**
 * Bandeau de consentement (inc/consent.php, assets/js/consent.js).
 *
 * Barre discrète en bas d'écran, sans voile ni blocage du défilement. « Tout refuser » et
 * « Tout accepter » ont exactement le même style (exigence CNIL : refuser aussi simplement
 * qu'accepter). ⚠️ Kadence stylise tous les <button> (fond #333, ombre au survol, au focus et au
 * clic) : chaque état est redéclaré ici.
 */

.cristime-consent[hidden],
.cristime-consent-panel[hidden] {
	display: none;
}

/* ── Barre ─────────────────────────────────────────────────────────────── */

.cristime-consent {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	background: #fff;
	color: var(--cristime-ink);
	border-top: 1px solid var(--cristime-border);
	box-shadow: 0 -6px 24px rgba(26, 26, 26, 0.08);
	font-size: 14px;
	line-height: 1.5;
}

.cristime-consent__inner {
	box-sizing: border-box;
	max-width: var(--global-content-width, 1290px);
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	align-items: center;
	gap: 24px;
}

.cristime-consent__text {
	flex: 1 1 auto;
	margin: 0;
	color: var(--cristime-ink);
}

.cristime-consent__title {
	font-weight: 600;
	margin-right: 4px;
}

.cristime-consent__text a {
	color: var(--cristime-ink);
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.cristime-consent__actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

/* ── Boutons (barre et panneau) ─────────────────────────────────────────── */

.cristime-consent .cristime-consent__btn,
.cristime-consent-panel .cristime-consent__btn {
	box-sizing: border-box;
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	border: 1px solid var(--cristime-ink);
	border-radius: 0;
	background: var(--cristime-ink);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cristime-consent .cristime-consent__btn:hover,
.cristime-consent-panel .cristime-consent__btn:hover {
	background: #3a3a3a;
	border-color: #3a3a3a;
	color: #fff;
	box-shadow: none;
}

.cristime-consent .cristime-consent__btn:focus,
.cristime-consent .cristime-consent__btn:active,
.cristime-consent-panel .cristime-consent__btn:focus,
.cristime-consent-panel .cristime-consent__btn:active {
	background: var(--cristime-ink);
	border-color: var(--cristime-ink);
	color: #fff;
	box-shadow: none;
}

.cristime-consent .cristime-consent__btn:focus-visible,
.cristime-consent-panel .cristime-consent__btn:focus-visible {
	outline: 2px solid var(--cristime-accent-dark);
	outline-offset: 2px;
}

/* « Personnaliser » : lien, pas un troisième bouton plein. */
.cristime-consent .cristime-consent__btn--link,
.cristime-consent .cristime-consent__btn--link:hover,
.cristime-consent .cristime-consent__btn--link:focus,
.cristime-consent .cristime-consent__btn--link:active {
	background: transparent;
	border-color: transparent;
	color: var(--cristime-ink);
	padding-left: 8px;
	padding-right: 8px;
	text-decoration: underline;
	text-underline-offset: 3px;
	box-shadow: none;
}

.cristime-consent .cristime-consent__btn--link:hover {
	color: var(--cristime-accent-dark);
}

/* ── Panneau de réglage ─────────────────────────────────────────────────── */

.cristime-consent-panel {
	position: fixed;
	inset: 0;
	z-index: 99995;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(26, 26, 26, 0.45);
}

html.cristime-consent-panel-open {
	overflow: hidden;
}

.cristime-consent-panel__box {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	padding: 28px 28px 24px;
	background: #fff;
	color: var(--cristime-ink);
	font-size: 14px;
	line-height: 1.55;
	outline: none;
}

.cristime-consent-panel .cristime-consent-panel__close,
.cristime-consent-panel .cristime-consent-panel__close:hover,
.cristime-consent-panel .cristime-consent-panel__close:focus,
.cristime-consent-panel .cristime-consent-panel__close:active {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--cristime-ink);
	box-shadow: none;
	cursor: pointer;
}

.cristime-consent-panel .cristime-consent-panel__close:hover {
	color: var(--cristime-accent-dark);
}

.cristime-consent-panel .cristime-consent-panel__close:focus-visible {
	outline: 2px solid var(--cristime-accent-dark);
	outline-offset: -2px;
}

.cristime-consent-panel__close svg {
	flex: 0 0 auto;
}

.cristime-consent-panel .cristime-consent-panel__title {
	margin: 0 40px 8px 0;
	font-size: 20px;
	line-height: 1.3;
	font-weight: 600;
	color: var(--cristime-ink);
}

.cristime-consent-panel__intro {
	margin: 0 0 20px;
	color: var(--cristime-muted);
}

.cristime-consent-panel__group {
	padding: 16px 0;
	border-top: 1px solid var(--cristime-line);
}

.cristime-consent-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0;
	cursor: pointer;
}

.cristime-consent-panel__group:first-of-type .cristime-consent-panel__head {
	cursor: default;
}

.cristime-consent-panel__name {
	font-weight: 600;
	font-size: 15px;
}

.cristime-consent-panel__always {
	font-size: 13px;
	color: var(--cristime-accent-dark);
	font-weight: 600;
}

.cristime-consent-panel__desc {
	margin: 6px 0 0;
	color: var(--cristime-muted);
}

.cristime-consent-panel__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 8px;
	padding-top: 20px;
	border-top: 1px solid var(--cristime-line);
}

.cristime-consent-panel__actions .cristime-consent__btn {
	flex: 1 1 0;
	min-width: 0;
	padding-left: 12px;
	padding-right: 12px;
	white-space: normal;
}

/* Panneau ouvert : la barre s'efface derrière lui. */
html.cristime-consent-panel-open .cristime-consent {
	visibility: hidden;
}

/* ── Interrupteur ─────────────────────────────────────────────────────── */

.cristime-consent-switch {
	position: relative;
	flex: 0 0 auto;
	width: 44px;
	height: 26px;
}

.cristime-consent-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.cristime-consent-switch__track {
	position: absolute;
	inset: 0;
	border-radius: 13px;
	background: var(--cristime-border);
	transition: background-color 0.15s ease;
}

.cristime-consent-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(26, 26, 26, 0.25);
	transition: transform 0.15s ease;
}

.cristime-consent-switch input:checked + .cristime-consent-switch__track {
	background: var(--cristime-ink);
}

.cristime-consent-switch input:checked + .cristime-consent-switch__track::after {
	transform: translateX(18px);
}

.cristime-consent-switch input:focus-visible + .cristime-consent-switch__track {
	outline: 2px solid var(--cristime-accent-dark);
	outline-offset: 2px;
}

/* ── Lien du pied de page ──────────────────────────────────────────────── */

.cristime-footer__copyright a[data-consent-open] {
	cursor: pointer;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
	.cristime-consent__inner {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
	}

	.cristime-consent {
		font-size: 13px;
	}

	.cristime-consent__actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	/* Refuser et Accepter côte à côte, à égalité ; Personnaliser dessous. */
	.cristime-consent__actions [data-consent="none"] {
		grid-column: 1;
		grid-row: 1;
	}

	.cristime-consent__actions [data-consent="all"] {
		grid-column: 2;
		grid-row: 1;
	}

	.cristime-consent__actions .cristime-consent__btn--link {
		grid-column: 1 / -1;
		grid-row: 2;
		min-height: 36px;
		padding-top: 4px;
		padding-bottom: 4px;
	}

	.cristime-consent .cristime-consent__btn,
	.cristime-consent-panel .cristime-consent__btn {
		white-space: normal;
		font-size: 14px;
	}

	.cristime-consent-panel {
		align-items: flex-end;
		padding: 0;
	}

	.cristime-consent-panel__box {
		max-width: none;
		max-height: 92vh;
		max-height: 92dvh;
		padding: 24px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.cristime-consent-panel__actions {
		flex-direction: column;
	}

	.cristime-consent-panel__actions .cristime-consent__btn {
		flex: 0 0 auto;
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cristime-consent-switch__track,
	.cristime-consent-switch__track::after,
	.cristime-consent .cristime-consent__btn,
	.cristime-consent-panel .cristime-consent__btn {
		transition: none;
	}
}
