/**
 * WLRE Theme — Saved-property toggle + /account/saved-properties/ layout.
 *
 * The heart button (.wlre-save-btn) lives globally on property cards + detail.
 * The page-level styles scope under .wlre-saved.
 */

/* === Heart toggle (shared) === */
.wlre-save-btn {
	position: relative;
}

.wlre-save-btn .wlre-save-btn__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.wlre-save-btn .wlre-save-btn__icon--on {
	display: none;
	color: #95231f; /* Figma: New UI/Semantic/Error 1 */
}

.wlre-save-btn.is-saved .wlre-save-btn__icon--off {
	display: none;
}

.wlre-save-btn.is-saved .wlre-save-btn__icon--on {
	display: inline-flex;
}

/* Detail-sidebar button has text labels too. */
.wlre-save-btn .wlre-save-btn__label-on {
	display: none;
}

.wlre-save-btn.is-saved .wlre-save-btn__label-off {
	display: none;
}

.wlre-save-btn.is-saved .wlre-save-btn__label-on {
	display: inline;
}

/* === Saved-properties page === */
.wlre-saved {
	background: var(--wlre-color-white);
	min-height: calc(100vh - 80px);
	padding-block: var(--wlre-space-40) var(--wlre-space-64);
}

/* Account switcher — pill segmented (Immobili salvati / Ricerche salvate).
 * Visible on all viewports per point 051. Mobile keeps full-width layout. */
.wlre-account-switcher {
	display: inline-flex;
	gap: 2px;
	align-items: center;
	width: max-content;
	max-width: 100%;
	margin: 0 0 var(--wlre-space-24);
	padding: var(--wlre-space-4);
	border-radius: 48px;
	background: #f5f5f5;
	border: 0.5px solid var(--wlre-color-neutral-400);
}

.wlre-account-switcher__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	padding: 12px var(--wlre-space-24);
	border: 2.333px solid transparent;
	border-radius: 32px;
	color: var(--wlre-color-text-900);
	font-family: var(--wlre-font-body);
	font-size: 18px;
	font-weight: 700;
	line-height: var(--wlre-line-height-body);
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
}

.wlre-account-switcher__item--active {
	border-color: var(--wlre-color-teal-700);
	background: #f3faf4;
}

.wlre-saved__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--wlre-space-16);
	margin-bottom: var(--wlre-space-24);
}

.wlre-saved__title {
	color: var(--wlre-color-text-900);
	margin: 0;
}

.wlre-saved__count {
	color: var(--wlre-color-neutral-600);
	margin: 0;
}

/* === Filter chip row — above toolbar (Figma 6163-158584) === */
.wlre-saved-chip-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wlre-space-8);
	margin-bottom: var(--wlre-space-16);
}

/* Toggleable variant: button (not anchor), no close icon, accent-active state. */
.wlre-filter-chip--toggle {
	cursor: pointer;
	font-family: inherit;
	font-size: 13px;
	line-height: 1;
	padding: var(--wlre-space-8) var(--wlre-space-16);
	height: 36px;
	display: inline-flex;
	align-items: center;
	gap: var(--wlre-space-4);
}

.wlre-filter-chip--toggle .wlre-filter-chip__count {
	color: var(--wlre-color-neutral-600);
	font-variant-numeric: tabular-nums;
}

.wlre-filter-chip--toggle[aria-pressed="true"] {
	background: var(--wlre-color-accent-500);
	border-color: var(--wlre-color-accent-500);
	color: var(--wlre-color-text-900);
}

.wlre-filter-chip--toggle[aria-pressed="true"] .wlre-filter-chip__count {
	color: var(--wlre-color-text-900);
	opacity: 0.75;
}

/* === Toolbar — count left / sort + view right (Figma 6081-50692) === */
.wlre-saved-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wlre-space-16);
	margin-bottom: var(--wlre-space-24);
	flex-wrap: wrap;
}

.wlre-saved-toolbar__count {
	display: inline-flex;
	align-items: baseline;
	gap: var(--wlre-space-4);
	margin: 0;
	color: var(--wlre-color-text-900);
}

.wlre-saved-toolbar__count-num {
	font-family: var(--wlre-font-heading);
	font-weight: 600;
	font-size: 28px;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.wlre-saved-toolbar__count-label {
	font-family: var(--wlre-font-body);
	font-size: 16px;
	line-height: 1.48;
}

.wlre-saved-toolbar__actions {
	display: flex;
	align-items: center;
	gap: var(--wlre-space-20);
}

.wlre-saved-toolbar__sort,
.wlre-saved-toolbar__view {
	display: inline-flex;
	align-items: center;
	gap: var(--wlre-space-8);
}

.wlre-saved-toolbar__sort-label,
.wlre-saved-toolbar__view-label {
	font-family: var(--wlre-font-body);
	font-size: 14px;
	color: var(--wlre-color-text-900);
	white-space: nowrap;
}

.wlre-saved-sort .wlre-sort-dropdown__menu {
	min-width: 220px;
}

/* View toggle on saved page uses the same base .wlre-view-toggle styles as
 * the search page — no local overrides needed. */
.wlre-saved-view-toggle .wlre-view-toggle__btn {
	border: 0;
	cursor: pointer;
}

.wlre-saved__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 24px;
}

/* Grid view — matches wlre-search-grid--grid */
.wlre-saved__list:not([data-view="list"]) {
	grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.wlre-saved__list:not([data-view="list"]) .wlre-property-card {
	width: 100%;
}

/* List view — matches wlre-search-grid--list */
.wlre-saved__list[data-view="list"] {
	grid-template-columns: 1fr;
}

.wlre-saved__list[data-view="list"] .wlre-property-card {
	width: 100%;
	min-width: 0;
	height: 303px;
	display: grid;
	grid-template-columns: 660px minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) auto;
	gap: 0;
	padding: 0;
	overflow: hidden;
}

.wlre-saved__list[data-view="list"] .wlre-property-card__image {
	grid-row: 1 / 3;
	width: 660px;
	height: 303px;
	border-radius: 0;
}

.wlre-saved__list[data-view="list"] .wlre-property-card__body {
	flex: 1;
	min-width: 0;
	padding: var(--wlre-space-24) var(--wlre-space-24) 0;
	gap: var(--wlre-space-24);
}

.wlre-saved__list[data-view="list"] .wlre-property-card__actions {
	width: 100%;
	padding: 0 var(--wlre-space-24) var(--wlre-space-24);
	margin-top: 0;
	gap: var(--wlre-space-12);
	flex-wrap: nowrap;
	align-self: end;
}

.wlre-saved__list[data-view="list"] .wlre-property-card__price {
	font-size: var(--wlre-font-size-h3);
}

.wlre-saved__list[data-view="list"] .wlre-property-card__visit {
	height: 50px;
}

.wlre-saved__list[data-view="list"] .wlre-property-card__action-btn {
	width: 52px;
	height: 52px;
	min-width: unset;
	padding: var(--wlre-space-16);
}

.wlre-saved__list[data-view="list"] .wlre-property-card__action-label {
	display: none;
}

.wlre-saved__item {
	position: relative;
}

.wlre-saved__item[hidden] {
	display: none;
}

/* Empty state when every chip filter hides all cards. */
.wlre-saved__no-results {
	text-align: center;
	padding: var(--wlre-space-40) var(--wlre-space-16);
	color: var(--wlre-color-neutral-600);
	font-family: var(--wlre-font-body);
	font-size: 16px;
	margin: 0;
}

/* Empty state: see empty-state.css (.wlre-empty). */

/* Toast primitive moved to assets/css/toasts.css (shared). */

/* === Mobile === */
@media (max-width: 767px) {
	.wlre-saved {
		padding-block: var(--wlre-space-32) var(--wlre-space-40);
	}

	.wlre-saved .wlre-container {
		padding-inline: var(--wlre-space-16);
	}

	.wlre-account-switcher {
		width: 100%;
		margin-top: -23px; /* mobile fudge: pull above the page title */
	}

	.wlre-account-switcher__item {
		flex: 1 1 0;
		padding-inline: var(--wlre-space-12);
	}

	.wlre-saved__header {
		display: none;
	}

	.wlre-saved-chip-row {
		display: none;
	}

	.wlre-saved__title {
		font-size: var(--wlre-font-size-h3);
	}

	.wlre-saved__header {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--wlre-space-4);
	}

	.wlre-saved-toolbar {
		flex-direction: row;
		align-items: center;
		gap: var(--wlre-space-12);
		margin-bottom: var(--wlre-space-12);
	}

	.wlre-saved-toolbar__actions {
		width: auto;
		margin-inline-start: auto;
		justify-content: flex-end;
		gap: var(--wlre-space-12);
	}

	.wlre-saved-toolbar__view {
		display: none;
	}

	.wlre-saved-toolbar__count-num {
		font-size: 22px;
	}

	.wlre-filter-chip--toggle {
		min-height: var(--wlre-tap-target);
	}

	.wlre-sort-dropdown__trigger {
		height: 32px;
		padding-inline: var(--wlre-space-12);
		font-size: 12px;
	}

	/* Expand wrapper + inner buttons so each tap target itself is 44×44. */
	.wlre-view-toggle {
		padding: var(--wlre-space-4);
	}

	.wlre-view-toggle__btn {
		width: var(--wlre-tap-target);
		height: var(--wlre-tap-target);
	}

	/* Stack list-view card vertically on phones — 280px sidebar image leaves no room for body. */
	.wlre-saved__list[data-view="list"] .wlre-property-card {
		flex-direction: column;
	}

	.wlre-saved__list[data-view="list"] .wlre-property-card__image {
		width: 100%;
		height: 200px;
	}
}
