/* =========================================
   ГЛАВНАЯ СТРАНИЦА КАТАЛОГА (archive-product)
   ========================================= */

.catalog-container {
    display: block; /* убираем flex, т.к. сайдбара нет */
}

/* ===== БЛОК 1: КОРНЕВЫЕ КАТЕГОРИИ + ПОДКАТЕГОРИИ (2 КОЛОНКИ, ТОЛЬКО ТЕКСТ) ===== */
.categories-tree {
    margin-bottom: 50px;
}

.two-columns-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.category-node {
    break-inside: avoid;
    margin-bottom: 20px;
}

.parent-cat {
    display: flex;          /* делаем контейнер flex */
    align-items: center;    /* вертикальное выравнивание по центру */
    font-weight: 700;
    font-size: var(--font-head4);
    margin-bottom: 10px;
    color: #1e1e1e;
}

.cat-icon {
    flex-shrink: 0;         /* запрещаем иконке сжиматься, если текста много */
    color: #E02E7A;
    transition: color 0.2s;
}

.parent-cat:hover .cat-icon {
    color: var(--main-dark); /* или #E02E7A, по вашему hover-цвету */
}

.subcats-list {
    margin: 0;
    padding-left: 18px;
    margin-left: 20px;
    list-style: disc;
}

.subcats-list li {
    margin-bottom: 6px;
}

.subcats-list a {
    text-decoration: none;
    color: #495057;
    font-size: var(--font-text);
    transition: color 0.2s;
}

.subcats-list a:hover {
    color: #E02E7A;
}

/* ===== БЛОК 2: ТЕКСТОВЫЙ БЛОК (ACF) ===== */
.catalog-middle-text {
    background: #f1f3f5;
    padding: 25px 30px;
    border-radius: 12px;
    margin: 30px 0 50px;
    line-height: 1.6;
    color: #2c3e50;
}

.catalog-middle-text h1,
.catalog-middle-text h2,
.catalog-middle-text h3 {
    margin-top: 0;
}

.catalog-middle-text p:last-child {
    margin-bottom: 0;
}

/* ===== БЛОК 3: КАТЕГОРИИ С ОПИСАНИЯМИ (ПОСЛЕДНИЙ УРОВЕНЬ) ===== */
/* ============================================
   Обертка секции
   ============================================ */
.deep-categories {
    margin-bottom: 50px;
}

/* ============================================
   Микро-сетка (clearfix, row, col-*, hidden-*)
   ============================================ */
.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.row {
    margin-left: -16px;
    margin-right: -16px;
}
.row:before,
.row:after {
    display: table;
    content: " ";
}
.row:after {
    clear: both;
}

.col-md-12, .col-md-6,
.col-sm-12, .col-sm-6,
.col-xs-12 {
    position: relative;
    min-height: 1px;
    padding-left: 16px;
    padding-right: 16px;
}

/* ============================================
   Общие вспомогательные классы
   ============================================ */
.border {
    border: 1px solid #eff1f5;
}
.shadow {
    transition: box-shadow .3s;
}
.shadow:hover {
    border-color: transparent;
    -webkit-box-shadow: 0 5px 25px 0 rgba(18,25,38,.1);
    box-shadow: 0 5px 25px 0 rgba(18,25,38,.1);
}

.font_sm {
    font-size: var(--font-small);
    line-height: 1.4286em;
}
.font_upper_md {
    font-size: var(--font-small);
    line-height: 1.3em;
    text-transform: uppercase;
    letter-spacing: .8px;
}

/* ============================================
   Каркас секции item-views
   ============================================ */
.item-views {
    margin-bottom: 0;
    position: relative;
}

.item-views .items {
    margin-top: -16px;
    margin-bottom: -16px;
}

/* ============================================
   Основные элементы секции
   ============================================ */
.item-views.services-items .items .item-new-section {
    width: 100% !important;
}
.item-views.services-items .items .item-new-section:first-child {
    margin-top: 0;
}

/* Заголовок раздела */
.item-views.services-items .items .item-new-section .title-center {
    text-align: center;
    padding: 30px 0 25px;
}
.item-views.services-items .items .item-new-section .title-center .title a {
    font-size: var(--font-head2);
    font-weight: 700;
    line-height: normal;
    color: #000;
    text-transform: uppercase;
}

/* Заголовок подкатегории 1 уровня */
.item-views.services-items .items .item-new-section .subtitle-center {
    text-align: center;
    margin: 20px 0;
}
.item-views.services-items .items .item-new-section .childs .col-md-12:first-child .subtitle-center {
    margin-top: 10px;
}
.item-views.services-items .items .item-new-section .subtitle-center a {
    font-size: var(--font-head3);
    font-weight: 500;
    color: #000;
}

/* Карточка подкатегории 2 уровня (sub-item) */
.item-views.services-items .items .item-new-section .childs .sub-item {
    display: flex;
    padding: 40px 0;
    margin-top: -1px;
    position: relative;
}
.item-views.services-items .items .item-new-section .childs .sub-item .col-md-6:first-child {
    border-right: 1px solid #eff1f5;
}

/* ---------- Левая колонка ---------- */
/* Изображение */
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-img {
    width: 70px;
    height: 100%;
    display: block;
    float: left;
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-img img {
    width: 50px;
}

/* Название подкатегории и список товаров */
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-text {
    display: table;
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-name {
    margin-bottom: 5px;
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-name a {
    color: #000;
    font-weight: 700;
    font-size: var(--font-head4);
    display: block;
    transition: all .3s;
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-name a:hover {
    color: var(--main-color);
}

/* Список товаров (ссылки через запятую) */
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-items a {
    font-size: var(--font-text);
    font-weight: 500;
    color: #000;
    text-decoration: none;
    border-bottom: 1px solid #a0a0a0;
    margin-right: 5px;
    transition: all .3s;
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-items a:hover {
    text-decoration: none;
    color: var(--main-color);
    border-bottom: 1px solid var(--main-color);
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-items a:after {
    content: ',';
}
.item-views.services-items .items .item-new-section .childs .sub-item .subsection-items a:last-child:after {
    content: '';
}

/* ---------- Правая колонка ---------- */
/* Делаем flex-колонку, чтобы кнопка прижалась к низу */
.item-views.services-items .items .item-new-section .childs .sub-item .font_sm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Описание */
.previewtext p {
    margin: auto;
}
.previewtext a {
    color: var(--main-color);
}
.previewtext a:hover {
    color: #333;
}

/* Список документов */
.item-views.services-items .items .item-new-section .childs .sub-item ul {
    margin: 20px -5px 0 0 !important;
    list-style-type: none;
}
.item-views.services-items .items .item-new-section .childs .sub-item ul li {
    margin: 4px -3px 4px 15px !important;
}
.item-views.services-items .items .item-new-section .childs .sub-item ul li:last-child {
    margin-bottom: 0 !important;
}
.item-views.services-items .items .item-new-section .childs .sub-item ul li:before {
    content: "•";
    position: absolute;
    color: #000;
    font-weight: 500;
    font-size: var(--font-text);
    margin-left: -15px;
}
.item-views.services-items .items .item-new-section .childs .sub-item ul li a {
    color: #000;
    font-weight: 500;
    font-size: var(--font-text);
    position: relative;
}
.item-views.services-items .items .item-new-section .childs .sub-item ul li a:hover {
    color: var(--main-color);
}

/* ---------- Кнопка "Оставить заявку" ---------- */
/* Контейнер кнопки – теперь внутри font_sm, поэтому позиционирование статично */
.side_forms.section_new_forms {
    margin-top: 20px;           /* прижимает кнопку к низу */
}

.side_forms.section_new_forms .button {
    display: flex;
    justify-content: flex-end;  /* выравнивание по правому краю */
}

.side_forms.section_new_forms .button > span,
.side_forms.section_new_forms .button > a {
    display: inline-block;
    padding: 0;                 /* убираем лишние отступы */
    background: none;
    color: #000;                /* чёрный текст, как у обычных ссылок */
    font-weight: 500;
    white-space: nowrap;        /* текст в одну строку */
    cursor: pointer;
    text-decoration: none;
    transition: color .3s;
}

.side_forms.section_new_forms .button > span:hover,
.side_forms.section_new_forms .button > a:hover {
    color: var(--main-color);
}

/* Убираем абсолютное позиционирование, если осталось */
.side_forms.section_new_forms .button > span,
.side_forms.section_new_forms .button > a {
    position: static;
    right: auto;
    bottom: auto;
}

/* Убираем абсолютное позиционирование, которое использовалось ранее */
.side_forms.section_new_forms .button > span,
.side_forms.section_new_forms .button > a {
    position: static;
    right: auto;
    bottom: auto;
}

/* SVG в кнопке */
.side_forms.section_new_forms .button svg {
    margin-right: 27px;
    vertical-align: middle;
    fill: var(--main-color);
}

/* ===== БЛОК 4: КОМПАКТНЫЕ КАРТОЧКИ ВСЕХ КАТЕГОРИЙ С КОЛИЧЕСТВОМ ТОВАРОВ ===== */
/* ============================================
   Секция каталога разделов (flex-сетка)
   ============================================ */
.item-views.catalog.sections {
    position: relative;
    padding: 0;
}

.item-views.catalog.sections .items {
    margin: 0 0 55px;
}

/* Flex-контейнер */
.item-views.catalog.sections .items.flex-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: 0;
    margin-right: 0;
}

/* Обёртка элемента – задаёт ширину */
.item-views.catalog.sections .item-wrap {
    padding: 0;
    box-sizing: border-box;
}

/* Десктоп: 4 колонки */
.item-views.catalog.sections .item-wrap.col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Карточка */
.item-views.catalog.sections .item {
    display: flex;
    align-items: center;
    padding: 29px;
    margin: 0 -1px -1px 0;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Изображение */
.item-views.catalog.sections .item .image {
    width: 60px;
    height: auto;
    max-height: 60px;
    margin-right: 20px;
    flex-shrink: 0;
    text-align: center;
    background: #fff;
    line-height: 1;
}
.item-views.catalog.sections .item .image img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Информация */
.item-views.catalog.sections .item .info {
    flex: 1;
}

/* Заголовок */
.item-views.catalog.sections .item .title {
    margin-bottom: 20px;
}
.item-views.catalog.sections .item .title a {
    font-size: var(--font-text);
    font-weight: 500;
    line-height: 24px;
    color: #000;
    transition: color 0.2s;
}
.item-views.catalog.sections .item .title a:hover {
    color: var(--main-color);
}

/* Информация */
.item-views.catalog.sections .item .info {
    flex: 1;
}

/* Заголовок */
.item-views.catalog.sections .item .title {
    margin-bottom: 20px;
}

/* Счётчик */
.item-views.catalog.sections .item .count_elements {
    margin: 7px 0 0;
    color: #999;
    font-size: var(--font-small);
    line-height: 1.3em;
    text-transform: uppercase;
    letter-spacing: .8px;
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ: скрываем лишние блоки и делаем карточки в столбец ===== */
@media (max-width: 767px) {

    /* Скрываем "Блок 1" (корневые категории + подкатегории) */
    .categories-tree {
        display: none !important;
    }

    /* Скрываем "Блок 3" (глубокие карточки с описаниями) */
    .deep-categories {
        display: none !important;
    }

    /* "Блок 4" – карточки в одну колонку */
    .item-views.catalog.sections .item-wrap {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* По желанию: убираем лишний отступ между карточками, если нужно */
    .item-views.catalog.sections .item {
        margin-right: 0;
        margin-bottom: 10px;  /* небольшой вертикальный промежуток */
    }
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .compact-cats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .two-columns-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .block-title {
        margin-bottom: 20px;
    }
    .catalog-middle-text {
        padding: 20px;
    }
}

/* Адаптив: на планшетах левая часть меньше */
@media (max-width: 768px) {
    .horizontal-card {
        flex-direction: column;
    }
    .card-left {
        flex: auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 20px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding: 15px;
    }
    .card-image {
        width: 80px;
        margin-bottom: 0;
    }
    .card-right {
        padding: 20px;
    }
    .btn-order {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .card-left {
        flex-direction: column;
        text-align: center;
    }
    .card-image {
        width: 100px;
    }
}

/* Адаптив: на планшетах карточки в 2 колонки */
@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
    .compact-cats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Мобильная адаптация
   ============================================ */
@media (max-width: 767px) {
    .item-views.services-items .items .item-new-section .childs .sub-item {
        display: inline-table;
    }
    .item-views.services-items .items .item-new-section .childs .sub-item .col-md-6.font_sm {
        padding-top: 30px;
    }
}

@media (min-width: 768px) {
    .col-sm-12 { width: 100%; }
    .col-sm-6  { width: 50%; }
}
@media (min-width: 992px) {
    .col-md-12 { width: 100%; }
    .col-md-6  { width: 50%; }
}

.hidden-sm,
.hidden-xs {
    display: block !important;
}
@media (max-width: 767px) {
    .hidden-xs { display: none !important; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .hidden-sm { display: none !important; }
}

/* Планшет: 3 колонки */
@media (max-width: 900px) {
    .item-views.catalog.sections .item-wrap.col-sm-6 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

/* Мобильные: 2 колонки */
@media (max-width: 767px) {
    .item-views.catalog.sections .item-wrap.col-xs-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Маленькие мобильные: 1 колонка */
@media (max-width: 500px) {
    .item-views.catalog.sections .item-wrap {
        flex: 0 0 100%;
        max-width: 100%;
    }
}