/* Elderion SearchWeave — SearchWeave – Search & Filter Content */

.elsw-filter-list {
	width: 100%;
	background-color: var( --elsw-container-bg, transparent );
}

.elsw-filter-list .elsw-heading {
	text-align: left;
	margin: 0 0 8px;
	font-size: 1rem;
}

/* Search box — colors/radius/font-size come from inline styles set in the
   editor (per-block customization); this covers layout/behaviour only. */
.elsw-search-wrap {
	position: relative;
	margin: 0 0 16px;
}

.elsw-filter-list .elsw-search-box {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 14px 40px 14px 16px;
	border: 1px solid #ccc;
	transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.elsw-filter-list .elsw-search-box:focus {
	outline: none;
	border-color: #0073e6;
	box-shadow: 0 0 0 3px rgba( 0, 115, 230, 0.15 );
}

button.elsw-search-clear {
	position: absolute !important;
	top: 50% !important;
	right: 8px !important;
	left: auto !important;
	bottom: auto !important;
	transform: translateY( -50% ) !important;
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 26px !important;
	height: 26px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: transparent !important;
	box-shadow: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	color: #666 !important;
	cursor: pointer !important;
	transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

button.elsw-search-clear svg {
	display: block;
	width: 14px;
	height: 14px;
}

button.elsw-search-clear:hover,
button.elsw-search-clear:focus {
	background-color: rgba( 0, 0, 0, 0.08 ) !important;
	color: #1e1e1e !important;
	outline: none !important;
	box-shadow: none !important;
}

button.elsw-search-clear[ hidden ] {
	display: none !important;
}

.elsw-filter-list-inner {
	display: grid;
	grid-template-columns: repeat( 1, 1fr );
	gap: 0;
}

.elsw-columns-2 .elsw-filter-list-inner {
	grid-template-columns: repeat( 2, 1fr );
	gap: 16px;
}

.elsw-columns-3 .elsw-filter-list-inner {
	grid-template-columns: repeat( 3, 1fr );
	gap: 16px;
}

.elsw-columns-4 .elsw-filter-list-inner {
	grid-template-columns: repeat( 4, 1fr );
	gap: 16px;
}

/* Single-column layout keeps the classic "row with divider" look;
   multi-column layouts read as cards. */
.elsw-columns-1 .elsw-filter-item {
	border-bottom: 1px solid #e2e2e2;
	border-radius: 0;
}

.elsw-columns-2 .elsw-filter-item,
.elsw-columns-3 .elsw-filter-item,
.elsw-columns-4 .elsw-filter-item {
	border: 1px solid #e2e2e2;
	border-radius: 6px;
}

.elsw-filter-item {
	padding: 14px 16px;
	background-color: var( --elsw-item-bg, #ffffff );
	transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.15s ease-in-out;
}

/* Clearfix: without this, a floated image (align left/right) can make the
   card collapse to zero height, since it would have no non-floated content
   left to size itself against. */
.elsw-filter-item::after {
	content: "";
	display: table;
	clear: both;
}

.elsw-filter-item:hover,
.elsw-filter-item:focus-within {
	background-color: var( --elsw-item-hover-bg, #f5f8fb );
}

.elsw-columns-2 .elsw-filter-item:hover,
.elsw-columns-3 .elsw-filter-item:hover,
.elsw-columns-4 .elsw-filter-item:hover {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.08 );
	transform: translateY( -2px );
}

/* Give images inside a filter item a sane default so authors don't have to
   fight WordPress's default alignleft/alignright margins. */
.elsw-filter-item img {
	max-width: 100%;
	height: auto;
}

/* Image/media alignment inside a filter item — defined ourselves rather
   than relying on WordPress core's wp-block-library stylesheet, since some
   themes/CSS-optimization plugins don't load or preserve those rules for
   content assembled inside a custom block. */
.elsw-filter-item .alignleft {
	float: left;
	margin: 0 16px 8px 0;
}

.elsw-filter-item .alignright {
	float: right;
	margin: 0 0 8px 16px;
}

.elsw-filter-item .aligncenter {
	display: block;
	float: none;
	margin-left: auto;
	margin-right: auto;
}

/* core/image always offers "Wide width" and "Full width" in its toolbar
   regardless of nesting — WordPress doesn't hide those based on how deep
   a block is nested, and we deliberately don't touch core/image's own
   supports, since doing so would affect images elsewhere on the site too,
   not just inside SearchWeave. Instead, neutralize the effect here: a
   theme's usual "breakout" technique for alignwide/alignfull (negative
   margins, calc(50% - 50vw), position tricks to reach viewport width) has
   no sensible meaning inside a small grid card, and was causing real
   breakage — overflowing the card (wide) or being pushed entirely outside
   its visible box (full). This makes both behave like normal contained
   width instead. */
.elsw-filter-item .alignwide,
.elsw-filter-item .alignfull {
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	left: auto !important;
	right: auto !important;
	float: none !important;
	position: static !important;
	transform: none !important;
}

.elsw-filter-item h1,
.elsw-filter-item h2,
.elsw-filter-item h3,
.elsw-filter-item h4,
.elsw-filter-item h5,
.elsw-filter-item h6 {
	margin: 0 0 4px;
}

.elsw-filter-item p:last-child {
	margin-bottom: 0;
}

.elsw-hidden {
	display: none !important;
}

.elsw-no-results {
	margin-top: 12px;
	font-style: italic;
	color: #555;
}

@media screen and ( max-width: 768px ) {
	.elsw-filter-list-inner {
		grid-template-columns: 1fr !important;
	}

	.elsw-filter-list .elsw-search-box {
		padding: 12px 38px 12px 14px;
	}
}
