/* Available Homes Grid - 4 columns desktop, 1 on mobile, responsive filters */

.ah-available-homes-grid {
	--ah-gap: 1.25rem;
	--ah-card-radius: 8px;
	--ah-filter-gap: 0.75rem;
	margin: 0 0 1.5rem;
}

/*
 * Filter bar: dropdown style (filter name in trigger, no labels).
 * To restore default style (label + select per filter): revert this block and
 * use .ah-grid-filters-inner + .ah-filter-group + label + .ah-filter select,
 * and in grid.js use .ah-filter select change + getFilterValues from select.value.
 */
.ah-grid-filters {
	margin-bottom: 1.5rem;
	padding: 1rem 0;
	border-bottom: 1px solid #e0e0e0;
}

.ah-filter-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	list-style: none;
	margin: 0;
	padding: 0;
	align-items: center;
	justify-content: center;
}

.ah-filter-category {
	position: relative;
	list-style: none;
	margin: 0;
}

/* Override theme/Elementor link styles so filter buttons keep white text and no underline */
.ah-available-homes-grid .ah-filter-trigger,
.ah-available-homes-grid .ah-filter-trigger:hover,
.ah-available-homes-grid .ah-filter-trigger:focus,
.ah-available-homes-grid .ah-filter-trigger:visited {
	color: #fff !important;
	text-decoration: none !important;
}

.ah-filter-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.5rem 0.75rem;
	font-size: 0.9375rem;
	text-decoration: none !important;
	text-transform: uppercase;
	color: #fff !important;
	background: #003a5a;
	border: 1px solid #003a5a;
	border-radius: 4px;
	margin-right: 0.25rem;
	transition: background 0.2s, border-color 0.2s;
}

.ah-filter-trigger:hover {
	background: #002a42;
	border-color: #002a42;
	color: #fff !important;
	text-decoration: none !important;
}

.ah-filter-dropdown-icon {
	display: inline-block;
	width: 0.5em;
	height: 0.5em;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg);
	margin-left: 0.15em;
	transition: transform 0.2s;
}

.ah-filter-category.ah-filter-open .ah-filter-dropdown-icon {
	transform: rotate(-135deg);
}

.ah-filter-sub {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 100%;
	margin: 0.25rem 0 0;
	padding: 0.25rem 0;
	list-style: none;
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	z-index: 100;
	display: none;
}

.ah-filter-category.ah-filter-open .ah-filter-sub {
	display: block;
}

.ah-filter-option {
	margin: 0;
	list-style: none;
}

.ah-filter-option a {
	display: block;
	padding: 0.4rem 0.75rem;
	font-size: 0.875rem;
	text-decoration: none;
	text-transform: uppercase;
	color: #444;
	white-space: nowrap;
}

.ah-filter-option a:hover {
	background: #f0f0f0;
	color: #222;
	text-decoration: none;
}

.ah-filter-option.ah-selected a {
	font-weight: 600;
	color: #003a5a;
	text-decoration: none;
}

.ah-filter-show-all-wrap {
	list-style: none;
	margin: 0;
	margin-left: 0.5rem;
}

/* Override theme/Elementor link styles for Show All button */
.ah-available-homes-grid .ah-grid-show-all,
.ah-available-homes-grid .ah-grid-show-all:hover,
.ah-available-homes-grid .ah-grid-show-all:focus,
.ah-available-homes-grid .ah-grid-show-all:visited {
	color: #fff !important;
	text-decoration: none !important;
}

.ah-grid-show-all {
	display: inline-block;
	padding: 0.5rem 0.75rem;
	font-size: 0.9375rem;
	text-decoration: none !important;
	text-transform: uppercase;
	color: #fff !important;
	background: #003a5a;
	border: 1px solid #003a5a;
	border-radius: 4px;
	transition: background 0.2s, border-color 0.2s;
}

.ah-grid-show-all:hover {
	background: #002a42;
	border-color: #002a42;
	color: #fff !important;
	text-decoration: none !important;
}

/* Grid: 4 columns on desktop */
.ah-grid-list {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--ah-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ah-grid-list .ah-grid-card {
	margin: 0;
}

/* Cards */
.ah-grid-card {
	border-radius: var(--ah-card-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	transition: box-shadow 0.2s ease;
}

.ah-grid-card:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.ah-grid-card-image {
	aspect-ratio: 4/3;
	overflow: hidden;
	background: #f0f0f0;
}

.ah-grid-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ah-grid-card-body {
	padding: 1rem;
}

.ah-grid-card-title {
	margin: 0 0 0.35em;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
}

.ah-grid-card-price {
	margin: 0 0 0.25em;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
}

.ah-grid-card-specs,
.ah-grid-card-builder {
	margin: 0.25em 0 0;
	font-size: 0.875rem;
	color: #555;
}

.ah-grid-card-actions {
	margin-top: 1rem;
	text-align: center;
}

/* Override Elementor global link color (e.g. .elementor-kit-7 a) for the button */
.ah-available-homes-grid .ah-grid-card-btn,
.ah-available-homes-grid .ah-grid-card-btn:hover,
.ah-available-homes-grid .ah-grid-card-btn:focus,
.ah-available-homes-grid .ah-grid-card-btn:visited {
	color: #ffffff !important;
	background: #ccaa39 !important;
	text-decoration: none !important;
}

.ah-grid-card-btn {
	display: inline-block;
	padding: 0.5rem 1.25rem;
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none !important;
	color: #ffffff !important;
	background: #ccaa39 !important;
	border-radius: 4px;
	transition: background 0.2s ease, color 0.2s ease;
}

.ah-grid-card-btn:hover {
	background: #b89830 !important;
	color: #ffffff !important;
	text-decoration: none !important;
}

.ah-grid-count {
	margin: 1rem 0 0;
	font-size: 0.875rem;
	color: #666;
}

/* View toggle: Grid / List (shown on mobile only) */
.ah-view-toggle {
	display: none;
	margin-bottom: 1rem;
	justify-content: center;
	gap: 0;
}

.ah-view-btn {
	padding: 0.4rem 0.75rem;
	font-size: 0.875rem;
	text-transform: uppercase;
	border: 1px solid #003a5a;
	background: #fff;
	color: #003a5a;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ah-view-btn:first-child {
	border-radius: 4px 0 0 4px;
	border-right-width: 0;
}

.ah-view-btn:last-child {
	border-radius: 0 4px 4px 0;
}

.ah-view-btn:hover {
	background: #e8eef2;
	border-color: #003a5a;
	color: #003a5a;
}

.ah-view-btn.is-active,
.ah-view-btn[aria-pressed="true"] {
	background: #003a5a;
	color: #fff;
	border-color: #003a5a;
}

.ah-view-btn.is-active:hover,
.ah-view-btn[aria-pressed="true"]:hover {
	background: #002a42;
	border-color: #002a42;
	color: #fff;
}

.ah-view-btn:focus {
	outline: 1px solid #003a5a;
	outline-offset: 1px;
}

/* Hidden when filtered out */
.ah-grid-card.ah-grid-hidden {
	display: none;
}

/* Responsive: 2 columns tablet */
@media (max-width: 1024px) {
	.ah-grid-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Single column on mobile */
@media (max-width: 640px) {
	.ah-filter-menu {
		flex-direction: column;
		align-items: stretch;
	}

	.ah-filter-show-all-wrap {
		display: flex;
		justify-content: center;
	}

	.ah-filter-trigger {
		width: 100%;
		justify-content: space-between;
	}

	.ah-filter-sub {
		left: 0;
		right: 0;
		min-width: 0;
	}

	.ah-view-toggle {
		display: flex;
	}

	.ah-grid-list {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	/* List view: compact horizontal rows to reduce scrolling */
	.ah-available-homes-grid.ah-view-list .ah-grid-list {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card {
		display: flex;
		flex-direction: row;
		align-items: stretch;
		box-shadow: 0 1px 2px rgba(0,0,0,0.06);
	}

	/* Keep filtered-out cards hidden in list view (overrides display:flex above) */
	.ah-available-homes-grid.ah-view-list .ah-grid-card.ah-grid-hidden {
		display: none;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-image {
		width: 88px;
		min-width: 88px;
		aspect-ratio: 1;
		flex-shrink: 0;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-body {
		flex: 1;
		min-width: 0;
		padding: 0.5rem 0.75rem;
		display: flex;
		flex-wrap: wrap;
		align-content: flex-start;
		align-items: flex-start;
		gap: 0.15rem 0.5rem;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-title {
		width: 100%;
		margin: 0;
		font-size: 0.9375rem;
		line-height: 1.25;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-price {
		margin: 0;
		font-size: 0.875rem;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-specs,
	.ah-available-homes-grid.ah-view-list .ah-grid-card-builder {
		margin: 0;
		font-size: 0.8125rem;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-actions {
		margin: 0 0 0 auto;
		align-self: center;
		text-align: right;
	}

	.ah-available-homes-grid.ah-view-list .ah-grid-card-btn {
		padding: 0.35rem 0.75rem;
		font-size: 0.8125rem;
	}
}
