/* =============================================================================
   RachonPoPup — Frontend Styles
   ============================================================================= */

/* ── Variables (surchargeables depuis le thème) ─────────────────────────── */
:root {
	--rachon-radius:       8px;
	--rachon-shadow:       0 8px 40px rgba(0, 0, 0, 0.35);
	--rachon-transition:   0.2s ease;
	--rachon-z-index:      99999;
	--rachon-banner-z:     9999;
}

/* ── Blocage du scroll quand popup ouvert ───────────────────────────────── */
body.rachon-popup-open {
	overflow: hidden;
}

/* =============================================================================
   POPUP — Overlay + boîte centrée
   ============================================================================= */

.rachon-popup-wrapper.rachon-is-popup {
	position: fixed;
	inset: 0;
	z-index: var(--rachon-z-index);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Fond semi-transparent bloquant */
.rachon-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	cursor: default;
}

/* Boîte du popup — card sans padding (géré par header/body) */
.rachon-is-popup .rachon-popup-box {
	position: relative;
	z-index: 1;
	max-width: 520px;
	width: 90%;
	padding: 0;
	border-radius: var(--rachon-radius);
	box-shadow: var(--rachon-shadow);
	text-align: center;
	overflow: hidden;
	animation: rachonFadeIn 0.25s ease both;
}

/* ── Card header ─────────────────────────────────────────────────────── */
.rachon-popup-header {
	position: relative;
	padding: 1.5rem 2.5rem 1.4rem;
	/* La couleur de fond est appliquée via style inline (option admin) */
	border-bottom: 1px solid rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 72px;
}

/* Le bouton × dans le header */
.rachon-popup-header .rachon-close-btn {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
}

/* ── Card body ───────────────────────────────────────────────────────── */
.rachon-popup-body {
	padding: 1.75rem 2.5rem 2rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.25rem;
}

/* =============================================================================
   BANNIÈRE — Top / Bottom
   ============================================================================= */

.rachon-popup-wrapper.rachon-is-banner {
	position: fixed;
	left: 0;
	right: 0;
	z-index: var(--rachon-banner-z);
	width: 100%;
}

.rachon-is-banner.rachon-banner-top    { top: 0; }
.rachon-is-banner.rachon-banner-bottom { bottom: 0; }

/* Décalage pour la barre d'administration WordPress */
.admin-bar .rachon-is-banner.rachon-banner-top { top: 32px; }

@media screen and (max-width: 782px) {
	.admin-bar .rachon-is-banner.rachon-banner-top { top: 46px; }
}

/* Bannière non-sticky : absolute (se désactive si le thème n'a pas position:relative sur body) */
.rachon-is-banner:not(.rachon-sticky) {
	position: absolute;
}

/* Layout intérieur de la bannière */
.rachon-is-banner .rachon-popup-box {
	width: 100%;
	padding: 0.85rem 1.5rem;
	border-radius: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	flex-wrap: wrap;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	animation: rachonSlideIn 0.2s ease both;
}

.rachon-is-banner.rachon-banner-bottom .rachon-popup-box {
	animation-name: rachonSlideInBottom;
}

/* =============================================================================
   Bouton fermer (×)
   ============================================================================= */

.rachon-close-btn {
	background: transparent;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: 0.65;
	padding: 0.15rem 0.45rem;
	border-radius: 3px;
	transition: opacity var(--rachon-transition), outline-color var(--rachon-transition);
}

.rachon-close-btn:hover,
.rachon-close-btn:focus-visible {
	opacity: 1;
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* En bannière, le bouton × est aligné à droite mais pas en absolute */
.rachon-is-banner .rachon-close-btn {
	position: static;
	margin-left: auto;
	flex-shrink: 0;
}

/* =============================================================================
   Titre & Contenu
   ============================================================================= */

/* Titre dans le header de la card popup */
.rachon-popup-title {
	margin: 0;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	letter-spacing: 0.01em;
}

.rachon-popup-content {
	margin: 0;
	font-size: 1rem;
	line-height: 1.65;
	color: inherit;
	text-align: center;
}

.rachon-popup-content p,
.rachon-popup-content ul,
.rachon-popup-content ol {
	display: block !important;
	margin: 0 0 0.6em !important;
}

.rachon-popup-content p:last-child,
.rachon-popup-content ul:last-child,
.rachon-popup-content ol:last-child {
	margin-bottom: 0 !important;
}

.rachon-popup-content strong { font-weight: 700 !important; }
.rachon-popup-content em     { font-style: italic !important; }
.rachon-popup-content u      { text-decoration: underline !important; }

.rachon-popup-content li {
	display: list-item !important;
	margin: 0 0 0.2em !important;
	list-style: inherit;
}

/* En bannière, titre et contenu sont inline */
.rachon-is-banner .rachon-popup-title {
	margin: 0;
	font-size: 1rem;
}

.rachon-is-banner .rachon-popup-content {
	margin: 0;
}

/* =============================================================================
   Bouton CTA
   ============================================================================= */

.rachon-cta-btn {
	display: inline-block;
	padding: 0.65rem 1.75rem;
	border-radius: 4px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
	white-space: nowrap;
	transition: filter var(--rachon-transition), transform var(--rachon-transition);
	cursor: pointer;
}

.rachon-cta-btn:hover,
.rachon-cta-btn:focus-visible {
	filter: brightness(1.12);
	transform: translateY(-1px);
	outline: 3px solid currentColor;
	outline-offset: 2px;
	text-decoration: none;
}

.rachon-cta-btn:active {
	transform: translateY(0);
}

/* =============================================================================
   Accessibilité
   ============================================================================= */

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* =============================================================================
   Animations
   ============================================================================= */

@keyframes rachonFadeIn {
	from {
		opacity: 0;
		transform: translateY(-14px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes rachonSlideIn {
	from {
		opacity: 0;
		transform: translateY(-100%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes rachonSlideInBottom {
	from {
		opacity: 0;
		transform: translateY(100%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 600px) {
	/* Popup : réduit les paddings header + body */
	.rachon-popup-header {
		padding: 1rem 1.25rem 0.9rem;
		min-height: 56px;
	}

	.rachon-popup-body {
		padding: 1.25rem 1.25rem 1.5rem;
		gap: 1rem;
	}

	.rachon-popup-title {
		font-size: 1.1rem;
	}

	.rachon-cta-btn {
		width: 100%;
		text-align: center;
	}

	/* Bannière : empilement vertical sur petits écrans */
	.rachon-is-banner .rachon-popup-box {
		flex-direction: column;
		text-align: center;
		gap: 0.75rem;
		padding: 0.75rem 1rem;
	}

	.rachon-is-banner .rachon-close-btn {
		margin-left: 0;
	}
}
