/**
 * Welcome Offer Popup — styles mobile-first
 * Préfixe unique : .wbo-popup-* (aucune collision avec Blocksy)
 *
 * Breakpoints testés : 375px → 768px → 1440px
 */

/* -------------------------------------------------------------------------
   Design tokens (scoped au root du popup uniquement)
   ------------------------------------------------------------------------- */
.wbo-popup-root {
	--wbo-green-dark: #1a2e28;
	--wbo-green-sage: #1f6f5c;
	--wbo-green-soft: #e8f2ef;
	--wbo-cream: #f7f5f0;
	--wbo-white: #ffffff;
	--wbo-text: #1a2e28;
	--wbo-text-muted: #5a6b64;
	--wbo-error: #b42318;
	--wbo-overlay: rgba(26, 46, 40, 0.55);
	--wbo-radius: 20px;
	--wbo-radius-sm: 12px;
	--wbo-shadow: 0 -8px 40px rgba(26, 46, 40, 0.18);
	--wbo-font: "Segoe UI", system-ui, -apple-system, sans-serif;
	--wbo-z: 100000;
	--wbo-safe-bottom: env(safe-area-inset-bottom, 0px);

	position: fixed;
	inset: 0;
	z-index: var(--wbo-z);
	font-family: var(--wbo-font);
	color: var(--wbo-text);
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	pointer-events: none;
}

.wbo-popup-root *,
.wbo-popup-root *::before,
.wbo-popup-root *::after {
	box-sizing: border-box;
}

.wbo-popup-root[hidden] {
	display: none !important;
}

.wbo-popup-root.is-open {
	pointer-events: auto;
}

/* Empêche le scroll du body quand ouvert (classe ajoutée en JS) */
html.wbo-popup-lock,
html.wbo-popup-lock body {
	overflow: hidden;
	touch-action: none;
}

/* -------------------------------------------------------------------------
   Overlay
   ------------------------------------------------------------------------- */
.wbo-popup-overlay {
	position: absolute;
	inset: 0;
	background: var(--wbo-overlay);
	opacity: 0;
	transition: opacity 0.28s ease;
	cursor: pointer;
}

.wbo-popup-root.is-open .wbo-popup-overlay {
	opacity: 1;
}

/* -------------------------------------------------------------------------
   Dialog — MOBILE FIRST : bottom-sheet (375px+)
   Animations via transform/opacity → pas de CLS
   ------------------------------------------------------------------------- */
.wbo-popup-dialog {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: min(92dvh, 640px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--wbo-cream);
	border-radius: var(--wbo-radius) var(--wbo-radius) 0 0;
	box-shadow: var(--wbo-shadow);
	padding: 12px 20px calc(24px + var(--wbo-safe-bottom));
	transform: translate3d(0, 100%, 0);
	opacity: 1;
	transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
	outline: none;
}

.wbo-popup-root.is-open .wbo-popup-dialog {
	transform: translate3d(0, 0, 0);
}

/* Poignée visuelle bottom-sheet */
.wbo-popup-handle {
	display: block;
	width: 40px;
	height: 4px;
	margin: 4px auto 16px;
	border-radius: 999px;
	background: rgba(26, 46, 40, 0.18);
}

/* -------------------------------------------------------------------------
   Close
   ------------------------------------------------------------------------- */
.wbo-popup-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--wbo-text-muted);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.wbo-popup-close:hover,
.wbo-popup-close:focus-visible {
	background: rgba(26, 46, 40, 0.08);
	color: var(--wbo-green-dark);
	outline: none;
}

.wbo-popup-close:focus-visible {
	box-shadow: 0 0 0 2px var(--wbo-cream), 0 0 0 4px var(--wbo-green-sage);
}

.wbo-popup-close-icon {
	font-size: 28px;
	line-height: 1;
	font-weight: 300;
}

/* -------------------------------------------------------------------------
   Contenu
   ------------------------------------------------------------------------- */
.wbo-popup-body {
	text-align: center;
	padding: 0 4px 4px;
}

.wbo-popup-logo-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 4px 0 16px;
}

.wbo-popup-logo {
	display: block;
	width: auto;
	height: auto;
	max-width: 96px;
	max-height: 112px;
	object-fit: contain;
}

.wbo-popup-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0 0 14px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--wbo-green-soft);
}

.wbo-popup-badge-value {
	font-size: 1.125rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--wbo-green-sage);
}

.wbo-popup-title {
	margin: 0 0 10px;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.3;
	color: var(--wbo-green-dark);
}

.wbo-popup-subtitle {
	margin: 0 0 20px;
	font-size: 0.9375rem;
	color: var(--wbo-text-muted);
	max-width: 34ch;
	margin-left: auto;
	margin-right: auto;
}

/* -------------------------------------------------------------------------
   Code promo
   ------------------------------------------------------------------------- */
.wbo-popup-code-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	max-width: 320px;
	margin: 0 auto 16px;
	padding: 16px 14px;
	border-radius: var(--wbo-radius-sm);
	background: var(--wbo-white);
	border: 1.5px dashed rgba(31, 111, 92, 0.35);
}

.wbo-popup-code-label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wbo-text-muted);
}

.wbo-popup-code {
	font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, monospace;
	font-size: 1.375rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	color: var(--wbo-green-sage);
	background: transparent;
	padding: 0;
}

.wbo-popup-copy {
	min-height: 40px;
	padding: 8px 16px;
	border: 1.5px solid var(--wbo-green-sage);
	border-radius: 10px;
	background: transparent;
	color: var(--wbo-green-sage);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.wbo-popup-copy:hover,
.wbo-popup-copy:focus-visible {
	background: var(--wbo-green-sage);
	color: var(--wbo-white);
	outline: none;
}

.wbo-popup-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 320px;
	min-height: 50px;
	margin: 0 auto;
	padding: 14px 20px;
	border: none;
	border-radius: var(--wbo-radius-sm);
	background: var(--wbo-btn-bg, var(--wbo-green-sage));
	color: var(--wbo-btn-color, var(--wbo-white));
	font: inherit;
	font-size: 1rem;
	font-weight: 650;
	letter-spacing: 0.01em;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
}

.wbo-popup-submit:hover {
	filter: brightness(0.92);
	color: var(--wbo-btn-color, var(--wbo-white));
}

.wbo-popup-submit:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--wbo-cream), 0 0 0 4px var(--wbo-green-sage);
}

.wbo-popup-submit:active {
	transform: scale(0.98);
}

.wbo-popup-legal {
	margin: 14px 0 0;
	font-size: 0.75rem;
	color: var(--wbo-text-muted);
	opacity: 0.85;
}

/* -------------------------------------------------------------------------
   Tablette (≥ 768px) — sheet plus large, toujours bas / centré soft
   ------------------------------------------------------------------------- */
@media (min-width: 768px) {
	.wbo-popup-dialog {
		left: 50%;
		right: auto;
		bottom: 0;
		width: min(440px, calc(100% - 48px));
		margin: 0;
		transform: translate3d(-50%, 100%, 0);
		border-radius: var(--wbo-radius) var(--wbo-radius) 0 0;
		padding: 14px 28px calc(28px + var(--wbo-safe-bottom));
	}

	.wbo-popup-root.is-open .wbo-popup-dialog {
		transform: translate3d(-50%, 0, 0);
	}

	.wbo-popup-title {
		font-size: 1.375rem;
	}

	.wbo-popup-subtitle {
		font-size: 1rem;
		max-width: 36ch;
	}

	.wbo-popup-logo {
		max-width: 108px;
		max-height: 126px;
	}
}

/* -------------------------------------------------------------------------
   Desktop (≥ 1024px) — modal centré, fade + scale
   ------------------------------------------------------------------------- */
@media (min-width: 1024px) {
	.wbo-popup-root {
		--wbo-shadow: 0 24px 64px rgba(26, 46, 40, 0.22);
	}

	.wbo-popup-handle {
		display: none;
	}

	.wbo-popup-dialog {
		top: 50%;
		bottom: auto;
		left: 50%;
		right: auto;
		width: min(420px, calc(100% - 64px));
		max-height: min(90vh, 560px);
		border-radius: var(--wbo-radius);
		padding: 36px 32px 28px;
		transform: translate3d(-50%, -46%, 0) scale(0.94);
		opacity: 0;
		transition:
			transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
			opacity 0.28s ease;
	}

	.wbo-popup-root.is-open .wbo-popup-dialog {
		transform: translate3d(-50%, -50%, 0) scale(1);
		opacity: 1;
	}

	.wbo-popup-close {
		top: 12px;
		right: 12px;
	}
}

/* Desktop large (référence 1440px) — même composition, respirations */
@media (min-width: 1440px) {
	.wbo-popup-dialog {
		width: 440px;
		padding: 40px 36px 32px;
	}

	.wbo-popup-title {
		font-size: 1.625rem;
	}
}

/* Réduction des motions (accessibilité) */
@media (prefers-reduced-motion: reduce) {
	.wbo-popup-overlay,
	.wbo-popup-dialog,
	.wbo-popup-submit,
	.wbo-popup-copy,
	.wbo-popup-close {
		transition: none !important;
	}
}
