/* Jolifish Cookies — styles sobres, personnalisables via variables CSS. */

.jfc {
	--jfc-primary: #1f2937;
	--jfc-bg: #ffffff;
	--jfc-text: #1f2937;
	--jfc-radius: 8px;
	--jfc-on-primary: #ffffff;
	--jfc-border: color-mix(in srgb, var(--jfc-text) 14%, transparent);
	--jfc-muted: color-mix(in srgb, var(--jfc-text) 72%, var(--jfc-bg));
	--jfc-shadow: 0 10px 40px rgba(0, 0, 0, .18);
	--jfc-z: 2147483000;
	font-size: 15px;
	line-height: 1.5;
}

.jfc [hidden],
.jfc[hidden] { display: none !important; }

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

/* ---------- Boutons ---------- */

.jfc-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 18px;
	margin: 0;
	border: 1.5px solid var(--jfc-primary);
	border-radius: var(--jfc-radius);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}
.jfc-btn--primary { background: var(--jfc-primary); color: var(--jfc-on-primary); }
.jfc-btn--primary:hover { opacity: .88; background: var(--jfc-primary); color: var(--jfc-on-primary); }
.jfc-btn--secondary { background: transparent; color: var(--jfc-primary); }
.jfc-btn--secondary:hover { background: color-mix(in srgb, var(--jfc-primary) 8%, transparent); color: var(--jfc-primary); }

.jfc-btn:focus-visible,
.jfc-link:focus-visible,
.jfc-close:focus-visible,
.jfc-float:focus-visible,
.jfc-switch input:focus-visible + .jfc-switch__track {
	outline: 2px solid var(--jfc-primary);
	outline-offset: 2px;
}

.jfc-link {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.jfc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.jfc-actions .jfc-btn { flex: 1 1 auto; }

/* ---------- Bandeau ---------- */

.jfc-banner {
	position: fixed;
	z-index: var(--jfc-z);
	background: var(--jfc-bg);
	color: var(--jfc-text);
	box-shadow: var(--jfc-shadow);
	padding: 20px;
	animation: jfc-in .25s ease-out;
}
.jfc-banner__title,
.jfc-modal__title {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--jfc-text);
}
.jfc-banner__text { color: var(--jfc-muted); margin-bottom: 16px; }
.jfc-banner__text p { margin: 0 0 6px; }
.jfc-banner__text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Encart en bas à gauche */
.jfc--box .jfc-banner {
	left: 16px;
	bottom: 16px;
	width: min(420px, calc(100vw - 32px));
	border-radius: var(--jfc-radius);
	border: 1px solid var(--jfc-border);
}
.jfc--box.jfc--float-right .jfc-banner { left: auto; right: 16px; }

/* Barre pleine largeur */
.jfc--bar .jfc-banner {
	left: 0;
	right: 0;
	bottom: 0;
	border-top: 1px solid var(--jfc-border);
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas: "title actions" "text actions";
	column-gap: 32px;
	align-items: center;
	padding: 18px max(20px, calc((100vw - 1200px) / 2));
}
.jfc--bar .jfc-banner__title { grid-area: title; }
.jfc--bar .jfc-banner__text { grid-area: text; margin-bottom: 0; }
.jfc--bar .jfc-actions { grid-area: actions; flex-wrap: nowrap; }

/* Fenêtre centrale */
.jfc--modal .jfc-banner {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(520px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow: auto;
	border-radius: var(--jfc-radius);
	animation: none;
}

/* ---------- Fond assombri ---------- */

.jfc-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--jfc-z) - 1);
	background: rgba(0, 0, 0, .45);
}
html.jfc-locked { overflow: hidden; }

/* ---------- Fenêtre de préférences ---------- */

.jfc-modal {
	position: fixed;
	z-index: var(--jfc-z);
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(600px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	background: var(--jfc-bg);
	color: var(--jfc-text);
	border-radius: var(--jfc-radius);
	box-shadow: var(--jfc-shadow);
}
.jfc-modal[hidden] { display: none; }
.jfc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	border-bottom: 1px solid var(--jfc-border);
}
.jfc-modal__head .jfc-modal__title { margin: 0; }
.jfc-close {
	appearance: none;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--jfc-text);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}
.jfc-close:hover { background: color-mix(in srgb, var(--jfc-text) 8%, transparent); }
.jfc-modal__body { padding: 16px 20px; overflow-y: auto; }
.jfc-modal__intro { color: var(--jfc-muted); }
.jfc-modal__intro p { margin: 0 0 12px; }
.jfc-modal__foot { padding: 16px 20px; border-top: 1px solid var(--jfc-border); }

.jfc-cats { list-style: none; margin: 0; padding: 0; }
.jfc-cat { padding: 14px 0; border-top: 1px solid var(--jfc-border); margin: 0; }
.jfc-cat__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.jfc-cat__label { font-weight: 600; cursor: pointer; margin: 0; }
.jfc-cat__desc { margin-top: 4px; font-size: 14px; color: var(--jfc-muted); }
.jfc-cat__always { font-style: italic; }

/* Interrupteur */
.jfc-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.jfc-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}
.jfc-switch input:disabled { cursor: not-allowed; }
.jfc-switch__track {
	position: absolute;
	inset: 0;
	border-radius: 24px;
	background: color-mix(in srgb, var(--jfc-text) 25%, var(--jfc-bg));
	transition: background-color .15s ease;
}
.jfc-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
	transition: transform .15s ease;
}
.jfc-switch input:checked + .jfc-switch__track { background: var(--jfc-primary); }
.jfc-switch input:checked + .jfc-switch__track::after { transform: translateX(20px); }
.jfc-switch input:disabled + .jfc-switch__track { opacity: .55; }

/* ---------- Bouton flottant ---------- */

.jfc-float {
	position: fixed;
	z-index: calc(var(--jfc-z) - 2);
	bottom: 16px;
	left: 16px;
	width: 44px;
	height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--jfc-border);
	border-radius: 50%;
	background: var(--jfc-bg);
	color: var(--jfc-primary);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
	cursor: pointer;
}
.jfc--float-right .jfc-float { left: auto; right: 16px; }
.jfc-float:hover { transform: scale(1.05); }

/* ---------- Aperçu des contenus bloqués (hors #jfc-root) ---------- */

.jfc-placeholder {
	--jfc-primary: #1f2937;
	--jfc-radius: 8px;
	--jfc-on-primary: #fff;
	box-sizing: border-box;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 200px;
	padding: 24px;
	background: #f3f4f6;
	color: #1f2937;
	border-radius: 6px;
	text-align: center;
	font-size: 14px;
	line-height: 1.5;
}
.jfc-placeholder p { margin: 0 0 12px; max-width: 46ch; }
.jfc-placeholder .jfc-link { margin-left: 10px; }
.jfc-placeholder + iframe[data-cookie-cat] { display: none; }
.wp-block-embed__wrapper > .jfc-placeholder { position: absolute; inset: 0; min-height: 0; }

/* ---------- Liste des cookies [jf_cookies_liste] ---------- */

.jfc-list__scroll { overflow-x: auto; margin-bottom: 24px; }
.jfc-list__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.jfc-list__table th,
.jfc-list__table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(0, 0, 0, .1); vertical-align: top; }

/* ---------- Mobile ---------- */

@media (max-width: 782px) {
	.jfc--bar .jfc-banner {
		display: block;
		padding: 16px;
	}
	.jfc--bar .jfc-banner__text { margin-bottom: 14px; }
	.jfc--bar .jfc-actions { flex-wrap: wrap; }
	.jfc--box .jfc-banner { left: 8px; right: 8px; bottom: 8px; width: auto; }
	.jfc-actions .jfc-btn { flex: 1 1 100%; }
	.jfc-actions { flex-direction: column-reverse; }
}

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

@media (prefers-reduced-motion: reduce) {
	.jfc *, .jfc-banner { animation: none !important; transition: none !important; }
}
