/**
 * @package     Comdev.Module
 * @subpackage  mod_onecore_search
 *
 * @copyright   (C) 2026 Comdev. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

.mod-onecore-search {
	margin-bottom: 2rem;
}

.mod-onecore-search__form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.mod-onecore-search__field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.mod-onecore-search__field label {
	font-weight: 500;
	margin-bottom: 0.25rem;
}

.mod-onecore-search__field--sort {
	margin-top: 10px;
	margin-bottom: 10px;
}

.mod-onecore-search__field--category {
	margin-top: 10px;
	margin-bottom: 10px;
}

.mod-onecore-search__field--search {
	margin-bottom: 1rem;
}

.mod-onecore-search__input-wrapper {
	position: relative;
}

.mod-onecore-search__input {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.mod-onecore-search__input:focus {
	outline: none;
	border-color: #007bff;
	box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.mod-onecore-search__select {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	background-color: #fff;
}

.mod-onecore-search__select[multiple] {
	min-height: 100px;
}

.mod-onecore-search__fancy-select {
	width: 100%;
}

.mod-onecore-search__checkbox {
	margin-right: 0.5rem;
}

.mod-onecore-search__filters {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
}

.mod-onecore-search__filters--basic {
	margin-top: 1rem;
}

.mod-onecore-search__filters--advanced {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #eee;
}

.mod-onecore-search__advanced-toggle {
	margin-top: 1rem;
}

.mod-onecore-search__toggle {
	padding: 0.5rem 0;
	color: #007bff;
	text-decoration: none;
	border: none;
	background: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.mod-onecore-search__toggle:hover {
	text-decoration: underline;
}

.mod-onecore-search__toggle-icon {
	transition: transform 0.3s ease;
	font-size: 0.8em;
}

.mod-onecore-search__toggle[aria-expanded="true"] .mod-onecore-search__toggle-icon {
	transform: rotate(180deg);
}

.mod-onecore-search__actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 20px;
	margin-bottom: 20px;
}

.mod-onecore-search__submit,
.mod-onecore-search__reset {
	padding: 0.75rem 1.5rem;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.mod-onecore-search__submit {
	background-color: #007bff;
	color: #fff;
	border: 1px solid #007bff;
}

.mod-onecore-search__submit:hover {
	background-color: #0056b3;
	border-color: #0056b3;
}

.mod-onecore-search__reset {
	background-color: #6c757d;
	color: #fff;
	border: 1px solid #6c757d;
}

.mod-onecore-search__reset:hover {
	background-color: #545b62;
	border-color: #545b62;
}

/* Autosuggest styles */
.mod-onecore-search__suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #ddd;
	border-top: none;
	border-radius: 0 0 4px 4px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	max-height: 300px;
	overflow-y: auto;
	z-index: 1000;
	display: none;
}

.mod-onecore-search__suggestions.is-visible {
	display: block;
}

.mod-onecore-search__suggestions.is-loading {
	padding: 1rem;
	text-align: center;
	color: #666;
}

.mod-onecore-search__suggestion {
	padding: 0.75rem 1rem;
	cursor: pointer;
	border-bottom: 1px solid #eee;
	transition: background-color 0.2s ease;
}

.mod-onecore-search__suggestion:hover,
.mod-onecore-search__suggestion:focus {
	background-color: #f8f9fa;
	outline: none;
}

.mod-onecore-search__suggestion:last-child {
	border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
	.mod-onecore-search__filters {
		grid-template-columns: 1fr;
	}
	
	.mod-onecore-search__actions {
		flex-direction: column;
	}
	
	.mod-onecore-search__submit,
	.mod-onecore-search__reset {
		width: 100%;
	}
}
