/* catalog.css - ВЕРСИЯ С ПРАВИЛЬНЫМИ ОТСТУПАМИ ИЗОБРАЖЕНИЯ И ПРЕФИКСОМ catalog- */

/* Стили для каталога - КОМПАКТНАЯ ВЕРСИЯ */
.catalog-container {
    padding: 20px 0;
}

/* Ширина сайдбара фильтров (десктоп) */
:root {
    --catalog-filters-sidebar-width: 312px;
}

/* Для страницы каталога расширяем основной контент шире, чем базовый .main-container */
.container.main-container.catalog-container {
    max-width: 1600px;
    width: 100%;
    /* Оставляем левую границу как при centered max-width:1400px,
       а расширяемся только вправо. */
    margin-top: 30px;
    margin-bottom: 30px;
    /* Выравниваем левый край контента каталога с логотипом в хедере:
       header-container: max-width 1200px + padding-left 20px */
    /* Сдвиг вправо под левый край кнопки "Все категории"
       (внутри сайдбара .catalog-filters-sidebar padding-left: 28px) */
    /* Важно: если ширина окна < 1104px, формула может дать 0.
       Делаем минимальный сдвиг, чтобы отступ был заметен визуально. */
    margin-left: max(0px, calc((100% - 1200px) / 2 - 99px));
    margin-right: 0;
    padding-left: 0;
    padding-right: 10px;
    box-sizing: border-box;
}

.catalog-page-title {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.catalog-filters-row {
    display: grid;
    grid-template-columns: var(--catalog-filters-sidebar-width) minmax(0, 1fr);
    gap: 25px;
    margin-bottom: 25px;
    box-sizing: border-box;
}

/* Область товаров — заполняет вторую колонку сетки полностью (иначе карточки «выпадают» вправо) */
.catalog-products-area {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: block;
    justify-self: stretch;
    box-sizing: border-box;
}

.catalog-filters-sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 15px;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    /* Важно: не режем расширение элементов по X */
    overflow-x: visible;
    -ms-overflow-style: none;  /* IE и старый Edge */
    scrollbar-width: none;     /* Firefox */
    width: var(--catalog-filters-sidebar-width);
    box-sizing: border-box;
}

.catalog-filters-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Кнопка для открытия фильтров на мобильных устройствах */
.catalog-mobile-filters-toggle {
    display: none;
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #333;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 15px;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
}

.catalog-mobile-filters-toggle:hover {
    background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 193, 7, 0.4);
}

.catalog-mobile-filters-toggle.active {
    background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
}

.catalog-mobile-filters-buttons {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.catalog-mobile-filters-buttons .catalog-mobile-filters-toggle {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.catalog-mobile-product-filters-toggle {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%) !important;
    box-shadow: 0 2px 5px rgba(56, 142, 60, 0.3);
}

.catalog-mobile-product-filters-toggle:hover {
    background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%) !important;
    box-shadow: 0 3px 8px rgba(56, 142, 60, 0.4);
}

/* Панель «Фильтр по товарам» (мобильная) */
.catalog-mobile-product-filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1004;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.catalog-mobile-product-filters-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

.catalog-mobile-product-filters-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -100%;
    width: 75%;
    max-width: none;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    background: white;
    z-index: 1005;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -2px 0 20px rgba(0,0,0,0.15);
}

.catalog-mobile-product-filters-sidebar.active {
    right: 0;
}

.catalog-mobile-product-filters-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    -webkit-overflow-scrolling: touch;
}

.catalog-mobile-product-filters-content .catalog-additional-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.catalog-mobile-product-filters-content .catalog-filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.catalog-mobile-product-filters-content .catalog-filter-item label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.catalog-mobile-product-filters-content .catalog-filter-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
}

.catalog-mobile-product-filters-actions {
    flex-shrink: 0;
    padding-top: 14px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 0px)));
    border-top: 1px solid #eee;
    background: #fff;
}

.catalog-mobile-product-filters-actions .catalog-apply-filters-btn {
    width: 100%;
    justify-content: center;
}

.catalog-mobile-filters-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1004;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.catalog-mobile-filters-overlay.active {
    display: block;
    opacity: 1;
}

.catalog-mobile-filters-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -100%;
    width: 75%;
    max-width: none;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    border-radius: 5px 0 0 5px;
    background: white;
    z-index: 1005;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -2px 0 20px rgba(0,0,0,0.15);
    -webkit-overflow-scrolling: touch;
}

.catalog-mobile-filters-sidebar.active {
    right: 0;
}

.catalog-mobile-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    border-bottom: 1px solid #eee;
    background: #fff;
}

.catalog-mobile-filters-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.catalog-mobile-filters-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.catalog-mobile-filters-close:hover {
    background: #f5f5f5;
    color: #333;
}

.catalog-mobile-filters-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 18px;
    padding-bottom: 18px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    -webkit-overflow-scrolling: touch;
}

/* Блок кнопок внизу первой мобильной панели (Применить / Сбросить / Закрыть) — всегда виден */
.catalog-mobile-filters-actions-main {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom, 0px)));
    border-top: 1px solid #eee;
    background: #fff;
}
.catalog-mobile-filters-actions-main .catalog-apply-filters-btn,
.catalog-mobile-filters-actions-main .catalog-clear-filters,
.catalog-mobile-filters-actions-main .catalog-mobile-filters-close-btn {
    margin: 0;
}
.catalog-mobile-filters-actions-main .catalog-apply-filters-btn {
    width: 100%;
    justify-content: center;
}

.catalog-filters-title {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Стили для табов категорий в фильтрах */
.catalog-filter-category-tabs {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.catalog-filter-category-tab {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 8px;
    /* Не обрезаем увеличенные кнопки внутри */
    overflow: visible;
    transition: all 0.3s ease;
}

.catalog-filter-category-tab.expanded {
    /* Убираем тень, чтобы визуально не создавалось "увеличение по горизонтали" */
    box-shadow: none;
    margin-bottom: 12px;
    overflow: visible;
}

.catalog-filter-category-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 16px;
    color: #555;
    user-select: none;
}

/* Расширяем кликабельную область заголовка категории внутри сайдбара на +20px по горизонтали */
.catalog-filters-sidebar .catalog-filter-category-tab-header,
.catalog-filters-sidebar .catalog-filter-category-tab-header.no-subcategories {
    margin-left: 0;
    margin-right: 0;
    /* Уменьшаем горизонтальные отступы внутри заголовка */
    padding-left: 18px;
    padding-right: 18px;
}

.catalog-filter-category-tab-header:hover {
    background: #f0f0f0;
}

.catalog-filter-category-tab-header.active {
    background: #FFC107;
    color: #333;
    /* Делаем одинаковым с базовым, чтобы не менять ширину текста */
    font-weight: 500;
}

.catalog-filter-category-tab-header i {
    transition: transform 0.3s ease;
    font-size: 16px;
}

.catalog-filter-category-tab-header.active i {
    transform: rotate(180deg);
}

.catalog-filter-subcategories-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.catalog-filter-subcategories-list.active {
    max-height: 400px !important;
    overflow-y: auto;
    /* Не обрезаем увеличение по X */
    overflow-x: hidden;
    border-top: 1px solid #eee;
}

.catalog-filter-subcategory-item {
    display: block;
    padding: 14px 36px 14px 64px;
    text-decoration: none;
    color: #666;
    font-size: 15px;
    /* Убираем скачок ширины текста при добавлении .active (где font-weight меняется) */
    font-weight: 500;
    /* Резервируем место под border-left, чтобы при переключении .active
       не происходило визуального "увеличения" по горизонтали */
    border-left: 3px solid transparent;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s;
    line-height: 1.35;
}

.catalog-filter-subcategory-item:hover {
    background: #FFF9E6;
    color: #333;
    padding-left: 68px;
}

.catalog-filter-subcategory-item.active {
    background: #FFE082;
    color: #333;
    font-weight: 500;
    border-left-color: #FFC107;
}

.catalog-filter-subcategory-item:last-child {
    border-bottom: none;
}

/* Обёртка уровня 1 в фильтре: пункт + подсписок уровня 2 */
.catalog-filter-subcategory-level1-wrapper {
    border-bottom: 1px solid #f5f5f5;
}
.catalog-filter-subcategory-level1-wrapper:last-child {
    border-bottom: none;
}
.catalog-filter-subcategories-level2 {
    display: block;
    margin: 0 0 4px 0;
    padding: 8px 0 8px 38px;
    border-left: 2px solid #FFE082;
    background: #fafafa;
}
.catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding: 12px 36px 12px 50px;
    font-size: 14px;
    border-bottom: none;
}
.catalog-filter-subcategories-level2 .catalog-filter-level2-item:last-child {
    border-bottom: none;
}

.catalog-filter-category-tab-header.no-subcategories {
    cursor: pointer;
}

.catalog-filter-category-tab-header.no-subcategories:hover {
    background: #f0f0f0;
}

.catalog-filter-section {
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.catalog-filter-section:last-child {
    border-bottom: none;
    margin-bottom: 15px;
}

.catalog-filter-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Кнопка "Все категории" */
.catalog-all-categories-link {
    margin-bottom: 12px;
    display: block;
}

/* Десктоп: та же ширина и отступы, что у заголовков табов (.catalog-filter-category-tab-header) */
.catalog-filters-sidebar .catalog-all-categories-link .catalog-all-categories-link__anchor {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 16px calc(20px + 16px);
    font-size: 16px;
    line-height: 1.35;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #eee;
    background: #f9f9f9;
    transition: background 0.2s ease, color 0.2s ease;
}

.catalog-filters-sidebar .catalog-all-categories-link .catalog-all-categories-link__anchor .fa-th-large {
    font-size: 11px;
    flex-shrink: 0;
}

.catalog-filters-sidebar .catalog-all-categories-link .catalog-all-categories-link__anchor.is-active {
    background: #FFC107;
    color: #333;
    font-weight: 600;
}

.catalog-filters-sidebar .catalog-all-categories-link .catalog-all-categories-link__anchor:hover {
    background: #FFF9E6;
    color: #333;
}

.catalog-filters-sidebar .catalog-all-categories-link .catalog-all-categories-link__anchor.is-active:hover {
    background: #ffeb9c;
    color: #333;
}

/* Контейнер с категориями и кнопкой "Все категории" - скрывается на мобильных */
.catalog-categories-navigation-container {
    /* Пустой класс для группировки элементов */
}

/* Увеличиваем высоту блока категорий на +20px */
.catalog-filter-section.catalog-categories-navigation-container {
    padding-bottom: 35px !important; /* 15px + 20px */
}

/* Расширяем элементы в сайдбаре фильтров по горизонтали на +20px
   (без .catalog-all-categories-link — иначе кнопка «Все категории» уже блока .catalog-filter-category-tabs) */
.catalog-filters-sidebar .catalog-filter-section h4,
.catalog-filters-sidebar .catalog-filter-category-tab-header,
.catalog-filters-sidebar .catalog-filter-subcategory-item,
.catalog-filters-sidebar .catalog-filter-subcategories-level2,
.catalog-filters-sidebar .catalog-filter-checkbox-group .catalog-filter-group-label,
.catalog-filters-sidebar .catalog-filter-checkbox-label,
.catalog-filters-sidebar .catalog-filter-more-btn,
.catalog-filters-sidebar .catalog-filter-select,
.catalog-filters-sidebar .catalog-price-filter,
.catalog-filters-sidebar .catalog-price-inputs,
.catalog-filters-sidebar .catalog-apply-filters-btn,
.catalog-filters-sidebar .catalog-clear-filters {
    margin-left: 0;
    margin-right: 0;
    padding-left: calc(20px + 0px);
    padding-right: calc(20px + 0px);
    box-sizing: border-box;
}

/* Не ломаем внутреннюю верстку: некоторые элементы уже имеют свой padding */
.catalog-filters-sidebar .catalog-filter-category-tab-header,
.catalog-filters-sidebar .catalog-filter-subcategory-item {
    padding-left: calc(20px + 16px);
    padding-right: calc(20px + 16px);
}
.catalog-filters-sidebar .catalog-filter-subcategories-level2 {
    padding-left: calc(20px + 18px);
}
.catalog-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    margin-left: 0;
    margin-right: 0;
    padding-left: calc(20px + 30px);
    padding-right: calc(20px + 16px);
    box-sizing: border-box;
}
.catalog-filters-sidebar .catalog-filter-select {
    padding-left: calc(20px + 8px);
    padding-right: calc(20px + 28px);
}
.catalog-filters-sidebar .catalog-filter-more-btn {
    padding-left: calc(20px + 0px);
    padding-right: calc(20px + 0px);
}
.catalog-filters-sidebar .catalog-price-inputs input {
    margin-left: 0;
    margin-right: 0;
}

/* Улучшенный скролл для списков */
.catalog-filter-subcategories-list {
    scrollbar-width: thin;
    scrollbar-color: #FFC107 #f5f5f5;
}

.catalog-filter-subcategories-list::-webkit-scrollbar {
    width: 4px;
}

.catalog-filter-subcategories-list::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 2px;
}

.catalog-filter-subcategories-list::-webkit-scrollbar-thumb {
    background: #FFC107;
    border-radius: 2px;
}

.catalog-price-filter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.catalog-price-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.catalog-price-inputs input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
    min-width: 0;
}

.catalog-price-inputs input:focus {
    border-color: #FFC107;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.1);
}

.catalog-price-range {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 20px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 2px;
    outline: none;
    transform: translateY(-50%);
    pointer-events: none;
}

.catalog-price-range-slider {
    position: relative;
    height: 20px;
}

.catalog-price-range-track,
.catalog-price-range-progress {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    border-radius: 999px;
    transform: translateY(-50%);
}

.catalog-price-range-track {
    background: #f0f0f0;
}

.catalog-price-range-progress {
    background: #FFC107;
}

.catalog-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border-radius: 50%;
    background: #FFC107;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    pointer-events: auto;
}

.catalog-price-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFC107;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    pointer-events: auto;
}

.catalog-price-range::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.catalog-price-range::-moz-range-track {
    height: 4px;
    background: transparent;
}

.catalog-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
}

.catalog-apply-filters-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-bottom: 10px;
}

.catalog-apply-filters-btn:hover {
    background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
    transform: translateY(-1px);
}

.catalog-clear-filters {
    display: block;
    text-align: center;
    padding: 6px;
    color: #666;
    text-decoration: none;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
}

.catalog-clear-filters:hover {
    background: #f9f9f9;
    color: #FF9800;
}

/* Кнопка «Закрыть» внизу мобильных панелей фильтров */
.catalog-mobile-filters-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.catalog-mobile-filters-close-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.catalog-products-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.catalog-products-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 15px;
}

.catalog-products-found {
    color: #666;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.catalog-products-found strong {
    color: #333;
    font-size: 14px;
}

/* Дополнительные фильтры для подкатегорий 2 уровня (ty-product-filters__wrapper — как на tehnopc.ru) */
/* Фильтр по товарам в сайдбаре — колонка под категориями и ценой */
.catalog-sidebar-product-filters .catalog-additional-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-wrap: nowrap;
}

.catalog-sidebar-product-filters .catalog-filter-item {
    width: 100%;
    max-width: none;
}

.catalog-sidebar-product-filters .catalog-filter-item label {
    max-width: none;
}

.catalog-sidebar-product-filters .catalog-filter-select {
    width: 100%;
}

.catalog-additional-filters.ty-product-filters__wrapper,
.catalog-additional-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin: 0;
    width: 100%;
    border: 1px solid #FFC107;
    border-radius: 5px;
    padding: 12px;
    box-sizing: border-box;
}

.catalog-filters-empty {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.catalog-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    box-sizing: border-box;
}

.catalog-filter-item label {
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.catalog-sorting {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

.catalog-filter-item label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    font-weight: 500;
}

/* Фильтры-галочки (как на tehnopc.ru) */
.catalog-filter-checkbox-group {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}
.catalog-filter-checkbox-group .catalog-filter-group-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}
.catalog-filter-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}
.catalog-filter-checkbox-list::-webkit-scrollbar {
    width: 4px;
}
.catalog-filter-checkbox-list::-webkit-scrollbar-thumb {
    background: #FFC107;
    border-radius: 2px;
}
.catalog-filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    white-space: normal;
}
.catalog-filter-checkbox-label:hover {
    color: #000;
}
.catalog-filter-checkbox {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #FFC107;
}
.catalog-filter-checkbox-label span {
    word-break: break-word;
}
.catalog-filter-item-hidden {
    display: none !important;
}
.catalog-filter-list-collapsible .catalog-filter-item-hidden.visible {
    display: flex !important;
}
.catalog-filter-more-btn {
    margin-top: 4px;
    padding: 4px 0;
    font-size: 12px;
    color: #FF9800;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.catalog-filter-more-btn:hover {
    text-decoration: underline;
    color: #F57C00;
}
.catalog-filter-more-btn-hide {
    display: none;
}
.catalog-filter-list-collapsible.expanded .catalog-filter-more-btn[data-action="more"] {
    display: none;
}
.catalog-filter-list-collapsible.expanded .catalog-filter-more-btn[data-action="hide"] {
    display: block;
}
/* При раскрытии по «Еще» — весь список показывается без скролла */
.catalog-filter-list-collapsible.expanded {
    max-height: none;
    overflow-y: visible;
}

.catalog-filter-select {
    padding: 5px 8px;
    padding-right: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 12px;
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    appearance: none;
}

.catalog-filter-select:focus {
    border-color: #FFC107;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.1);
}

.catalog-sort-select {
    padding: 6px 10px;
    padding-right: 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    min-width: 180px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    appearance: none;
}

.catalog-sort-select:focus {
    border-color: #FFC107;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.1);
}

/* Сетка товаров - 5 КАРТОЧЕК В РЯД НА ДЕСКТОПЕ (для всех категорий, в т.ч. Смартфоны) */
.catalog-products-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 30px;
    align-items: stretch;
    justify-items: stretch;
}

/* На десктопе (от 993px) всегда 5 колонок; карточки в ряду одной высоты (align-items: stretch) */
@media (min-width: 993px) {
    .catalog-products-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        align-items: stretch;
    }
}

/* КОМПАКТНЫЕ КАРТОЧКИ ТОВАРОВ
   Вертикальные margin / padding / gap у блоков внутри карточки — не больше 8px. */
.catalog-product-card {
    /* Одинаковый зазор: изображение ↔ категория ↔ название */
    --catalog-card-section-gap: 8px;
    /* Минимальная высота задаётся только в медиа для десктопа; иначе — по контенту */
    --catalog-card-min-height: 0;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    height: auto;
    min-height: var(--catalog-card-min-height);
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.catalog-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

/* Кликабельная карточка товара */
.catalog-product-card.catalog-product-clickable {
    cursor: pointer;
}

.catalog-product-card.catalog-product-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

/* ИЗОБРАЖЕНИЕ ЗАНИМАЕТ ВСЁ ПРОСТРАНСТВО С ОТСТУПАМИ ПО 10px */
.catalog-product-image {
    height: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    position: relative;
    flex-shrink: 0;
    padding: 8px;
    box-sizing: border-box;
    min-height: 0;
}

/* Кнопки действий не должны быть кликабельными для открытия модального окна */
.catalog-product-actions {
    position: relative;
    z-index: 10;
}

.catalog-btn-add-to-cart {
    position: relative;
    z-index: 11;
}

.catalog-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

.catalog-product-card:hover .catalog-product-image img {
    transform: none;
}

/* Стиль для хита продаж */
.catalog-product-hit {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #FF5722 0%, #F44336 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(244, 67, 54, 0.3);
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 3px;
}

.catalog-product-hit i {
    font-size: 9px;
}

.catalog-product-info {
    padding: 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    gap: 4px;
}

.catalog-product-category {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Категория сразу под изображением: --catalog-card-section-gap совпадает с отступом до названия */
.catalog-product-category-after-image {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0;
    padding: var(--catalog-card-section-gap, 8px) 12px 0;
    text-align: left;
}

.catalog-product-category-after-image .catalog-product-category {
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.25;
}

/* Такой же зазор, как между изображением и категорией */
.catalog-product-category-after-image + .catalog-product-info {
    padding-top: var(--catalog-card-section-gap, 8px);
}

/* Название товара */
.catalog-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 0;
    margin-bottom: 4px;
    line-height: 1.35;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 54px;
    max-height: 54px;
}

.catalog-product-description {
    font-size: 11px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 45px;
    max-height: 45px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 65px;
    max-height: 65px;
    height: 65px;
}

.catalog-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #FFC107;
    line-height: 1;
    flex: 1;
}

/* Контейнер отметок (несколько вариантов) */
.catalog-product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

/* Статус наличия / доставки */
.catalog-product-stock {
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 4px;
    line-height: 1.15;
}


/* Строка с ценой и кнопкой "В корзину" */
.catalog-product-bottom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.catalog-product-bottom-row .catalog-btn-add-to-cart {
    flex: 0 0 auto;
    min-width: 40px;
}

.catalog-product-stock.in-stock {
    color: #4CAF50;
    background: #E8F5E9;
}

.catalog-product-stock.on-order {
    color: #2196F3;
    background: #E3F2FD;
}

.catalog-product-stock.delivery-1 {
    color: #856404;
    background: #fff3cd;
}

.catalog-product-stock.delivery-3-7 {
    color: #388E3C;
    background: #E8F5E9;
}

.catalog-product-stock.out-of-stock {
    color: #c62828;
    background: #ffebee;
}

.catalog-product-stock i {
    font-size: 10px;
}

.catalog-stock-quantity {
    font-size: 10px;
    color: #666;
    margin-left: auto;
    padding-left: 5px;
    font-weight: 500;
}

.catalog-product-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.catalog-btn-add-to-cart,
.catalog-btn-view-details {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    min-height: 32px;
}

.catalog-btn-add-to-cart span {
    display: none;
}

.catalog-btn-add-to-cart i {
    font-size: 16px;
    line-height: 1;
}

.catalog-btn-add-to-cart {
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #333;
}

.catalog-btn-add-to-cart:hover {
    background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
    transform: translateY(-1px);
}

.catalog-btn-view-details {
    background: #f5f5f5;
    color: #666;
}

.catalog-btn-view-details:hover {
    background: #e0e0e0;
    color: #333;
    transform: translateY(-1px);
}

.catalog-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 15px;
    background: #f9f9f9;
    border-radius: 6px;
    margin: 10px 0;
}

.catalog-no-products i {
    font-size: 40px;
    color: #ddd;
    margin-bottom: 15px;
}

.catalog-no-products h3 {
    margin-bottom: 10px;
    color: #666;
    font-size: 18px;
}

.catalog-no-products p {
    color: #888;
    margin-bottom: 15px;
    font-size: 14px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.catalog-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 25px;
}

.catalog-pagination a,
.catalog-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    font-size: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.catalog-pagination a:hover {
    background: #FFF9E6;
    border-color: #FFC107;
    color: #333;
}

.catalog-pagination .catalog-active {
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    border-color: #FFC107;
    color: #333;
    font-weight: 600;
}

.catalog-pagination .catalog-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* МОДАЛЬНОЕ ОКНО ТОВАРА - КВАДРАТНОЕ ДЛЯ ДЕСКТОПА, КОМПАКТНОЕ ДЛЯ МОБИЛЬНЫХ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 15px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

/* Дублируем усиление слоя (подробности в style.css — fixed на body ломал порядок слоёв) */
#productModal.modal-overlay {
    z-index: 10050 !important;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 960px;
    height: 85vh;
    max-height: 90vh;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Окно для десктопа: фиксированная высота — скролл только у описания */
@media (min-width: 769px) {
    .modal-content {
        width: 960px;
        min-height: 400px;
        height: 85vh;
        max-width: 960px;
        max-height: 90vh;
    }
}

/* Мобильная модалка: хедер и футер всегда видны, скролл только контент между ними.
   Важно: без padding у .modal-content снизу — иначе кнопки «висят» над нижним краем экрана.
   safe-area перенесён на шапку и футер. */
@media (max-width: 768px) {
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
        /* Высота видимой области (iOS/Android), не «обрезанный» 100vh */
        height: 100vh;
        height: 100dvh;
        min-height: -webkit-fill-available;
    }

    .modal-overlay.active {
        display: flex;
        overflow: hidden;
    }
    
    .modal-content {
        position: relative;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        /* Не 0 — иначе колонка с кнопками не тянется на всю высоту экрана */
        min-height: 100vh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden;
        border-radius: 0;
        /* Без внешних отступов — футер прижат к низу экрана */
        padding: 0;
        box-sizing: border-box;
    }

    .modal-header {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        margin: 0;
        border-radius: 0;
        padding-top: max(12px, env(safe-area-inset-top, 0px));
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 12px;
    }

    /* На мобильных скроллится весь контент между хедером и футером */
    .modal-body {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        display: block;
        /* Без лишнего «воздуха» над кнопками — отступ только у футера */
        padding-bottom: 0 !important;
    }

    .product-modal-content {
        overflow: visible !important;
        flex: 0 1 auto !important;
    }

    .product-modal-layout {
        overflow: visible !important;
    }

    .product-modal-right {
        overflow: visible !important;
    }

    .product-modal-description-block {
        overflow: visible !important;
    }

    .product-modal-description-text {
        max-height: none !important;
        overflow: visible !important;
    }

    .modal-footer {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        margin: 0;
        margin-top: 0;
        border-radius: 0;
        min-height: 0;
        flex-basis: auto !important;
        /* Узкая полоса по вертикали; отступ от «домика» — только safe-area */
        padding-top: 4px;
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #eef2f7;
    }
}

/* МОБИЛЬНЫЕ ТЕЛЕФОНЫ — не возвращаем padding у .modal-content (ломает прижатие футера) */
@media (max-width: 480px) {
    .modal-content {
        padding: 0;
    }
}

/* ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ */
@media (max-width: 360px) {
    .modal-content {
        padding: 0;
    }
}

/* Заголовок модального окна — скругление верхних углов как у .modal-content, без просвета */
.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
    background: #fff;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    font-size: 18px;
}

.modal-close .fas {
    font-size: 1em;
}

.modal-close:hover {
    background: #e5e5e5;
    color: #333;
}

/* Кнопка в потоке шапки, не поверх названия (переопределяем position: absolute из style.css) */
.modal-header .modal-close {
    position: static !important;
    top: auto !important;
    right: auto !important;
}

/* Тело модального окна — скролл при переполнении, все блоки видны, отступ снизу */
.modal-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: 24px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Футер модального окна — скругление нижних углов как у .modal-content, без просвета */
.modal-footer {
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: stretch;
    border-radius: 0 0 8px 8px;
    background: #fff;
}

/* Кнопки: чуть выше зона нажатия, без лишней высоты самой полосы footer */
.btn-modal {
    padding: 10px 14px;
    min-height: 40px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
}

.btn-modal-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #333;
}

.btn-modal-primary:hover {
    background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
    transform: translateY(-1px);
}

.btn-modal-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-modal-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Содержимое модалки — высота по контенту, скролл у body (ничего не обрезается) */
.product-modal-content {
    flex: 0 0 auto;
    min-height: min-content;
    height: auto;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* Слева: изображения, название, цена, варианты (цвет/память/SIM); справа: описание */
.product-modal-layout {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 28px;
    padding: 4px 0;
    min-height: min-content;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 100%;
    align-items: flex-start;
    overflow: visible;
}

.product-modal-left {
    flex: 0 0 auto;
    width: 38%;
    max-width: 360px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: visible;
}

.product-modal-gallery-wrap {
    width: 100%;
    overflow: visible;
}

/* Блок с названием, ценой, вариантами — не обрезать, высота по контенту */
.product-modal-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    flex-shrink: 0;
    min-height: min-content;
}

.product-modal-image-wrap {
    width: 100%;
    min-height: 180px;
    max-height: 35vh;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Галерея изображений товара (в левой колонке) */
.product-modal-left .product-modal-gallery {
    width: 100%;
    position: relative;
}

.product-modal-gallery-main {
    position: relative;
    min-height: 180px;
    height: 260px;
    max-height: 38vh;
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.product-modal-gallery-main img,
.product-modal-content .product-modal-gallery-main img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.product-modal-gallery-prev,
.product-modal-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-modal-gallery-prev:hover,
.product-modal-gallery-next:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-modal-gallery-prev:disabled,
.product-modal-gallery-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.product-modal-gallery-prev {
    left: 10px;
}

.product-modal-gallery-next {
    right: 10px;
}

.product-modal-gallery-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.product-modal-gallery-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #f5f5f5;
}

.product-modal-gallery-thumb:hover {
    border-color: #FFC107;
    transform: scale(1.05);
}

.product-modal-gallery-thumb.active {
    border-color: #FF9800;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.2);
}

.product-modal-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-modal-gallery-counter {
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Правая колонка — описание (не обрезается, скролл у body) */
.product-modal-right {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.product-modal-description-block {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.product-modal-category {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.product-modal-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.35;
    margin: 0 0 10px 0;
}

.product-modal-price {
    font-size: 20px;
    font-weight: 700;
    color: #c9a227;
    margin-bottom: 10px;
}

.product-modal-price.product-modal-price--unavailable {
    color: #c62828;
}

.product-modal-availability {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.product-modal-availability--in {
    color: #2e7d32;
    background: #e8f5e9;
}

.product-modal-availability--out {
    color: #c62828;
    background: #ffebee;
}

/* Выбор вариантов телефона (цвет/память/SIM) в модалке — в одну линию, не обрезать */
.product-modal-variants {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 10px;
    min-width: 0;
    max-width: 100%;
    align-items: flex-start;
    overflow: visible;
    flex-shrink: 0;
}
.product-modal-variant-block {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}
.product-modal-variant-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 600;
}

.product-modal-variant-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
    overflow: visible;
}
.product-modal-swatch {
    width: 26px;
    height: 26px;
    border-radius: 4px; /* квадраты со слегка скруглёнными углами */
    border: 2px solid rgba(0,0,0,0.12);
    cursor: pointer;
    padding: 0;
    outline: none;
    box-sizing: border-box;
}
.product-modal-swatch.is-active {
    border-color: #FFD700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.18);
}

.product-modal-variant-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}
.product-modal-pill {
    padding: 6px 10px;
    min-height: 30px;
    box-sizing: border-box;
    border-radius: 4px; /* как у цветовых квадратов */
    border: 2px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.product-modal-pill.is-active {
    border-color: #FFD700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.18);
}

/* Горизонтальный скролл пилюль при нехватке места внутри блока */
@media (min-width: 769px) {
    #productModalPhoneMemBlock .product-modal-variant-pills,
    #productModalPhoneMemories.product-modal-variant-pills,
    #productModalPhoneSimBlock .product-modal-variant-pills,
    #productModalPhoneSims.product-modal-variant-pills,
    #productModalPhoneRamBlock .product-modal-variant-pills,
    #productModalPhoneRams.product-modal-variant-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
}

@media (max-width: 480px) {
    .product-modal-variants {
        gap: 12px 16px;
    }
    .product-modal-variant-block {
        flex: 1 1 100%;
    }
}

.product-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.product-modal-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}

.product-modal-stock.in-stock {
    color: #2e7d32;
    background: #e8f5e9;
}

.product-modal-stock.on-order {
    color: #1565c0;
    background: #e3f2fd;
}

.product-modal-stock.delivery-1 {
    color: #856404;
    background: #fff3cd;
}

.product-modal-stock.delivery-3-7 {
    color: #388E3C;
    background: #E8F5E9;
}

.product-modal-stock.out-of-stock {
    color: #c62828;
    background: #ffebee;
}

.product-modal-bestseller {
    margin-left: 8px;
    background: linear-gradient(135deg, #ff5722 0%, #f44336 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.product-modal-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-modal-description-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-modal-description-title i {
    color: #888;
}

/* Комплектующие в модальном окне (сборки) */
.product-modal-components-block {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}
.product-modal-components-block:first-child {
    margin-top: 0;
}
.product-modal-components-block .product-modal-description-title {
    margin-bottom: 10px;
}
.product-modal-components-list {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
    list-style: disc;
}
.product-modal-components-list li {
    margin-bottom: 4px;
}

/* Описание: читаемая типографика и структура */
.product-modal-description-text {
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
    word-wrap: break-word;
    padding: 12px 0;
    padding-right: 8px;
    margin: 0;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    max-width: 52em;
    letter-spacing: 0.01em;
}

/* Каждая пара «параметр - значение» — одна строка */
.product-modal-description-text .product-modal-desc-row {
    display: block;
    margin-bottom: 0.4em;
    line-height: 1.55;
}
.product-modal-description-text .product-modal-desc-row::after {
    content: "";
}
.product-modal-description-text .product-modal-desc-label,
.product-modal-description-text .product-modal-desc-value {
    display: inline;
}
.product-modal-description-text .product-modal-desc-label {
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}
.product-modal-description-text .product-modal-desc-label::after {
    content: " - ";
    font-weight: 500;
    color: #6b7280;
}
.product-modal-description-text .product-modal-desc-value {
    display: inline;
    color: #111827;
    font-size: 14px;
    font-weight: 500;
    word-break: break-word;
}

/* Заголовки секций — с новой строки */
.product-modal-description-text .product-modal-desc-heading {
    display: block;
    margin: 0.75em 0 0.35em;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
}
.product-modal-description-text .product-modal-desc-heading:first-child {
    margin-top: 0;
}
.product-modal-description-text .product-modal-desc-heading::after {
    content: "";
}

.product-modal-description-text .product-modal-desc-heading-block {
    display: block !important;
    margin-top: 1.25em;
    margin-bottom: 0.4em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid #e5e7eb;
}
.product-modal-description-text .product-modal-desc-heading-block::after {
    content: "";
}

/* Абзацы текста — блок с отступом */
.product-modal-description-text .product-modal-desc-p {
    display: block;
    margin: 0 0 0.65em;
    line-height: 1.6;
    color: #374151;
    font-size: 15px;
}
.product-modal-description-text .product-modal-desc-p::after {
    content: "";
}
.product-modal-description-text > *:last-child::after {
    content: "";
}

.product-modal-description-text {
    font-variant-numeric: tabular-nums;
}

.product-modal-no-desc {
    color: #999;
    font-style: italic;
}

/* Низкий экран: уменьшаем галерею, чтобы влезали варианты и описание */
@media (max-height: 700px) {
    .product-modal-gallery-main {
        min-height: 160px;
        height: 200px;
        max-height: 28vh;
        margin-bottom: 8px;
    }
    .product-modal-image-wrap {
        min-height: 140px;
        max-height: 25vh;
    }
    .product-modal-left {
        gap: 10px;
    }
    .product-modal-variants {
        margin-top: 6px;
        gap: 10px 16px;
    }
    .product-modal-name {
        margin-bottom: 6px;
        font-size: 16px;
    }
    .product-modal-price {
        margin-bottom: 6px;
        font-size: 18px;
    }
}

/* Очень низкий экран: ещё компактнее, всё доступно по скроллу */
@media (max-height: 500px) {
    .modal-body {
        padding: 10px 12px;
        padding-bottom: 20px;
    }
    .product-modal-gallery-main {
        min-height: 120px;
        height: 150px;
        max-height: 22vh;
        margin-bottom: 6px;
    }
    .product-modal-image-wrap {
        min-height: 100px;
        max-height: 20vh;
    }
    .product-modal-gallery-thumb {
        width: 40px;
        height: 40px;
    }
    .product-modal-name {
        font-size: 15px;
        margin-bottom: 4px;
    }
    .product-modal-price {
        font-size: 16px;
        margin-bottom: 4px;
    }
    .product-modal-variants {
        margin-top: 4px;
        gap: 6px 12px;
    }
    .product-modal-variant-label {
        font-size: 11px;
        margin-bottom: 4px;
    }
    .product-modal-pill {
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .product-modal-layout {
        flex-direction: column;
        gap: 20px;
    }
    .product-modal-left {
        width: 100%;
        max-width: none;
    }
    .product-modal-left .product-modal-gallery {
        width: 100%;
        margin-bottom: 0;
    }
    .product-modal-gallery-main {
        min-height: 200px;
        height: 240px;
        max-height: 35vh;
        touch-action: pan-y;
        cursor: grab;
    }
    .product-modal-gallery-main:active {
        cursor: grabbing;
    }
    .product-modal-gallery-thumb {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .product-modal-image-wrap {
        min-height: 220px;
    }
    .product-modal-name {
        font-size: 16px;
    }
    .product-modal-description-text {
        font-size: 14px;
        line-height: 1.4;
    }
}

/* На мобильных max-height у описания отключается в блоке модалки (768px) — скроллится весь контент */

/* Старые классы на случай использования в других местах */
.product-modal-content img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    margin: 0 auto;
}
/* Изображение в .product-modal-gallery-main переопределено выше (width/height 100%, max-height: none) */

.product-modal-content h1 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.product-modal-content .category-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.product-modal-content .price {
    font-size: 18px;
    font-weight: 700;
    color: #FFC107;
    margin: 8px 0;
}

.product-modal-content .stock-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 12px;
}

.product-modal-content .stock-status.in-stock {
    color: #4CAF50;
    background: #E8F5E9;
}

.product-modal-content .stock-status.on-order {
    color: #2196F3;
    background: #E3F2FD;
}

.product-modal-content .description-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-modal-content .description-text {
    color: #666;
    line-height: 1.4;
    font-size: 12px;
}

/* Анимация появления */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ОТСТУПЫ ДЛЯ МОБИЛЬНОЙ ВЕРСИИ */
@media (max-width: 1024px) {
    /* Основной контейнер страницы */
    .catalog-container {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* Мобильная панель фильтров: единый стиль без конфликтов */
@media (max-width: 992px) {
    .catalog-mobile-filters-sidebar {
        right: -100%;
        width: 75%;
        max-width: none;
        padding: 0;
    }
    .catalog-mobile-filters-sidebar.active {
        right: 0;
    }
    .catalog-mobile-product-filters-sidebar {
        right: -100%;
        width: 75%;
        max-width: none;
    }
    .catalog-mobile-product-filters-sidebar.active {
        right: 0;
    }
    .catalog-mobile-filters-content {
        padding-top: 16px;
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        padding-bottom: max(28px, calc(24px + env(safe-area-inset-bottom, 0px)));
    }
}

/* АДАПТИВНОСТЬ С ПРАВИЛЬНЫМИ ОТСТУПАМИ ИЗОБРАЖЕНИЙ */
@media (max-width: 1400px) {
    .catalog-products-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-filters-row {
        grid-template-columns: 240px 1fr;
        gap: 20px;
    }

    .catalog-product-image {
        height: 170px;
    }

    .catalog-product-name {
        min-height: 52px;
        max-height: 52px;
        height: 52px;
    }
}

@media (max-width: 1200px) {
    .catalog-products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-filters-row {
        grid-template-columns: 220px 1fr;
        gap: 15px;
    }

    .catalog-product-image {
        height: 160px;
    }

    .catalog-product-name {
        font-size: 13px;
        min-height: 55px;
        max-height: 55px;
        height: 55px;
    }
}

@media (max-width: 992px) {
    .catalog-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 15px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-filters-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .catalog-filters-sidebar {
        display: none;
    }

    .catalog-mobile-filters-buttons {
        display: flex;
    }

    .catalog-mobile-filters-toggle {
        display: flex;
    }

    /* На мобильных блок «Фильтр по товарам» показывается только в панели по кнопке */
    .catalog-products-header .catalog-additional-filters {
        display: none !important;
    }

    .catalog-categories-navigation-container {
        display: none;
    }

    /* ОСНОВНЫЕ ОТСТУПЫ ДЛЯ МОБИЛЬНЫХ */
    .catalog-container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Сброс отступов для внутренних элементов */
    .catalog-products-area {
        padding: 0;
    }

    .catalog-product-image {
        height: 180px;
    }

    .catalog-product-name {
        min-height: 55px;
        max-height: 55px;
        height: 55px;
        font-size: 14px;
    }
}

/* АДАПТИРУЕМ ДЛЯ РАЗНЫХ ВЫСОТ ШАПКИ */
@media (max-width: 768px) {
    .catalog-container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .catalog-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-products-header {
        flex-wrap: wrap;
        gap: 10px;
        align-items: flex-start;
    }

    /* Блок дополнительных фильтров на подкатегориях: аккуратная сетка на мобильных */
    .catalog-additional-filters {
        width: 100%;
        margin: 0;
        gap: 12px;
        flex-wrap: wrap;
        padding: 14px;
        border-radius: 5px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .catalog-additional-filters .catalog-filters-empty {
        grid-column: 1 / -1;
    }

    .catalog-filter-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        min-width: 0;
        max-width: none;
    }

    .catalog-filter-item label {
        font-size: 12px;
        max-width: none;
    }

    .catalog-filter-select {
        width: 100%;
        min-width: 0;
        font-size: 13px;
        padding: 8px 10px;
    }

    .catalog-sort-select {
        width: 100%;
        min-width: auto;
    }
    
    .catalog-sorting {
        width: 100%;
        margin-left: 0;
    }

    .catalog-product-image {
        height: 200px;
    }

    .catalog-product-name {
        font-size: 14px;
        min-height: 60px;
        max-height: 60px;
        height: 60px;
    }

    .catalog-page-title h1 {
        font-size: 22px;
    }

    .catalog-page-title p {
        font-size: 14px;
    }

    .catalog-product-price {
        font-size: 16px;
    }

    .catalog-product-actions {
        flex-direction: row !important;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: stretch;
        width: 100%;
        overflow-x: hidden !important;
    }

    .catalog-btn-view-details {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        padding: 0 8px !important;
        font-size: 11px !important;
        min-height: 36px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 5px;
    }

    .catalog-btn-add-to-cart {
        flex: 0 0 auto !important;
        min-width: 38px !important;
        width: 38px !important;
        padding: 0 !important;
        font-size: 11px !important;
        min-height: 36px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 0;
    }

    .catalog-btn-add-to-cart span,
    .catalog-add-to-cart-text {
        display: none !important;
    }
    
    .catalog-btn-view-details span {
        display: inline !important;
    }

    .catalog-btn-add-to-cart i {
        font-size: 12px;
    }

    .catalog-btn-view-details .catalog-view-details-icon {
        font-size: 12px;
    }

    .catalog-product-card {
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 576px) {
    .catalog-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* На мобильных чтобы кнопка «Рассрочка»/«в карзину» не выходила за границу карточки */
    .catalog-product-card {
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Фиксированная шапка сайтбара для очень маленьких экранов */
    .catalog-mobile-filters-header {
        height: 55px;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 55px !important;
        height: auto !important;
        min-height: calc(100% - 55px) !important;
        overflow-y: visible !important;
        padding-top: 15px !important;
        padding-left: max(15px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(15px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 40px !important;
    }

    .catalog-mobile-product-filters-sidebar .catalog-mobile-product-filters-content {
        padding-top: 15px !important;
        padding-left: max(15px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(15px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 16px !important;
    }
    
    .catalog-mobile-filters-header h3 {
        font-size: 16px;
    }
    
    .catalog-mobile-filters-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .catalog-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-product-image {
        height: 180px;
    }

    .catalog-product-info {
        padding: 8px;
    }

    .catalog-product-name {
        min-height: 52px;
        max-height: 52px;
        height: 52px;
        font-size: 13px;
    }

    .catalog-product-price {
        font-size: 15px;
    }

    .catalog-product-actions {
        flex-direction: row;
        gap: 6px;
        justify-content: space-between;
        width: 100%;
        align-items: stretch;
    }

    .catalog-btn-add-to-cart {
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        padding: 0 !important;
        font-size: 11px;
        min-height: 40px !important;
        height: 40px !important;
    }

    .catalog-btn-view-details {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 6px !important;
        min-height: 40px !important;
        height: auto !important;
        font-size: 10px !important;
    }

    .catalog-btn-add-to-cart span,
    .catalog-add-to-cart-text {
        display: none !important;
    }
    
    .catalog-btn-view-details span {
        display: inline !important;
    }

    .catalog-btn-add-to-cart i {
        margin: 0;
        font-size: 13px !important;
    }

    .catalog-btn-view-details .catalog-view-details-icon {
        font-size: 11px !important;
    }

    .catalog-pagination {
        flex-wrap: wrap;
    }

    .catalog-pagination a,
    .catalog-pagination span {
        min-width: 30px;
        height: 30px;
        padding: 0 6px;
        font-size: 12px;
    }

    .catalog-mobile-filters-sidebar,
    .catalog-mobile-product-filters-sidebar {
        width: 75%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .catalog-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Фиксированная шапка сайтбара для телефонов */
    .catalog-mobile-filters-header {
        height: 50px;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 50px !important;
        height: auto !important;
        min-height: calc(100% - 50px) !important;
        overflow-y: visible !important;
        padding-top: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 40px !important;
    }

    .catalog-mobile-product-filters-sidebar .catalog-mobile-product-filters-content {
        padding-top: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 16px !important;
    }
    
    .catalog-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-product-image {
        height: 160px;
    }

    .catalog-product-name {
        font-size: 12px;
        min-height: 48px;
        max-height: 48px;
        height: 48px;
    }

    .catalog-product-stock {
        font-size: 10px;
        min-height: 0;
        padding: 1px 6px;
    }

    .catalog-filters-sidebar {
        padding: 15px;
    }
}

@media (max-width: 360px) {
    .catalog-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    /* Фиксированная шапка сайтбара для самых маленьких экранов */
    .catalog-mobile-filters-header {
        height: 45px;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 45px !important;
        height: auto !important;
        min-height: calc(100% - 45px) !important;
        overflow-y: visible !important;
        padding-top: 10px !important;
        padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 40px !important;
    }

    .catalog-mobile-product-filters-sidebar .catalog-mobile-product-filters-content {
        padding-top: 10px !important;
        padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 16px !important;
    }
    
    .catalog-mobile-filters-header h3 {
        font-size: 15px;
    }
    
    .catalog-products-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 15px;
        align-items: stretch;
        justify-items: stretch;
    }

    .catalog-product-image {
        height: 220px;
    }

    .catalog-product-name {
        font-size: 14px;
        min-height: auto;
        max-height: none;
        -webkit-line-clamp: 3;
        height: auto;
    }

    .catalog-btn-add-to-cart span,
    .catalog-add-to-cart-text {
        display: none !important;
    }
    
    .catalog-btn-view-details span {
        display: inline;
        font-size: 10px;
    }

    .catalog-btn-add-to-cart {
        flex: 0 0 36px !important;
        min-width: 36px !important;
        width: 36px !important;
        padding: 0 !important;
    }

    .catalog-btn-view-details {
        padding: 0 6px;
        font-size: 11px;
        flex-direction: row;
    }
}

/* ФИКС ДЛЯ IOS SAFARI */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 992px) {
        .catalog-mobile-filters-header {
            padding-top: calc(15px + env(safe-area-inset-top, 0px)) !important;
            height: calc(55px + env(safe-area-inset-top, 0px)) !important;
        }
        
        .catalog-mobile-filters-content {
            margin-top: calc(55px + env(safe-area-inset-top, 0px)) !important;
        }
    }
}

/* УБЕДИТЕСЬ ЧТО ШАПКА САЙТА НЕ ЗАКРЫВАЕТ НАШ САЙТБАР */
@media (max-width: 992px) {
    /* Если шапка сайта имеет position: fixed */
    .header {
        z-index: 1000 !important;
    }
    
    /* Если есть другие фиксированные элементы */
    .mobile-navigation {
        z-index: 1000 !important;
    }
}

/* ДЛЯ ЛАНДШАФТНОЙ ОРИЕНТАЦИИ */
@media (max-width: 992px) and (orientation: landscape) {
    .catalog-mobile-filters-header {
        height: 50px;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 50px !important;
        height: auto !important;
        min-height: calc(100% - 50px) !important;
        overflow-y: visible !important;
        max-height: none !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 40px !important;
    }
}

/* Стили для отладочного блока */
.debug-info {
    background: #f0f0f0;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    border-left: 4px solid #FFC107;
}

/* ОБЩИЕ СТИЛИ ДЛЯ ПРЕДОТВРАЩЕНИЯ ВЫХОДА ЗА ЭКРАН */
.catalog-container * {
    box-sizing: border-box;
}

.catalog-products-grid {
    width: 100%;
    max-width: 100%;
}

/* ДЛЯ ПАГИНАЦИИ - ЦЕНТРИРУЕМ И ДОБАВЛЯЕМ ОТСТУПЫ */
.catalog-pagination {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* ДЛЯ ИЗОБРАЖЕНИЙ В КАРТОЧКАХ - ПРАВИЛЬНОЕ МАСШТАБИРОВАНИЕ БЕЗ ОБРЕЗКИ */
.catalog-product-image img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* СИММЕТРИЧНЫЕ ОТСТУПЫ ДЛЯ ВСЕХ ЭЛЕМЕНТОВ КАТАЛОГА */
.catalog-page-title,
.catalog-products-header,
.catalog-no-products,
.catalog-pagination {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* УБЕЖДАЕМСЯ ЧТО КОНТЕЙНЕР ИМЕЕТ ПРАВИЛЬНЫЕ ОТСТУПЫ
   ВАЖНО: не переопределяем margin-left/левые смещения для главного контейнера каталога
   (.container.main-container.catalog-container) */
.catalog-container:not(.main-container) {
    width: 100% !important;
    margin: 0 auto !important;
}

/* ДЛЯ КАРТОЧЕК ТОВАРОВ - УБЕЖДАЕМСЯ ЧТО ОНИ В ПРЕДЕЛАХ КОНТЕЙНЕРА */
.catalog-product-card {
    margin: 0 !important;
    width: 100% !important;
}

/* ПРЕДОТВРАЩАЕМ ПРОКРУТКУ ТЕЛА КОГДА ОТКРЫТ САЙТБАР */
body.catalog-filters-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* catalog.css - ОТСТУП СПРАВА 10px ДЛЯ ОСНОВНОГО КОНТЕНТА НА МОБИЛЬНЫХ */

@media (max-width: 992px) {
    .catalog-container {
        padding-right: 10px !important; /* Добавляем отступ справа 10px */
    }
    
    .catalog-products-area {
        padding-right: 0 !important; /* Убираем внутренние отступы если есть */
    }
    
    /* Убедимся что сетка товаров не выходит за границы */
    .catalog-products-grid {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 768px) {
    .catalog-container {
        padding-right: 10px !important;
    }
}

@media (max-width: 576px) {
    .catalog-container {
        padding-right: 10px !important;
    }
}

@media (max-width: 480px) {
    .catalog-container {
        padding-right: 10px !important;
    }
}

@media (max-width: 360px) {
    .catalog-container {
        padding-right: 10px !important;
    }
}

/* Обеспечиваем симметричные отступы */
@media (max-width: 992px) {
    .catalog-container {
        padding-left: 10px !important; /* Также добавляем слева для симметрии */
        box-sizing: border-box !important;
    }
}

/* Мобильный сайдбар фильтров: компактные отступы и читаемые элементы */
@media (max-width: 992px) {
    .catalog-mobile-filters-sidebar .catalog-filter-section {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-section h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .catalog-mobile-filters-sidebar .catalog-price-inputs input {
        padding: 8px 10px;
        font-size: 14px;
    }

    .catalog-mobile-filters-sidebar .catalog-apply-filters-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .catalog-mobile-filters-sidebar .catalog-clear-filters {
        font-size: 13px;
        padding: 8px;
    }
}

@media (max-width: 576px) {
    .catalog-mobile-filters-sidebar,
    .catalog-mobile-product-filters-sidebar {
        width: 75%;
        max-width: none;
    }

    .catalog-mobile-filters-header h3 {
        font-size: 16px;
    }

    .catalog-mobile-filters-close {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .catalog-mobile-filters-sidebar {
        width: 75% !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .catalog-mobile-product-filters-sidebar {
        width: 75% !important;
        max-width: none !important;
    }

    .catalog-mobile-filters-header {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
        padding-left: max(14px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
    }

    .catalog-mobile-filters-header h3 {
        font-size: 16px !important;
    }

    .catalog-mobile-filters-content {
        padding-top: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: max(24px, calc(20px + env(safe-area-inset-bottom, 0px))) !important;
    }

    .catalog-mobile-product-filters-sidebar .catalog-mobile-product-filters-content {
        padding-top: 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
        padding-bottom: 16px !important;
    }

    .catalog-mobile-filters-sidebar .catalog-mobile-filters-actions-main,
    .catalog-mobile-product-filters-sidebar .catalog-mobile-product-filters-actions {
        padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
    }

    /* Дополнительные фильтры подкатегорий: одна колонка на узких экранах */
    .catalog-additional-filters {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .catalog-products-header-top {
        flex-wrap: wrap;
        gap: 10px;
    }

    .catalog-sort-select {
        min-width: 0;
        width: 100%;
    }
}

/* Экраны уже 414px: кнопки «Применить» / «Сбросить» / «Закрыть» всегда видны внизу */
@media (max-width: 414px) {
    .catalog-mobile-filters-sidebar,
    .catalog-mobile-product-filters-sidebar {
        height: 100dvh !important;
        min-height: 100dvh !important;
        max-height: 100dvh !important;
    }
    .catalog-mobile-filters-content {
        min-height: 0 !important;
    }
    .catalog-mobile-filters-actions-main,
    .catalog-mobile-product-filters-actions {
        flex-shrink: 0 !important;
        padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom, 0px))) !important;
    }
}

@media (max-width: 360px) {
    .catalog-mobile-filters-sidebar {
        width: 75% !important;
        max-width: none !important;
        padding: 6px !important;
    }

    .catalog-mobile-product-filters-sidebar {
        width: 75% !important;
        max-width: none !important;
        padding: 6px !important;
        box-sizing: border-box !important;
    }
    
    .catalog-mobile-filters-header h3 {
        font-size: 14px !important;
    }
    
    .catalog-mobile-filters-close {
        width: 28px !important;
        height: 28px !important;
        font-size: 18px !important;
    }
}

/* Мобильные сайдбары: ничего не шире панели (100vw шире 75% — давало вылет вправо) */
@media (max-width: 992px) {
    .catalog-mobile-filters-sidebar,
    .catalog-mobile-product-filters-sidebar {
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    .catalog-mobile-filters-content,
    .catalog-mobile-product-filters-content {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    .catalog-mobile-filters-sidebar *,
    .catalog-mobile-product-filters-sidebar * {
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    /* Полоса прокрутки у range — не сжимать */
    .catalog-mobile-filters-sidebar .catalog-price-range,
    .catalog-mobile-filters-content .catalog-price-range {
        max-width: none !important;
    }

    .catalog-mobile-filters-sidebar .catalog-mobile-filters-header,
    .catalog-mobile-product-filters-sidebar .catalog-mobile-filters-header {
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 8px !important;
    }

    .catalog-mobile-filters-sidebar .catalog-mobile-filters-header h3,
    .catalog-mobile-product-filters-sidebar .catalog-mobile-filters-header h3 {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .catalog-mobile-filters-actions-main,
    .catalog-mobile-product-filters-actions {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-section,
    .catalog-mobile-filters-sidebar .catalog-filter-category-tabs,
    .catalog-mobile-filters-sidebar .catalog-all-categories-link,
    .catalog-mobile-filters-sidebar .catalog-price-filter,
    .catalog-mobile-filters-content .catalog-filter-section,
    .catalog-mobile-filters-content .catalog-filter-category-tabs,
    .catalog-mobile-filters-content .catalog-all-categories-link,
    .catalog-mobile-filters-content .catalog-price-filter {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .catalog-mobile-filters-sidebar .catalog-price-inputs,
    .catalog-mobile-filters-content .catalog-price-inputs {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .catalog-mobile-filters-sidebar .catalog-price-inputs input,
    .catalog-mobile-filters-content .catalog-price-inputs input {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .catalog-mobile-filters-sidebar .catalog-price-labels,
    .catalog-mobile-filters-content .catalog-price-labels {
        max-width: 100% !important;
        flex-wrap: wrap !important;
        gap: 4px 8px !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-category-tab-header,
    .catalog-mobile-filters-content .catalog-filter-category-tab-header {
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 8px !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-category-tab-header > div,
    .catalog-mobile-filters-content .catalog-filter-category-tab-header > div {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-category-tab-header > div span,
    .catalog-mobile-filters-content .catalog-filter-category-tab-header > div span {
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-category-tab-header > i,
    .catalog-mobile-filters-content .catalog-filter-category-tab-header > i {
        flex-shrink: 0 !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-subcategory-item,
    .catalog-mobile-filters-content .catalog-filter-subcategory-item,
    .catalog-mobile-filters-sidebar .catalog-filter-level2-item,
    .catalog-mobile-filters-content .catalog-filter-level2-item {
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .catalog-mobile-filters-sidebar .catalog-filter-subcategory-level1-wrapper,
    .catalog-mobile-filters-content .catalog-filter-subcategory-level1-wrapper {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* «Фильтр по товарам»: одна колонка, чтобы селекты не давили вправо */
    .catalog-mobile-product-filters-content .catalog-additional-filters {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .catalog-mobile-product-filters-content .catalog-filter-item,
    .catalog-mobile-product-filters-content .catalog-filter-select {
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Гарантируем что прямые дети контента не шире панели */
    .catalog-mobile-filters-content > *,
    .catalog-mobile-product-filters-content > * {
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* Для очень коротких экранов */
@media (max-height: 600px) and (max-width: 992px) {
    .catalog-mobile-filters-sidebar,
    .catalog-mobile-product-filters-sidebar {
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: none !important;
        overflow-y: auto !important;
    }
    
    /* Еще более компактные стили */
    .catalog-filter-section {
        margin-bottom: 8px !important;
        padding-bottom: 6px !important;
    }
    
    .catalog-filter-category-tab {
        margin-bottom: 4px !important;
    }
    
    .catalog-apply-filters-btn {
        margin-bottom: 6px !important;
    }
}

/* Оверлей мобильных фильтров (не дублируем sidebar — он уже задан выше) */
.catalog-mobile-filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1004;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.catalog-mobile-filters-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Табы категорий в мобильных фильтрах */
.catalog-mobile-filters-content .catalog-filter-category-tab {
    margin-bottom: 8px;
    overflow: visible; /* Не обрезаем подкатегории */
}

.catalog-mobile-filters-content .catalog-filter-category-tab-header {
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.catalog-mobile-filters-content .catalog-filter-category-tab-header:hover {
    background: #f0f0f0;
}

.catalog-mobile-filters-content .catalog-filter-category-tab-header.active {
    background: #FFC107;
    border-color: #FFC107;
    color: #333;
    font-weight: 600;
}

.catalog-mobile-filters-content .catalog-filter-category-tab-header i.fa-chevron-down {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.catalog-mobile-filters-content .catalog-filter-category-tab.expanded .catalog-filter-category-tab-header i.fa-chevron-down {
    transform: rotate(180deg);
}

.catalog-mobile-filters-content .catalog-filter-subcategories-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 10px;
    padding-right: 8px;
    box-sizing: border-box;
}

.catalog-mobile-filters-content .catalog-filter-subcategories-list.active {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 10px;
    padding-bottom: 5px;
    padding-right: 8px;
    -webkit-overflow-scrolling: touch;
}

.catalog-mobile-filters-content .catalog-filter-subcategory-item {
    display: block;
    padding: 8px 15px;
    margin-bottom: 5px;
    background: white;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.catalog-mobile-filters-content .catalog-filter-subcategory-item:hover {
    background: #f9f9f9;
    border-color: #ddd;
}

.catalog-mobile-filters-content .catalog-filter-subcategory-item.active {
    background: #FFF9E6;
    border-color: #FFC107;
    color: #333;
    font-weight: 600;
}

/* ПРЕДОТВРАЩАЕМ ВЫХОД ЗА ГРАНИЦЫ НА МАЛЕНЬКИХ ЭКРАНАХ ДЛЯ МОДАЛЬНОГО ОКНА */
@media (max-width: 768px) {
    .modal-content * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .product-modal-content > div {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* ЕЩЕ БОЛЬШЕ УМЕНЬШАЕМ РАЗМЕРЫ НА МОБИЛЬНЫХ */
    .modal-body {
        padding: 12px 12px 0 !important;
    }
    
    .product-modal-content img {
        max-height: 140px !important;
    }
    .product-modal-content .product-modal-gallery-main img {
        max-height: none !important;
        height: 100% !important;
    }
    .product-modal-content h1 {
        font-size: 15px !important;
    }
    
    .product-modal-content .price {
        font-size: 16px !important;
    }
    
    .btn-modal {
        padding: 9px 12px !important;
        min-height: 40px !important;
        font-size: 12px !important;
    }
}

/* ЕЩЕ БОЛЬШЕ УМЕНЬШАЕМ НА МАЛЕНЬКИХ ЭКРАНАХ */
@media (max-width: 480px) {
    .modal-header {
        padding: 12px 14px !important;
    }
    
    .modal-header h3 {
        font-size: 14px !important;
    }
    
    .modal-close {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
        min-width: 44px;
    }
    
    .modal-body {
        padding: 10px 10px 0 !important;
    }
    
    .product-modal-content img {
        max-height: 120px !important;
    }
    .product-modal-content .product-modal-gallery-main img {
        max-height: none !important;
        height: 100% !important;
    }
    .product-modal-content h1 {
        font-size: 14px !important;
    }
    
    .product-modal-content .price {
        font-size: 15px !important;
    }
    
    .product-modal-content .description-title {
        font-size: 13px !important;
    }
    
    .product-modal-content .description-text {
        font-size: 11px !important;
    }
    
    .modal-footer {
        padding: 4px 10px !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        gap: 6px !important;
    }
    
    .btn-modal {
        padding: 8px 10px !important;
        min-height: 40px !important;
        font-size: 12px !important;
    }
}

/* DNS-inspired catalog refresh */
.catalog-container {
    padding-top: 24px;
    padding-bottom: 40px;
}

.catalog-page-title {
    margin-bottom: 24px;
}

.catalog-page-title h1 {
    margin: 0;
    color: #1f2937;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.catalog-page-subtitle {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.catalog-filters-row {
    align-items: start;
    grid-template-columns: var(--catalog-filters-sidebar-width) minmax(0, 1fr);
    gap: 25px;
}

.catalog-filters-sidebar {
    padding: 28px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-left: 0;
    width: var(--catalog-filters-sidebar-width);
    box-sizing: border-box;
}

.catalog-products-area {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
}

.catalog-products-header {
    gap: 16px;
    margin-bottom: 22px;
    padding: 0 0 18px;
    border-bottom: 1px solid #eef2f7;
}

.catalog-products-header-top {
    gap: 16px;
}

.catalog-products-found {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    box-sizing: border-box;
    color: #4b5563;
    font-size: 14px;
    font-weight: 600;
}

.catalog-products-found strong {
    color: #111827;
    font-size: 14px;
}

.catalog-sort-select {
    min-width: 220px;
    height: 44px;
    padding: 0 42px 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    box-sizing: border-box;
    color: #111827;
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.catalog-sort-select:hover,
.catalog-sort-select:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

/* Сетка каталога: 5 карточек в ряд на широком экране (см. медиа ниже) */
.catalog-products-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
    justify-items: stretch;
}

.catalog-product-card {
    --catalog-card-section-gap: 8px;
    overflow: visible;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
    height: auto;
    min-height: var(--catalog-card-min-height, 0);
    align-self: stretch;
    justify-self: stretch;
}

.catalog-product-card:hover,
.catalog-product-card.catalog-product-clickable:hover {
    transform: translateY(-4px);
    border-color: #fbbf24;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

/* Раньше здесь была минимальная высота карточек — на десктопе убрана (см. min-width: 993px) */
@media (max-width: 1200px) {
    .catalog-product-card {
        --catalog-card-min-height: 0;
    }
}

@media (max-width: 992px) {
    .catalog-product-card {
        /* Планшеты и мобильные: высота по контенту */
        --catalog-card-min-height: 0;
    }
}

@media (max-width: 768px) {
    .catalog-product-card {
        /* Высота по содержимому — без искусственного «растягивания» сетки */
        --catalog-card-min-height: 0;
    }
}

@media (max-width: 576px) {
    .catalog-product-card {
        --catalog-card-min-height: 0;
    }
}

.catalog-product-image {
    height: 170px;
    min-height: 170px;
    max-height: 170px;
    flex: 0 0 170px;
    margin: 8px 8px 0;
    padding: 8px;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 5px;
    box-sizing: border-box;
}

.catalog-product-hit {
    top: 8px;
    left: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    box-shadow: 0 8px 18px rgba(244, 63, 94, 0.25);
}

.catalog-product-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 16px 6px;
}

/* Выравнивание категории под картинкой с отступами как у блока info */
.catalog-product-category-after-image {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0;
    padding: var(--catalog-card-section-gap, 8px) 16px 0;
    text-align: left;
}

.catalog-product-category-after-image + .catalog-product-info {
    padding-top: var(--catalog-card-section-gap, 8px);
}

.catalog-product-category {
    display: inline-flex;
    align-items: center;
    max-width: 75%;
    padding: 4px 10px;
    border-radius: 5px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-product-name {
    margin: 0;
    padding: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    min-height: 58px;
    max-height: 58px;
}

.catalog-product-badges {
    order: 2;
    gap: 6px;
    margin-bottom: 0;
}

.catalog-product-stock {
    min-height: 0;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.catalog-stock-quantity {
    font-size: 11px;
    font-weight: 700;
}

/* Одна линия: цена (#ffb800) + только кнопка корзины (рассрочка — в модалке) */
.catalog-product-bottom-row--price-cart {
    order: 3;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid #eef2f7;
}

.catalog-product-bottom-row--price-cart .catalog-product-price {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: #ffb800;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.15;
}

.catalog-product-bottom-row--price-cart .catalog-product-price.product-modal-price--unavailable {
    color: #c62828;
}

.catalog-product-bottom-row--price-cart .catalog-btn-add-to-cart {
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
}

/* Десктоп (≥993px): одинаковая высота карточек в ряду (сетка растягивает ячейки; цена у низа) */
@media (min-width: 993px) {
    .catalog-products-grid {
        align-items: stretch;
    }

    .catalog-product-card {
        height: 100%;
        min-height: 0;
        align-self: stretch;
        width: 100%;
    }

    .catalog-product-image {
        height: 148px;
        min-height: 148px;
        max-height: 148px;
        flex: 0 0 148px;
    }

    .catalog-product-name {
        min-height: 0 !important;
        max-height: 2.75em;
        font-size: 15px;
        font-weight: 700;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .catalog-product-bottom-row--price-cart {
        margin-top: auto;
    }
}

.catalog-product-price-block {
    flex: 0 0 auto;
    min-width: 0;
    border-radius: 5px;
}

.catalog-product-price-label {
    margin-bottom: 4px;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.catalog-product-price {
    color: #111827;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.catalog-product-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.catalog-btn-add-to-cart,
.catalog-btn-view-details {
    min-height: 44px;
    padding: 0 10px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.catalog-btn-view-details {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.catalog-btn-add-to-cart {
    flex: 0 0 auto;
    min-width: 44px;
    width: auto;
    padding: 0 12px;
    gap: 0;
    background: linear-gradient(180deg, #ffb800 0%, #ff9f0a 100%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(255, 159, 10, 0.25);
}

.catalog-btn-add-to-cart:hover {
    background: linear-gradient(180deg, #ffad14 0%, #f97316 100%);
    color: #fff;
}

.catalog-btn-add-to-cart i {
    font-size: 13px;
    flex-shrink: 0;
}

.catalog-btn-add-to-cart span,
.catalog-add-to-cart-text {
    display: none !important;
}

.catalog-btn-view-details {
    background: #f8fafc;
    color: #111827;
    border: 1px solid #dbe3ee;
}

.catalog-btn-view-details:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.catalog-btn-view-details span {
    display: inline;
}

.catalog-btn-view-details .catalog-view-details-icon {
    flex-shrink: 0;
    font-size: 13px;
}

.catalog-no-products {
    padding: 48px 20px;
    border: 1px dashed #d1d5db;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

.catalog-pagination a,
.catalog-pagination span {
    min-width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 13px;
}

@media (max-width: 1200px) {
    .catalog-filters-row {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 14px;
    }

    .catalog-products-area {
        padding: 16px;
    }

    .catalog-products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }

    .catalog-product-price {
        font-size: 18px;
        white-space: nowrap;
    }
}

@media (max-width: 992px) {
    .catalog-products-area {
        padding: 16px;
        border-radius: 5px;
    }

    .catalog-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }

    .catalog-products-header-top {
        flex-wrap: wrap;
    }

    .catalog-sorting {
        width: 100%;
        margin-left: 0;
    }

    .catalog-sort-select {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .catalog-page-title h1 {
        font-size: 28px;
    }

    .catalog-products-area {
        padding: 14px;
        border-radius: 18px;
    }

    .catalog-product-image {
        height: 200px;
    min-height: 200px;
    max-height: 200px;
    flex: 0 0 200px;
        margin: 8px 8px 0;
        padding: 8px;
    }

    .catalog-product-info {
        padding: 6px;
        gap: 6px;
    }

    .catalog-product-category-after-image + .catalog-product-info {
        padding-top: 6px;
    }

    .catalog-product-name {
        margin: 0 0 2px 0;
        min-height: 52px;
        max-height: 52px;
        font-size: 15px;
        line-height: 1.3;
    }
}

@media (max-width: 576px) {
    .catalog-products-area {
        padding: 12px;
        border-radius: 5px;
    }

    .catalog-products-grid {
        gap: 12px;
    }

    .catalog-product-image {
        height: 170px;
        min-height: 170px;
        max-height: 170px;
        flex: 0 0 170px;
        padding: 8px;
    }

    .catalog-product-category {
        max-width: 100%;
    }

    .catalog-product-price {
        font-size: 20px;
    }

    .catalog-btn-view-details span {
        display: inline;
    }
}

@media (max-width: 360px) {
    .catalog-products-grid {
        grid-template-columns: 1fr;
    }

    .catalog-product-image {
        height: 210px;
        min-height: 210px;
        max-height: 210px;
        flex: 0 0 210px;
    }
}

.catalog-inline-product-panel[hidden] {
    display: none !important;
}

.catalog-inline-product-panel {
    grid-column: 1 / -1;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    scroll-margin-top: 110px;
}

.catalog-inline-product-panel-header,
.catalog-inline-product-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
}

.catalog-inline-product-panel-header {
    border-bottom: 1px solid #eef2f7;
}

.catalog-inline-product-panel-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #111827;
}

.catalog-inline-product-panel-close {
    width: 42px;
    height: 42px;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #f8fafc;
    color: #111827;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.catalog-inline-product-panel-close:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.catalog-inline-product-panel-body {
    padding: 20px;
    background: #fff;
}

.catalog-inline-product-panel-footer {
    justify-content: flex-end;
    border-top: 1px solid #eef2f7;
}

.catalog-inline-product-panel-footer .btn-modal {
    flex: 0 0 auto;
    min-width: 180px;
}

.catalog-product-card.is-expanded {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15), 0 16px 34px rgba(15, 23, 42, 0.12);
}

.catalog-inline-product-panel .product-modal-content {
    width: 100%;
}

@media (max-width: 992px) {
    .container.main-container.catalog-container {
        width: 100% !important;
        max-width: none !important;
        /* Не обнуляем margin-left полностью, чтобы отступ мог сохраняться */
        margin-top: 16px !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
        margin-left: max(0px, calc((100% - 1200px) / 2 - 99px)) !important;
        /* На мобилке не сбрасываем горизонтальный отступ слишком сильно */
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }

    .container.main-container.catalog-container .catalog-page-title,
    .container.main-container.catalog-container .catalog-filters-row {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    .container.main-container.catalog-container .catalog-filters-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
    }

    .container.main-container.catalog-container .catalog-products-area {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
        padding: 12px !important;
    }

    .catalog-inline-product-panel {
        border-radius: 18px;
    }

    .catalog-inline-product-panel-header,
    .catalog-inline-product-panel-body,
    .catalog-inline-product-panel-footer {
        padding: 14px;
    }

    .catalog-inline-product-panel-footer {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .catalog-inline-product-panel-footer .btn-modal {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .catalog-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px;
        align-items: stretch;
    }

    .catalog-product-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    .catalog-product-image {
        height: 200px;
    min-height: 200px;
    max-height: 200px;
    flex: 0 0 200px;
        margin: 8px 8px 0;
        padding: 8px;
    }

    .catalog-product-info {
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start;
        flex: 1 1 auto !important;
        min-height: 0;
        gap: 6px;
        padding: 6px 8px;
    }

    .catalog-product-category-after-image + .catalog-product-info {
        padding-top: 6px;
    }

    .catalog-product-name {
        order: 2;
        margin: 0 !important;
        padding: 0 !important;
        min-height: 0;
        max-height: none;
        font-size: 15px;
        line-height: 1.3;
    }

    .catalog-product-badges {
        order: 3;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        margin-bottom: 0;
        min-width: 0;
        overflow: hidden;
    }

    .catalog-product-badges .catalog-product-stock {
        padding: 1px 6px !important;
        min-height: 0 !important;
        max-width: 100%;
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .catalog-product-badges .catalog-stock-quantity {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .catalog-product-bottom-row--price-cart {
        display: flex;
        order: 4;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px;
        margin-top: auto;
        padding-top: 8px;
        border-top: 1px solid #eef2f7;
        height: auto;
    }

    .catalog-product-bottom-row--price-cart .catalog-product-price {
        font-size: 15px !important;
        line-height: 1.15;
        color: #ffb800 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .catalog-product-bottom-row--price-cart .catalog-btn-add-to-cart {
        flex: 0 0 44px !important;
        min-width: 44px !important;
        width: 44px !important;
        padding: 0 !important;
        justify-content: center;
        gap: 0;
    }

    .catalog-add-to-cart-text {
        display: none !important;
    }

    .catalog-btn-add-to-cart i {
        margin: 0;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .catalog-products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Анимации для уведомлений каталога (тост) */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   FINAL OVERRIDES: увеличиваем "кнопки открытия" категорий
   и подкатегорий (уровни 1/2) внутри сайдбара фильтров.
   Держим в конце файла, чтобы не перебивалось.
   ============================================================ */
:root {
    --catalog-open-btn-expand-x: 20px; /* увеличение padding по горизонтали */
    --catalog-open-btn-pad-y: 18px;    /* высота кнопки */
}

/* Цена (от/до): выравниваем поля внутри сайдбара */
.catalog-filters-sidebar .catalog-price-inputs {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.catalog-filters-sidebar #min_price,
.catalog-filters-sidebar #max_price {
    box-sizing: border-box !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Чтобы расширение "кнопок" не обрезалось */
.catalog-filters-sidebar .catalog-filter-category-tab {
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-list.active {
    /* Внутри раскрытой категории не должно быть скролла */
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

/* ============================================================
   NO-SCROLL SIDEBAR: сайдбар фильтров не должен скроллиться
   (ни по Y, ни по X) — скролл будет только у страницы.
   ============================================================ */
.catalog-filters-sidebar {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.catalog-filters-sidebar {
    overflow-x: hidden !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-list.active {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.catalog-filters-sidebar .catalog-filter-checkbox-list {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}

/* Сам "видимый" блок кнопки (фон/рамка) рисуется на .catalog-filter-category-tab */
.catalog-filters-sidebar .catalog-filter-category-tab {
    /* Чтобы фон/рамка выбранной категории не выходили за границы сайдбара */
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Категории (заголовок таба, включая no-subcategories) */
.catalog-filters-sidebar .catalog-filter-category-tab-header,
.catalog-filters-sidebar .catalog-filter-category-tab-header.no-subcategories {
    padding: var(--catalog-open-btn-pad-y) 18px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: hidden !important;
}
.catalog-filters-sidebar .catalog-filter-category-tab-header i {
    font-size: 18px !important;
}

/* Подкатегории 1 уровня */
.catalog-filters-sidebar .catalog-filter-subcategory-item {
    padding-top: var(--catalog-open-btn-pad-y) !important;
    padding-bottom: var(--catalog-open-btn-pad-y) !important;
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.catalog-filters-sidebar .catalog-filter-subcategory-item:hover {
    /* Не меняем отступ по горизонтали на hover */
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}

/* Подкатегории 2 уровня */
.catalog-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding-top: calc(var(--catalog-open-btn-pad-y) - 2px) !important;
    padding-bottom: calc(var(--catalog-open-btn-pad-y) - 2px) !important;
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Не даём элементам внутри списка раздувать ширину и вызывать горизонтальный скролл */
.catalog-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item,
.catalog-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-level2-item {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Убираем/уменьшаем отступы внутри раскрытой категории (уровни 1/2) */
.catalog-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item {
    padding-left: 24px !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-level2 {
    padding-left: 0 !important;
    border-left: 0 !important;
    background: transparent !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding-left: 24px !important;
}
.catalog-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}

/* Уровень 2 (подкатегории 2-го уровня): по умолчанию скрываем
   и показываем только после клика по подкатегории 1-го уровня. */
.catalog-filter-subcategories-level2 {
    display: none !important;
}
.catalog-filter-subcategories-level2.is-open {
    display: block !important;
}

/* ===== Мобильная панель фильтров: те же "увеличенные кнопки" ===== */
.catalog-mobile-filters-sidebar .catalog-filter-category-tab-header,
.catalog-mobile-filters-content .catalog-filter-category-tab-header {
    padding: var(--catalog-open-btn-pad-y) calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
    box-sizing: border-box !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategory-item,
.catalog-mobile-filters-content .catalog-filter-subcategory-item {
    padding-top: var(--catalog-open-btn-pad-y) !important;
    padding-bottom: var(--catalog-open-btn-pad-y) !important;
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
    box-sizing: border-box !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategory-item:hover,
.catalog-mobile-filters-content .catalog-filter-subcategory-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}

/* Мобильная панель: внутри раскрытой категории тоже без скролла */
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-list.active,
.catalog-mobile-filters-content .catalog-filter-subcategories-list.active {
    max-height: none !important;
    overflow: visible !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item,
.catalog-mobile-filters-content .catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding-top: calc(var(--catalog-open-btn-pad-y) - 2px) !important;
    padding-bottom: calc(var(--catalog-open-btn-pad-y) - 2px) !important;
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
    box-sizing: border-box !important;
}

/* Мобильная панель: уменьшаем отступы внутри раскрытой категории */
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item,
.catalog-mobile-filters-content .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item {
    padding-left: 24px !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item:hover,
.catalog-mobile-filters-content .catalog-filter-subcategories-list.active .catalog-filter-subcategory-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-level2,
.catalog-mobile-filters-content .catalog-filter-subcategories-level2 {
    padding-left: 0 !important;
    border-left: 0 !important;
    background: transparent !important;
}
.catalog-mobile-filters-sidebar .catalog-filter-subcategories-level2 .catalog-filter-level2-item,
.catalog-mobile-filters-content .catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding-left: 24px !important;
}

/* Жёстко фиксируем горизонтальные отступы на hover,
   чтобы визуальное "увеличение по горизонтали" не происходило. */
.catalog-filter-subcategory-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}
.catalog-filter-subcategory-item.catalog-filter-level2-item:hover {
    padding-left: 24px !important;
    padding-right: calc(16px + var(--catalog-open-btn-expand-x) - 10px) !important;
}

/* ========== Мобильные карточки товара: компактнее по вертикали ==========
   (min-height карточки + большие gap/padding давали «лестницу» и лишнюю высоту) */
@media (max-width: 768px) {
    .catalog-products-grid {
        align-items: stretch !important;
        gap: 10px !important;
    }

    .catalog-product-card {
        --catalog-card-section-gap: 8px;
        height: 100%;
        min-height: 0;
        align-self: stretch;
    }

    .catalog-product-card .catalog-product-image {
        margin: 8px 8px 0 !important;
        padding: 8px !important;
    }

    .catalog-product-info {
        flex: 1 1 auto !important;
        min-height: 0;
        gap: 6px !important;
        padding: 6px 10px 6px !important;
    }

    .catalog-product-category-after-image {
        padding: 6px 10px 0 !important;
    }

    .catalog-product-category-after-image + .catalog-product-info {
        padding-top: 6px !important;
    }

    .catalog-product-name {
        margin: 0 0 4px 0 !important;
        padding: 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
    }

    .catalog-product-description {
        margin-bottom: 8px !important;
        min-height: 0 !important;
        max-height: none !important;
        height: auto !important;
    }

    .catalog-product-badges {
        margin-bottom: 4px !important;
        gap: 4px !important;
        flex-wrap: nowrap !important;
        align-items: center;
        min-width: 0;
        overflow: hidden;
    }

    .catalog-product-badges .catalog-product-stock {
        padding: 1px 6px !important;
        min-height: 0 !important;
        max-width: 100%;
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .catalog-product-badges .catalog-product-stock i {
        flex-shrink: 0;
    }

    .catalog-product-badges .catalog-stock-quantity {
        flex-shrink: 0;
        white-space: nowrap !important;
    }

    .catalog-product-bottom-row--price-cart {
        gap: 8px !important;
        margin-top: auto !important;
        padding-top: 8px !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .catalog-product-bottom-row--price-cart .catalog-product-price {
        color: #ffb800 !important;
    }
}

@media (max-width: 576px) {
    .catalog-product-card {
        --catalog-card-section-gap: 8px;
    }

    .catalog-product-info {
        gap: 5px !important;
        padding: 6px 8px 6px !important;
    }

    .catalog-products-grid {
        gap: 8px !important;
    }

    .catalog-product-image {
        height: 150px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        flex: 0 0 150px !important;
    }

    .catalog-product-name {
        margin: 0 0 2px 0 !important;
        font-size: 13px !important;
        line-height: 1.28 !important;
    }

    /* Узкий экран: чуть компактнее бейдж, чтобы реже срабатывало обрезание … */
    .catalog-product-badges .catalog-product-stock {
        font-size: 10px !important;
        padding: 1px 5px !important;
    }
}
.catalog-filters-sidebar .catalog-filter-category-tab-header:hover,
.catalog-mobile-filters-sidebar .catalog-filter-category-tab-header:hover,
.catalog-mobile-filters-content .catalog-filter-category-tab-header:hover {
    padding-left: 18px !important;
    padding-right: 18px !important;
}

/* ========== #productModal: футер и кнопки (в конце файла — перебивает home.css и кэш) ========== */
@media (max-width: 768px) {
    /* Больше высоты под основной контент: ниже шапка, тот же скролл body */
    #productModal.modal-overlay .modal-header {
        padding-top: max(6px, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 6px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        gap: 8px !important;
    }

    #productModal.modal-overlay .modal-header h3 {
        font-size: 15px !important;
        line-height: 1.25 !important;
    }

    #productModal.modal-overlay .modal-header .modal-close {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 16px !important;
    }

    /* Средняя колонка на всю высоту между шапкой и футером — кнопки зафиксированы внизу окна */
    #productModal.modal-overlay .modal-body {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px !important;
        padding-bottom: 0 !important;
    }

    #productModal.modal-overlay .modal-footer {
        flex-shrink: 0 !important;
        margin-top: 0 !important;
        padding: 4px 10px !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        min-height: 0 !important;
        gap: 8px !important;
        align-items: stretch !important;
        background: #fff !important;
    }

    #productModal.modal-overlay .modal-footer .btn-modal {
        padding: 9px 10px !important;
        min-height: 40px !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 480px) {
    #productModal.modal-overlay .modal-header {
        padding-top: max(6px, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 6px !important;
    }

    #productModal.modal-overlay .modal-body {
        padding: 8px 10px !important;
        padding-bottom: 0 !important;
    }

    #productModal.modal-overlay .modal-footer {
        padding: 4px 8px !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        gap: 6px !important;
    }

    #productModal.modal-overlay .modal-footer .btn-modal {
        padding: 8px 8px !important;
        min-height: 40px !important;
        font-size: 11px !important;
    }
}

/* Десктоп: футер с кнопками внизу окна модалки */
@media (min-width: 769px) {
    #productModal.modal-overlay .modal-content {
        display: flex !important;
        flex-direction: column !important;
        height: 85vh !important;
        max-height: 90vh !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    #productModal.modal-overlay .modal-header {
        flex-shrink: 0 !important;
        padding: 10px 16px !important;
    }

    #productModal.modal-overlay .modal-header h3 {
        font-size: 15px !important;
    }

    #productModal.modal-overlay .modal-body {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 12px 18px !important;
        padding-bottom: 12px !important;
    }

    #productModal.modal-overlay .modal-footer {
        flex-shrink: 0 !important;
        margin-top: 0 !important;
        padding: 6px 16px !important;
    }
}