.v-catalog-grid {
    display: grid;
    /*grid-template-columns: 250px 1fr;*/
    margin-bottom: 120px;
}
.v-catalog-grid > * {
    min-width: 0;
    width: 100%;
}
.v-catalog-grid.without-menu {
    grid-template-columns: 1fr;
}

/* Режим правки: Bitrix оборачивает вывод компонента в #bx_incl_area_* — один
   прямой потомок .v-catalog-grid, иначе grid-template-columns не даёт две колонки. */
.v-catalog-grid > [id^="bx_incl_area_"] {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}
.v-catalog-grid.without-menu  > [id^="bx_incl_area_"]{
    grid-template-columns: 1fr;
    grid-column: initial;
}

.v-catalog-grid > [id^="bx_incl_area_"] > script,
.v-catalog-grid > script {
    grid-column: 1 / -1;
}

/* Каталог: визуально убираем рамку зоны страницы. Не используем display:contents — иначе ломается
   привязка BX.admin к дереву зон редактирования вложенных элементов. */
body.v-catalog-min-edit #bx_incl_area_1 {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
}

.v-catalog-sections {
    position: relative;
    max-height: calc(100vh - 50px);
    padding-right: 50px;
}

/* AJAX как раньше: на весь экран (каталог /catalog/, шаблон v_section) */
html.v-catalog-fullscreen-loader {
    overflow: hidden;
}

html.v-catalog-fullscreen-loader::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    z-index: 99990;
    background: rgba(255, 255, 255, 0.88);
    pointer-events: auto;
}

html.v-catalog-fullscreen-loader::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    box-sizing: border-box;
    z-index: 99991;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--blue-color);
    border-radius: 50%;
    animation: vCatalogSpinner 0.8s linear infinite;
    pointer-events: none;
}

html:has(.v-catalog-grid:not([data-vilka-catalog-section-template="v_section_list"]).v-catalog-scripts-pending) {
    overflow: hidden;
}

.v-catalog-grid:not([data-vilka-catalog-section-template="v_section_list"]).v-catalog-scripts-pending .v-catalog-sections a {
    pointer-events: none;
    cursor: wait;
}

.v-catalog-grid:not([data-vilka-catalog-section-template="v_section_list"]).v-catalog-scripts-pending::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    z-index: 99990;
    background: rgba(255, 255, 255, 0.88);
    pointer-events: auto;
}

.v-catalog-grid:not([data-vilka-catalog-section-template="v_section_list"]).v-catalog-scripts-pending::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    box-sizing: border-box;
    z-index: 99991;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--blue-color);
    border-radius: 50%;
    animation: vCatalogSpinner 0.8s linear infinite;
    pointer-events: none;
}

/* Локальный прелоадер только для блока с шаблоном v_section_list (напр. /style/) */
.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"] {
    position: relative;
}

.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"].v-catalog-grid-loading::before,
.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"].v-catalog-scripts-pending::before {
    content: "";
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    z-index: 50;
    background: rgba(255, 255, 255, 0.88);
    pointer-events: auto;
}

.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"].v-catalog-grid-loading::after,
.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"].v-catalog-scripts-pending::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    box-sizing: border-box;
    z-index: 51;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--blue-color);
    border-radius: 50%;
    animation: vCatalogSpinner 0.8s linear infinite;
    pointer-events: none;
}

.v-catalog-grid[data-vilka-catalog-section-template="v_section_list"].v-catalog-scripts-pending .v-catalog-sections a {
    pointer-events: none;
    cursor: wait;
}
.v-catalog-sections .item.all {
    margin-bottom: 20px;
}
.v-catalog-sections .item {
    font-size: 15px;
    transition: .3s ease-out;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    word-break: normal;
    background-color: #E6E6E6;
    padding: 10px 20px;
    border: 1px solid #ffffff;
    cursor: pointer;
    display: block;
    color: black;
}

.v-catalog-sections .item:hover {
    color: white;
    background: var(--blue-color);
}
.v-catalog-sections .item.active {
    color: white;
    background: rgb(140, 190, 206);
    font-weight: 600;
}
.v-catalog-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 50px;
}

@keyframes vCatalogSpinner {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


.v-catalog {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-column-gap: 20px;
    grid-row-gap: 50px;
    width: 100%;
}
.v-catalog-item {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}
.v-catalog-item .photo {
    position: relative;
    background: white;
    width: 100%;
    height: 250px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.v-catalog-item .photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    background-size: contain;
    background-position: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: .3s ease-out;
    z-index: 1;
}

.v-catalog-item .photo img.detail {
    opacity: 0;
    z-index: 3;
}
.v-catalog-item .photo:hover img.detail {
    opacity: 1;
}

.v-catalog-item .category {
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 600;
}
.v-catalog-item .article {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.55;
}
.v-catalog-item .price,
.v-catalog-item .priceDescription{
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.35;
}
.v-catalog-item .priceDescription {
    font-weight: bold;
    font-size: 12px;
}
.v-catalog-item .v-btn.outline {
    margin-bottom: 8px;
}
.v-catalog-item .v-btn {
    font-size: 14px;
    padding-top: 12px;
    padding-bottom: 12px;
    min-width: initial;
    min-height: initial;
}
.v-product-detail-popup {
    background: var(--gray-color)!important;
    padding: 40px!important;
    max-width: 1240px!important;
    width: 100%;
}
.v-product-detail-popup .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 40px;
    margin-bottom: 60px;
}
.v-product-detail-popup .grid > * {
    min-width: 0;
}
.v-product-detail-popup .gallery .main-slider {
    height: 560px;
    background: white;
    margin-bottom: 4px;
}
.v-product-detail-popup .gallery .main-slider .swiper-slide {
    width: 100%;
    height: 100%;
}
.v-product-detail-popup .gallery .main-slider .swiper-slide img,
.v-product-detail-popup .gallery .thumb-slider .swiper-slide img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}
.v-product-detail-popup .gallery .thumb-slider {
    height: 60px;
}
.v-product-detail-popup .gallery .thumb-slider .swiper-slide {
    width: 60px;
    height: 60px;
    background: white;
    border: 1px solid white;
}
.v-product-detail-popup .gallery .thumb-slider .swiper-slide.swiper-slide-thumb-active{
    border-color:  rgba(0, 0, 0, .15);
}
.v-product-detail-popup .category {
    font-size: 24px;
    line-height: 1.35;
    margin-bottom: 4px;
}
.v-product-detail-popup .brand,
.v-product-detail-popup .article {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 4px;
    color: #777;
}
.v-product-detail-popup .price,
.v-product-detail-popup .priceDescription{
    font-size: 20px;
    line-height: 1.35;
    margin-bottom: 18px;
}
.v-product-detail-popup .priceDescription{
    font-size: 12px;
    font-weight: bold;
}
.v-product-detail-popup .label {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 3px;
}
.v-product-detail-popup select {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #000;
    cursor: pointer;
    padding: 10px;
    display: block;
}
.v-product-detail-popup .grid .v-btn {
    margin-top: 30px;
}

html.v-catalog-detail-popup-open {
    overflow: hidden;
}

.v-catalog-detail-popup {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.v-catalog-detail-popup.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.v-catalog-detail-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.v-catalog-detail-popup__dialog {
    position: relative;
    z-index: 1;
    width: min(1240px, 100%);
    max-height: min(92vh, 900px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v-catalog-detail-popup__close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
}

.v-catalog-detail-popup__close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.v-catalog-detail-popup__body {
    flex: 1;
    overflow: auto;
    padding: 48px 24px 32px;
    -webkit-overflow-scrolling: touch;
}

.v-catalog-detail-popup__loading,
.v-catalog-detail-popup__error {
    padding: 40px 24px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
}

.v-catalog-detail-popup__error {
    color: #b00020;
}

@media (max-width: 1200px) {
    .v-catalog-grid {
        grid-template-columns: 224px 1fr;
    }
    .v-catalog-sections {
        padding-right: 24px;
    }
}
@media (max-width: 1024px) {
    .v-catalog-grid {
        grid-template-columns:1fr !important;
        grid-gap: 24px;
    }
    .v-catalog-sections {
        padding-right: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .v-catalog-sections .item {
        margin: 0!important;
    }

}
@media (max-width: 768px) {
    .v-catalog {
        grid-template-columns: 1fr 1fr;
        grid-column-gap: 12px;
        grid-row-gap: 32px;
    }
    .v-catalog-item .photo {
        height: 130px;
    }

    .v-product-detail-popup .grid {
        grid-template-columns: 1fr;
        grid-gap: 32px;
        margin-bottom: 48px;
    }
    .v-product-detail-popup .gallery .main-slider {
        height: 340px;
    }
}
@media (max-width: 480px) {
    .v-catalog {
        /*grid-template-columns: 1fr;*/
        /*grid-row-gap: 32px;*/
    }
}