/*
 * Фильтры каталога по программам: кнопка, панель (Bootstrap offcanvas)
 * и карточка программы. Цвета и радиусы - сайта: красный #CF3425,
 * серые бейджи страницы тура, карточки tour_card.css.
 */

/* ── Кнопка «Фильтры» рядом с сортировкой ───────────────────────────── */
.catalog-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.catalog-filters-btn:hover {
    background: #f5f8fa;
}

.catalog-filters-btn i {
    font-size: 18px;
}

.catalog-filters-btn.is-active {
    border-color: #CF3425;
}

.catalog-filters-btn__count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #CF3425;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

/* До 576 px .sorting-panel в main.css принудительно в одну строку - с
   кнопкой «Фильтры» сортировка обрезалась бы. Счётчик сверху, под ним
   строка «Фильтры … Сортировка» на всю ширину. */
@media (max-width: 576px) {
    .sorting-panel:has(.catalog-toolbar) {
        flex-wrap: wrap !important;
        row-gap: 8px;
    }

    .sorting-panel .catalog-toolbar {
        width: 100%;
        justify-content: space-between;
    }
}

.catalog-results__reset {
    margin-left: 8px;
    color: #CF3425;
    font-size: 14px;
    white-space: nowrap;
}

/* ── Панель ─────────────────────────────────────────────────────────── */
.catalog-filters.offcanvas {
    --bs-offcanvas-width: 420px;
    max-width: 100vw;
}

/* < 768 px - на весь экран; dvh - высота с учётом панелей браузера,
   чтобы закреплённые кнопки не уезжали под них. */
@media (max-width: 767.98px) {
    .catalog-filters.offcanvas {
        --bs-offcanvas-width: 100vw;
        height: 100vh;
        height: 100dvh;
    }
}

.catalog-filters__header {
    border-bottom: 1px solid #eee;
    padding: 14px 16px;
}

.catalog-filters__header .offcanvas-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.catalog-filters__body {
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.catalog-filters__group {
    margin: 0 0 22px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.catalog-filters__legend {
    float: none;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

/* Язык и транспорт: открытый список radio без рамки и прокрутки -
   вариантов немного, лишние спрятаны за «Показать ещё». */
.catalog-filters__choices {
    display: flex;
    flex-direction: column;
}

.catalog-filters__choice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 8px 0;
    color: #111827;
    font-size: 15px;
    line-height: 1.3;
    cursor: pointer;
}

.catalog-filters__choice[hidden] {
    display: none;
}

.catalog-filters__choice input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #CF3425;
    cursor: pointer;
}

.catalog-filters__choice:has(input:checked) {
    font-weight: 600;
}

.catalog-filters__more {
    margin-top: 4px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: #CF3425;
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.catalog-filters__more:hover,
.catalog-filters__more:focus-visible {
    color: #b52c1f;
}

/* Дни: семь кнопок в одну строку на любой ширине от 320 px. */
.catalog-filters__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.catalog-filters__day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.btn-check:checked + .catalog-filters__day {
    border-color: #CF3425;
    background: #CF3425;
    color: #fff;
}

.btn-check:focus-visible + .catalog-filters__day {
    outline: 2px solid #CF3425;
    outline-offset: 2px;
}

.catalog-filters__range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-filters__range .form-control {
    min-width: 0;
    flex: 1 1 0;
    font-size: 15px;
}

.catalog-filters__dash {
    flex: none;
    color: #9ca3af;
}

/* Плавающая кнопка WhatsApp (z-index 9999) перекрывала бы поля и
   кнопки панели - пока панель открыта, прячем её. */
body:has(.catalog-filters.show) .whatsapp-btn,
body:has(.catalog-filters.showing) .whatsapp-btn {
    display: none !important;
}

/* Двойной ползунок цены: два range поверх одной дорожки. Сами input
   прозрачны для касаний, «ловятся» только бегунки - иначе верхний range
   перехватывал бы перетаскивание нижнего. */
.price-slider {
    position: relative;
    height: 36px;
    margin: 10px 11px 0;
}

.price-slider__track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
    background: #e5e7eb;
}

.price-slider__fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 2px;
    background: #CF3425;
}

.price-slider__input {
    position: absolute;
    top: 0;
    left: -11px;
    width: calc(100% + 22px);
    height: 36px;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.price-slider__input:focus {
    outline: none;
}

.price-slider__input::-webkit-slider-runnable-track {
    height: 36px;
    background: none;
}

.price-slider__input::-moz-range-track {
    height: 36px;
    background: none;
}

.price-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: 7px;
    border: 2px solid #CF3425;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.2);
    cursor: grab;
    pointer-events: auto;
}

.price-slider__input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #CF3425;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.2);
    cursor: grab;
    pointer-events: auto;
}

.price-slider__input:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(207, 52, 37, 0.2);
}

.price-slider__input:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px rgba(207, 52, 37, 0.2);
}

/* Под палец - бегунок крупнее. */
@media (pointer: coarse) {
    .price-slider {
        height: 44px;
        margin-left: 14px;
        margin-right: 14px;
    }

    .price-slider__input {
        left: -14px;
        width: calc(100% + 28px);
        height: 44px;
    }

    .price-slider__input::-webkit-slider-runnable-track {
        height: 44px;
    }

    .price-slider__input::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
        margin-top: 8px;
    }

    .price-slider__input::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* Закреплённая нижняя панель: тело прокручивается, кнопки на месте. */
.catalog-filters__footer {
    flex: none;
    padding: 10px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(17, 24, 39, 0.04);
}

.catalog-filters__status {
    margin: 0 0 6px;
    min-height: 0;
    color: #b45309;
    font-size: 13px;
}

.catalog-filters__status:empty {
    display: none;
}

.catalog-filters__actions {
    display: flex;
    gap: 8px;
}

.catalog-filters__reset {
    flex: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.catalog-filters__apply {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    /* Красный сайта явно: на v2-страницах .btn-primary - синий Bootstrap. */
    background: #CF3425;
    border-color: #CF3425;
    color: #fff;
}

.catalog-filters__apply:hover,
.catalog-filters__apply:focus-visible,
.catalog-filters__apply:active {
    background: #b52c1f;
    border-color: #b52c1f;
    color: #fff;
}

/* Ноль результатов: кнопка остаётся (переход - явное действие
   посетителя), но не зовёт ярким цветом на пустую выдачу. */
.catalog-filters__apply.is-empty,
.catalog-filters__apply.is-empty:hover {
    background: #6b7280;
    border-color: #6b7280;
}

/* ── Карточка программы ─────────────────────────────────────────────── */
/* Своё фото программы - оригинал любых пропорций, превью тура - 640×360.
   Рамка та же 16:9 (на десктопе) и та же высота строки (на мобильном):
   фото не растягивает карточку, лишнее обрезает object-fit: cover. */
.card-image-wrap img.program-card__own-photo {
    aspect-ratio: 16 / 9;
}

.mobile-tour-card__image img.program-card__own-photo {
    position: absolute;
    inset: 0;
}

.program-card__name {
    margin: -2px 0 6px;
    color: #CF3425;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.program-card-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.program-card-attrs li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
    line-height: 1.3;
}

.program-card-attrs img {
    flex: none;
    opacity: 0.7;
}

.catalog-empty {
    padding: 40px 16px;
    text-align: center;
    color: #6b7280;
}
