/* Основные стили каталога */
.catalog-main {
    margin: 20px 0;
}

/* Заголовок категории */
.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.category-image img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.category-info h1 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.category-info p {
    color: #666;
    line-height: 1.6;
}

/* Подкатегории */
.subcategories {
    margin-bottom: 30px;
}

.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.subcategory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    border: 1px solid #eee;
}

.subcategory-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #3498db;
}

.subcategory-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    margin-bottom: 10px;
    border-radius: 4px;
}

.subcategory-item span {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

/* Мобильные контролы */
.mobile-controls {
    display: none;
    margin-bottom: 15px;
    gap: 10px;
}

.btn-filter-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.sort-select-mobile {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Основной layout */
.catalog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* Боковая панель фильтров */
.filters-sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filters-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.btn-close-filters {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

/* Фильтры */
.filter-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
}

.filter-header span {
    font-weight: 500;
    color: #333;
}

.filter-header i {
    color: #666;
    font-size: 14px;
    transition: transform 0.3s;
}

.filter-content {
    padding-top: 15px;
}

/* Цена */
.price-range {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.price-range input {
    width: 100px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.sliders {
    position: relative;
    height: 20px;
}

.slider {
    position: absolute;
    width: 100%;
    height: 5px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
}

/* Чекбоксы */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    position: relative;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    flex-shrink: 0;
}

.checkbox-label input:checked ~ .checkmark {
    background: #3498db;
    border-color: #3498db;
}

.checkbox-label input:checked ~ .checkmark:after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Поиск брендов */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.brand-name {
    flex: 1;
}

.brand-count {
    color: #666;
    font-size: 12px;
}

/* Кнопки фильтров */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-apply, .btn-reset {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

.btn-apply {
    background: #3498db;
    color: white;
}

.btn-apply:hover {
    background: #2980b9;
}

.btn-reset {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-reset:hover {
    background: #e9ecef;
}

/* Основной контент */
.products-main {
    min-width: 0; /* Для правильного отображения грида */
}

/* Панель управления */
.controls-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.view-toggle {
    display: flex;
    gap: 4px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 2px;
    background: #f8f9fa;
}

.view-btn {
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.2s;
}

.view-btn:hover {
    color: #495057;
    background: #e9ecef;
}

.view-btn.active {
    background: white;
    color: #3498db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Сортировка в стиле vseinstrumenti */
.vi-sort-panel {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-label {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
    white-space: nowrap;
}

.sort-buttons {
    display: flex;
    gap: 2px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 2px;
}

.sort-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.sort-button:hover:not(.active) {
    background: #e9ecef;
    color: #212529;
}

.sort-button.active {
    background: white;
    color: #3498db;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.button-label {
    font-size: 14px;
}

.button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.sort-icon {
    font-size: 12px;
    font-weight: bold;
}

.sort-icon.desc {
    color: #3498db;
}

.sort-icon.asc {
    color: #3498db;
}

/* Информация о результатах */
.results-info {
    font-size: 14px;
    color: #6c757d;
    text-align: right;
    white-space: nowrap;
}

.results-info strong {
    color: #212529;
    font-weight: 600;
}

/* Сетка товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

.product-card {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid #e9ecef;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* Бейджи */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    z-index: 1;
}

.product-badge.discount {
    background: #e74c3c;
}

.product-badge.new {
    background: #2ecc71;
}

.product-badge.low-stock {
    background: #f39c12;
}

/* Изображение товара */
.product-image {
    position: relative;
    padding-top: 75%; /* 4:3 соотношение */
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.product-card:hover .product-actions {
    opacity: 1;
}

.btn-wishlist, .btn-compare {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.btn-wishlist:hover, .btn-compare:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* Информация о товаре */
.product-info {
    padding: 20px;
}

.product-category {
    font-size: 12px;
    color: #3498db;
    font-weight: 500;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.stars {
    display: flex;
}

.star {
    color: #ddd;
    font-size: 16px;
}

.star.filled {
    color: #ffc107;
}

.reviews {
    font-size: 14px;
    color: #666;
}

/* Характеристики */
.product-specs {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

.spec-name {
    color: #666;
}

.spec-value {
    color: #333;
    font-weight: 500;
}

/* Магазины */
.product-stores {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.store-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 3px 0;
}

.store-name {
    color: #666;
}

.store-stock {
    font-weight: 500;
    color: #2c3e50;
}

/* Футер товара */
.product-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.price-container {
    margin-bottom: 15px;
}

.current-price {
    font-size: 22px;
    font-weight: 700;
    color: #e74c3c;
}

.old-price {
    font-size: 16px;
    color: #95a5a6;
    text-decoration: line-through;
    margin-bottom: 5px;
}

/* Кнопки действий */
.product-actions-bottom {
    display: flex;
    gap: 10px;
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.qty-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-input {
    width: 50px;
    height: 36px;
    border: none;
    text-align: center;
    font-size: 14px;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btn-cart {
    flex: 1;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-cart:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-cart:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled):not(.active) {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
}

.page-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Сообщение если нет товаров */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 2px dashed #dee2e6;
}

.no-results h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.no-results p {
    color: #666;
    margin-bottom: 20px;
}

.btn-reset-all {
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-reset-all:hover {
    background: #2980b9;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 60px;
    font-size: 18px;
    color: #666;
}

.loading i {
    margin-right: 10px;
}

/* Мобильная адаптация */
@media (max-width: 1200px) {
    .catalog-layout {
        grid-template-columns: 250px 1fr;
        gap: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 992px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1000;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s;
        overflow-y: auto;
    }
    
    .filters-sidebar.mobile-visible {
        transform: translateX(0);
    }
    
    .btn-close-filters {
        display: block;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .controls-panel {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .sort-controls {
        justify-content: space-between;
        width: 100%;
    }
    
    .results-info {
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .category-header {
        flex-direction: column;
        text-align: center;
    }
    
    .category-image img {
        width: 100px;
        height: 100px;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .vi-sort-panel {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .sort-label {
        width: 100%;
    }
    
    .sort-buttons {
        width: 100%;
        overflow-x: auto;
    }
    
    .sort-button {
        flex-shrink: 0;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }
    
    .product-actions-bottom {
        flex-direction: column;
    }
    
    .quantity-control {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-actions {
        opacity: 1; /* Всегда показываем на мобильных */
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .page-btn {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* Навигация по категориям */
.category-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    color: #495057;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #e9ecef;
    color: #212529;
}

.category-path {
    flex: 1;
    font-size: 14px;
}

.category-path a {
    color: #495057;
    text-decoration: none;
    transition: color 0.3s;
}

.category-path a:hover {
    color: #3498db;
    text-decoration: underline;
}

.category-path a.active {
    color: #3498db;
    font-weight: 500;
}

.category-path span {
    color: #6c757d;
    margin: 0 5px;
}

/* Стрелочка у подкатегорий с детьми */
.subcategory-arrow {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    color: #95a5a6;
    opacity: 0.7;
}

.subcategory-count {
    font-size: 12px;
    color: #6c757d;
    margin-left: 5px;
}

/* Стили для подкатегорий в фильтрах */
.filter-list .subcategory-count {
    margin-left: auto;
    font-size: 11px;
    color: #95a5a6;
}

/* Адаптивность */
@media (max-width: 768px) {
    .category-navigation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .btn-back {
        align-self: flex-start;
    }
    
    .category-path {
        text-align: center;
    }
}