.catalog-page {
    padding: 40px 0;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.catalog-title {
    font-size: 2rem;
    color: var(--secondary-color);
}

.catalog-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.view-options {
    display: flex;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
}

.view-option {
    padding: 8px 12px;
    background: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.view-option.active {
    background: var(--primary-color);
    color: white;
}

.filter-toggle {
    display: none;
    padding: 8px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.catalog-content {
    display: grid;
    grid-template-columns: 430px 1fr;
    gap: 30px;
}

.catalog-filters {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    height: fit-content;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
}

.filter-list {
    list-style: none;
    line-height: 1.2;
}

.filter-item {
    margin-bottom: 3px;
    transition: background-color 0.2s;
    padding: 3px 0;
}

.filter-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.filter-item input {
    margin-right: 10px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

.filter-buttons button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.apply-filters {
    background: var(--primary-color);
    color: white;
}

.reset-filters {
    background: var(--light-gray);
}

/* Основной контейнер для каталога */
.catalog-main {
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

/* Карточки всегда прижаты кверху */
.catalog-products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    flex-grow: 1;
    align-items: start;
    justify-items: start;
    grid-auto-rows: min-content;
}

.catalog-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    align-items: start;
}

.catalog-list-view {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.catalog-grid-view.active {
    display: grid;
}

.catalog-list-view.active {
    display: flex;
}

/* Карточка товара */
.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 350px;
    border: 1px solid var(--light-gray);
    cursor: pointer;
    align-self: start;
    justify-self: start;
    width: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--light-gray);
}

.product-image {
    height: 220px;
    flex-shrink: 0;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

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

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
    min-height: 80px;
    gap: 8px;
}

.product-category {
    font-size: 0.9rem;
    color: var(--gray-color);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-top: 0;
}

.product-name {
    display: none;
}

.product-description {
    display: none;
}

.product-article {
    font-size: 0.8rem;
    color: var(--gray-color);
    font-style: italic;
    margin-bottom: 0;
    margin-top: auto;
}

.product-list-item {
    display: flex;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    height: 250px;
    align-items: start;
}

.product-list-image {
    width: 250px;
    flex-shrink: 0;
}

.product-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-list-info {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Стили для пагинации */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    width: 100%;
}

.pagination {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.pagination-item:hover,
.pagination-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-ellipsis {
    cursor: default;
    background: transparent !important;
    color: var(--gray-color) !important;
    border-color: var(--light-gray) !important;
}

.pagination-ellipsis:hover {
    background: transparent !important;
    color: var(--gray-color) !important;
    border-color: var(--light-gray) !important;
}

/* Чекбоксы */
input[type="checkbox"]:indeterminate {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect x='3' y='7' width='10' height='2' fill='white'/%3E%3C/svg%3E");
}

input[type="checkbox"].indeterminate {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Crect x='3' y='7' width='10' height='2' fill='white'/%3E%3C/svg%3E");
}

.filter-item:hover {
    background-color: var(--light-color);
}

.filter-item input[type="checkbox"] {
    margin-right: 10px;
    flex-shrink: 0;
}

.filter-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.filter-item label:hover {
    background-color: var(--light-color);
}

.filter-item span {
    flex-grow: 1;
}

.filter-item[style*="padding-left"] {
    border-left: none;
    margin-left: 10px;
    padding-left: 15px;
}

/* Стили для списка товаров (list view) */
.catalog-list-view .product-list-info .product-category {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 5px;
}

.catalog-list-view .product-list-info .product-name {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.catalog-list-view .product-list-info .product-description {
    display: block;
    font-size: 0.95rem;
    color: var(--gray-color);
    margin-bottom: 15px;
    line-height: 1.5;
}

.catalog-list-view .product-list-info .product-article {
    font-size: 0.85rem;
    color: var(--gray-color);
    font-style: italic;
    margin-top: auto;
}

/* Стили для пустого состояния */
.catalog-products:empty::before {
    content: "Загрузка товаров...";
    display: block;
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
    color: var(--gray-color);
}

.catalog-products .no-products-message {
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
    color: var(--gray-color);
}

.catalog-products .empty-state {
    text-align: center;
    padding: 60px 40px;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 3rem;
    color: var(--light-gray);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--gray-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--gray-color);
}

.catalog-products > * {
    align-self: start;
}

.no-products-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
    align-self: start;
}

/* ===== МОДАЛЬНОЕ ОКНО - ФИКСИРОВАННАЯ СТРУКТУРА ===== */
.modal-content {
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}

.product-modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: 100%;
    max-height: 80vh;
    overflow: hidden;
}

/* Левая колонка - изображения - ФИКСИРОВАННАЯ ШИРИНА */
.product-modal-images {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    flex: 1;
    overflow: visible;
    min-width: 0;
}

/* ОБЕРТКА ГЛАВНОГО ИЗОБРАЖЕНИЯ - ФИКСИРОВАННЫЙ РАЗМЕР */
.main-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: #f5f5f5;
    flex-shrink: 0;
    height: 400px;
    width: 100%;
    max-width: 100%;
}

/* ГЛАВНОЕ ИЗОБРАЖЕНИЕ */
.main-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* ТУЛБАР */
.image-toolbar {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 16px;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: white;
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn:disabled:hover {
    background: transparent;
    color: #333;
}

.zoom-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.zoom-indicator.visible {
    opacity: 1;
}

/* ===== МИНИАТЮРЫ - ВСЕГДА 4 ВИДИМЫХ ===== */
.image-thumbnails-container {
    flex-shrink: 0;
    padding: 5px 0;
    overflow: visible;
    width: 100%;
    max-width: 100%;
}

.image-thumbnails {
    position: relative;
    padding: 5px 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.thumbnails-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 0 15px;
}

.thumbnails-scroll {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    overflow: hidden;
    flex: 1;
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100%;
}

/* Когда миниатюр больше 4 - добавляем скролл */
.thumbnails-scroll.has-scroll {
    overflow-x: auto;
    display: flex;
    gap: 10px;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

.thumbnails-scroll.has-scroll::-webkit-scrollbar {
    display: none;
}

.thumbnails-scroll.has-scroll .thumbnail {
    flex: 0 0 calc(25% - 10px);
    min-width: calc(25% - 10px);
    max-width: calc(25% - 10px);
}

.thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    background: #f5f5f5;
    min-width: 0;
}

.thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.thumbnail.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumbnail:hover img {
    transform: scale(1.1);
}

.thumbnail.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* КНОПКИ ПРОКРУТКИ */
.thumb-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.3s;
    color: #333;
    flex-shrink: 0;
}

.thumb-scroll-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.thumb-scroll-btn.visible {
    display: flex;
}

.thumb-scroll-left {
    left: -4px;
}

.thumb-scroll-right {
    right: -4px;
}

/* ===== ПРАВАЯ КОЛОНКА - ИНФОРМАЦИЯ ===== */
.product-modal-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    max-height: 80vh;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.product-modal-info .product-category {
    font-size: 0.9rem;
    color: var(--gray-color);
    font-weight: 500;
}

.product-modal-info h2 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin: 0;
}

.product-modal-info .product-description {
    font-size: 0.95rem;
    color: var(--gray-color);
    line-height: 1.6;
    flex: 1;
}

.product-modal-info .product-article {
    font-size: 0.85rem;
    color: var(--gray-color);
    font-style: italic;
}

/* ===== АНИМАЦИЯ СМЕНЫ ИЗОБРАЖЕНИЯ ===== */
.main-image img.fade-out {
    opacity: 0;
}

.main-image img.fade-in {
    opacity: 1;
}

/* ===== КУРСОРЫ ДЛЯ ПАНОРАМИРОВАНИЯ ===== */
.main-image img {
    cursor: default;
}

.main-image img.grab,
.fullscreen-image.grab {
    cursor: grab !important;
}

.main-image img.grabbing,
.fullscreen-image.grabbing {
    cursor: grabbing !important;
}

.fullscreen-image {
    cursor: default !important;
}

.fullscreen-image.grab {
    cursor: grab !important;
}

.fullscreen-image.grabbing {
    cursor: grabbing !important;
}

/* ===== ПОЛНОЭКРАННЫЙ РЕЖИМ ===== */
.fullscreen-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.95) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    padding: 20px !important;
}

.fullscreen-container img {
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 40px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    cursor: default !important;
    transition: none !important;
}

.fullscreen-close {
    position: fixed !important;
    top: 20px !important;
    right: 30px !important;
    font-size: 40px !important;
    font-weight: bold !important;
    color: white !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 10000 !important;
    transition: transform 0.3s !important;
}

.fullscreen-close:hover {
    transform: scale(1.2) !important;
}

.fullscreen-reset {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 30px !important;
    color: white !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    cursor: pointer !important;
    z-index: 10000 !important;
    transition: background 0.3s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.fullscreen-reset:hover {
    background: rgba(255, 255, 255, 0.4) !important;
}

/* ===== ДОПОЛНИТЕЛЬНЫЙ ФИКС ДЛЯ КНОПОК ===== */
.image-thumbnails-container {
    overflow: visible !important;
}

.thumbnails-wrapper {
    overflow: visible !important;
}

.thumb-scroll-btn {
    z-index: 20 !important;
}

/* ===== ПОИСК ===== */
.search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    background: white;
    border: 1px solid var(--light-gray);
    border-radius: 5px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.search-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(58, 110, 165, 0.2);
}

.search-input {
    padding: 8px 35px 8px 15px;
    border: none;
    outline: none;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    min-width: 200px;
    background: transparent;
    color: var(--dark-color);
}

.search-input::placeholder {
    color: var(--gray-color);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    padding: 5px 8px;
    transition: color 0.3s;
    font-size: 14px;
}

.search-btn:hover {
    color: var(--primary-color);
}

.search-clear {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    padding: 5px 8px;
    transition: color 0.3s;
    font-size: 14px;
    display: none;
}

.search-clear:hover {
    color: var(--accent-color);
}

.search-clear.visible {
    display: block;
}

/* Адаптивность для поиска */
@media (max-width: 768px) {
    .search-wrapper {
        width: 100%;
    }
    .search-input {
        min-width: 100px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .search-input {
        min-width: 80px;
        font-size: 0.8rem;
        padding: 6px 30px 6px 10px;
    }
    .search-btn {
        right: 3px;
        font-size: 12px;
    }
    .search-clear {
        right: 28px;
        font-size: 12px;
    }
}

/* ===== АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    .product-modal {
        grid-template-columns: 1fr;
        max-height: none;
        gap: 15px;
    }
    
    .main-image-wrapper {
        height: 300px;
    }
    
    .product-modal-info {
        max-height: none;
    }
    
    .image-toolbar {
        top: 10px;
        right: 10px;
        padding: 5px;
        gap: 5px;
    }
    
    .toolbar-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .thumb-scroll-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .thumb-scroll-left {
        left: -2px;
    }
    
    .thumb-scroll-right {
        right: -2px;
    }
}

@media (max-width: 480px) {
    .main-image-wrapper {
        height: 250px;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    .thumb-scroll-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .thumb-scroll-left {
        left: -1px;
    }
    
    .thumb-scroll-right {
        right: -1px;
    }
}

/* Адаптивность для каталога */
@media (max-width: 1200px) {
    .catalog-content {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 992px) {
    .catalog-content {
        grid-template-columns: 280px 1fr;
    }
    .product-list-image {
        width: 200px;
    }
    .product-card {
        height: 320px;
    }
    .product-image {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .catalog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .catalog-controls {
        width: 100%;
        justify-content: space-between;
    }
    .filter-toggle {
        display: block;
    }
    .catalog-content {
        grid-template-columns: 1fr;
    }
    .catalog-filters {
        display: none;
        position: static;
        transform: none;
    }
    .catalog-filters.active {
        display: block;
    }
    .product-list-item {
        flex-direction: column;
        height: auto;
    }
    .product-list-image {
        width: 100%;
        height: 200px;
    }
    .product-image {
        height: 200px;
    }
    .product-info {
        padding: 12px;
    }
    .catalog-products {
        grid-template-columns: 1fr;
    }
    .product-card {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .view-options {
        display: none;
    }
    .product-image {
        height: 180px;
    }
    .product-card {
        height: 280px;
    }
    .pagination-item {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    .catalog-products {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .pagination-item {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    .pagination {
        gap: 3px;
    }
    .product-card {
        height: 260px;
    }
    .product-image {
        height: 160px;
    }
}

