/* ================================
   SEARCH BAR BIDULE - STYLES
   ================================ */

/* ================================
   SECTION SEARCH BAR CONFIGURABLE (from search.css)
   ================================ */

.search-section {
	padding: 3rem 0;
	background: #f8f9fa;
}

/* Header de section */
.search-header {
	text-align: center;
	margin-bottom: 2rem;
}

.search-title {
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--color-text-dark);
	margin: 0;
}

/* Container de la barre de recherche (legacy - peut entrer en conflit avec .search-bar-container) */
.search-bar-container.legacy {
	max-width: 700px;
	margin: 0 auto 3rem;
	text-align: center;
}

.search-input-wrapper.legacy {
	position: relative;
}

.search-input {
	width: 100%;
	padding: 1.25rem 3rem 1.25rem 1.5rem;
	font-size: 1.1rem;
	border: 3px solid var(--color-border);
	border-radius: 60px;
	outline: none;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	background: var(--color-light);
	box-shadow: 0 4px 20px rgba(0,0,0,0.08);
	font-family: inherit;
}

.search-input:focus {
	border-color: var(--color-primary);
	box-shadow: 0 8px 30px rgba(0, 115, 170, 0.15);
	transform: translateY(-2px);
}

.search-input::placeholder {
	color: var(--color-placeholder);
}

.search-icon {
	position: absolute;
	right: 1.5rem;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.2rem;
	color: var(--color-text-muted);
	pointer-events: none;
}

.search-stats {
	font-size: 0.95rem;
	color: var(--color-text-muted);
	font-weight: 500;
}

/* ===== COMPOSANT PRINCIPAL ===== */
.searchbar {
	padding: 0;
	text-align: right;
	flex: 0 0 auto;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

/* Container pour breadcrumb + searchbar alignés */
.breadcrumb-searchbar-wrapper {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding: calc(var(--gut) * 0.75) 0;
	/* margin-bottom: calc(var(--gut) * 0.5); */
	width: 100%;
}

/* Message "aucun résultat" en tooltip flottant sous la barre de recherche */
.search-no-results-message {
	position: absolute;
	bottom: -2.5rem;
	right: 0;
	font-size: 0.875rem;
	color: #fff;
	background: rgba(0, 0, 0, 0.85);
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	line-height: 1.4;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-10px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-no-results-message.show {
	opacity: 1;
	transform: translateY(0);
}

.search-no-results-message::after {
	content: '';
	position: absolute;
	top: -6px;
	right: 1rem;
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-bottom: 6px solid rgba(0, 0, 0, 0.85);
}

.search-no-results-message span {
	display: inline-block;
}

.breadcrumb-searchbar-wrapper .breadcrumb {
	flex: 0 0 auto;
	margin: 0;
}

.breadcrumb-searchbar-wrapper .searchbar {
	flex: 0 0 auto;
	margin: 0;
}

.breadcrumb-searchbar-wrapper .searchbar-section {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	width: 100%;
	/* max-width: 25%; */
}

.breadcrumb-searchbar-wrapper .search-no-results-message {
	position: absolute;
	bottom: -2.5rem;
	right: 0;
}

/* Responsive: stack breadcrumb and searchbar on mobile */
@media (max-width: 768px) {
	.breadcrumb-searchbar-wrapper {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}
	
	.breadcrumb-searchbar-wrapper .searchbar {
		width: 100%;
	}
	
	.breadcrumb-searchbar-wrapper .search-bar-container {
		width: 100%;
	}
}

.searchbar-header {
	margin-bottom: 2rem;
}

.searchbar-title {
	font-size: 2rem;
	font-weight: 600;
	color: var(--color-text-dark);
	margin: 0;
}

/* ===== CONTAINER DE RECHERCHE ===== */
.search-bar-container {
	width: 25%;
	min-width: 200px;
	max-width: none;
	margin: 0;
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.search-bar-container.filters-left {
	flex-direction: row;
}

/* ===== BARRE DE RECHERCHE CLASSIQUE ===== */
.search-bar-simple {
	flex: 1;
	min-width: 0;
	margin: 0;
	text-align: right;
	width: 100%;
}

.search-input-wrapper {
	position: relative;
	width: 100%;
}

.search-input-simple {
	width: 100%;
	padding: 0.5rem 2.5rem 0.5rem 1rem;
	font-size: 0.9rem;
	border: 1px solid var(--color-border);
	border-radius: 20px;
	outline: none;
	background: var(--color-light);
	font-family: inherit;
	transition: all 0.3s ease;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

/* Bouton clear pour effacer la recherche */
.search-clear-btn {
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: #666;
	cursor: pointer;
	pointer-events: auto;
	z-index: 900;
	width: 16px;
	height: 16px;
	user-select: none;
	padding: 0;
	margin: 0;
	transition: opacity 0.2s ease;
	opacity: 0.6;
}

.search-clear-btn:hover {
	opacity: 1;
}

.search-clear-btn:active {
	transform: translateY(-50%) scale(0.95);
}

.search-clear-btn svg {
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.search-no-results-icon {
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ef4444;
	cursor: pointer;
	pointer-events: auto;
	z-index: 100;
	width: 20px;
	height: 20px;
	user-select: none;
}

.search-no-results-icon svg {
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.search-no-results-icon::after {
	content: attr(title);
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	background: rgba(0, 0, 0, 0.9);
	color: white;
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	font-size: 0.875rem;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
	z-index: 1000;
}

.search-no-results-icon:hover::after {
	opacity: 1;
	visibility: visible;
}

.search-input-simple::placeholder {
	color: var(--color-placeholder);
}

.search-input-simple:focus {
	border-color: var(--color-primary);
	box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
	transform: translateY(-2px);
}

/* ===== BARRE DE RECHERCHE INTÉGRÉE ===== */
.search-bar-inline {
	max-width: 1000px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	position: relative;
}

.search-bar-inline.modern {
	border: 1px solid var(--color-border);
}

.search-bar-inline.rounded {
	border-radius: 50px;
}

.search-input-wrapper-inline {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
}

.search-input-inline {
	flex: 1;
	padding: 1rem 2.5rem 1rem 1.5rem;
	font-size: 1.1rem;
	border: none;
	outline: none;
	background: transparent;
	font-family: inherit;
	min-width: 250px;
}

.search-input-wrapper-inline .search-clear-btn {
	right: 1rem;
}

.search-input-inline::placeholder {
	color: var(--color-placeholder);
}

.search-button {
	padding: 1rem 2rem;
	background: var(--color-text-dark);
	color: var(--color-light);
	border: none;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
}

.search-button:hover {
	background: var(--color-button-dark);
}

/* ===== FILTRES TAXONOMIQUES ===== */
.search-filters {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}

.search-filters.filters-above {
	max-width: 800px;
	margin: 0 auto 1.5rem;
	justify-content: center;
	flex-wrap: wrap;
	display:none;
}

.search-filters.filters-left {
	flex-direction: column;
	min-width: 200px;
}

.taxonomy-filter:not(.inline) {
	padding: 0.75rem 1rem;
	font-size: 0.95rem;
	border: 2px solid var(--color-border);
	border-radius: 8px;
	background: var(--color-light);
	outline: none;
	transition: all 0.3s ease;
	cursor: pointer;
	font-family: inherit;
	position: relative;
	min-width: 160px;
}

.taxonomy-filter:not(.inline):focus,
.taxonomy-filter:not(.inline):hover {
	border-color: var(--color-primary);
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.taxonomy-filter:not(.inline).has-selection {
	border-color: var(--color-accent);
	background: #e3f2fd;
	color: var(--color-accent);
}

.taxonomy-filter.inline {
	padding: calc(var(--gut)*0.75);
	font-size: 0.85rem;
	border: none;
	border-right: 1px solid var(--color-border);
	background: transparent;
	outline: none;
	cursor: pointer;
	font-family: inherit;
	color: var(--color-text-medium);
	position: relative;
	width: 20%;
	
}

.taxonomy-filter.inline:last-of-type {
	border-right: 1px solid var(--color-border);
}

.taxonomy-filter.inline:focus,
.taxonomy-filter.inline:hover {
	background: #f8f9fa;
}

.taxonomy-filter.inline.has-selection {
	background: #e3f2fd;
	color: var(--color-accent);
	font-weight: 500;
}

.taxonomy-filter option {
	padding: 0.5rem;
}

.taxonomy-filter option:disabled {
	color: var(--color-text-lighter);
	font-style: italic;
}

/* ===== META RECHERCHE ===== */
.search-meta {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	margin-top: 1rem;
	min-height: 2.5rem;
	gap: 1rem;
	flex-wrap: wrap;
}

/* Style search-results-count supprimé - le compteur n'est plus affiché */

.reset-search-link {
	background: none;
	border: none;
	color: var(--color-text-light);
	font-size: 0.9rem;
	cursor: pointer;
	padding: 0.5rem 0;
	text-decoration: underline;
	transition: color 0.3s ease;
	margin-left: auto;
}

.reset-search-link:hover {
	color: var(--color-primary);
}

.active-filters {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	align-items: center;
	margin-left: 1rem;
}

.filter-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: #e3f2fd;
	color: var(--color-accent);
	padding: 0.25rem 0.75rem;
	border-radius: 20px;
	font-size: 0.85rem;
	font-weight: 500;
	opacity: 0;
	transform: scale(0.8);
	animation: badgeAppear 0.3s ease forwards;
}

.filter-badge .remove-filter {
	background: none;
	border: none;
	color: var(--color-accent);
	cursor: pointer;
	padding: 0;
	margin-left: 0.25rem;
	font-size: 1rem;
	line-height: 1;
}

.filter-badge .remove-filter:hover {
	color: var(--color-accent-dark);
}

/* ===== ÉTATS / ANIMATIONS ===== */
.searching .search-input-simple,
.searching .search-input-inline {
	animation: searchPulse 1.5s ease-in-out infinite;
}

@keyframes searchPulse {
	0%, 100% {
		box-shadow: 0 4px 20px rgba(0, 115, 170, 0.1);
	}
	50% {
		box-shadow: 0 4px 25px rgba(0, 115, 170, 0.2);
	}
}

@keyframes badgeAppear {
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.taxonomy-filter.updating {
	opacity: 0.6;
	pointer-events: none;
}

.taxonomy-filter.updating::after {
	content: "⟳";
	position: absolute;
	right: 0.5rem;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* ===== ÉLÉMENTS BIDULE / POSTS ===== */
.bidule-item,
.post,
.toad,
.post.mario {
	opacity: 1;
	transform: translateY(0) scale(1);
	display: block !important;
}

.bidule-item.hidden,
.searchbar-hidden {
	display: none !important;
	opacity: 0;
	pointer-events: none;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
}

/* Protection : forcer l'affichage si pas de classe searchbar */
.bidule-item:not(.searchbar-hidden):not(.searchbar-show),
.post.mario:not(.searchbar-hidden):not(.searchbar-show) {
	display: block !important;
}

.bidule-item.show,
.searchbar-show,
.post.mario.searchbar-show,
.bidule-item.searchbar-show {
	display: block !important;
	opacity: 1 !important;
	transform: translateY(0) scale(1) !important;
	pointer-events: auto !important;
	width: auto !important;
	height: auto !important;
	margin: inherit !important;
	padding: inherit !important;
	visibility: visible !important;
}

/* Surcharger searchbar-hidden si searchbar-show est présent */
.bidule-item.searchbar-show.searchbar-hidden,
.post.mario.searchbar-show.searchbar-hidden {
	display: block !important;
}

/* ===== MESSAGE AUCUN RÉSULTAT ===== */
.search-no-results {
	text-align: center;
	padding: 3rem 1rem;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.search-no-results.show {
	opacity: 1;
}

.no-results-content {
	max-width: 400px;
	margin: 0 auto;
}

.no-results-icon {
	font-size: 3rem;
	display: block;
	margin-bottom: 1rem;
	opacity: 0.3;
}

.search-no-results p {
	font-size: 1.1rem;
	color: var(--color-text-muted);
	margin: 0;
	line-height: 1.5;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
	.searchbar {
		padding: 1.5rem 0;
	}
	
	.searchbar-title {
		font-size: 1.5rem;
	}
	
	.search-input-simple {
		padding: 0.875rem 1.25rem;
		font-size: 1rem;
	}
	
	.search-bar-container {
		width: 100%;
		padding: 0 1rem;
		flex-direction: column;
		gap: 1rem;
	}
	
	.search-bar-container.filters-left {
		flex-direction: column;
	}
	
	.search-filters {
		flex-direction: column;
		width: 100%;
	}
	
	.search-filters.filters-left {
		min-width: auto;
	}
	
	.taxonomy-filter:not(.inline) {
		width: 100%;
		min-width: auto;
	}
	
	.search-bar-inline {
		flex-direction: column;
		gap: 0;
		border-radius: 8px;
		margin: 0 1rem;
	}
	
	.taxonomy-filter.inline {
		border-right: none;
		border-bottom: 1px solid var(--color-border);
		width: 100%;
		text-align: left;
		min-width: auto;
		max-width: none;
	}
	
	.taxonomy-filter.inline:last-of-type {
		border-bottom: 1px solid var(--color-border);
	}
	
	.search-input-inline {
		min-width: auto;
	}
	
	.search-button {
		width: 100%;
		border-radius: 0;
	}
	
	.search-meta {
		flex-direction: column;
		gap: 0.75rem;
		align-items: flex-start;
	}
	
	.active-filters {
		width: 100%;
		justify-content: flex-start;
		margin-left: 0;
	}
	
	.reset-search-link {
		margin-left: 0;
		align-self: flex-start;
	}
	
	.filter-badge {
		font-size: 0.8rem;
	}
}

/* XS: Largeur très large pour la searchbar sur single-edition */
@media (max-width: 576px) {
	.search-bar-container {
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
	}
	
	.breadcrumb-searchbar-wrapper .searchbar {
		width: 100% !important;
	}
	
	.breadcrumb-searchbar-wrapper .search-bar-container {
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
	}
	
	.search-input-wrapper {
		width: 100% !important;
		min-width: 450px !important;
	}
	
	.search-bar-simple {
		width: 100% !important;
		min-width: 450px !important;
	}
	
	.search-input-simple {
		min-width: 450px !important;
	}
}

/* ===== FILTRES AVEC UL/LI ===== */
.taxonomy-filter-wrapper {
	position: relative;
	display: inline-block;
}

/* Bouton du filtre */
.taxonomy-filter-button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	font-size: 0.95rem;
	border: 2px solid var(--color-border);
	border-radius: 8px;
	background: var(--color-light);
	outline: none;
	transition: all 0.3s ease;
	cursor: pointer;
	font-family: inherit;
	min-width: 160px;
	width: 100%;
	text-align: left;
}

.taxonomy-filter-button:hover {
	border-color: var(--color-primary);
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.taxonomy-filter-button.active {
	border-color: var(--color-primary);
	background: #f8f9fa;
}

.taxonomy-filter-button.has-selection {
	border-color: var(--color-accent);
	background: #e3f2fd;
	color: var(--color-accent);
}

/* Chevron du bouton */
.filter-chevron {
	font-size: 0.7em;
	transition: transform 0.3s ease;
	color: var(--color-text-light);
}

.taxonomy-filter-button.active .filter-chevron {
	transform: rotate(180deg);
}

.taxonomy-filter-button.has-selection .filter-chevron {
	color: var(--color-accent);
}

/* Dropdown (ul) */
.taxonomy-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--color-light);
	border: 2px solid var(--color-border);
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	max-height: 300px;
	overflow-y: auto;
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
}

.taxonomy-dropdown.open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Options (li) */
.taxonomy-option {
	padding: 0.75rem 1rem;
	cursor: pointer;
	transition: all 0.2s ease;
	border-bottom: 1px solid #f0f0f0;
	font-size: 0.95rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.taxonomy-option:last-child {
	border-bottom: none;
}

.taxonomy-option:hover {
	background: #f8f9fa;
	color: var(--color-primary);
}

.taxonomy-option.selected {
	background: #e3f2fd;
	color: var(--color-accent);
	font-weight: 500;
}

.taxonomy-option .count {
	font-size: 0.85rem;
	color: var(--color-text-lighter);
	margin-left: 0.5rem;
}

.taxonomy-option.selected .count {
	color: var(--color-accent);
}

/* Filtres inline */
.taxonomy-filter-wrapper.inline {
	flex: 1;
}

.taxonomy-filter-button.inline {
	border: none;
	border-right: 1px solid var(--color-border);
	border-radius: 0;
	background: transparent;
	padding: 1rem 1.5rem;
	min-width: auto;
}

.taxonomy-filter-button.inline:last-of-type {
	border-right: 1px solid var(--color-border);
}

.taxonomy-dropdown.inline {
	top: 100%;
	border-radius: 0 0 8px 8px;
	border-top: 1px solid var(--color-border);
	margin-top: 0;
}

/* Scrollbar personnalisée */
.taxonomy-dropdown::-webkit-scrollbar {
	width: 6px;
}

.taxonomy-dropdown::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 3px;
}

.taxonomy-dropdown::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

.taxonomy-dropdown::-webkit-scrollbar-thumb:hover {
	background: var(--color-text-lighter);
}

/* Responsive */
@media (max-width: 768px) {
	.taxonomy-filter-button {
		width: 100%;
	}
	
	.taxonomy-dropdown {
		position: fixed;
		left: 1rem;
		right: 1rem;
		max-width: calc(100vw - 2rem);
	}
}
