/* ==========================================================================
   MCF Afrique — Consentement cookies
   Tokens surchargeables : les variables --mcf-* viennent du style.css du thème.
   ========================================================================== */

.mcf-cc {
	--cc-accent: var(--mcf-color-primary, #0e5da8);
	--cc-accent-dark: var(--mcf-color-primary-dark, #0a4a86);
	--cc-bg: #ffffff;
	--cc-text: #16202e;
	--cc-muted: #5b6472;
	--cc-border: rgba(22, 32, 46, 0.1);
	--cc-radius: 18px;
	--cc-radius-sm: 10px;
	--cc-shadow: 0 12px 40px rgba(10, 20, 40, 0.18), 0 2px 8px rgba(10, 20, 40, 0.08);
	--cc-z: 99990;

	font-family: var(--mcf-font-body, inherit);
	font-size: 15px;
	line-height: 1.55;
	color: var(--cc-text);
}

@media (prefers-color-scheme: dark) {
	.mcf-cc {
		--cc-bg: #1b2432;
		--cc-text: #eef2f7;
		--cc-muted: #a7b0bd;
		--cc-border: rgba(238, 242, 247, 0.12);
		--cc-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
	}
}

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

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

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

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

.mcf-cc-link:hover {
	color: var(--cc-accent-dark);
}

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

.mcf-cc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 18px;
	border: 1.5px solid transparent;
	border-radius: var(--cc-radius-sm);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}

.mcf-cc-btn:active {
	transform: scale(0.97);
}

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

.mcf-cc-btn--primary {
	background: var(--cc-accent);
	color: #fff;
}

.mcf-cc-btn--primary:hover {
	background: var(--cc-accent-dark);
	color: #fff;
}

.mcf-cc-btn--secondary {
	background: transparent;
	border-color: var(--cc-border);
	color: var(--cc-text);
}

.mcf-cc-btn--secondary:hover {
	border-color: var(--cc-accent);
	color: var(--cc-accent);
}

.mcf-cc-btn--ghost {
	background: transparent;
	color: var(--cc-muted);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.mcf-cc-btn--ghost:hover {
	color: var(--cc-accent);
}

/* --------------------------------------------------------------------------
   Bannière — carte flottante (desktop), bottom-sheet (mobile)
   -------------------------------------------------------------------------- */

.mcf-cc-banner {
	position: fixed;
	z-index: var(--cc-z);
	bottom: 20px;
	left: 20px;
	width: min(430px, calc(100vw - 40px));
	padding: 22px 22px 20px;
	background: var(--cc-bg);
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 14px;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.mcf-cc-banner.is-open {
	opacity: 1;
	transform: translateY(0);
}

.mcf-cc-banner__icon {
	grid-row: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: color-mix(in srgb, var(--cc-accent) 12%, transparent);
	color: var(--cc-accent);
}

@supports not (background: color-mix(in srgb, red 10%, blue)) {
	.mcf-cc-banner__icon {
		background: rgba(14, 93, 168, 0.12);
	}
}

.mcf-cc-banner__body {
	grid-row: 1;
	min-width: 0;
}

.mcf-cc-banner__title {
	margin: 0 0 4px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.mcf-cc-banner__text {
	margin: 0;
	font-size: 13.5px;
	color: var(--cc-muted);
}

.mcf-cc-banner__actions {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
}

.mcf-cc-banner__actions .mcf-cc-btn--ghost {
	margin-left: auto;
	padding-left: 8px;
	padding-right: 8px;
}

/* --------------------------------------------------------------------------
   Overlay + modale
   -------------------------------------------------------------------------- */

.mcf-cc-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--cc-z) + 1);
	background: rgba(10, 16, 26, 0.55);
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.mcf-cc-overlay.is-open {
	opacity: 1;
}

.mcf-cc-modal {
	position: fixed;
	z-index: calc(var(--cc-z) + 2);
	top: 50%;
	left: 50%;
	transform: translate(-50%, -46%) scale(0.97);
	width: min(560px, calc(100vw - 32px));
	max-height: min(82vh, 700px);
	display: flex;
	flex-direction: column;
	background: var(--cc-bg);
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius);
	box-shadow: var(--cc-shadow);
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.mcf-cc-modal.is-open {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.mcf-cc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 22px 14px;
	border-bottom: 1px solid var(--cc-border);
}

.mcf-cc-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--cc-text);
}

.mcf-cc-modal__close {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--cc-muted);
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.mcf-cc-modal__close:hover {
	background: color-mix(in srgb, var(--cc-text) 8%, transparent);
	color: var(--cc-text);
}

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

.mcf-cc-modal__body {
	overflow-y: auto;
	padding: 16px 22px;
	overscroll-behavior: contain;
}

.mcf-cc-modal__intro {
	margin: 0 0 16px;
	font-size: 13.5px;
	color: var(--cc-muted);
}

.mcf-cc-modal__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	padding: 14px 22px 18px;
	border-top: 1px solid var(--cc-border);
}

/* Catégories */

.mcf-cc-cat {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 16px;
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius-sm);
}

.mcf-cc-cat + .mcf-cc-cat {
	margin-top: 10px;
}

.mcf-cc-cat__text {
	min-width: 0;
}

.mcf-cc-cat__label {
	display: block;
	font-weight: 600;
	font-size: 14.5px;
	margin-bottom: 2px;
}

.mcf-cc-cat__desc {
	display: block;
	font-size: 13px;
	color: var(--cc-muted);
}

/* Interrupteur */

.mcf-cc-switch {
	position: relative;
	flex: 0 0 auto;
	display: inline-block;
	margin-top: 2px;
	cursor: pointer;
}

.mcf-cc-switch.is-locked {
	cursor: not-allowed;
	opacity: 0.6;
}

.mcf-cc-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: inherit;
}

.mcf-cc-switch__track {
	display: block;
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--cc-muted) 35%, transparent);
	transition: background-color 0.2s ease;
}

@supports not (background: color-mix(in srgb, red 10%, blue)) {
	.mcf-cc-switch__track {
		background: rgba(91, 100, 114, 0.35);
	}
}

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

.mcf-cc-switch input:checked + .mcf-cc-switch__track {
	background: var(--cc-accent);
}

.mcf-cc-switch input:checked + .mcf-cc-switch__track::after {
	transform: translateX(20px);
}

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

/* --------------------------------------------------------------------------
   Bouton de réouverture
   -------------------------------------------------------------------------- */

.mcf-cc-reopen {
	position: fixed;
	z-index: var(--cc-z);
	bottom: 18px;
	left: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border: 1px solid var(--cc-border);
	border-radius: 50%;
	background: var(--cc-bg);
	color: var(--cc-accent);
	box-shadow: 0 4px 16px rgba(10, 20, 40, 0.16);
	cursor: pointer;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.18s ease;
}

.mcf-cc-reopen.is-open {
	opacity: 1;
	transform: translateY(0);
}

.mcf-cc-reopen:hover {
	box-shadow: 0 6px 22px rgba(10, 20, 40, 0.24);
}

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

/* --------------------------------------------------------------------------
   Mobile — la bannière et la modale deviennent des bottom-sheets
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.mcf-cc-banner {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		border-radius: var(--cc-radius) var(--cc-radius) 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
		transform: translateY(100%);
	}

	.mcf-cc-banner.is-open {
		transform: translateY(0);
	}

	.mcf-cc-banner__actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}

	.mcf-cc-banner__actions .mcf-cc-btn--primary,
	.mcf-cc-banner__actions .mcf-cc-btn--secondary {
		width: 100%;
	}

	.mcf-cc-banner__actions .mcf-cc-btn--ghost {
		grid-column: 1 / -1;
		margin-left: 0;
	}

	.mcf-cc-modal {
		top: auto;
		bottom: 0;
		left: 0;
		transform: translateY(100%);
		width: 100%;
		max-height: 88vh;
		border-radius: var(--cc-radius) var(--cc-radius) 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
	}

	.mcf-cc-modal.is-open {
		transform: translateY(0);
	}

	.mcf-cc-modal__footer {
		padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	}

	.mcf-cc-modal__footer .mcf-cc-btn {
		flex: 1 1 auto;
	}

	.mcf-cc-reopen {
		bottom: 14px;
		left: 14px;
		width: 42px;
		height: 42px;
	}
}

/* --------------------------------------------------------------------------
   Accessibilité — réduction des animations
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.mcf-cc-banner,
	.mcf-cc-modal,
	.mcf-cc-overlay,
	.mcf-cc-reopen,
	.mcf-cc-btn,
	.mcf-cc-switch__track,
	.mcf-cc-switch__track::after {
		transition: none;
	}
}
