/* ==========================================================================
   1. AKTYWACJA SIATKI GRID DLA FORMULARZA WYSZUKIWARKI
   ========================================================================== */
.as-form-wrap .advance-search-form {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
	gap: 15px !important;
}

/* Wymuszenie, aby pierwsze pole zawsze wskakiwało na 1. kolumnę (likwiduje pusty kwadrat) */
.as-form-wrap .advance-search-form > .option-bar:first-of-type {
	grid-column-start: 1 !important;
}

/* ==========================================================================
   2. FORMATOWANIE GŁÓWNYCH PÓL WYSZUKIWARKI (Z WYŁĄCZENIEM CHECKBOXÓW!)
   Stosujemy selektor bezpośredniego dziecka (>), aby reguły NIE przechodziły 
   na checkboxy ukryte głęboko w strukturze .more-options-wrapper
   ========================================================================== */
.as-form-wrap .advance-search-form > .option-bar {
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	box-sizing: border-box !important;
	display: flex !important;
	flex-direction: column !important;
	justify-content: flex-end !important;
}

/* Usuwamy ewentualne elementy before, które mogłyby spychać przycisk */
.as-form-wrap .advance-search-form > .option-bar::before {
	display: none !important;
	content: none !important;
}

/* Ujednolicenie wysokości głównych pól edit i select */
.as-form-wrap .advance-search-form > .option-bar input[type="text"],
.as-form-wrap .advance-search-form > .option-bar .selectwrap,
.as-form-wrap .advance-search-form > .option-bar .select2-container--default .select2-selection--single {
	height: 42px !important;
	line-height: 42px !important;
	box-sizing: border-box !important;
}

.as-form-wrap .advance-search-form > .option-bar .select2-container--default .select2-selection--single .select2-selection__rendered,
.as-form-wrap .advance-search-form > .option-bar .select2-container--default .select2-selection--single .select2-selection__arrow {
	line-height: 40px !important;
	height: 40px !important;
}

/* Wyrównanie i margines dla przycisku wyszukiwania */
.as-form-wrap .advance-search-form > .option-bar input.real-btn {
	height: 42px !important;
	line-height: 42px !important;
	margin: 24px 0 10px 0 !important;
	padding: 0 !important;
	box-sizing: border-box !important;
}

/* Zapewnienie, że dynamicznie ukrywane pola ceny nie psują układu */
.as-form-wrap .advance-search-form > .option-bar.hide-fields {
	display: none !important;
}

/* ==========================================================================
   3. CAŁKOWITE ODSEPAROWANIE ELEMENTÓW ROZWIJANYCH OD STRUKTURY GRID
   ========================================================================== */

/* Przycisk rozwijania ("Looking for certain features") rozciąga się na całą szerokość */
.as-form-wrap .more-option-trigger {
	grid-column: 1 / -1 !important;
	width: 100% !important;
}

/* Kontener z checkboxami rozciąga się na całą szerokość */
.as-form-wrap .more-options-wrapper {
	grid-column: 1 / -1 !important;
	width: 100% !important;
	/* NIE wymuszamy display: block ani none za pomocą !important, 
	   aby pozwolić skryptowi JavaScript z RealHomes na swobodne ukrywanie i pokazywanie */
}

/* ==========================================================================
   4. RESPONSYWNOŚĆ (MEDIA QUERIES)
   ========================================================================== */
@media (min-width: 1200px) {
	.as-form-wrap .advance-search-form { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (min-width: 769px) and (max-width: 1199px) {
	.as-form-wrap .advance-search-form { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (min-width: 481px) and (max-width: 768px) {
	.as-form-wrap .advance-search-form { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
	.as-form-wrap .advance-search-form { grid-template-columns: 1fr !important; }
	.as-form-wrap .advance-search-form > .option-bar input.real-btn { margin-top: 0 !important; }
}