/* Фон страницы каталога — общий фон body, без отдельного градиента секций */
/* Bootstrap primary/outline на странице каталога — в палитре сайта, без синего */
body.page-catalog .btn-primary {
    --bs-btn-bg: var(--ns-blue, #8b5a2b);
    --bs-btn-border-color: var(--ns-blue, #8b5a2b);
    --bs-btn-hover-bg: #7a4f25;
    --bs-btn-hover-border-color: #7a4f25;
    --bs-btn-active-bg: #6e4520;
    --bs-btn-active-border-color: #6e4520;
    --bs-btn-focus-shadow-rgb: 139, 90, 43;
}

body.page-catalog .btn-outline-primary {
    --bs-btn-color: var(--ns-blue, #8b5a2b);
    --bs-btn-border-color: rgba(139, 90, 43, 0.55);
    --bs-btn-hover-bg: var(--ns-blue, #8b5a2b);
    --bs-btn-hover-border-color: var(--ns-blue, #8b5a2b);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #6e4520;
    --bs-btn-active-border-color: #6e4520;
    --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: 139, 90, 43;
}

.page-head {
    padding: 28px 0 18px 0;
}

.page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: var(--ns-text-main);
}

.page-subtitle {
    margin-top: 6px;
    color: var(--ns-text-muted);
    font-size: 14px;
}

.categories-list-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-bottom: 40px;
}

.categories-list-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    background: rgba(255, 255, 255, 0.92);
    min-height: 110px;
    display: block;
}

.categories-list-card-bg {
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(circle at 12% 0, rgba(110, 85, 55, 0.12), transparent 55%),
        radial-gradient(circle at 88% 100%, rgba(90, 82, 72, 0.1), transparent 58%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 242, 236, 0.96));
    opacity: 0.95;
}

.categories-list-card-inner {
    position: relative;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    height: 100%;
}

.categories-list-card-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--ns-text-main);
}

.categories-list-card:hover .categories-list-card-bg {
    background:
        radial-gradient(circle at 12% 0, rgba(110, 85, 55, 0.16), transparent 55%),
        radial-gradient(circle at 88% 100%, rgba(90, 82, 72, 0.14), transparent 58%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 236, 228, 0.98));
}

.catalog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.catalog-filter-toggle {
    display: none;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    padding-bottom: 40px;
    align-items: start;
}

.catalog-filters {
    /* Наследуемые переменные Bootstrap — фокус, ссылки, primary без синего */
    --bs-primary: #8b5a2b;
    --bs-primary-rgb: 139, 90, 43;
    --bs-link-color: #8b5a2b;
    --bs-link-hover-color: #6e4520;
    --bs-focus-ring-opacity: 0.28;
    --bs-focus-ring-color: rgba(139, 90, 43, var(--bs-focus-ring-opacity));
    --bs-border-color: #d9c8ac;

    display: flex;
    flex-direction: column;
    min-height: 0;
    height: max-content;
    align-self: start;
    overflow: hidden;
    border: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    padding: 14px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.catalog-filters .form-control,
.catalog-filters .form-select {
    border: 1px solid var(--ns-input-border, #d9c8ac);
    background: #fff;
    height: auto;
}

.catalog-filters .form-control:hover,
.catalog-filters .form-select:hover {
    border-color: var(--ns-input-border-hover, #c4a882);
}

/* Стрелка селекта — коричневая, не системный серый/синий акцент */
.catalog-filters .form-select:not([multiple]):not([size]) {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b5a2b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.catalog-filters .form-control:focus,
.catalog-filters .form-control:focus-visible,
.catalog-filters .form-select:focus,
.catalog-filters .form-select:focus-visible {
    border-color: var(--ns-input-border-focus, #8b5a2b);
    box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.16);
    outline: 0;
}

.catalog-filters .form-control:-webkit-autofill,
.catalog-filters .form-control:-webkit-autofill:hover,
.catalog-filters .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ns-text-main, #2b2620);
    box-shadow: 0 0 0 1000px #faf8f5 inset;
    transition: background-color 99999s ease-out 0s;
}

.catalog-filters-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    max-height: inherit;
}

.catalog-filters-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -2px;
    -webkit-overflow-scrolling: touch;
}

.catalog-filter-block {
    flex: 0 0 auto;
    min-width: 0;
}

.catalog-filter-block + .catalog-filter-block {
    margin-top: 14px;
}

.catalog-filter-title {
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--ns-text-main);
}

.price-range-single {
    margin-top: 4px;
}

.price-range-dual {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.price-range-dual-row {
    min-width: 0;
}

.price-range-single-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 800;
    color: var(--ns-text-main);
}

.price-range-single-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--ns-text-muted);
}

.price-range-single-output {
    font-variant-numeric: tabular-nums;
}

.price-range-single-currency {
    font-weight: 700;
    color: var(--ns-text-muted);
    font-size: 13px;
}

/* Ползунок цены: тёплый «бегунок», без серого/синего системного оформления */
.catalog-filters input[type="range"].price-range-single-input {
    width: 100%;
    height: 22px;
    margin-top: 2px;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    accent-color: var(--ns-blue, #8b5a2b);
}

.catalog-filters input[type="range"].price-range-single-input:focus {
    outline: none;
}

.catalog-filters input[type="range"].price-range-single-input::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(90, 82, 72, 0.22);
}

.catalog-filters input[type="range"].price-range-single-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--ns-blue, #8b5a2b);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(80, 50, 25, 0.28);
    cursor: pointer;
}

.catalog-filters input[type="range"].price-range-single-input::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(90, 82, 72, 0.22);
}

.catalog-filters input[type="range"].price-range-single-input::-moz-range-thumb {
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ns-blue, #8b5a2b);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(80, 50, 25, 0.28);
    cursor: pointer;
}

.catalog-filter-block:has(.catalog-checklist) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.catalog-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 128px;
    max-height: 128px;
    min-height: 0;
    flex-shrink: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-right: 6px;
    margin-right: -2px;
    border: 1px solid rgba(139, 90, 43, 0.12);
    border-radius: 8px;
    padding: 8px 6px 8px 8px;
    background: rgba(250, 248, 245, 0.9);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 90, 43, 0.45) rgba(139, 90, 43, 0.1);
}

.catalog-checklist::-webkit-scrollbar {
    width: 6px;
}

.catalog-checklist::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.06);
    border-radius: 999px;
}

.catalog-checklist::-webkit-scrollbar-thumb {
    background: rgba(139, 90, 43, 0.32);
    border-radius: 999px;
}

.catalog-checklist--dense {
    height: 112px;
    max-height: 112px;
}

.catalog-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--ns-text-muted);
    font-size: 13px;
    user-select: none;
}

.catalog-check > span {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.catalog-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--ns-blue, #8b5a2b);
    border-color: rgba(80, 50, 25, 0.35);
}

.catalog-filters .catalog-filter-actions .btn:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(139, 90, 43, 0.28);
}

.catalog-filter-actions {
    flex-shrink: 0;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    display: grid;
    gap: 10px;
}

.catalog-results {
    min-width: 0;
    align-self: stretch;
    border: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    padding: 14px;
    border-radius: 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

.recommended-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 388px;
    max-height: 388px;
    border: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}

.recommended-card:hover {
    color: inherit;
}

.recommended-card-media {
    position: relative;
    width: 100%;
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    flex: 0 0 200px;
    overflow: hidden;
    background: rgba(243, 239, 232, 0.95);
}

.recommended-card-img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 200px;
    max-height: 200px;
    object-fit: cover;
    object-position: center;
    background-color: rgba(243, 239, 232, 0.95);
}

.recommended-card-img-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: rgba(236, 232, 224, 0.95);
    color: rgba(110, 95, 78, 0.55);
    font-size: 32px;
    line-height: 1;
}

.recommended-card-img-empty i {
    display: block;
}

.recommended-card-category {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--ns-border-subtle, rgba(80, 50, 25, 0.1));
    color: var(--ns-text-main);
    font-size: 12px;
    font-weight: 700;
}

.recommended-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.recommended-card-title {
    font-weight: 500;
    color: var(--ns-text-main);
    font-size: 14px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.recommended-card-price {
    font-weight: 800;
    color: var(--ns-blue);
    font-size: 14px;
}

.catalog-pagination {
    margin-top: 16px;
}

@media (max-width: 991.98px) {
    .categories-list-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .catalog-filter-toggle {
        display: inline-flex;
        gap: 8px;
        align-items: center;
        white-space: nowrap;
    }

    .catalog-filters {
        position: fixed;
        inset: auto 12px 12px 12px;
        top: auto;
        z-index: 200;
        max-height: 70vh;
        overflow: hidden;
        display: none;
        flex-direction: column;
        min-height: 0;
        height: auto;
    }

    .catalog-filters.open {
        display: flex;
    }

    .recommended-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .categories-list-grid {
        grid-template-columns: 1fr;
    }

    .recommended-grid {
        grid-template-columns: 1fr;
    }
}

.recommended-card-btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    color: #fff;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--ns-blue), #6e4520);
    border: none;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.recommended-card:hover .recommended-card-btn {
    transform: translateX(4px);
    filter: brightness(1.05);
}

.page-title{font-weight:500;}
.categories-list-card-title{font-weight:500;}
.catalog-filter-title{font-weight:500;}
.recommended-card-category{font-weight:400;}
.recommended-card-title{font-weight:500;}
.recommended-card-price{font-weight:500;}
.recommended-card-btn{font-weight:500;}
