/**
 * Nutriforce CRM — Popups front.
 *
 * Design calqué sur les maquettes Nutriforce :
 *  - Layout split horizontal 50/50 sur desktop (texte à gauche, image full-bleed à droite)
 *  - Stack vertical sur mobile (image en haut compacte, contenu dessous)
 *  - Palette noir/blanc épurée
 *  - Typo : titres gras avec accents italiques sur la phrase clé
 *  - CTA : bouton noir rounded-full italique pleine largeur
 *  - Radio buttons épurés (cercles simples)
 *
 * 4 templates : modal centré (split desktop) / bottom-sheet (mobile-first) /
 * slide-in droite (compact) / banner bas (passif texte seul).
 */

.nf-crm-popup-root {
	--nfp-bg: #ffffff;
	--nfp-text: #0a0a0a;
	--nfp-text-muted: #6b6b6b;
	--nfp-text-soft: #9a9a9a;
	--nfp-border: #e8e5dd;
	--nfp-input-border: #d8d4c8;
	--nfp-cta-bg: #0a0a0a;
	--nfp-cta-bg-hover: #000;
	--nfp-cta-text: #ffffff;
	/* Highlight beige (palette produit Nutriforce) appliqué au <em> dans titres/subtitles */
	--nfp-highlight-bg: #ead9b3;
	--nfp-highlight-text: #0a0a0a;
	/* Bords carrés conformes aux maquettes (10.png, "Page d'accueil", "Vous partez déjà") */
	--nfp-radius: 0;
	--nfp-radius-pill: 999px;
	--nfp-shadow: 0 30px 80px rgba(20, 20, 18, 0.28);

	/* Inter doit être déjà chargé par le thème (Astra child). Aucune police externe injectée. */
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--nfp-text);
	-webkit-font-smoothing: antialiased;
}
.nf-crm-popup-root *,
.nf-crm-popup-root *::before,
.nf-crm-popup-root *::after {
	box-sizing: border-box;
}

/* =========================================================
 * Common
 * ========================================================= */
.nf-crm-popup {
	position: fixed;
	z-index: 100000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 220ms ease;
}
.nf-crm-popup-root.is-visible .nf-crm-popup {
	opacity: 1;
	pointer-events: auto;
}

.nf-crm-popup__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 20, 18, 0.55);
	z-index: 100001;
}

.nf-crm-popup__panel {
	position: relative;
	z-index: 100002;
	background: var(--nfp-bg);
	border-radius: var(--nfp-radius);
	box-shadow: var(--nfp-shadow);
	overflow: hidden;
}

.nf-crm-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	background: rgba(255, 255, 255, 0.95);
	border: 0;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	color: var(--nfp-text);
	z-index: 10;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	padding: 0;
	transition: transform 120ms ease;
}
.nf-crm-popup__close:hover { transform: scale(1.06); }

/* =========================================================
 * Logo (texte par défaut, fidèle aux maquettes Nutriforce :
 *   "NUTRIFORCE™" gros gras, lettres espacées, ™ en exposant)
 * ========================================================= */
.nf-crm-popup__logo {
	font-weight: 900;
	font-size: 32px;
	letter-spacing: 0.045em;
	color: var(--nfp-text);
	display: flex;
	align-items: flex-start;
	gap: 1px;
	margin: 0;
	line-height: 1;
}
.nf-crm-popup__logo:not(.nf-crm-popup__logo--img)::after {
	content: '™';
	font-size: 12px;
	font-weight: 700;
	margin-top: 3px;
	letter-spacing: 0;
}
.nf-crm-popup__logo--img {
	display: block;
	margin: 0;
}
.nf-crm-popup__logo--img img {
	display: block;
	height: 32px;
	width: auto;
	max-width: 220px;
	object-fit: contain;
}

/* =========================================================
 * Body content
 * ========================================================= */
.nf-crm-popup__body {
	padding: 44px 48px 38px;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.nf-crm-popup__title {
	margin: 38px 0 0;
	font-size: 30px;
	font-weight: 800;
	color: var(--nfp-text);
	line-height: 1.18;
	letter-spacing: -0.02em;
}
/* Markdown-like *italic*/**bold** rendu par le JS en <em>.
 * Style "highlight beige" Nutriforce : fond beige + texte noir + italique gras.
 * box-decoration-break: clone permet au bandeau de s'enrouler proprement sur 2 lignes. */
.nf-crm-popup__title em,
.nf-crm-popup__title i {
	background: var(--nfp-highlight-bg);
	color: var(--nfp-highlight-text);
	font-style: italic;
	font-weight: 800;
	padding: 4px 12px;
	display: inline;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	line-height: 1.45;
}

.nf-crm-popup__subtitle {
	margin: 18px 0 24px;
	font-size: 14.5px;
	color: var(--nfp-text-muted);
	line-height: 1.5;
}
.nf-crm-popup__subtitle em,
.nf-crm-popup__subtitle i {
	font-style: italic;
	font-weight: 600;
	color: var(--nfp-text);
}

.nf-crm-popup__footer {
	margin: 14px 0 0;
	font-size: 12px;
	color: var(--nfp-text-soft);
	text-align: center;
}

/* =========================================================
 * Image (split layout)
 * ========================================================= */
.nf-crm-popup__image {
	margin: 0;
	background: #f3f3f3;
	overflow: hidden;
	flex-shrink: 0;
}
.nf-crm-popup__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* =========================================================
 * Form
 * ========================================================= */
/* Champ input — verrouillage anti-thème max specificité.
 * On utilise .nf-crm-popup-root (parent racine) pour battre des sélecteurs Astra
 * qui ciblent input[type="email"] avec specificity standard.
 * Fond beige saturé + bordure 2px noire-claire + box-shadow inset pour donner
 * vraiment l'impression d'une zone "remplissable". */
.nf-crm-popup-root .nf-crm-popup__input,
.nf-crm-popup .nf-crm-popup__input,
.nf-crm-popup__input {
	width: 100% !important;
	padding: 13px 18px !important;
	border: 2px solid #2b2a26 !important;
	border-radius: var(--nfp-radius-pill) !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	margin-bottom: 14px !important;
	font-family: inherit !important;
	background: #faf7ee !important;
	color: var(--nfp-text) !important;
	box-shadow: inset 0 1px 2px rgba(20, 20, 18, 0.06) !important;
	text-shadow: none !important;
	min-height: auto !important;
	height: auto !important;
	max-height: none !important;
	display: block !important;
	transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease !important;
	box-sizing: border-box !important;
}
.nf-crm-popup-root .nf-crm-popup__input:hover,
.nf-crm-popup .nf-crm-popup__input:hover,
.nf-crm-popup__input:hover {
	border-color: #000 !important;
	background: #fff !important;
}
.nf-crm-popup-root .nf-crm-popup__input:focus,
.nf-crm-popup-root .nf-crm-popup__input:focus-visible,
.nf-crm-popup .nf-crm-popup__input:focus,
.nf-crm-popup .nf-crm-popup__input:focus-visible,
.nf-crm-popup__input:focus,
.nf-crm-popup__input:focus-visible {
	outline: 0 !important;
	border-color: #000 !important;
	background: #fff !important;
	box-shadow: 0 0 0 3px rgba(20, 20, 18, 0.12), inset 0 1px 2px rgba(20, 20, 18, 0.04) !important;
}
.nf-crm-popup-root .nf-crm-popup__input::placeholder,
.nf-crm-popup .nf-crm-popup__input::placeholder,
.nf-crm-popup__input::placeholder {
	color: #6b6b6b !important;
	opacity: 1 !important;
}
/* WebKit autofill : Chrome force fond jaune sur les champs autofilled. On override. */
.nf-crm-popup-root .nf-crm-popup__input:-webkit-autofill,
.nf-crm-popup .nf-crm-popup__input:-webkit-autofill,
.nf-crm-popup__input:-webkit-autofill {
	-webkit-box-shadow: 0 0 0 1000px #faf7ee inset !important;
	-webkit-text-fill-color: var(--nfp-text) !important;
	box-shadow: 0 0 0 1000px #faf7ee inset !important;
}

.nf-crm-popup__honeypot {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important; height: 1px !important;
	opacity: 0;
}

/* Message d'erreur form (email invalide, etc.) — inline juste avant le bouton submit. */
.nf-crm-popup__error {
	background: #fef2f2;
	color: #b91c1c;
	border-left: 3px solid #dc2626;
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.4;
	margin: -4px 0 14px;
	border-radius: 0;
	font-weight: 500;
}

/* Verrouillage des styles CTA contre les thèmes (Astra & co) qui peuvent override
 * .button, button[type=submit], a, etc. via .wp-block-button__link, .ast-button, etc.
 * Tous les props critiques sont en !important pour garantir le rendu Nutriforce. */
.nf-crm-popup .nf-crm-popup__cta,
.nf-crm-popup__cta {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 100% !important;
	padding: 14px 22px !important;
	background: var(--nfp-cta-bg) !important;
	color: var(--nfp-cta-text) !important;
	border: 0 !important;
	border-radius: var(--nfp-radius-pill) !important;
	font-weight: 600 !important;
	font-style: italic !important;
	font-size: 14.5px !important;
	line-height: 1.3 !important;
	cursor: pointer !important;
	font-family: inherit !important;
	text-decoration: none !important;
	text-transform: none !important;
	letter-spacing: 0.01em !important;
	box-shadow: none !important;
	text-shadow: none !important;
	min-height: auto !important;
	transition: background 0.12s ease, transform 0.12s ease !important;
}
.nf-crm-popup .nf-crm-popup__cta:hover,
.nf-crm-popup .nf-crm-popup__cta:focus,
.nf-crm-popup .nf-crm-popup__cta:focus-visible,
.nf-crm-popup .nf-crm-popup__cta:active,
.nf-crm-popup .nf-crm-popup__cta:visited,
.nf-crm-popup__cta:hover,
.nf-crm-popup__cta:focus,
.nf-crm-popup__cta:active,
.nf-crm-popup__cta:visited {
	background: var(--nfp-cta-bg-hover) !important;
	color: var(--nfp-cta-text) !important;
	text-decoration: none !important;
	border: 0 !important;
	box-shadow: none !important;
	text-shadow: none !important;
	outline: none !important;
}
.nf-crm-popup .nf-crm-popup__cta:active,
.nf-crm-popup__cta:active { transform: scale(0.985) !important; }
.nf-crm-popup .nf-crm-popup__cta:disabled,
.nf-crm-popup__cta:disabled { opacity: 0.5 !important; cursor: wait !important; }

/* =========================================================
 * Objective radio group (épuré)
 * ========================================================= */
.nf-crm-popup__objective {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0 0 22px;
}
.nf-crm-popup__obj-option {
	display: flex;
	align-items: center;
	gap: 11px;
	cursor: pointer;
	font-size: 13.5px;
	color: var(--nfp-text);
	user-select: none;
	padding: 2px 0;
}
/* Radio buttons : Astra (et autres) override souvent input[type="radio"] avec leurs
 * propres styles. On force tous les props pour garantir le rendu custom Nutriforce. */
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"],
.nf-crm-popup__obj-option input[type="radio"] {
	appearance: none !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	width: 16px !important;
	height: 16px !important;
	min-width: 16px !important;
	min-height: 16px !important;
	max-width: 16px !important;
	max-height: 16px !important;
	border: 1.5px solid var(--nfp-text) !important;
	border-radius: 50% !important;
	margin: 0 !important;
	padding: 0 !important;
	position: relative !important;
	flex-shrink: 0 !important;
	cursor: pointer !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	transition: border-color 120ms ease !important;
}
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"]::after,
.nf-crm-popup__obj-option input[type="radio"]::after {
	content: '' !important;
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) scale(0) !important;
	width: 8px !important;
	height: 8px !important;
	border-radius: 50% !important;
	background: var(--nfp-text) !important;
	transition: transform 120ms ease !important;
}
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"]:checked,
.nf-crm-popup__obj-option input[type="radio"]:checked {
	background: transparent !important;
	border-color: var(--nfp-text) !important;
}
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"]:checked::after,
.nf-crm-popup__obj-option input[type="radio"]:checked::after {
	transform: translate(-50%, -50%) scale(1) !important;
	background: var(--nfp-text) !important;
}
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"]:focus,
.nf-crm-popup .nf-crm-popup__obj-option input[type="radio"]:focus-visible,
.nf-crm-popup__obj-option input[type="radio"]:focus,
.nf-crm-popup__obj-option input[type="radio"]:focus-visible {
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(20, 20, 18, 0.08) !important;
}
.nf-crm-popup .nf-crm-popup__obj-option:hover,
.nf-crm-popup__obj-option:hover { color: var(--nfp-text) !important; }

/* =========================================================
 * Success state
 * ========================================================= */
.nf-crm-popup__success-title {
	margin: 0 0 10px;
	font-size: 20px;
	color: var(--nfp-text);
	font-weight: 700;
	line-height: 1.25;
}
.nf-crm-popup__success-text {
	margin: 0 0 18px;
	font-size: 13.5px;
	color: var(--nfp-text-muted);
}
.nf-crm-popup__coupon {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	background: #f7f5ef;
	border: 1px dashed var(--nfp-text);
	border-radius: var(--nfp-radius);
	margin-bottom: 16px;
}
.nf-crm-popup__coupon span {
	font-size: 10.5px;
	text-transform: uppercase;
	color: var(--nfp-text-muted);
	letter-spacing: 0.08em;
	font-weight: 600;
}
.nf-crm-popup__coupon strong {
	flex: 1;
	font-size: 18px;
	color: var(--nfp-text);
	letter-spacing: 0.04em;
	font-weight: 700;
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
.nf-crm-popup__copy {
	background: var(--nfp-cta-bg);
	color: #fff;
	border: 0;
	border-radius: var(--nfp-radius-pill);
	padding: 7px 14px;
	font-size: 12px;
	cursor: pointer;
	font-family: inherit;
	font-weight: 600;
}

/* =========================================================
 * Reward (révélation cross-sell mystery — A2)
 * ========================================================= */
.nf-crm-popup__reward {
	display: flex;
	gap: 14px;
	align-items: center;
	background: var(--nfp-highlight-bg);
	padding: 14px 16px;
	margin-bottom: 16px;
}
.nf-crm-popup__reward-image {
	flex: 0 0 auto;
	width: 70px;
	height: 70px;
	overflow: hidden;
	background: #fff;
}
.nf-crm-popup__reward-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
.nf-crm-popup__reward-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.nf-crm-popup__reward-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--nfp-text-muted);
	font-weight: 700;
}
.nf-crm-popup__reward-name {
	font-size: 16px;
	font-weight: 800;
	color: var(--nfp-text);
	line-height: 1.2;
}
.nf-crm-popup__reward-reason {
	font-size: 12px;
	color: var(--nfp-text-muted);
	line-height: 1.4;
	margin-top: 3px;
}
.nf-crm-popup__reward-reason em {
	font-style: italic;
	font-weight: 600;
}

/* =========================================================
 * Countdown (pour exit intent avec timer)
 * ========================================================= */
.nf-crm-popup__countdown {
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 32px;
	font-weight: 700;
	letter-spacing: 0.05em;
	color: var(--nfp-text);
	text-align: center;
	margin: 12px 0 18px;
	font-variant-numeric: tabular-nums;
}

/* =========================================================
 * MODAL split — desktop
 * ========================================================= */
.nf-crm-popup--modal {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.nf-crm-popup--modal .nf-crm-popup__panel {
	width: 100%;
	max-width: 880px;
	min-height: 440px;
	max-height: 92vh;
	overflow: hidden;
	display: flex;
	flex-direction: row;
	transform: translateY(8px);
	transition: transform 240ms cubic-bezier(.4,0,.2,1);
}
.nf-crm-popup-root.is-visible .nf-crm-popup--modal .nf-crm-popup__panel {
	transform: translateY(0);
}
.nf-crm-popup--modal .nf-crm-popup__body {
	flex: 1 1 47%;
	min-width: 0;
	overflow-y: auto;
}
.nf-crm-popup--modal .nf-crm-popup__image {
	flex: 1 1 53%;
	min-height: 100%;
	max-height: none;
}

/* Modal sans image : largeur réduite, body centré */
.nf-crm-popup--modal:not(:has(.nf-crm-popup__image)) .nf-crm-popup__panel {
	max-width: 520px;
	min-height: 0;
}

/* MOBILE : modal split → stack vertical (bords carrés conservés) */
@media (max-width: 720px) {
	.nf-crm-popup--modal { padding: 0; align-items: flex-end; }
	.nf-crm-popup--modal .nf-crm-popup__panel {
		max-width: 100%;
		min-height: 0;
		max-height: 100vh;
		flex-direction: column;
		border-radius: 0;
		margin-top: auto;
		transform: translateY(100%);
	}
	.nf-crm-popup-root.is-visible .nf-crm-popup--modal .nf-crm-popup__panel {
		transform: translateY(0);
	}
	/* Sur mobile : image en haut, body en bas (l'image catche l'œil avant le texte
	 * et le CTA reste en zone "thumb"). En HTML l'ordre est body→image (utile pour le
	 * desktop split body-gauche / image-droite) : on flippe via flex order. */
	.nf-crm-popup--modal .nf-crm-popup__image {
		flex: 0 0 auto;
		max-height: 220px;
		height: 220px;
		order: 1;
	}
	.nf-crm-popup--modal .nf-crm-popup__body {
		padding: 28px 24px 24px;
		order: 2;
	}
	.nf-crm-popup__title { font-size: 24px; margin-top: 24px; }
	.nf-crm-popup__logo { font-size: 24px; }
}

/* =========================================================
 * BOTTOM-SHEET (toujours mobile-first, vient du bas)
 * ========================================================= */
.nf-crm-popup--sheet {
	inset: 0;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.nf-crm-popup--sheet .nf-crm-popup__panel {
	width: 100%;
	max-width: 520px;
	max-height: 88vh;
	overflow: hidden;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
}
.nf-crm-popup-root.is-visible .nf-crm-popup--sheet .nf-crm-popup__panel {
	transform: translateY(0);
}
.nf-crm-popup--sheet .nf-crm-popup__image {
	flex: 0 0 auto;
	max-height: 200px;
}
.nf-crm-popup--sheet .nf-crm-popup__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 24px 26px 26px;
}
/* Petit "handle" décoratif en haut du sheet */
.nf-crm-popup--sheet .nf-crm-popup__panel::before {
	content: '';
	position: absolute;
	top: 8px; left: 50%;
	transform: translateX(-50%);
	width: 38px; height: 4px;
	background: rgba(0, 0, 0, 0.18);
	border-radius: 999px;
	z-index: 11;
}

/* =========================================================
 * SLIDE-IN droite (notification non bloquante)
 * ========================================================= */
.nf-crm-popup--slidein {
	bottom: 24px;
	right: 24px;
	max-width: 360px;
	width: calc(100% - 32px);
}
.nf-crm-popup--slidein .nf-crm-popup__panel {
	transform: translateX(20px);
	transition: transform 220ms cubic-bezier(.4,0,.2,1);
}
.nf-crm-popup-root.is-visible .nf-crm-popup--slidein .nf-crm-popup__panel {
	transform: translateX(0);
}
.nf-crm-popup--slidein .nf-crm-popup__body {
	padding: 20px 22px 18px;
}
.nf-crm-popup--slidein .nf-crm-popup__image {
	max-height: 140px;
}
.nf-crm-popup--slidein .nf-crm-popup__logo { font-size: 16px; margin-bottom: 12px; }
.nf-crm-popup--slidein .nf-crm-popup__title { font-size: 17px; }
.nf-crm-popup--slidein .nf-crm-popup__subtitle { font-size: 12.5px; margin-bottom: 14px; }
.nf-crm-popup--slidein .nf-crm-popup__cta { padding: 11px 16px; font-size: 13.5px; }
@media (max-width: 640px) {
	.nf-crm-popup--slidein { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* =========================================================
 * BANNER bas (texte passif uniquement)
 * ========================================================= */
.nf-crm-popup--banner {
	left: 0;
	right: 0;
	bottom: 0;
}
.nf-crm-popup--banner .nf-crm-popup__panel {
	border-radius: 0;
	background: var(--nfp-cta-bg);
	color: #fff;
	box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.16);
	transform: translateY(100%);
	transition: transform 240ms ease;
	display: flex;
	align-items: center;
	padding: 0;
}
.nf-crm-popup-root.is-visible .nf-crm-popup--banner .nf-crm-popup__panel {
	transform: translateY(0);
}
.nf-crm-popup--banner .nf-crm-popup__body {
	padding: 14px 60px 14px 24px;
	flex: 1;
	flex-direction: row;
	gap: 12px;
	align-items: center;
}
.nf-crm-popup--banner .nf-crm-popup__title,
.nf-crm-popup--banner .nf-crm-popup__subtitle {
	color: #fff;
	margin: 0;
}
.nf-crm-popup--banner .nf-crm-popup__title { font-size: 14px; font-weight: 600; }
.nf-crm-popup--banner .nf-crm-popup__close {
	background: transparent;
	color: #fff;
	box-shadow: none;
	top: 50%;
	transform: translateY(-50%);
}
.nf-crm-popup--banner .nf-crm-popup__close:hover {
	background: rgba(255, 255, 255, 0.1);
	transform: translateY(-50%) scale(1.05);
}
