/*
 * Passerelle Digiforma : cartes de sessions et liste d'attente.
 * Les couleurs dérivent du texte du thème (currentColor) et d'une couleur d'accent :
 * le rendu s'adapte au thème du client, clair ou sombre.
 * Accent : réglage « Couleur principale », sinon couleur primaire du thème en blocs, sinon bleu canard.
 */

.ndw-sessions {
	--ndw-a: var(--ndw-accent, var(--wp--preset--color--primary, #0f766e));
	--ndw-line: color-mix(in srgb, currentColor 14%, transparent);
	--ndw-soft: color-mix(in srgb, currentColor 4%, transparent);
	--ndw-muted: color-mix(in srgb, currentColor 62%, transparent);
	--ndw-radius: 10px;
	margin: 0 0 1.5em;
	font-size: 1rem;
	line-height: 1.4;
}

.ndw-sessions__title {
	margin: 0 0 .75em;
	font-weight: 600;
	font-size: 1.05em;
}

.ndw-sessions__list {
	display: grid;
	gap: .6em;
}

.ndw-session {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 1em;
	margin: 0;
	padding: .85em 1em;
	border: 1px solid var(--ndw-line);
	border-radius: var(--ndw-radius);
	background: transparent;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.ndw-session:hover {
	border-color: color-mix(in srgb, var(--ndw-a) 55%, transparent);
	background: var(--ndw-soft);
}

.ndw-session__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.ndw-session:has(.ndw-session__input:checked),
.ndw-session.is-checked {
	border-color: var(--ndw-a);
	box-shadow: inset 0 0 0 1px var(--ndw-a);
	background: color-mix(in srgb, var(--ndw-a) 6%, transparent);
}

.ndw-session:has(.ndw-session__input:focus-visible:not(:checked)) {
	outline: 2px solid var(--ndw-a);
	outline-offset: 2px;
}

/* Session choisie : pavé date plein, bien visible. */
.ndw-session:has(.ndw-session__input:checked) .ndw-session__date,
.ndw-session.is-checked .ndw-session__date {
	background: var(--ndw-a);
	color: #fff;
}

/* Pavé date */
.ndw-session__date {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 3.4em;
	height: 3.4em;
	border-radius: 8px;
	background: color-mix(in srgb, var(--ndw-a) 10%, transparent);
	color: var(--ndw-a);
	line-height: 1;
}

.ndw-session__day {
	font-size: 1.35em;
	font-weight: 700;
}

.ndw-session__month {
	margin-top: .2em;
	font-size: .72em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.ndw-session__body {
	display: flex;
	flex-direction: column;
	gap: .2em;
	min-width: 0;
}

.ndw-session__when {
	font-weight: 600;
}

.ndw-session__meta {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	color: var(--ndw-muted);
	font-size: .9em;
}

.ndw-session__meta svg {
	flex: none;
}

.ndw-session__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: .35em;
	text-align: right;
}

.ndw-session__price {
	font-weight: 700;
	white-space: nowrap;
}

/* Pastilles de places */
.ndw-badge {
	display: inline-block;
	padding: .2em .6em;
	border-radius: 999px;
	font-size: .75em;
	font-weight: 600;
	white-space: nowrap;
	color: var(--ndw-a);
	background: color-mix(in srgb, var(--ndw-a) 12%, transparent);
}

.ndw-badge.is-low {
	color: #9a4a00;
	background: #fdf0dc;
}

.ndw-badge.is-full {
	color: var(--ndw-muted);
	background: var(--ndw-soft);
	box-shadow: inset 0 0 0 1px var(--ndw-line);
}

.ndw-session.is-full .ndw-session__date {
	background: var(--ndw-soft);
	color: var(--ndw-muted);
}

.ndw-session.is-full .ndw-session__price {
	color: var(--ndw-muted);
	font-weight: 500;
}

/* Session complète : le bouton d'achat (désactivé) laisse la place au formulaire de liste d'attente. */
.ndw-is-full .woocommerce-variation-add-to-cart {
	display: none !important;
}

/* Une fois les cartes en place, on masque la liste déroulante et les doublons WooCommerce. */
.ndw-enhanced table.variations,
.ndw-enhanced .reset_variations,
.ndw-enhanced .woocommerce-variation-price,
.ndw-enhanced .woocommerce-variation-availability,
.ndw-enhanced .kf-atc-selected-price,
.ndw-enhanced .kf-atc-variation-price {
	display: none !important;
}

.ndw-notices {
	margin: 0 0 1em;
}

.ndw-enhanced .single_variation_wrap {
	margin-top: 0;
}

/* Session complète : le formulaire d'achat (vide) ne laisse pas de grand blanc. */
form.variations_form.ndw-is-full {
	margin-bottom: 0;
}

form.variations_form.ndw-is-full .ndw-sessions {
	margin-bottom: 1em;
}

/* Liste d'attente */
.ndw-waitlist {
	--ndw-a: var(--ndw-accent, var(--wp--preset--color--primary, #0f766e));
	--ndw-line: color-mix(in srgb, currentColor 14%, transparent);
	margin: 0 0 1.5em;
	padding: 1.25em;
	border: 1px solid var(--ndw-line);
	border-radius: 10px;
	background: color-mix(in srgb, var(--ndw-a) 5%, transparent);
}

.ndw-waitlist[hidden] {
	display: none;
}

.ndw-waitlist__title {
	margin: 0 0 .25em;
	font-weight: 700;
	font-size: 1.05em;
}

.ndw-waitlist__intro {
	margin: 0 0 1em;
	color: color-mix(in srgb, currentColor 70%, transparent);
	font-size: .95em;
}

.ndw-waitlist__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .75em;
}

.ndw-waitlist__field {
	display: flex;
	flex-direction: column;
	gap: .3em;
	margin: 0;
	font-size: .9em;
	font-weight: 600;
}

.ndw-waitlist__field input {
	width: 100%;
	box-sizing: border-box;
	font-weight: 400;
}

.ndw-waitlist__consent {
	display: flex;
	gap: .5em;
	align-items: flex-start;
	margin: 1em 0;
	font-size: .85em;
	line-height: 1.45;
}

.ndw-waitlist__consent input {
	margin-top: .2em;
	flex: none;
}

/* Le bouton garde le style des boutons du thème (comme « Ajouter au panier »). */
.ndw-waitlist__submit {
	width: 100%;
}

.ndw-waitlist__optional {
	font-weight: 400;
	font-size: 1em;
	opacity: .65;
}

.ndw-waitlist-message:not(:empty) {
	margin: .9em 0 0;
	padding: .7em .9em;
	border-radius: 8px;
	background: color-mix(in srgb, var(--ndw-a) 10%, transparent);
	font-size: .9em;
}

.ndw-waitlist-message.is-error {
	background: #fde8e8;
	color: #8a1c1c;
}

.ndw-hp {
	position: absolute !important;
	left: -9999px !important;
}

@media (max-width: 480px) {
	.ndw-session {
		grid-template-columns: auto 1fr;
		gap: .75em;
	}

	.ndw-session__side {
		grid-column: 2;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		text-align: left;
	}

	.ndw-waitlist__grid {
		grid-template-columns: 1fr;
	}
}

/*
 * Même disposition compacte quand la colonne d'achat est étroite sur grand écran
 * (fiche en 3 colonnes, tablette, petit portable) : on suit la largeur réelle du bloc.
 */
.ndw-sessions,
.ndw-waitlist {
	container-type: inline-size;
}

/* Une carte ne doit jamais dépasser sa colonne (sinon défilement horizontal de la page). */
.ndw-sessions__list {
	grid-template-columns: minmax(0, 1fr);
}

.ndw-session,
.ndw-session__body {
	min-width: 0;
}

@container (max-width: 420px) {
	.ndw-session {
		grid-template-columns: auto 1fr;
		gap: .75em;
		padding: .75em .8em;
	}

	.ndw-session__side {
		flex-wrap: wrap;
		gap: .35em .5em;
	}
}

@container (max-width: 300px) {
	.ndw-badge {
		white-space: normal;
	}
}

@container (max-width: 420px) {

	.ndw-session__side {
		grid-column: 2;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		text-align: left;
	}

	.ndw-waitlist__grid {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ndw-session {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/* Style « calendrier » : résumé + prochaines dates en calendriers      */
/* Couleurs : --ndw-accent (dates, sélection), --ndw-accent2 (presque plein). */
/* ------------------------------------------------------------------ */
.ndw-style-calendar {
	--ndw-a2: var(--ndw-accent2, #c2410c);
	--ndw-off: color-mix(in srgb, currentColor 38%, transparent);
}

.ndw-facts {
	margin: 0 0 1.1em;
	padding: 0;
}

.ndw-facts__row {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	padding: .55em 0;
	border-bottom: 1px solid color-mix(in srgb, currentColor 30%, transparent);
	font-size: .95em;
}

.ndw-facts__row dt {
	margin: 0;
	color: var(--ndw-muted);
	font-weight: 400;
}

.ndw-facts__row dd {
	margin: 0;
	text-align: right;
	font-weight: 600;
}

.ndw-style-calendar .ndw-sessions__title {
	font-weight: 700;
	font-size: 1.1em;
}

.ndw-style-calendar .ndw-sessions__list {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 10px;
	padding-top: 6px;
}

.ndw-style-calendar .ndw-session.ndw-cal {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	width: 72px;
	min-width: 0;
	margin: 0;
	padding: 8px 0 6px;
	border: 2px solid var(--ndw-a);
	border-top-width: 8px;
	border-radius: 3px;
	background: transparent;
	color: var(--ndw-a);
	line-height: 1.1;
	text-align: center;
	cursor: pointer;
	box-shadow: none;
}

/* Anneaux du calendrier */
.ndw-style-calendar .ndw-cal::before,
.ndw-style-calendar .ndw-cal::after {
	content: "";
	position: absolute;
	top: -14px;
	width: 3px;
	height: 10px;
	border-radius: 2px;
	background: currentColor;
}

.ndw-style-calendar .ndw-cal::before { left: 16px; }
.ndw-style-calendar .ndw-cal::after { right: 16px; }

.ndw-cal__day {
	font-size: 1.35em;
	font-weight: 700;
}

.ndw-cal__month,
.ndw-cal__year {
	font-size: .72em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
}

.ndw-cal__place {
	max-width: 100%;
	margin-top: 4px;
	padding: 0 4px;
	overflow: hidden;
	font-size: .7em;
	font-weight: 500;
	color: var(--ndw-muted);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ndw-style-calendar .ndw-cal:hover {
	background: color-mix(in srgb, var(--ndw-a) 7%, transparent);
}

.ndw-style-calendar .ndw-cal.is-low {
	border-color: var(--ndw-a2);
	color: var(--ndw-a2);
}

.ndw-style-calendar .ndw-cal.is-full {
	border-color: var(--ndw-off);
	color: var(--ndw-off);
}

.ndw-style-calendar .ndw-cal.is-checked {
	background: var(--ndw-a);
	border-color: var(--ndw-a);
	color: #fff;
}

.ndw-style-calendar .ndw-cal.is-checked .ndw-cal__place {
	color: rgba(255, 255, 255, .85);
}

.ndw-style-calendar .ndw-cal.is-low.is-checked {
	background: var(--ndw-a2);
	border-color: var(--ndw-a2);
}

.ndw-style-calendar .ndw-cal.is-full.is-checked {
	background: #8d95a5;
	border-color: #8d95a5;
}

/* Anneaux : gardent la couleur du cadre quand le calendrier est sélectionné (texte blanc). */
.ndw-style-calendar .ndw-cal.is-checked::before,
.ndw-style-calendar .ndw-cal.is-checked::after {
	background: var(--ndw-a);
}

.ndw-style-calendar .ndw-cal.is-low.is-checked::before,
.ndw-style-calendar .ndw-cal.is-low.is-checked::after {
	background: var(--ndw-a2);
}

.ndw-style-calendar .ndw-cal.is-full.is-checked::before,
.ndw-style-calendar .ndw-cal.is-full.is-checked::after {
	background: #8d95a5;
}

.ndw-style-calendar .ndw-cal .ndw-session__input {
	position: absolute;
	inset: 0;
	opacity: 0;
	margin: 0;
	cursor: pointer;
}

.ndw-style-calendar .ndw-cal:focus-within {
	outline: 2px solid var(--ndw-a);
	outline-offset: 3px;
}

.ndw-pick {
	margin: 1em 0 0;
	padding: .7em .85em;
	border-left: 3px solid var(--ndw-a);
	background: color-mix(in srgb, var(--ndw-a) 7%, transparent);
	font-size: .92em;
	line-height: 1.45;
}

.ndw-pick[hidden] {
	display: none;
}

.ndw-pick__when {
	display: block;
}

.ndw-pick__meta {
	display: block;
	color: var(--ndw-muted);
}

.ndw-pick.is-low {
	border-left-color: var(--ndw-a2);
}

.ndw-pick.is-low .ndw-pick__meta {
	color: var(--ndw-a2);
	font-weight: 600;
}

.ndw-pick.is-full {
	border-left-color: #8d95a5;
}

@media (prefers-reduced-motion: no-preference) {
	.ndw-style-calendar .ndw-cal {
		transition: background-color .15s, color .15s, border-color .15s;
	}
}

/* Panneau autour du formulaire d'achat (style calendrier) */
form.variations_form.ndw-panel {
	padding: 20px 22px 22px;
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 3px;
	background: #fff;
	box-shadow: 0 2px 10px rgba(29, 57, 118, .08);
}

form.variations_form.ndw-panel .single_add_to_cart_button {
	width: 100%;
}

/* Le formulaire de liste d'attente prolonge le panneau quand la session est complète */
form.variations_form.ndw-panel + .ndw-waitlist {
	margin-top: -1px;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

.ndw-pick.is-empty {
	border-left-color: color-mix(in srgb, currentColor 25%, transparent);
	background: color-mix(in srgb, currentColor 4%, transparent);
}

.ndw-pick.is-empty .ndw-pick__when {
	font-weight: 400;
	color: var(--ndw-muted);
}

/* Session complète : étiquette sur le calendrier et phrase d'aide vers la liste d'attente */
.ndw-style-calendar .ndw-cal__flag {
	position: absolute;
	left: 50%;
	bottom: -9px;
	transform: translateX(-50%);
	padding: 1px 7px;
	border-radius: 999px;
	background: #6b7280;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.5;
	text-transform: uppercase;
	white-space: nowrap;
}

.ndw-style-calendar .ndw-sessions__list {
	padding-bottom: 6px;
}

.ndw-cal-hint {
	margin: .9em 0 0;
	font-size: .85em;
	color: var(--ndw-muted);
}
