/* ==========================================================================
   Ленты «как приложение» (29.09.2026): категория, подкатегория, поиск —
   pages/category, pages/subcategory, pages/search (корень .ls-page).
   Телефон (≤768) — category_screen / subcategory_screen / search_screen
   приложения (лист light, «назад» + название, FeedCard, листы фильтров и
   сортировки). ПК — прежняя раскладка в новом стиле (макет Category.dc.html).
   Форма фильтров, сортировка, select.js/filters.js — прежние, здесь только
   оформление (привязки — mobile/docs/plans/2026-09-30-listing-redesign.md).
   ========================================================================== */

/* --------------------------------------------------------------------------
   ОБЩЕЕ (все ширины)
   -------------------------------------------------------------------------- */

.ls-page {
	--ls-field: var(--light); /* фон полей: на белой карточке ПК — light */
}

.ls-page .ls-empty {
	padding: 60px 20px;
	text-align: center;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	color: rgb(22 14 24 / 40%); /* black 40 % */
}

.ls-page .ls-sub {
	font-size: 14px;
	line-height: 1.3;
	color: var(--gray);
}

/* --- пагинация: кнопки 44, r12, текущая фиолетовая (макет) --- */
.ls-page .pagination {
	gap: 8px;
	margin: 32px auto 0;
}

.ls-page .pagination a {
	min-width: 44px;
	height: 44px;
	padding: 0 6px;
	border-radius: 12px;
	background: var(--white);
	font-size: 15px;
	font-weight: 600;
}

.ls-page .pagination .active a {
	background: var(--accent);
	color: var(--white);
}

.ls-page .pagination li:not(.active) a:hover {
	background: var(--card-lilac);
}

/* --- фильтры: подписи, поля, «таблетки» --- */
.ls-page .filter {
	margin-bottom: 24px;
}

.ls-page .filter-name {
	margin-bottom: 10px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
	color: var(--label-gray);
}

.ls-page .filter-grid {
	gap: 8px;
}

.ls-page .filter-input {
	height: 46px;
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: 16px;
	background: var(--ls-field);
	font-size: 14px;
	font-weight: 600;
	color: var(--black);
}

.ls-page .filter-input::placeholder {
	font-weight: 400;
	color: rgb(22 14 24 / 40%);
}

.ls-page .filter-input:focus {
	border-color: var(--brand-purple);
}

/* стрелка списка — вниз, labelGray (keyboard_arrow_down приложения) */
.ls-page .filter .select::before {
	right: 14px;
	width: 20px;
	height: 20px;
	background: var(--label-gray);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

.ls-page .filter .select-input {
	padding-right: 40px;
}

/* выпадающий список — белая карточка r16 */
.ls-page .select-popup {
	top: calc(100% + 6px);
	padding: 6px 0;
	border: 0;
	border-radius: 16px;
	box-shadow: 0 8px 24px rgb(22 14 24 / 12%);
}

.ls-page .select-button {
	padding: 10px 16px;
	font-size: 14px;
}

.ls-page .select-button:hover,
.ls-page .select-button.selected {
	background: var(--light);
}

.ls-page .select-button.selected {
	font-weight: 600;
}

/* «Тип объявления» и «Состояние» — таблетками «Все / Частные / Бизнес»
   (filters_sheet.dart). Это те же кнопки списка (.select-button): список
   показан всегда, поле скрыто — выбор обрабатывает select.js как раньше. */
.ls-page .filter .select:has(input[name="type"]),
.ls-page .filter .select:has(input[name="item_condition"]) {
	position: static;
}

.ls-page .filter .select:has(input[name="type"])::before,
.ls-page .filter .select:has(input[name="item_condition"])::before,
.ls-page .filter .select:has(input[name="type"]) .select-input,
.ls-page .filter .select:has(input[name="item_condition"]) .select-input {
	display: none;
}

.ls-page .filter .select:has(input[name="type"]) .select-popup,
.ls-page .filter .select:has(input[name="item_condition"]) .select-popup {
	position: static;
	visibility: visible;
	opacity: 1;
	transform: none;
	width: auto;
	max-height: none;
	padding: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	overflow: visible;
	transition: none;
}

.ls-page .filter .select:has(input[name="type"]) .select-popup-wrap,
.ls-page .filter .select:has(input[name="item_condition"]) .select-popup-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	overflow: visible;
}

/* таблетка: 10/14, r16, рамка 1 (выбранная — brandPurple), 13/400 → 600 */
.ls-page .filter .select:has(input[name="type"]) .select-button,
.ls-page .filter .select:has(input[name="item_condition"]) .select-button,
.ls-page .filter-multi-wrap .filter-item,
.ls-page .filter > label,
.ls-page .child-filter > label {
	display: inline-flex;
	align-items: center;
	width: auto;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid transparent;
	border-radius: 16px;
	background: var(--ls-field);
	font-size: 13px;
	font-weight: 400;
	line-height: 16px;
	color: var(--black);
	cursor: pointer;
}

.ls-page .filter .select:has(input[name="type"]) .select-button.selected,
.ls-page .filter .select:has(input[name="item_condition"]) .select-button.selected,
.ls-page .filter-multi-wrap .filter-item:has(input:checked),
.ls-page .filter > label:has(input:checked),
.ls-page .child-filter > label:has(input:checked) {
	border-color: var(--brand-purple);
	background: var(--ls-field);
	font-weight: 600;
}

.ls-page .filter .select:has(input[name="type"]) .select-button.selected::after,
.ls-page .filter .select:has(input[name="item_condition"]) .select-button.selected::after {
	display: none;
}

/* галочки у таблеток не нужны — выбор виден по рамке */
.ls-page .filter-multi-wrap .checkmark,
.ls-page .filter > label input,
.ls-page .child-filter > label input {
	display: none;
}

.ls-page .filter-multi-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ls-page .filter-toggle-button {
	width: 100%;
	margin-top: 4px;
	text-align: left;
	font-size: 13px;
	font-weight: 600;
	color: var(--brand-purple);
}

.ls-page .filter-toggle-button:hover {
	border-color: transparent;
	opacity: 0.8;
}

/* «Показать N объявлений» / «Сбросить фильтры» (filters_sheet.dart) */
.ls-page .apply-filters-button {
	height: 48px;
	padding: 0 12px;
	white-space: nowrap;
	border-radius: 16px;
	font-size: 14px;
	font-weight: 700;
	line-height: 16px;
}

.ls-page .apply-filters-button.inactive {
	background: var(--card-lilac);
	color: var(--gray);
}

.ls-page .reset-filters-button {
	margin-top: 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--brand-purple);
}

.ls-page .reset-filters-button:hover {
	color: var(--accent);
}

/* --- карточка: промо-метка как в ленте приложения --- */
.ls-page .promo-mark {
	padding: 5px 9px;
	border-radius: 999px;
	background: rgb(238 237 254 / 92%);
	color: #534ab7; /* как в FeedCard приложения (так же в home-v2.css) */
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
}

/* ==========================================================================
   ПК (≥769) — привычная раскладка, новый стиль (макет Category.dc.html)
   ========================================================================== */
@media (min-width: 769px) {
	body:has(.ls-page) {
		background: var(--light);
	}

	/* второе поле поиска под шапкой не нужно — поиск в шапке (Амир,
	   29.09.2026). Только прячем: filters.js берёт запрос (s) из него. */
	body:has(.ls-page) .global-search {
		display: none;
	}

	.ls-page {
		padding-top: 24px;
	}

	.ls-back {
		display: none;
	}

	.ls-crumbs {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		margin-bottom: 14px;
		font-size: 14px;
		color: var(--gray);
	}

	.ls-crumbs a {
		color: var(--gray);
		transition: color 0.2s ease;
	}

	.ls-crumbs a:hover {
		color: var(--accent);
	}

	.ls-page h1.title {
		margin: 0;
		text-align: left;
		font-size: 34px;
		font-weight: 700;
		line-height: 1.15;
		letter-spacing: -0.4px;
	}

	.ls-page .ls-sub {
		margin-top: 6px;
		font-size: 15px;
		color: var(--gray);
	}

	/* --- категория: подкатегории белыми чипами, сетка 4 --- */
	.ls-page .category {
		margin-bottom: 28px;
	}

	.ls-page .subcategories {
		justify-content: flex-start;
		gap: 8px;
		margin-top: 20px;
	}

	.ls-page .subcategories a {
		display: flex;
		align-items: center;
		height: 40px;
		padding: 0 16px;
		border-radius: 12px;
		background: var(--white);
		font-size: 15px;
		font-weight: 500;
		color: var(--black);
	}

	.ls-page .subcategories a:hover {
		background: var(--card-lilac);
	}

	.ls-page .categories-posts {
		margin-bottom: 60px;
	}

	/* --- подкатегория и поиск: фильтры слева белой карточкой --- */
	.ls-page .subcategory,
	.ls-page .search-results {
		margin-bottom: 60px;
	}

	.ls-page .sidebar-posts-grid {
		grid-template-columns: 280px minmax(0, 1fr);
		gap: 24px;
		margin-top: 24px;
	}

	.ls-page .popup-filters {
		display: block;
		padding: 24px;
		border-radius: 24px;
		background: var(--white);
		font-family: inherit;
	}

	.ls-page .popup-filters .popup-body {
		display: block;
		font-family: inherit;
	}

	.ls-page .filters-control {
		margin: 0 -24px -24px;
		padding: 16px 24px 24px;
		border-radius: 0 0 24px 24px;
		background: var(--white);
	}

	.ls-page .posts-content {
		gap: 0;
	}

	.ls-page .posts-content-head {
		padding-top: 0;
		margin-bottom: 20px;
	}

	.ls-page .sort {
		width: 220px;
	}

	.ls-page .sort .filter-input {
		height: 44px;
		border: 0;
		border-radius: 12px;
		background: var(--white);
		font-size: 15px;
		font-weight: 500;
	}

	/* --- сетка и карточка — как на новой главной (home-v2.css) --- */
	.ls-page .posts-grid {
		gap: 28px 20px;
	}

	.ls-page .post-item {
		display: flex;
		flex-direction: column;
	}

	.ls-page .post-item-image {
		border-radius: 20px;
	}

	.ls-page .post-item-title {
		order: 1;
		margin-top: 12px;
		font-size: 16px;
		font-weight: 500;
	}

	.ls-page .post-item-location {
		order: 2;
		margin-top: 2px;
	}

	.ls-page .post-item-pair {
		order: 3;
		margin-top: 6px;
	}

	.ls-page .post-item-price {
		font-size: 22px;
		font-weight: 700;
	}

	.ls-page .ls-subtitle {
		margin: 12px 0 20px;
		text-align: left;
		font-size: 24px;
		font-weight: 700;
	}

	.ls-page .ls-empty {
		margin-bottom: 8px;
		border-radius: 24px;
		background: var(--white);
	}
}

/* карточки уже — «Цена не указана» 22 px переносилась на две строки */
@media (min-width: 769px) and (max-width: 1200px) {
	.ls-page .post-item-price {
		font-size: 18px;
	}
}

@media (min-width: 769px) and (max-width: 992px) {
	.ls-page .sidebar-posts-grid {
		grid-template-columns: 250px minmax(0, 1fr);
		gap: 20px;
	}

	.ls-page .popup-filters {
		padding: 20px;
	}

	.ls-page .filters-control {
		margin: 0 -20px -20px;
		padding: 16px 20px 20px;
	}
}

/* ==========================================================================
   ТЕЛЕФОН (≤768) — экраны каталога и поиска приложения
   ========================================================================== */
@media (max-width: 768px) {
	/* лист контента — light (в приложении фон экрана #F5F3F6) */
	body:has(.ls-page),
	main.content:has(.ls-page) {
		background: var(--light);
	}

	body:has(.ls-page) .global-search.gs-v2::after {
		background: var(--light);
	}

	.ls-page {
		--ls-field: var(--white); /* на светлом листе поля белые */
		padding-bottom: 20px;
	}

	.ls-page .container {
		padding-left: 20px;
		padding-right: 20px;
	}

	.ls-crumbs {
		display: none; /* в приложении хлебных крошек нет */
	}

	/* --- «назад» (чёрный круг 40) + название 20/600 --- */
	.ls-head {
		display: flex;
		align-items: center;
		gap: 10px;
	}

	.ls-back {
		flex-shrink: 0;
		width: 40px;
		height: 40px;
		color: #000; /* back_circle_dark.svg приложения — чистый чёрный */
	}

	.ls-back svg {
		display: block;
		width: 40px;
		height: 40px;
	}

	.ls-page h1.title {
		margin: 0;
		text-align: left;
		font-size: 20px;
		font-weight: 600;
		line-height: 20px;
	}

	/* поиск: «запрос» — найдено N (12/500 black 40 %) */
	.ls-page .ls-sub {
		margin-top: 6px;
		font-size: 12px;
		font-weight: 500;
		line-height: 16px;
		color: rgb(22 14 24 / 40%);
	}

	/* --- категория: подкатегории одной лентой 170×72 белые r16 --- */
	.ls-page .category {
		margin-bottom: 24px;
	}

	.ls-page .subcategories {
		display: flex;
		flex-wrap: nowrap;
		gap: 8px;
		margin-top: 20px;
		padding: 0 20px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.ls-page .subcategories::-webkit-scrollbar {
		display: none;
	}

	.ls-page .subcategories a {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		flex: 0 0 170px;
		min-width: 0;
		height: 72px;
		padding: 12px;
		border-radius: 16px;
		background: var(--white);
		font-size: 12px;
		font-weight: 600;
		line-height: 14px;
		color: var(--black);
	}

	/* --- подкатегория и поиск: «Фильтры» + сортировка (search_screen) --- */
	.ls-page .sidebar-posts-grid {
		margin-top: 20px;
	}

	.ls-page .posts-content {
		gap: 0;
	}

	/* не «липкая» (в приложении строка прокручивается) и без z-index:
	   внутри сетки он создаёт свой слой, и лист сортировки уходил под меню */
	.ls-page .posts-content-head {
		position: static;
		z-index: auto;
		justify-content: stretch;
		gap: 8px;
		margin: 0 0 24px;
		padding: 0;
	}

	.ls-page .mobile-filters-button {
		flex: 1 1 auto;
		gap: 10px;
		height: 48px;
		padding: 0 15px;
		border-radius: 16px;
		background: var(--white);
		color: var(--black);
		font-size: 12px;
		font-weight: 600;
		line-height: 16px;
	}

	.ls-page .mobile-filters-button svg {
		width: 18px;
		height: 18px;
		color: var(--accent);
	}

	.ls-page .sort {
		flex: 0 0 auto;
		width: 148px;
	}

	.ls-page .sort .filter-input {
		height: 48px;
		padding: 0 34px 0 14px;
		border: 0;
		border-radius: 16px;
		background: var(--white);
		color: var(--black);
		font-size: 12px;
		font-weight: 600;
	}

	/* значок unfold_more 16, black 40 % */
	.ls-page .sort .select::before {
		right: 12px;
		width: 16px;
		height: 16px;
		background: rgb(22 14 24 / 40%);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M8 9l4-4 4 4M8 15l4 4 4-4' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M8 9l4-4 4 4M8 15l4 4 4-4' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
	}

	/* список сортировки — лист снизу (шит «Сортировка» приложения).
	   Затемнение — на .sort (вне .select): тап по нему закрывает список
	   штатным кодом select.js («клик вне селекта»). */
	.ls-page .sort:has(.select-popup.active)::before {
		content: "";
		position: fixed;
		inset: 0;
		z-index: 590;
		background: rgb(22 14 24 / 50%);
	}

	.ls-page .sort .select-popup {
		position: fixed;
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 600;
		width: auto;
		max-height: 80dvh;
		padding: 20px 20px max(20px, env(safe-area-inset-bottom));
		border-radius: 32px 32px 0 0;
		background: var(--light);
		box-shadow: none;
		transform: translateY(101%);
		transform-origin: center bottom;
	}

	.ls-page .sort .select-popup.active {
		transform: translateY(0);
	}

	.ls-page .sort .select-popup::before {
		content: "Сортировка";
		margin-bottom: 16px;
		font-size: 20px;
		font-weight: 600;
		line-height: 24px;
		color: var(--black);
	}

	.ls-page .sort .select-button {
		display: flex;
		align-items: center;
		height: 46px;
		margin-bottom: 10px;
		padding: 0 14px;
		border-radius: 16px;
		background: var(--white);
		font-size: 14px;
		font-weight: 500;
		line-height: 20px;
	}

	.ls-page .sort .select-button.selected {
		background: var(--white);
	}

	/* галочка выбранного — check_rounded brandPurple */
	.ls-page .sort .select-button.selected::after {
		right: 14px;
		width: 18px;
		height: 18px;
		background: var(--brand-purple);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='m4 9 3.5 3.5L14 6' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='m4 9 3.5 3.5L14 6' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
	}

	/* --- окно фильтров — лист снизу 90 %, light, r32 (filters_sheet.dart) --- */
	.ls-page .popup-filters {
		align-items: end;
		padding: 0;
		overflow: hidden;
	}

	.ls-page .popup-filters .popup-body {
		display: flex;
		flex-direction: column;
		max-width: 100%;
		height: 90vh;
		height: 90dvh;
		max-height: 90dvh;
		padding: 0;
		border-radius: 32px 32px 0 0;
		background: var(--light);
		transform-origin: center bottom;
		transform: translateY(101%);
	}

	.ls-page .popup-filters.active .popup-body {
		transform: translateY(0);
	}

	.ls-page .popup-filters .popup-body-header {
		display: flex;
		align-items: center;
		flex-shrink: 0;
		margin: 0;
		padding: 14px 14px 8px 20px;
	}

	.ls-page .popup-filters .popup-title {
		flex: 1 1 auto;
		text-align: left;
		font-size: 20px;
		font-weight: 600;
		line-height: 1;
	}

	/* крестик — sheet_close.svg: белый квадрат r14 */
	.ls-page .popup-filters .popup-close {
		position: static;
		flex-shrink: 0;
		width: 36px;
		height: 36px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 14px;
		background: var(--white);
		color: rgb(22 14 24 / 30%);
	}

	.ls-page .popup-filters .popup-close svg {
		width: 16px;
		height: 16px;
	}

	.ls-page .popup-filters .popup-close:hover {
		transform: none;
		color: var(--black);
	}

	.ls-page .popup-filters .popup-body-content {
		flex: 1 1 auto;
		min-height: 0;
		height: auto;
		max-height: none;
		overflow-y: auto;
		padding: 10px 20px 0;
	}

	/* кнопка «Показать N» прилипает к низу листа, подложка цвета листа */
	.ls-page .filters-control {
		padding: 8px 0 max(16px, env(safe-area-inset-bottom));
		background: var(--light);
	}

	/* --- сетка 2 колонки (8 / 24), карточка как FeedCard приложения --- */
	.ls-page .posts-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 24px 8px;
	}

	.ls-page .post-item {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"img img"
			"title fav"
			"loc loc"
			"price price";
		align-items: start;
	}

	.ls-page .post-item-image {
		grid-area: img;
		aspect-ratio: 164 / 182;
		margin-bottom: 8px;
		border-radius: 24px;
		background: var(--light-gray);
	}

	.ls-page .post-item-image::after {
		display: none;
	}

	.ls-page .post-item-image img {
		aspect-ratio: auto;
		height: 100%;
	}

	/* строка сетки = рамка (30.09.2026): иначе высокое фото растягивало
	   строку, и в рамке 164/182 было видно только его верх, а не середину
	   (на главной было верно). Теперь обрезка по центру, как в приложении. */
	.ls-page .post-item-image {
		grid-template-rows: minmax(0, 1fr);
	}

	.ls-page .post-item-image > img {
		min-height: 0;
	}

	.ls-page .post-item-pair {
		display: contents;
	}

	.ls-page .post-item-title {
		grid-area: title;
		height: 36px;
		padding: 0;
		font-size: 14px;
		font-weight: 500;
		line-height: 18px;
	}

	/* сердце 18 в зоне 30×26 у названия; контур labelGray, выбранное red */
	.ls-page .post-item-favorite {
		grid-area: fav;
		width: 30px;
		height: 26px;
		margin-left: 6px;
		padding: 0;
		display: flex;
		align-items: flex-start;
		justify-content: center;
		color: var(--label-gray);
	}

	.ls-page .post-item-favorite svg {
		width: 20px;
		height: 18px;
	}

	.ls-page .post-item-favorite.active svg {
		color: var(--red);
	}

	.ls-page .post-item-location {
		grid-area: loc;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		height: 32px;
		margin-top: 4px;
		padding: 0;
		font-size: 11px;
		font-weight: 500;
		line-height: 16px;
		color: rgb(22 14 24 / 40%);
	}

	.ls-page .post-item-price {
		grid-area: price;
		margin-top: 8px;
		padding: 0;
		font-size: 18px;
		font-weight: 700;
		line-height: 16px;
	}

	.ls-page .ls-subtitle {
		margin: 0 0 20px;
		text-align: left;
		font-size: 20px;
		font-weight: 600;
		line-height: 1.2;
	}

	.ls-page .ls-empty {
		padding: 60px 20px 40px;
	}

	.ls-page .pagination a {
		min-width: 40px;
		height: 40px;
	}
}

@media (max-width: 576px) {
	.ls-page .posts-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
