.catalog-page {
    padding: 60px 0;
    background-color: var(--bg-surface-alt, #f8f9fa);
    min-height: 70vh;
}

.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.catalog-title {
    font-size: 36px;
    margin-bottom: 30px;
    color: var(--text-primary, #313131);
}

.catalog-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
}

/* Кнопка «Фильтры» — показывается только при адаптации */
.catalog-filters-toggle-btn {
    display: none;
}

.catalog-filters {
    background-color: var(--bg-surface, #ffffff);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    align-self: start;
    /* Липкость только после прокрутки: блок ограничен по высоте, внутри можно доскроллить до «Размер» */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    position: sticky;
    top: 100px;
}

.filter-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-primary, #313131);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border, #eee);
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group-title {
    font-size: 16px;
    margin-bottom: 12px;
    color: #555;
    font-weight: 600;
}

.filter-option {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.filter-option input {
    margin-right: 10px;
}

.filter-option label {
    cursor: pointer;
}

.price-range {
    margin-top: 10px;
}

.price-inputs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.price-input {
    width: 45%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Два ползунка на одной дорожке (мин / макс цена) */
.price-dual-slider {
    position: relative;
    height: 36px;
    margin-top: 6px;
    --price-thumb-size: 18px;
    --price-track-h: 6px;
}

.price-slider-track-bg {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: var(--price-track-h);
    background: #e8e8e8;
    border-radius: 3px;
    pointer-events: none;
    z-index: 0;
}

.price-slider-track-fill {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: var(--price-track-h);
    width: 0;
    margin-left: 0;
    background: linear-gradient(90deg, #ff7b00, #ff9500);
    border-radius: 3px;
    pointer-events: none;
    z-index: 1;
}

.price-dual-slider input[type="range"].price-slider-layer {
    position: absolute;
    left: 0;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    height: var(--price-thumb-size);
    margin: 0;
    padding: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    z-index: 2;
}

.price-dual-slider input.price-slider-max {
    z-index: 3;
}

.price-dual-slider input.price-slider-min:focus,
.price-dual-slider input.price-slider-max:focus {
    z-index: 4;
}

.price-dual-slider input[type="range"].price-slider-layer::-webkit-slider-runnable-track {
    height: var(--price-track-h);
    background: transparent;
    border: none;
}

.price-dual-slider input[type="range"].price-slider-layer::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--price-thumb-size);
    height: var(--price-thumb-size);
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ff7b00;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    margin-top: calc((var(--price-track-h) - var(--price-thumb-size)) / 2);
    pointer-events: auto;
    cursor: grab;
}

.price-dual-slider input[type="range"].price-slider-layer:active::-webkit-slider-thumb {
    cursor: grabbing;
}

.price-dual-slider input[type="range"].price-slider-layer::-moz-range-track {
    height: var(--price-track-h);
    background: transparent;
    border: none;
}

.price-dual-slider input[type="range"].price-slider-layer::-moz-range-thumb {
    width: var(--price-thumb-size);
    height: var(--price-thumb-size);
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ff7b00;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
    cursor: grab;
}

.price-dual-slider input[type="range"].price-slider-layer:active::-moz-range-thumb {
    cursor: grabbing;
}

/* ---- Сетка карточек: чёткие брейкпоинты (4 → 3 → 2 в ряд) ---- */
.catalog-products {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(4, 1fr);
}

/* Карточка в каталоге: не сужается уродливо, картинка с пропорциями */
.catalog-products .product-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface, #fff);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.catalog-products .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.37);
}

/* Возрастной рейтинг на картинке товара (слева снизу) */
.product-age-rating {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    z-index: 2;
}

.catalog-products .product-card .product-image.product-card-image-wrap {
    position: relative;
    height: 0;
    padding-bottom: 100%;
    background-color: var(--accent-muted, #f0f0f0);
    flex-shrink: 0;
}

.catalog-products .product-card .product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-products .product-card .product-image > i {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: var(--text-primary);
    z-index: 1;
}

.catalog-products .product-card .product-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.catalog-products .product-card .product-content h3 {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalog-products .product-card .product-content p {
    font-size: 0.8125rem;
    color: var(--text-muted, #777);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.catalog-products .product-card .product-price {
    font-size: 1.125rem;
    margin-bottom: 12px;
}

.catalog-products .product-card .rating {
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.catalog-products .product-card .material-tag {
    font-size: 0.6875rem;
    padding: 3px 8px;
    margin-bottom: 8px;
}

.catalog-products .product-card .btn {
    margin-top: auto;
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.875rem;
}

.catalog-products .btn-wishlist-catalog {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #e91e63;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.catalog-products .btn-wishlist-catalog:hover {
    background: #fff;
    color: #c2185b;
    transform: scale(1.08);
}

.catalog-products .btn-wishlist-catalog:focus {
    outline: 2px solid #e91e63;
    outline-offset: 2px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 12px;
}

.catalog-header .search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border, #eee);
    border-radius: 8px;
    min-width: 220px;
    flex: 1;
    max-width: 320px;
}

.catalog-header .search-box i {
    color: var(--text-muted, #777);
    font-size: 0.875rem;
}

.catalog-header .search-box .search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9375rem;
    width: 100%;
    color: var(--text-primary, #313131);
}

.catalog-header #resultsCount {
    color: var(--text-muted, #777);
    font-size: 0.875rem;
    margin: 0;
}

.sort-options {
    display: flex;
    align-items: center;
}

.sort-label {
    margin-right: 10px;
    color: #555;
}

.sort-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.pagination-list {
    display: flex;
    list-style: none;
}

.pagination-item {
    margin: 0 5px;
}

.pagination-link {
    display: inline-block;
    padding: 8px 15px;
    background-color: white;
    color: #313131;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.pagination-link.active {
    background-color: #d5e300;
    border-color: #d5e300;
    color: #313131;
}

.pagination-link:hover {
    background-color: #f0f0f0;
}

/* 3 колонки на планшете */
@media (max-width: 1100px) {
    .catalog-products {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* 2 колонки на малом экране */
@media (max-width: 768px) {
    .catalog-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .catalog-products .product-card .product-content {
        padding: 12px;
    }

    .catalog-products .product-card .product-content h3 {
        font-size: 0.9375rem;
    }

    .catalog-products .product-card .product-price {
        font-size: 1rem;
    }

    .catalog-products .product-card .btn {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }
}

/* ---- Расположение: фильтры и шапка каталога ---- */
@media (max-width: 992px) {
    .catalog-content {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .catalog-title {
        font-size: 28px;
        margin-bottom: 20px;
    }

    /* Обёртка фильтров сверху при адаптации */
    .catalog-filters-wrap {
        order: 1;
        width: 100%;
    }

    .catalog-filters-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-primary, #313131);
        background: var(--bg-surface, #fff);
        border: 1px solid var(--border, #ddd);
        border-radius: 10px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        transition: background 0.2s, box-shadow 0.2s;
    }

    .catalog-filters-toggle-btn:hover {
        background: var(--bg-surface-alt, #f8f9fa);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .catalog-filters-toggle-btn i {
        font-size: 1.1rem;
    }

    /* При адаптации фильтры скрыты по умолчанию, на всю ширину, без внутренней прокрутки */
    .catalog-filters {
        order: 1;
        display: none;
        margin-top: 16px;
        padding: 20px;
        border-radius: 12px;
        position: static;
        width: 100%;
        max-height: none;
        overflow-y: visible;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }

    .catalog-filters-wrap.catalog-filters--open .catalog-filters {
        display: block;
    }

    .catalog-filters-wrap.catalog-filters--open .catalog-filters-toggle-btn {
        border-radius: 10px 10px 0 0;
        border-bottom: none;
    }

    .catalog-products-container {
        order: 2;
    }

    .catalog-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 24px;
        flex-wrap: wrap;
    }

    .catalog-header .search-box {
        width: 100%;
        max-width: 100%;
    }

    .catalog-header .search-box .search-input {
        width: 100%;
    }

    #resultsCount {
        order: 2;
        margin: 0;
    }

    .sort-options {
        margin-top: 0;
        flex-wrap: wrap;
    }

    .sort-label {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* Мобильная компактность: фильтры и карточки */
@media (max-width: 576px) {
    .catalog-page {
        padding: 32px 0 40px;
    }

    .catalog-container {
        padding: 0 16px;
    }

    .catalog-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .catalog-filters {
        padding: 16px;
    }

    .filter-title {
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .filter-group {
        margin-bottom: 18px;
    }

    .catalog-header {
        gap: 12px;
        margin-bottom: 20px;
    }

    .sort-options {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-select {
        width: 100%;
    }
}

/* Карточки 12+/18+ для гостя или без даты рождения: замазать превью, без перехода на товар */
.catalog-products .product-card--age-censored:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.catalog-age-censored__media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 14px;
}

.catalog-age-censored__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(20px) brightness(0.5);
    transform: scale(1.12);
}

.catalog-age-censored__veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(18, 18, 22, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.catalog-age-censored__veil--soft {
    background: rgba(18, 18, 22, 0.55);
}

.catalog-age-censored__lock {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.product-card--age-censored .product-age-rating {
    z-index: 4;
}

.catalog-age-censored__media--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #2a2a2e 0%, #141416 100%);
}

.catalog-age-censored__media--placeholder .catalog-age-censored__ph-icon {
    position: absolute;
    z-index: 1;
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    color: rgba(255, 255, 255, 0.2);
}

.catalog-age-censored__hint {
    font-size: 0.8125rem;
    color: var(--text-muted, #777);
    line-height: 1.45;
    margin-bottom: 10px;
    flex: 1;
}

.catalog-age-censored__price {
    color: var(--text-muted, #999);
    font-weight: 600;
}

[data-theme="dark"] .catalog-age-censored__hint {
    color: var(--text-muted, #9ca3af);
}

@media (max-width: 480px) {
    .catalog-page {
        padding: 24px 0 32px;
    }
    .catalog-container {
        padding: 0 14px;
    }
    .catalog-title {
        font-size: 22px;
    }
    .catalog-products {
        gap: 12px;
    }
    .catalog-products .product-card .product-content {
        padding: 12px 10px;
    }
    .catalog-products .product-card .product-content h3 {
        font-size: 0.875rem;
    }
    .catalog-products .product-card .product-price {
        font-size: 0.9375rem;
    }
    .catalog-products .product-card .btn {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
}