/* ============================================================
   Preparun — Courses list redesign
   Scoped under body.template-courses.courses-redesign
   ============================================================ */

body.template-courses.courses-redesign {
	--pr-orange: #f37b33;
	--pr-orange-hover: #e26a22;
	--pr-orange-soft: #ffefe0;
	--pr-orange-ring: rgba(243, 123, 51, 0.35);

	--pr-indigo: #2a2266;
	--pr-indigo-deep: #1f1b4d;

	--pr-cream: #fbf5ec;
	--pr-cream-deep: #f4eee2;
	--pr-cream-border: #ece6da;

	--cr-fg-1: #1f1b33;
	--cr-fg-2: #3a3742;
	--cr-fg-3: #6b6772;

	--cr-shadow-sm: 0 1px 2px rgba(31, 27, 77, 0.06), 0 2px 4px rgba(31, 27, 77, 0.04);
	--cr-shadow-md: 0 4px 8px rgba(31, 27, 77, 0.06), 0 12px 24px rgba(31, 27, 77, 0.08);
	--cr-shadow-lg: 0 12px 32px rgba(31, 27, 77, 0.1), 0 24px 64px rgba(31, 27, 77, 0.1);

	--cr-font-display: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
	background: var(--pr-cream);
}

body.template-courses.courses-redesign #informations {
	background: var(--pr-cream);
}

/* ===================== SEARCH COMMAND BAR ===================== */
body.template-courses.courses-redesign .div-recherche-principal {
	background: transparent;
	box-shadow: none;
	padding: 0;
	font-family: inherit;
	font-size: inherit;
	color: var(--cr-fg-1);
	margin-bottom: 28px;
}

body.template-courses.courses-redesign .div-recherche-principal #div-recherche-titre {
	display: none;
}

body.template-courses.courses-redesign .cr-search-shell {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

body.template-courses.courses-redesign .cr-filterbar {
	background: #fff;
	border-radius: 999px;
	box-shadow: var(--cr-shadow-md);
	padding: 6px;
	display: flex;
	align-items: stretch;
	flex-wrap: nowrap;
	min-height: 64px;
}

body.template-courses.courses-redesign .cr-filter {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 18px 6px 8px;
	border-right: 1px solid var(--pr-cream-border);
	position: relative;
	min-width: 0;
	flex: 0 1 auto;
}

body.template-courses.courses-redesign .cr-filter:last-of-type {
	border-right: none;
}

body.template-courses.courses-redesign .cr-filter--grow {
	flex: 1 1 auto;
}

body.template-courses.courses-redesign .cr-filter-icon {
	width: 36px;
	height: 36px;
	border-radius: 999px;
	background: var(--pr-orange-soft);
	color: var(--pr-orange);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 14px;
}

body.template-courses.courses-redesign .cr-filter--active .cr-filter-icon {
	background: var(--pr-orange);
	color: #fff;
}

body.template-courses.courses-redesign .cr-filter-icon.cr-icon-indigo {
	background: var(--pr-indigo);
	color: #fff;
}

body.template-courses.courses-redesign .cr-filter-body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
	flex: 1 1 auto;
}

body.template-courses.courses-redesign .cr-filter-label {
	font-size: 10px;
	font-weight: 600;
	color: var(--cr-fg-3);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-family: "Inter", sans-serif;
	line-height: 1.2;
}

body.template-courses.courses-redesign .cr-filter-body select,
body.template-courses.courses-redesign .cr-filter-body input[type="text"] {
	font-family: "Inter", sans-serif;
	font-size: 13px;
	font-weight: 600;
	color: var(--cr-fg-1);
	border: none;
	background: transparent;
	padding: 0;
	margin: 0;
	cursor: pointer;
	width: 100%;
	min-width: 0;
	box-shadow: none;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

body.template-courses.courses-redesign .cr-filter-body select {
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231F1B33' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 0 center;
	padding-right: 16px;
}

body.template-courses.courses-redesign .cr-filter--active .cr-filter-body select {
	color: var(--pr-orange);
}

body.template-courses.courses-redesign .cr-filter-body input[type="text"] {
	cursor: pointer;
	white-space: nowrap;
}

/* OK search button (overrides legacy #rechercher round style) */
body.template-courses.courses-redesign #div-rechercher-bouton {
	position: static;
	margin-left: 6px;
	display: flex;
	align-items: stretch;
}

body.template-courses.courses-redesign #rechercher {
	position: static;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 28px;
	background: var(--pr-orange);
	color: #fff;
	border: none;
	border-radius: 999px;
	font-family: var(--cr-font-display);
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition:
		background-color 150ms ease,
		transform 150ms ease,
		box-shadow 150ms ease;
	bottom: auto;
	height: auto;
	box-shadow: var(--cr-shadow-sm);
}

body.template-courses.courses-redesign #rechercher::before {
	content: "";
	width: 15px;
	height: 15px;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='7'/%3e%3cpath d='m20 20-3-3'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-size: contain;
}

body.template-courses.courses-redesign #rechercher:hover {
	background: var(--pr-orange-hover);
	transform: translateY(-1px);
	box-shadow: var(--cr-shadow-md);
}

/* Second row — département (Affiner) */
body.template-courses.courses-redesign .cr-filterbar--secondary {
	box-shadow: var(--cr-shadow-sm);
	gap: 8px;
	position: relative;
	align-self: flex-start;
	min-width: 380px;
}

body.template-courses.courses-redesign .cr-filterbar--secondary::before {
	content: "";
	position: absolute;
	top: -10px;
	left: 220px;
	width: 2px;
	height: 10px;
	background: var(--pr-orange);
	border-radius: 1px;
}

body.template-courses.courses-redesign .cr-affiner-tag {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 6px 8px;
	border-right: 1px solid var(--pr-cream-border);
}

body.template-courses.courses-redesign .cr-affiner-corner {
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: var(--pr-orange-soft);
	color: var(--pr-orange);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	font-family: var(--cr-font-display);
}

body.template-courses.courses-redesign .cr-affiner-label {
	font-size: 11px;
	font-weight: 600;
	color: var(--cr-fg-3);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

body.template-courses.courses-redesign #supprimer-departement,
body.template-courses.courses-redesign #supprimer-distance {
	color: var(--cr-fg-3);
	font-size: 12px;
	margin-left: auto;
	cursor: pointer;
	padding: 0 12px;
	align-self: center;
}

body.template-courses.courses-redesign #supprimer-departement:hover,
body.template-courses.courses-redesign #supprimer-distance:hover {
	color: var(--pr-orange);
}

/* Distance slider — when "Autre distance" is picked, the slider replaces the select */
body.template-courses.courses-redesign .cr-filter--distance {
	min-width: 0;
}

body.template-courses.courses-redesign .cr-filter--distance.cr-filter--slider {
	flex: 1 1 320px;
	min-width: 320px;
	padding-right: 14px;
}

body.template-courses.courses-redesign .cr-filter--distance #slider-distance {
	width: 100%;
	min-width: 220px;
	margin: 18px 8px 6px;
	box-sizing: border-box;
}

body.template-courses.courses-redesign .cr-filter--distance .noUi-target {
	border: none;
	background: var(--pr-orange-soft);
	border-radius: 999px;
	height: 6px;
	box-shadow: none;
	overflow: visible;
}

body.template-courses.courses-redesign .cr-filter--distance .noUi-connect {
	background: var(--pr-orange) !important;
}

body.template-courses.courses-redesign .cr-filter--distance .noUi-handle {
	width: 18px !important;
	height: 18px !important;
	border-radius: 999px;
	border: 2px solid #fff;
	background: var(--pr-orange);
	box-shadow: 0 1px 3px rgba(31, 27, 77, 0.25);
	top: -7px !important;
	right: -9px !important;
	cursor: grab;
}

body.template-courses.courses-redesign .cr-filter--distance .noUi-handle::before,
body.template-courses.courses-redesign .cr-filter--distance .noUi-handle::after {
	display: none;
}

body.template-courses.courses-redesign .cr-filter--distance .noUi-tooltip {
	bottom: 22px !important;
	background: var(--pr-orange);
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 2px 8px;
	font-family: "Inter", sans-serif;
	font-size: 11px !important;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 2px 4px rgba(31, 27, 77, 0.15);
}

/* Pips hidden — the tooltips above the handles already show the selected values */
body.template-courses.courses-redesign .cr-filter--distance .noUi-pips {
	display: none;
}

/* Make sure the filter pill doesn't clip the tooltips above the slider */
body.template-courses.courses-redesign .cr-filterbar {
	overflow: visible;
}
body.template-courses.courses-redesign .cr-filter--distance .cr-filter-body {
	overflow: visible;
}

/* Date input width override (legacy custom.css set 215px) */
body.template-courses.courses-redesign #rechercher-date {
	width: 200px;
	font-size: 13px;
	color: #000;
	font-family: Inter;
}

/* ===================== RESULT COUNT + TOOLBAR ===================== */
body.template-courses.courses-redesign .cr-result-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	margin: 8px 0 20px;
	flex-wrap: wrap;
}

body.template-courses.courses-redesign h2.cr-result-count {
	display: inline-flex;
	align-items: top;
	gap: 5px;
	margin: 0;
	font-family: var(--cr-font-display);
	font-weight: 600;
	font-size: 22px;
	color: var(--cr-fg-1);
	line-height: 42px;
}

body.template-courses.courses-redesign h2.cr-result-count .nb-courses-trouvees {
	font-family: var(--cr-font-display) !important;
	font-weight: 600 !important;
	font-size: 32px !important;
	color: var(--pr-orange) !important;
	background: var(--pr-orange-soft) !important;
	padding: 4px 14px !important;
	border-radius: 8px !important;
	line-height: 1.05 !important;
	display: inline-block;
}

body.template-courses.courses-redesign h2.cr-result-count + .nb-courses-region {
	display: block;
	margin-top: 4px;
	font-size: 16px;
	color: var(--cr-fg-3);
}

/* ===================== LISTE COURSES — CARDS ===================== */
body.template-courses.courses-redesign .liste-courses {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 18px;
	margin: 0;
}

body.template-courses.courses-redesign .liste-courses a.item {
	background: #fff;
	border: 1px solid var(--pr-cream-border);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: var(--cr-shadow-sm);
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	transition:
		box-shadow 220ms ease,
		transform 220ms ease,
		border-color 220ms ease;
}

body.template-courses.courses-redesign .liste-courses a.item:hover {
	box-shadow: var(--cr-shadow-md);
	transform: translateY(-2px);
	background-color: #fff;
}

body.template-courses.courses-redesign .liste-courses a.item > .item {
	display: contents;
}

body.template-courses.courses-redesign .liste-courses .banniere {
	position: relative;
	height: 160px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 0;
}

body.template-courses.courses-redesign .liste-courses .banniere::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.35) 100%);
	pointer-events: none;
}

body.template-courses.courses-redesign .cr-day-block {
	position: absolute;
	top: 12px;
	left: 12px;
	background: #fff;
	border-radius: 8px;
	padding: 6px 10px;
	text-align: center;
	min-width: 48px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
	z-index: 1;
}

body.template-courses.courses-redesign .cr-day-month {
	display: block;
	font-family: "Inter", sans-serif;
	font-size: 10px;
	font-weight: 600;
	color: var(--pr-orange);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1;
}

body.template-courses.courses-redesign .cr-day-num {
	display: block;
	font-family: var(--cr-font-display);
	font-weight: 600;
	font-size: 22px;
	color: var(--cr-fg-1);
	line-height: 1.05;
	margin-top: 2px;
}

body.template-courses.courses-redesign .cr-type-chip {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(255, 255, 255, 0.95);
	padding: 4px 10px;
	border-radius: 999px;
	font-family: "Inter", sans-serif;
	font-size: 11px;
	font-weight: 600;
	color: var(--pr-indigo);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	z-index: 1;
}

body.template-courses.courses-redesign .liste-courses .item-padding {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
}

body.template-courses.courses-redesign .liste-courses h3.titre {
	font-family: var(--cr-font-display);
	font-weight: 600;
	font-size: 17px;
	color: var(--cr-fg-1);
	margin: 0;
	line-height: 1.2;
}

body.template-courses.courses-redesign .card-lieu-date {
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: flex-start;
}

body.template-courses.courses-redesign .card-lieu-date .ville,
body.template-courses.courses-redesign .card-lieu-date .date {
	font-size: 13px;
	color: var(--cr-fg-3);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

body.template-courses.courses-redesign .card-lieu-date .ville i,
body.template-courses.courses-redesign .card-lieu-date .date i {
	color: var(--pr-orange);
	font-size: 12px;
}

body.template-courses.courses-redesign .liste-courses .distances {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 0;
}

body.template-courses.courses-redesign .liste-courses .distances .distance {
	background: var(--pr-orange-soft);
	color: var(--pr-orange);
	border: none;
	border-radius: 999px;
	padding: 3px 10px;
	font-family: "Inter", sans-serif;
	font-size: 9px;
	font-weight: 600;
	width: auto;
}

body.template-courses.courses-redesign .cr-card-foot {
	margin-top: auto;
	padding-top: 10px;
	border-top: 1px solid var(--pr-cream-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

body.template-courses.courses-redesign .cr-card-meta {
	font-size: 12px;
	color: var(--cr-fg-3);
}

body.template-courses.courses-redesign .cr-card-cta {
	color: var(--pr-orange);
	font-size: 13px;
	font-weight: 600;
	text-underline-offset: 2px;
}

/* ===================== PAGINATION ===================== */
body.template-courses.courses-redesign .pagination {
	display: flex;
	gap: 6px;
	justify-content: center;
	align-items: center;
	margin: 12px 0;
	flex-wrap: wrap;
}

body.template-courses.courses-redesign .pagination .page-link {
	width: 36px;
	height: 36px;
	border-radius: 999px;
	border: none;
	background: var(--pr-orange-soft);
	color: var(--pr-orange);
	font-family: "Inter", sans-serif;
	font-weight: 600;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	padding: 0;
	transition:
		background 150ms ease,
		color 150ms ease;
}

body.template-courses.courses-redesign .pagination .page-link.active {
	background: var(--pr-orange);
	color: #fff;
}

body.template-courses.courses-redesign .pagination a.page-link:hover {
	background: var(--pr-orange);
	color: #fff;
}

/* ===================== "COURSE INTROUVABLE" CTA ===================== */
body.template-courses.courses-redesign .course_introuvable {
	background: var(--pr-indigo);
	color: #fff;
	padding: 22px 24px;
	display: flex;
	gap: 16px;
	align-items: center;
	border-radius: 14px;
	margin-top: 32px;
	box-shadow: var(--cr-shadow-md);
}

body.template-courses.courses-redesign .course_introuvable > div:first-child {
	align-items: center;
	justify-content: center;
	color: #fff;
	flex-shrink: 0;
}

body.template-courses.courses-redesign .course_introuvable .titre {
	font-family: var(--cr-font-display);
	font-weight: 600;
	font-size: 17px;
	display: block;
}

body.template-courses.courses-redesign .course_introuvable a,
body.template-courses.courses-redesign a:has(.course_introuvable) {
	text-decoration: none;
}

body.template-courses.courses-redesign .description-sous-recherche {
	background: #fff;
	border: 1px solid var(--pr-cream-border);
	border-radius: 14px;
	padding: 28px;
	margin-top: 28px;
	color: var(--cr-fg-2);
	box-shadow: var(--cr-shadow-sm);
}

/* ===================== MOBILE FILTER SUMMARY (existing block) ===================== */
body.template-courses.courses-redesign #div-recherche-filtres-mobile {
	background: #fff;
	border: 1px solid var(--pr-cream-border);
	border-radius: 14px;
	padding: 16px;
	box-shadow: var(--cr-shadow-sm);
	display: none;
	margin-bottom: 20px;
	flex-direction: column;
	gap: 8px;
}

body.template-courses.courses-redesign #div-recherche-filtres-mobile .filtre-label {
	font-size: 13px;
	color: var(--cr-fg-2);
}

body.template-courses.courses-redesign #div-recherche-filtres-mobile .filtre-value {
	color: var(--cr-fg-1);
	font-weight: 600;
}

body.template-courses.courses-redesign #div-recherche-filtres-mobile .filtre-bouton {
	background: var(--pr-orange);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	margin: 12px 0 0;
	font-weight: 600;
	font-family: var(--cr-font-display);
	cursor: pointer;
	width: 100%;
	text-align: center;
	font-size: 14px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
	body.template-courses.courses-redesign .liste-courses {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 900px) {
	body.template-courses.courses-redesign .liste-courses {
		grid-template-columns: repeat(2, 1fr);
	}
	body.template-courses.courses-redesign .cr-filterbar {
		flex-wrap: wrap;
		border-radius: 18px;
		padding: 10px;
		gap: 4px;
	}
	body.template-courses.courses-redesign .cr-filter {
		border-right: none;
		border-bottom: 1px solid var(--pr-cream-border);
		flex: 1 1 100%;
		padding: 8px 6px;
	}
	body.template-courses.courses-redesign .cr-filter:last-of-type {
		border-bottom: none;
	}
	body.template-courses.courses-redesign #div-rechercher-bouton {
		width: 100%;
		margin-left: 0;
		margin-top: 6px;
	}
	body.template-courses.courses-redesign #rechercher {
		width: 100%;
		justify-content: center;
		padding: 12px 24px;
	}
	body.template-courses.courses-redesign .cr-filterbar--secondary {
		min-width: 0;
	}
	body.template-courses.courses-redesign .cr-filterbar--secondary::before {
		display: none;
	}
}

@media (max-width: 768px) {
	body.template-courses.courses-redesign .div-recherche-principal {
		display: none;
	}
	body.template-courses.courses-redesign .div-recherche-parent {
		display: none;
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		margin: 56px 0 0;
		flex-direction: column;
		z-index: 999;
		background: var(--pr-cream);
		padding: 20px;
		overflow-y: auto;
	}
	body.template-courses.courses-redesign #div-recherche-filtres-mobile {
		display: flex;
		margin: 10px;
	}
	body.template-courses.courses-redesign h2.cr-result-count {
		display: block;
		line-height: 26px;
	}
}

@media (max-width: 560px) {
	body.template-courses.courses-redesign .liste-courses {
		grid-template-columns: 1fr;
	}
}
