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

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

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

.catalog-filters-row {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

/* Область товаров — одинаковая для всех категорий (в т.ч. Смартфоны) */
.catalog-products-area {
    min-width: 0;
    width: 100%;
    display: block;
}

.catalog-filters-sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    height: fit-content;
    position: sticky;
    top: 15px;
    min-height: calc(100vh - 150px);
    max-height: none;
    overflow-y: visible;
}

/* Кнопка для открытия фильтров на мобильных устройствах */
.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: 88%;
    max-width: 320px;
    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: 16px 18px;
    -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: 14px 18px;
    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: 88%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    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: 16px 18px;
    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: 18px;
    -webkit-overflow-scrolling: touch;
}

/* Блок кнопок внизу первой мобильной панели (Применить / Сбросить / Закрыть) — всегда виден */
.catalog-mobile-filters-actions-main {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
    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: 16px;
    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: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.catalog-filter-category-tab.expanded {
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    overflow: visible;
}

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

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

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

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

.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;
    overflow-x: hidden;
    border-top: 1px solid #eee;
}

.catalog-filter-subcategory-item {
    display: block;
    padding: 8px 12px 8px 24px;
    text-decoration: none;
    color: #666;
    font-size: 12px;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s;
}

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

.catalog-filter-subcategory-item.active {
    background: #FFE082;
    color: #333;
    font-weight: 500;
    border-left: 3px solid #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: 4px 0 4px 12px;
    border-left: 2px solid #FFE082;
    background: #fafafa;
}
.catalog-filter-subcategories-level2 .catalog-filter-level2-item {
    padding: 6px 12px 6px 16px;
    font-size: 11px;
    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-categories-navigation-container {
    /* Пустой класс для группировки элементов */
}

/* Улучшенный скролл для списков */
.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 {
    width: 100%;
    height: 4px;
    margin: 8px 0;
    -webkit-appearance: none;
    background: #f0f0f0;
    border-radius: 2px;
    outline: none;
}

.catalog-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    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);
}

.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: 6px;
    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, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

/* На десктопе (от 993px) всегда 5 колонок — чтобы не переключалось на 2 из-за узкой области */
@media (min-width: 993px) {
    .catalog-products-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

/* КОМПАКТНЫЕ КАРТОЧКИ ТОВАРОВ */
.catalog-product-card {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}

.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;
    background: #f9f9f9;
    position: relative;
    flex-shrink: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* Кнопки действий не должны быть кликабельными для открытия модального окна */
.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: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    display: block;
}

.catalog-product-card:hover .catalog-product-image img {
    transform: scale(1.05);
}

/* Стиль для хита продаж */
.catalog-product-hit {
    position: absolute;
    top: 16px;
    left: 16px;
    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: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.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-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 60px;
    max-height: 60px;
}

.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: 6px;
    margin-bottom: 12px;
}

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


/* Строка с ценой и кнопкой "В корзину" */
.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 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;
}

.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;
    }
}

/* Мобильная модалка: хедер и футер всегда видны, скролл только контент между ними */
@media (max-width: 768px) {
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .modal-overlay.active {
        display: flex;
        overflow: hidden;
    }
    
    .modal-content {
        position: relative;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden;
        border-radius: 0;
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        padding-top: max(12px, env(safe-area-inset-top));
        box-sizing: border-box;
    }

    .modal-header {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        margin: 0 0 8px 0;
        border-radius: 8px;
    }

    /* На мобильных скроллится весь контент между хедером и футером */
    .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: 24px !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: 8px 0 0 0;
        border-radius: 8px;
        min-height: 44px;
        flex-basis: auto !important;
    }
}

/* МОБИЛЬНЫЕ ТЕЛЕФОНЫ — хедер и футер остаются видимыми */
@media (max-width: 480px) {
    .modal-content {
        padding: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-top: max(10px, env(safe-area-inset-top));
    }
}

/* ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ */
@media (max-width: 360px) {
    .modal-content {
        padding: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        padding-top: max(8px, env(safe-area-inset-top));
    }
}

/* Заголовок модального окна — скругление верхних углов как у .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: 12px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    border-radius: 0 0 8px 8px;
    background: #fff;
}

/* Кнопки модального окна - УМЕНЬШЕНЫ */
.btn-modal {
    padding: 8px 16px;
    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;
}

.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;
}

/* Выбор вариантов телефона (цвет/память/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: 999px; /* кружки */
    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: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.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 {
        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: 6px 12px;
    border-radius: 6px;
    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-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;
}

/* Описание: при нехватке места скролл у body, блок не обрезается */
.product-modal-description-text {
    font-size: 15px;
    line-height: 1.45;
    color: #333;
    word-wrap: break-word;
    white-space: pre-line;
    padding: 12px 0;
    padding-right: 8px;
    letter-spacing: 0.1px;
    text-indent: 0;
    margin-bottom: 0;
    margin-top: 0;
    font-weight: 400;
    font-family: Arial, sans-serif;
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
}

/* Улучшаем отображение точек для выравнивания характеристик */
.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: 4px;
    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: 88%;
        max-width: 320px;
        padding: 0;
    }
    .catalog-mobile-filters-sidebar.active {
        right: 0;
    }
    .catalog-mobile-filters-content {
        padding: 16px;
        padding-bottom: max(28px, calc(24px + env(safe-area-inset-bottom, 0px)));
    }
}

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

    .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, 1fr);
        gap: 12px;
    }

    .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, 1fr);
        gap: 15px;
    }

    .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, 1fr);
        gap: 15px;
    }

    .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: 8px;
        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-btn-add-to-cart,
    .catalog-btn-view-details {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

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

@media (max-width: 576px) {
    .catalog-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Фиксированная шапка сайтбара для очень маленьких экранов */
    .catalog-mobile-filters-header {
        height: 55px;
        padding: 12px !important;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 55px !important;
        height: auto !important;
        min-height: calc(100% - 55px) !important;
        overflow-y: visible !important;
        padding: 15px !important;
        padding-bottom: 40px !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, 1fr);
        gap: 12px;
    }

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

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

    .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;
    }

    .catalog-btn-add-to-cart,
    .catalog-btn-view-details {
        width: auto;
        padding: 6px 8px;
        font-size: 11px;
        min-height: 32px;
    }

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

    .catalog-btn-add-to-cart i,
    .catalog-btn-view-details i {
        margin: 0;
        font-size: 12px;
    }

    .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 {
        width: 90%;
    }
}

@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: 12px !important;
        padding-bottom: 40px !important;
    }
    
    .catalog-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .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;
        padding: 4px 8px;
    }

    .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: 10px !important;
    }
    
    .catalog-mobile-filters-content {
        margin-top: 45px !important;
        height: auto !important;
        min-height: calc(100% - 45px) !important;
        overflow-y: visible !important;
        padding: 10px !important;
        padding-bottom: 40px !important;
    }
    
    .catalog-mobile-filters-header h3 {
        font-size: 15px;
    }
    
    .catalog-products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .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 {
        display: none;
    }
    
    .catalog-btn-view-details span {
        display: inline;
        font-size: 11px;
    }

    .catalog-btn-add-to-cart,
    .catalog-btn-view-details {
        padding: 8px 12px;
        font-size: 12px;
        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-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: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

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

/* УБЕЖДАЕМСЯ ЧТО КОНТЕЙНЕР ИМЕЕТ ПРАВИЛЬНЫЕ ОТСТУПЫ */
.catalog-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 {
        width: 94%;
        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: 92% !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .catalog-mobile-filters-header {
        padding: 14px 16px !important;
    }

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

    .catalog-mobile-filters-content {
        padding: 12px 14px max(24px, calc(20px + env(safe-area-inset-bottom, 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: 85% !important;
        max-width: 220px !important;
        padding: 6px !important;
    }
    
    .catalog-mobile-filters-header h3 {
        font-size: 14px !important;
    }
    
    .catalog-mobile-filters-close {
        width: 28px !important;
        height: 28px !important;
        font-size: 18px !important;
    }
}

/* Предотвращаем горизонтальный скролл */
@media (max-width: 992px) {
    .catalog-mobile-filters-sidebar,
    .catalog-mobile-filters-content,
    .catalog-mobile-filters-sidebar * {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Гарантируем что ничего не выйдет за границы */
    .catalog-mobile-filters-content > * {
        max-width: 100% !important;
    }
}

/* Для очень коротких экранов */
@media (max-height: 600px) and (max-width: 992px) {
    .catalog-mobile-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;
}

.catalog-mobile-filters-content .catalog-filter-subcategories-list.active {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 10px;
    padding-bottom: 5px;
    -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 !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: 7px 14px !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 !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: 10px 12px !important;
        gap: 6px !important;
    }
    
    .btn-modal {
        padding: 6px 12px !important;
        font-size: 11px !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; }
}