/* ============================================================
   КАТАЛОГ — СЕТКА КАРТОЧЕК В СТИЛЕ ГЛАВНОЙ
   Все селекторы имеют префикс .catalog-card / .catalog-grid,
   чтобы не пересекаться со стилями главной и детальной.
   ============================================================ */

.catalog-description {
    max-width: 1420px;
    margin: 0 auto 24px;
    font-size: 15px;
    line-height: 22px;
    color: #333;
}

.catalog-empty {
    padding: 40px 0;
    font-size: 16px;
    color: #666;
    text-align: center;
}

/* ---------- Сетка ---------- */
.catalog-grid {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

/* ---------- Карточка ---------- */
.catalog-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
    border: 1px solid #0E316566;
    border-radius: 16px;
    background: #fff;
    box-sizing: border-box;
    position: relative;
    transition: box-shadow .2s;
    min-height: 240px;
}
.catalog-card:hover {
    box-shadow: 0 4px 16px rgba(14, 49, 101, .10);
}

/* Иконки редактирования/удаления (появляются только в режиме правки Bitrix) */
.catalog-card > .bx-context-toolbar,
.catalog-card > .bx-core-popup-menu,
.catalog-card .bx-edit-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

/* ---------- Левая колонка: картинка ---------- */
.catalog-card__image {
    flex: 0 0 42%;
    max-width: 42%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-card__image a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.catalog-card__image img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: contain;
    object-position: center;
}

/* ---------- Бейдж ---------- */
.catalog-card__badge {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    background: #0E3165;
    border-radius: 6px;
    font-style: normal;
    z-index: 2;
}
.catalog-card__badge--discount { background: #FF0F12; }
.catalog-card__badge--hit      { background: #0E3165; }
.catalog-card__badge--new      { background: #2858C8; }

/* ---------- Правая колонка: контент ---------- */
.catalog-card__content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.catalog-card__name {
    font-size: 15px;
    line-height: 20px;
    font-weight: 700;
    color: #0E3165;
}
.catalog-card__name a {
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.catalog-card__name a:hover {
    color: #2858C8;
}

/* ---------- Счётчик ---------- */
.catalog-card__counter {
    width: 100%;
    max-width: 200px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px;
    border: 1px solid #000;
    border-radius: 10px;
    box-sizing: border-box;
    gap: 8px;
}

.catalog-card__counter input{
    border: none !important;
    color: #0E3165 !important;
    margin: 0 !important;
}

.catalog-card__counter .qty-minus,
.catalog-card__counter .qty-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font-size: 20px;
    line-height: 1;
    font-weight: 500;
    color: #0E3165;
    cursor: pointer;
    float: none;
    box-shadow: none;
}

.catalog-card__counter .quantity {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 60px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #0E3165;
    padding: 0;
    margin: 0;
    outline: none;
    box-shadow: none;
}

/* ---------- Минимальный заказ ---------- */
.catalog-card__ratio {
    font-size: 12px;
    line-height: 16px;
    color: #0E3165;
    margin: 0;
    padding: 0;
    position: static;
}

/* ---------- Цена + кнопка ---------- */
.catalog-card__price-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 0;
    padding-top: 4px;
    flex-wrap: wrap;
}

.catalog-card__price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #0E316566;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1;
    font-weight: 700;
    color: #0E3165;
    box-sizing: border-box;
    white-space: nowrap;
}

.catalog-card__price-old {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
    margin-left: 6px;
}

.catalog-card__btn {
    width: 100%;
    max-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    background: #FF0F12;
    color: #fff;
    font-size: 13px;
    line-height: 1;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .2s;
}
.catalog-card__btn:hover {
    background: #e00d10;
}

.catalog-card__btn--disabled {
    background: #ccc;
    cursor: not-allowed;
}

.catalog-card__btn svg {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: #fff;
    stroke: #fff;
    fill: none;
}

/* ---------- Пагинация ---------- */
.catalog-pagination {
    width: 100%;
    max-width: 1420px;
    margin: 40px auto 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Контейнеры Bitrix */
.catalog-pagination .bx-pagination,
.catalog-pagination .bx-pagination-container,
.catalog-pagination .modern-page-navigation,
.catalog-pagination .modern-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
}

/* Универсальный сброс: убираем ВСЕ фоновые картинки у пагинации */
.catalog-pagination,
.catalog-pagination *,
.catalog-pagination *::before,
.catalog-pagination *::after {
    background-image: none !important;
}

/* Скрываем title/подписи, которые Bitrix выводит рядом */
.catalog-pagination .bx-pagination-page,
.catalog-pagination .modern-page-title,
.catalog-pagination .bx-pag-title {
    display: none !important;
}

/* ---- Список страниц ---- */
.catalog-pagination ul {
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    flex-wrap: wrap;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 4px;
}

/* ---- Каждый li: одинаковая высота, чтобы ховер работал везде ---- */
.catalog-pagination ul li {
    display: flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 44px;
    background: none !important;
    background-image: none !important;
    list-style: none !important;
    border: none !important;
}

/* ---- Ссылка/номер: цвет как у кнопки, выравнивание по всей площади ---- */
.catalog-pagination ul li > a,
.catalog-pagination ul li > span,
.catalog-pagination .modern-page-numbers a,
.catalog-pagination .modern-page-numbers span,
.catalog-pagination .modern-page-current,
.catalog-pagination .modern-page-first,
.catalog-pagination .modern-page-last,
.catalog-pagination .modern-page-prev,
.catalog-pagination .modern-page-next,
.catalog-pagination .bx-pag-prev,
.catalog-pagination .bx-pag-next {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;

    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    text-indent: 0 !important;
    overflow: visible !important;
    color: #FF0F12 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border: none !important;
    border-radius: 10px !important;
    transition: background-color .15s, color .15s !important;
}

/* ---------- Ховер — на всю площадь плитки ---------- */
.catalog-pagination ul li > a:hover,
.catalog-pagination .modern-page-numbers a:hover,
.catalog-pagination .modern-page-first:hover,
.catalog-pagination .modern-page-last:hover,
.catalog-pagination .modern-page-prev:hover,
.catalog-pagination .modern-page-next:hover,
.catalog-pagination .bx-pag-prev a:hover,
.catalog-pagination .bx-pag-next a:hover {
    background-color: #FF0F12 !important;
    color: #fff !important;
}

/* ---------- Активная страница — как кнопка ---------- */
.catalog-pagination ul li.bx-active > span,
.catalog-pagination ul li.bx-active > a,
.catalog-pagination .modern-page-current,
.catalog-pagination .modern-page-current span,
.catalog-pagination .modern-page-current a {
    background-color: #FF0F12 !important;
    color: #fff !important;
    font-weight: 700 !important;
    cursor: default !important;
}
.catalog-pagination .pagination .links a,
.catalog-pagination .pagination .links b{
    height: 100% !important;
    display: flex;
    justify-content: center;
    align-items: center;
    transition-duration: 0.3s !important;
    font-weight: 600;
}
.catalog-pagination .pagination .links b{
    background-color: #FF0F12 !important;
}
.catalog-pagination .pagination .links a:hover{
    background-color: #FF0F12 !important;
}
.catalog-pagination .pagination .links a #btn-pag-back,
.catalog-pagination .pagination .links a #btn-pag-next{
    width: unset !important;
    height: unset !important;
}
.catalog-pagination .pagination .links a #btn-pag-back::before{
    content: "‹" !important;
}
.catalog-pagination .pagination .links a #btn-pag-next::before{
    content: "›" !important;
}
.catalog-pagination .pagination .links a #btn-pag-next::before,
.catalog-pagination .pagination .links a #btn-pag-back::before{
    display: inline-block !important;
    font-size: 24px !important;
    line-height: 1 !important;
    font-weight: 400 !important;
    color: inherit !important;
}


/* ---------- Стрелки вперёд/назад — оставляем только текст ---------- */
.catalog-pagination .bx-pag-prev,
.catalog-pagination .bx-pag-next,
.catalog-pagination .modern-page-prev,
.catalog-pagination .modern-page-next,
.catalog-pagination .modern-page-first,
.catalog-pagination .modern-page-last {
    text-indent: 0 !important;
    overflow: visible !important;
    font-size: 18px !important;
    color: #0E3165 !important;
}

/* Если у стрелок внутри span с text-indent -9999 — исправляем */
.catalog-pagination .bx-pag-prev span,
.catalog-pagination .bx-pag-next span,
.catalog-pagination .modern-page-prev span,
.catalog-pagination .modern-page-next span,
.catalog-pagination .modern-page-first span,
.catalog-pagination .modern-page-last span {
    text-indent: 0 !important;
    overflow: visible !important;
    color: inherit !important;
    font-size: inherit !important;
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
}

/* Иконки внутри стрелок, если есть <i> — скрываем */
.catalog-pagination .bx-pag-prev i,
.catalog-pagination .bx-pag-next i,
.catalog-pagination .modern-page-prev i,
.catalog-pagination .modern-page-next i {
    display: none !important;
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

/* 992–1439: 2 карточки в ряд */
@media (max-width: 1439px) {
    .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 768–991: 2 карточки, но с меньшим padding */
@media (max-width: 991px) {
    .catalog-grid {
        gap: 16px;
    }
    .catalog-card {
        padding: 12px;
        min-height: 220px;
    }
    .catalog-card__image img {
        height: 170px;
    }
    .catalog-card__name {
        font-size: 14px;
        line-height: 18px;
    }
}

/* до 767: 1 карточка в ряд */
@media (max-width: 767px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
    .catalog-card {
        min-height: 200px;
    }
    .catalog-card__image {
        flex: 0 0 45%;
        max-width: 45%;
    }
    .catalog-card__image img {
        height: 150px;
    }
    .catalog-card__price-block{
        width: 100%;
        max-width: 200px;
        flex-flow: row nowrap;
    }
    .catalog-card__content{
        align-items: center;
    }
    .catalog-pagination ul li,
    .catalog-pagination ul li > a,
    .catalog-pagination ul li > span {
        min-height: 38px !important;
        min-width: 38px !important;
        font-size: 14px !important;
        padding: 0 8px !important;
    }
}

/* совсем узкие: перестраиваем карточку вертикально */
@media (max-width: 480px) {
    .catalog-card {
        flex-direction: column;
        align-items: stretch;
        min-height: auto;
    }
    .catalog-card__image {
        flex: 0 0 auto;
        max-width: 100%;
    }
    .catalog-card__image img {
        height: 200px;
    }
    .catalog-card__price-block {
        justify-content: space-between;
    }
}