/*
 * Страница поиска (Этап 2, док 16 §2.3, §2.5): полоса фильтров сверху,
 * список карточек слева, закреплённая карта справа; на телефоне список,
 * кнопки «Фильтры» и «Карта». Подключается только на /search.
 */

.search-page { padding-bottom: 40px; }
.search-head { margin: 10px 0 14px; }
.search-head .search-title { margin-bottom: 4px; }
.search-summary { color: #666; margin: 0; }
.search-error p { color: #b00020; }

/* ---- Полоса фильтров ---- */
.search-filters {
    background: #f6f6f6;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 18px;
}
.search-filters__row { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.search-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.search-filter__label { font-size: 12px; color: #666; white-space: nowrap; }
.search-filter .select,
.search-filter .inputbox { height: 36px; margin: 0; }
.search-filter--check { align-self: flex-end; padding-bottom: 6px; }
.search-price-range { display: inline-flex; gap: 6px; }
.search-price-range .inputbox { width: 84px; padding: 0 8px; }
.search-filter--actions { flex-direction: row; align-items: center; gap: 10px; margin-left: auto; }
.search-filter--actions .button { height: 36px; line-height: 36px; padding: 0 18px; margin: 0; }
.search-apply { display: none; } /* показывается без JS (см. .no-js ниже) */
.search-reset { font-size: 13px; color: #666; text-decoration: underline; }
.search-more {
    background: none; border: 0; padding: 0; cursor: pointer;
    font-size: 13px; color: #1a73e8; text-decoration: underline;
}
.search-more.is-open { color: #333; }

.search-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.search-chip {
    position: relative; display: inline-flex; align-items: center;
    border: 1px solid #cfcfcf; border-radius: 18px; background: #fff;
    padding: 6px 12px; font-size: 13px; cursor: pointer; line-height: 1.2; user-select: none;
}
.search-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.search-chip small { color: #888; font-size: 11px; margin-left: 2px; }
.search-chip.is-on { background: #2b2b2b; border-color: #2b2b2b; color: #fff; }
.search-chip.is-on small { color: #ddd; }
.search-chip.is-empty { opacity: .55; }
.search-chip:focus-within { outline: 2px solid #1a73e8; outline-offset: 1px; }

.search-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.search-check small { color: #888; font-size: 11px; }

.search-filters__more { display: none; border-top: 1px solid #e3e3e3; margin-top: 12px; padding-top: 12px; }
.search-filters__more.is-open { display: block; }
.search-filter--area { margin-bottom: 12px; }
.search-amenities__groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin-top: 6px; }
.search-amenities__title { display: block; font-size: 13px; margin-bottom: 4px; }
.search-amenities ul { list-style: none; margin: 0; padding: 0; }
.search-amenities li { margin: 2px 0; }

/* ---- Список + карта ---- */
.search-layout { display: flex; gap: 20px; align-items: flex-start; }
.search-main { flex: 1 1 auto; min-width: 0; }
.search-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.search-toolbar__left { display: flex; gap: 8px; }
.search-toggle { display: none; height: 34px; padding: 0 12px; border: 1px solid #cfcfcf; border-radius: 4px; background: #fff; cursor: pointer; font-size: 13px; }
.search-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #666; }
.search-sort__select { height: 34px; margin: 0; width: auto; }

.search-list .row-2 { display: flex; float: none; }
.search-list .flat-carousel-box { display: flex; flex-direction: column; width: 100%; }
.search-list__item.is-hover .flat-carousel-box { box-shadow: 0 0 0 2px #1a73e8; }
.search-empty { padding: 30px 0; }

.search-map { flex: 0 0 42%; max-width: 42%; position: sticky; top: 10px; }
.search-map__inner { position: relative; height: calc(100vh - 20px); min-height: 420px; }
.search-map__canvas { width: 100%; height: 100%; border-radius: 6px; background: #e9e9e9; }
.search-map__close { display: none; }

/* Маркер-цена на карте */
.search-marker { background: transparent; border: 0; }
.search-marker__pin {
    display: inline-block; white-space: nowrap; background: #fff; color: #222;
    border: 1px solid #999; border-radius: 14px; padding: 3px 8px; font: 600 12px/1.2 Arial, sans-serif;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); transform: translate(-50%, -100%);
}
.search-marker.is-active .search-marker__pin,
.search-marker:hover .search-marker__pin { background: #2b2b2b; color: #fff; border-color: #2b2b2b; z-index: 2; }
.search-popup { width: 220px; font-size: 13px; }
.search-popup__photo { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; }
.search-popup__name { display: block; font-weight: 600; margin-bottom: 4px; }
.search-popup__price { display: block; margin-bottom: 6px; }
.leaflet-popup-content { margin: 10px 12px; }

/* ---- Пагинация ---- */
.site-pagination ul { list-style: none; display: flex; gap: 6px; justify-content: center; padding: 0; margin: 20px 0; }
.site-pagination li a,
.site-pagination li span { display: inline-block; min-width: 34px; height: 34px; line-height: 32px; text-align: center; border: 1px solid #cfcfcf; border-radius: 4px; padding: 0 6px; color: #333; }
.site-pagination li.is-current span { background: #2b2b2b; border-color: #2b2b2b; color: #fff; }
.site-pagination li.is-disabled span { opacity: .4; }

/* Без JS: кнопка «Применить» видна, карта — просто блок */
html:not(.js) .search-apply { display: inline-block; }

/* ---- Телефон и планшет ---- */
@media (max-width: 1023px) {
    .search-layout { display: block; }
    .search-toggle { display: inline-block; }
    .search-filters { display: none; }
    .search-page.is-filters-open .search-filters { display: block; }
    .search-map { display: none; max-width: none; position: fixed; inset: 0; z-index: 1000; background: #fff; }
    .search-page.is-map-open .search-map { display: block; }
    .search-map__inner { height: 100vh; }
    .search-map__canvas { border-radius: 0; }
    .search-map__close { display: block; position: absolute; top: 10px; right: 10px; z-index: 1001; height: 36px; padding: 0 14px; border: 0; border-radius: 4px; background: #2b2b2b; color: #fff; cursor: pointer; }
    .search-filter--actions { margin-left: 0; width: 100%; }
    .search-apply { display: inline-block; }
}
@media (max-width: 640px) {
    .search-list .row-2 { width: 100%; }
    .search-filters__row { gap: 10px; }
    .search-filter--price .search-price-range .inputbox { width: 70px; }
}
