﻿/* ============================================
   CATALOG.CSS - Стили для страниц каталога
   ============================================ */

/* -------------------- Общие элементы -------------------- */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 2rem 0;
    text-align: center;
    color: var(--gray-900);
}

.category-description {
    text-align: center;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* -------------------- Двухколоночная сетка -------------------- */
.catalog-layout {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

/* -------------------- Боковая панель фильтров -------------------- */
.catalog-filters {
    flex: 0 0 280px;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

    .catalog-filters h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--primary);
        display: inline-block;
    }

/* -------------------- Группы фильтров (обновлено) -------------------- */
.filter-group {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 1.5rem;
}

    .filter-group:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .filter-group label {
        display: block;
        font-weight: 600;
        margin-bottom: 0.75rem;
        color: var(--gray-800);
        font-size: 0.95rem;
    }

/* -------------------- Поля ввода и select -------------------- */
.form-control,
.custom-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--gray-700);
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

    .form-control:focus,
    .custom-select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    }

.filter-group select {
    cursor: pointer;
}

/* -------------------- Дерево категорий -------------------- */
.categories-block h3 {
    margin-top: 0;
}

.category-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

    .category-tree ul {
        list-style: none;
        padding-left: 0;
        margin: 0.5rem 0;
    }

    .category-tree li {
        margin: 0.5rem 0;
    }

/* Аккордеон в дереве категорий */
.category-tree-item {
    list-style: none;
    margin: 0;
}

.category-tree-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.toggle-icon {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--gray-500);
    width: 20px;
    text-align: center;
    user-select: none;
}

    .toggle-icon:hover {
        color: var(--primary);
    }

.category-tree-item.has-children > .category-tree-node > a {
    font-weight: 700;
}

.category-tree-children {
    padding-left: 1.5rem;
}

/* Ссылки в дереве */
.category-tree a {
    display: inline-block;
    padding: 0.4rem 0.5rem;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

    .category-tree a:hover {
        background-color: var(--primary-light);
        color: var(--primary);
    }

    .category-tree a.active {
        background-color: var(--primary);
        color: var(--white);
        font-weight: 500;
    }

/* -------------------- Слайдер цены (noUiSlider) -------------------- */
.price-range-slider {
    width: 100%;
    margin: 1rem 0;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

    .price-range-slider .noUi-connect {
        background: var(--primary);
    }

    .price-range-slider .noUi-handle {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--white);
        border: 2px solid var(--primary);
        box-shadow: none;
        cursor: pointer;
        top: -7px;
    }

        .price-range-slider .noUi-handle::before,
        .price-range-slider .noUi-handle::after {
            display: none;
        }

.price-range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    color: var(--gray-600);
    gap: 1rem;
}

    .price-range-values span {
        background: var(--gray-100);
        padding: 0.2rem 0.5rem;
        border-radius: var(--radius-sm);
    }

/* -------------------- Кастомные чекбоксы -------------------- */
.custom-checkboxes .checkbox-label {
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    user-select: none;
}

    .custom-checkboxes .checkbox-label input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
        height: 0;
        width: 0;
    }

.checkbox-custom {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--white);
    border: 1px solid var(--gray-400);
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-label:hover input ~ .checkbox-custom {
    border-color: var(--primary);
}

.checkbox-label input:checked ~ .checkbox-custom {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkbox-custom::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkbox-custom::after {
    display: block;
}

/* -------------------- Список производителей -------------------- */
.manufacturer-list {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* -------------------- Кнопки -------------------- */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

    .btn-primary:hover {
        background: var(--primary-dark);
        transform: translateY(-1px);
    }

.btn-link {
    display: inline-block;
    text-align: center;
    width: 100%;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

    .btn-link:hover {
        color: var(--primary);
        background: var(--gray-100);
    }

/* -------------------- Список товаров -------------------- */
.catalog-products {
    flex: 1;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
    position: relative;
}

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--primary-light);
    }

.product-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 5;
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-new {
    background: var(--primary);
    color: var(--white);
}

.badge-popular {
    background: var(--warning);
    color: var(--white);
}

.product-link {
    text-decoration: none;
    color: inherit;
}

.product-image {
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    padding: 1rem;
}

    .product-image img {
        max-width: 90%;
        max-height: 90%;
        object-fit: contain;
        transition: transform 0.3s ease;
    }

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.5rem;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5rem;
}

.product-article {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.product-actions {
    padding: 0 1.5rem 1.5rem;
}

.btn-add-to-cart {
    width: 100%;
    padding: 0.75rem;
    background: var(--gray-900);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

    .btn-add-to-cart:hover {
        background: var(--primary);
    }

/* -------------------- Пагинация -------------------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

    .pagination a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        height: 40px;
        padding: 0 0.5rem;
        border: 1px solid var(--gray-300);
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--gray-700);
        transition: var(--transition);
    }

        .pagination a:hover {
            background: var(--primary);
            color: var(--white);
            border-color: var(--primary);
        }

        .pagination a.active {
            background: var(--primary);
            color: var(--white);
            border-color: var(--primary);
        }

/* -------------------- Пустое состояние -------------------- */
.empty-catalog {
    text-align: center;
    padding: 4rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
}

/* -------------------- Адаптивность -------------------- */
@media (max-width: 1024px) {
    .catalog-layout {
        flex-direction: column;
    }

    .catalog-filters {
        flex: auto;
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-tree ul {
        padding-left: 1rem;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image {
        height: 200px;
    }

    .product-title {
        font-size: 0.9rem;
    }

    .catalog-filters {
        width: 100%;
    }

    .categories-block {
        margin-bottom: 1rem;
    }

    .category-tree a {
        padding: 0.3rem 0.5rem;
    }
}
.all-products-link {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 1.5rem;
}

.btn-all-products {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--primary-light);
    color: var(--primary);
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
}

    .btn-all-products:hover {
        background: var(--primary);
        color: var(--white);
    }