/* ==========================================================================
   Перрон — каталог туров с фильтрами. Подключается после styles.css и tour.css
   (из tour.css берутся хлебные крошки).
   ========================================================================== */

/* ---------- Заголовок каталога ---------- */
.cat-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding-bottom: var(--space-4); }
.cat-head__title { font: 700 26px/32px var(--font-display); letter-spacing: -.01em; }
@media (min-width: 640px) { .cat-head__title { font-size: 34px; line-height: 40px; } }
@media (min-width: 1024px) { .cat-head__title { font-size: 40px; line-height: 46px; } .cat-head { padding-bottom: var(--space-6); } }
.cat-head__lead { color: var(--ink-muted); max-width: 44em; }
.quick { margin-top: var(--space-2); }
.quick .scroller { gap: var(--space-2); }
@media (min-width: 1024px) { .quick .scroller { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }

/* ---------- Раскладка ---------- */
.cat { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); padding-bottom: var(--space-12); }
@media (min-width: 1024px) {
  .cat { grid-template-columns: 280px minmax(0, 1fr); gap: var(--space-8); align-items: start; padding-bottom: var(--space-16); }
}

/* ---------- Панель фильтров ---------- */
.filters { display: grid; align-content: start; }
.filters__head, .filters__foot { display: none; }
.fgroup { border: 0; margin: 0; padding: var(--space-4) 0; min-width: 0; border-bottom: 1px solid var(--line); display: grid; gap: var(--space-2); }
.fgroup:first-of-type { padding-top: 0; }
.fgroup legend { float: left; width: 100%; padding: 0; margin-bottom: var(--space-2); font-weight: 600; font-size: 15px; }
.fgroup legend + * { clear: both; }

.fopt { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 15px; }
.fopt input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.fopt__count { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.fopt.is-empty { color: var(--ink-muted); }
.fopt.is-empty .fopt__count { opacity: .6; }

.fchips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fchip { position: relative; }
.fchip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.fchip span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; }
.fchip span small { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fchip:hover span { border-color: var(--brand); }
.fchip input:checked + span { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.fchip input:checked + span small { color: var(--brand); }
.fchip input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

.price-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.price-range label { display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 52px; padding: 0 12px;
  border-radius: var(--radius-md); background: var(--surface-alt); box-shadow: inset 0 0 0 1px transparent; }
.price-range label:focus-within { box-shadow: inset 0 0 0 2px var(--brand); }
.price-range span { font-size: 12px; color: var(--ink-muted); }
.price-range input { border: 0; background: transparent; padding: 0; width: 100%; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; outline: none; }
.price-range input::placeholder { color: var(--ink-muted); font-weight: 400; }

.fswitch { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.fswitch small { display: block; font-size: 13px; color: var(--ink-muted); }
.fswitch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .15s; }
.fswitch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.fswitch input:checked { background: var(--brand); }
.fswitch input:checked::after { transform: translateX(18px); }

.filters__submit { margin-top: var(--space-4); }
.filters.is-enhanced .filters__submit { display: none; }
.filters__reset { justify-self: start; margin-top: var(--space-3); background: none; border: 0; padding: 0; min-height: 44px; color: var(--brand); font-weight: 600; }

/* Мобильная шторка */
.filters-open { display: inline-flex; }
@media (max-width: 1023px) {
  .filters.is-enhanced { position: fixed; inset: 0; z-index: 95; background: var(--surface); display: none; grid-template-rows: auto minmax(0, 1fr) auto; }
  .filters.is-enhanced.is-open { display: grid; animation: sheet-in .2s ease-out; }
  .filters.is-enhanced .filters__head { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--gutter) 8px; border-bottom: 1px solid var(--line); }
  .filters__head h2 { font: 600 20px/26px var(--font-display); }
  .filters.is-enhanced .filters__body { overflow-y: auto; padding: var(--space-4) var(--gutter); overscroll-behavior: contain; }
  .filters.is-enhanced .filters__foot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); align-items: center;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
  .filters.is-enhanced .filters__body > .filters__reset { display: none; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 1024px) {
  .filters-open { display: none; }
  .filters { position: sticky; top: calc(var(--header-h) + var(--space-4)); max-height: calc(100vh - var(--header-h) - var(--space-8)); overflow-y: auto; padding-right: var(--space-2); scrollbar-width: thin; }
}

/* ---------- Панель над результатами ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.toolbar__count { font-weight: 600; }
.toolbar__count span { font-variant-numeric: tabular-nums; }
.toolbar__right { display: flex; gap: var(--space-2); align-items: center; }
.sort { position: relative; display: inline-flex; align-items: center; }
.sort select { appearance: none; -webkit-appearance: none; min-height: 44px; padding: 0 40px 0 14px; border-radius: var(--radius-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 15px; cursor: pointer; }
.sort svg { position: absolute; right: 12px; pointer-events: none; color: var(--ink-muted); }
.filters-open { min-height: 44px; position: relative; }
.filters-open__badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.filters-open__badge[hidden] { display: none; }

.active { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.active:empty { display: none; }
.active button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 14px; border-radius: var(--radius-pill);
  border: 0; background: var(--brand-tint); color: var(--brand); font-size: 14px; font-weight: 600; }
.active button:hover { background: var(--brand); color: var(--on-brand); }
.active .active__clear { background: transparent; color: var(--ink-muted); padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }
.active .active__clear:hover { background: transparent; color: var(--brand); }

.results-wrap { display: grid; gap: var(--space-4); min-width: 0; align-content: start; }

/* ---------- Карточка в выдаче (горизонтальная) ---------- */
.results { display: grid; gap: var(--space-4); }
.result { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); transition: box-shadow .2s; }
.result:hover { box-shadow: var(--shadow-raised); }
.result[hidden] { display: none; }
.result__media { position: relative; aspect-ratio: 16 / 9; background: var(--brand-tint); }
.result__media img { width: 100%; height: 100%; object-fit: cover; }
.result__badges { position: absolute; top: var(--space-3); left: var(--space-3); display: flex; flex-wrap: wrap; gap: 6px; }
.result__body { display: grid; gap: 8px; padding: var(--space-4); align-content: start; }
.result__type { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--brand); }
.result__title { font: 600 18px/24px var(--font-display); }
.result__title a { color: var(--ink); }
.result__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.result:hover .result__title a { color: var(--brand); text-decoration: none; }
.result__route, .result__meta { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.result__meta b { color: var(--ink); font-weight: 600; }
.result__dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.result__dates li { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); font: 500 12px/1 var(--font-mono); }
.result__dates li.is-match { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.result__side { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); }
.result__op { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.result__price { font-size: 22px; line-height: 26px; }
.result__rail { font-size: 12px; color: var(--ink-muted); }
.result__rail.is-no { color: var(--warning-ink); font-weight: 600; }
.result__cta { pointer-events: none; }
.result .tour-card__fav { z-index: 2; }
@media (min-width: 640px) {
  .result { grid-template-columns: 240px minmax(0, 1fr); }
  .result__media { aspect-ratio: auto; grid-row: span 2; min-height: 100%; }
  .result__side { grid-column: 2; }
}
@media (min-width: 1100px) {
  .result { grid-template-columns: 260px minmax(0, 1fr) 200px; }
  .result__media { grid-row: auto; }
  .result__side { grid-column: auto; flex-direction: column; justify-content: center; align-items: stretch; text-align: right; gap: 6px;
    border-top: 0; border-left: 1px solid var(--line); padding: var(--space-4); }
  .result__side .btn { margin-top: var(--space-2); }
}

/* ---------- Пустое состояние, «показать ещё», пагинация ---------- */
.empty { display: grid; gap: var(--space-3); justify-items: center; text-align: center; padding: var(--space-12) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-alt); }
.empty[hidden] { display: none; }
.empty svg { color: var(--line-strong); }
.empty h2 { font: 600 20px/26px var(--font-display); }
.empty p { color: var(--ink-muted); max-width: 30em; }
.empty__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.more { display: grid; gap: var(--space-3); justify-items: center; margin-top: var(--space-2); }
.more[hidden] { display: none; }
.more__note { font-size: 14px; color: var(--ink-muted); }
.pager ol { display: flex; gap: var(--space-2); justify-content: center; list-style: none; margin: 0; padding: 0; }
.pager a, .pager span { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.pager [aria-current] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.is-enhanced-list .pager { display: none; }

/* ---------- Подборки и текст под выдачей ---------- */
.collections { display: grid; gap: var(--space-4); }
.collections__list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
