/**
 * Formation Search — front-end styles.
 *
 * Plain CSS, no preprocessor, so it stays easy to override. All colours,
 * radii and spacing are exposed as CSS variables on .formation-search.
 */

.formation-search {
	--fs-color-primary: #f7a600;
	--fs-color-primary-dark: #dd9400;
	--fs-color-text: #1a1a1a;
	--fs-color-muted: #6b6b6b;
	--fs-color-border: #f7a600;
	--fs-color-surface: #ffffff;
	--fs-color-tag-border: #e2e2e2;
	--fs-color-tag-bg: #ffffff;
	--fs-color-error: #c0392b;
	--fs-radius-pill: 999px;
	--fs-radius-md: 12px;
	--fs-gap: 12px;
	--fs-font-family: inherit;

	box-sizing: border-box;
	font-family: var(--fs-font-family);
	color: var(--fs-color-text);
}

/* The title + form stay compact and, on wide enough screens, leave room on
   the right for the decorative France map; the results grid below is a
   separate block and always uses the component's full width. */
.formation-search__intro {
	max-width: 640px;
}

.formation-search__form {
	max-width: 640px;
}

@media (min-width: 780px) {
	.formation-search__intro {
		max-width: none;
		min-height: 280px;
		padding-right: 300px;
		background-image: url('../images/france-map.png');
		background-repeat: no-repeat;
		background-position: right center;
		background-size: 260px auto;
	}
}

.formation-search *,
.formation-search *::before,
.formation-search *::after {
	box-sizing: inherit;
}

/* Themes/page builders (e.g. Elementor's global Theme Style) frequently
   apply their own colour/size rules directly to h1-h6, sometimes with more
   specificity than expected. The properties below are !important so the
   widget's headings stay legible regardless of the surrounding theme. */
.formation-search__title {
	margin: 0 0 1.5rem;
	font-size: 2rem !important;
	font-weight: 800 !important;
	line-height: 1.15 !important;
	color: var(--fs-color-text) !important;
}

.formation-search__fields {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fs-gap);
	margin-bottom: 1rem;
}

.formation-search__field {
	position: relative;
	flex: 1 1 220px;
}

/* Decorative "+" icon reproducing the mockup's pill fields. */
.formation-search__field::before {
	content: '+';
	position: absolute;
	top: 50%;
	left: 0.65rem;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	border: 1px solid var(--fs-color-primary);
	border-radius: 50%;
	color: var(--fs-color-primary);
	font-size: 0.95rem;
	line-height: 1;
	pointer-events: none;
	z-index: 1;
}

.formation-search__field .ts-wrapper {
	width: 100%;
}

.formation-search__field .ts-control {
	min-height: auto;
	padding: 0.65rem 1rem 0.65rem 2.75rem;
	border: 1px solid var(--fs-color-border);
	border-radius: var(--fs-radius-pill);
	background-color: var(--fs-color-surface);
	cursor: pointer;
	box-shadow: none;
}

.formation-search__field .ts-wrapper.focus .ts-control {
	border-color: var(--fs-color-primary-dark);
	box-shadow: 0 0 0 3px rgba(247, 166, 0, 0.2);
}

.formation-search__field .ts-control input {
	color: var(--fs-color-text);
	cursor: pointer;
}

/* Once the field is actually focused for typing, switch to a text cursor
   so it still reads as an editable search box while active. */
.formation-search__field .ts-wrapper.focus .ts-control input {
	cursor: text;
}

/* Selected values are shown as tags below the fields (see .formation-search__tags),
   so the native Tom Select item chips inside the control are hidden. Remove this
   rule if you would rather keep Tom Select's default in-field chips. */
.formation-search__field .ts-control > .item {
	display: none;
}

.formation-search__field .ts-dropdown {
	margin-top: 0.5rem;
	border: 1px solid var(--fs-color-tag-border);
	border-radius: var(--fs-radius-md);
	overflow: hidden;
}

.formation-search__field .ts-dropdown .active {
	background-color: rgba(247, 166, 0, 0.12);
	color: var(--fs-color-text);
}

.formation-search__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.formation-search__tag {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.5rem 0.35rem 0.9rem;
	background-color: var(--fs-color-tag-bg);
	border: 1px solid var(--fs-color-tag-border);
	border-radius: var(--fs-radius-pill);
	font-size: 0.875rem;
}

.formation-search__tag-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	padding: 0;
	border: 1px solid var(--fs-color-tag-border);
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 0.9rem;
	line-height: 1;
	cursor: pointer;
}

.formation-search__tag-remove:hover,
.formation-search__tag-remove:focus-visible {
	background-color: #f2f2f2;
}

.formation-search__error {
	margin: 0 0 1rem;
	color: var(--fs-color-error);
	font-size: 0.875rem;
}

.formation-search__submit {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.85rem 1.5rem;
	border: none;
	border-radius: var(--fs-radius-pill);
	background-color: var(--fs-color-primary);
	color: #ffffff;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.formation-search__submit:hover,
.formation-search__submit:focus-visible {
	background-color: var(--fs-color-primary-dark);
}

.formation-search__submit-icon::after {
	content: '\2192';
}

.formation-search__results {
	margin-top: 2rem;
}

.formation-search__results-empty {
	color: var(--fs-color-text);
}

.formation-search__results-count {
	margin: 0 0 1.25rem;
	color: var(--fs-color-text);
	font-size: 0.95rem;
	font-weight: 600;
}

.formation-search__results-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
}

.formation-search__result {
	padding: 1.25rem;
	background-color: var(--fs-color-surface);
	border: 1px solid var(--fs-color-tag-border);
	border-radius: var(--fs-radius-md);
}

.formation-search__result-name {
	margin: 0 0 0.75rem;
	font-size: 1.1rem !important;
	font-weight: 700 !important;
	line-height: 1.3 !important;
	color: var(--fs-color-text) !important;
}

.formation-search__result-type {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 1rem;
	color: var(--fs-color-muted);
	font-size: 0.9rem;
}

.formation-search__result-type svg {
	flex-shrink: 0;
	color: var(--fs-color-primary);
}

.formation-search__result-details summary {
	color: var(--fs-color-primary-dark);
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
}

.formation-search__result-details address {
	margin-top: 0.75rem;
	font-style: normal;
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--fs-color-muted);
}

@media (max-width: 900px) {
	.formation-search__results-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.formation-search__title {
		font-size: 1.5rem !important;
	}

	.formation-search__fields {
		flex-direction: column;
	}

	.formation-search__field {
		flex-basis: auto;
	}

	.formation-search__submit {
		width: 100%;
		justify-content: center;
	}

	.formation-search__results-grid {
		grid-template-columns: 1fr;
	}
}
