/* ============================================ */
/* CATALOG.CSS - Единый файл стилей каталога    */
/* ============================================ */

/* -------------------- Заголовок -------------------- */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.catalog-title {
    font-size: 32px;
    color: #000000;
    font-weight: 700;
    margin: 0;
}

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

.sort-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-control label {
    font-weight: 600;
    color: #333;
}

.sort-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.sort-select:focus {
    outline: none;
    border-color: #f54900;
}

/* -------------------- Основной контент -------------------- */
.catalog-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

.products-container {
    display: flex;
    flex-direction: column;
}

/* -------------------- Сетка товаров -------------------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* -------------------- Сайдбар фильтров -------------------- */
.filters-sidebar {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-section {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Сворачиваемые фильтры */
.filter-section--collapsible .filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
}

.filter-toggle {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s;
}

.filter-section--collapsed .filter-toggle {
    transform: rotate(-90deg);
}

.filter-section--collapsed .filter-content {
    display: none;
}

.filter-content {
    padding: 10px 0;
}

/* -------------------- Элементы фильтров -------------------- */
.filter-group {
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f54900;
    cursor: pointer;
    margin: 0;
}

.filter-checkbox:hover {
    color: #f54900;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-inputs input {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

.range-inputs span {
        flex-shrink: 0;
        color: #666;
}

.range-inputs input:focus {
    outline: none;
    border-color: #f54900;
}

.filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #f54900;
}

.filter-search {
    margin-bottom: 12px;
}

.filter-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.filter-search input:focus {
    outline: none;
    border-color: #f54900;
}

/* -------------------- Категории -------------------- */
.filter-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.category-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f54900;
    cursor: pointer;
    margin: 0;
}

.category-item:hover {
    color: #f54900;
}

.category-icon {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: auto;
}

.subcategories {
    margin-left: 24px;
    border-left: 2px solid #eee;
    padding-left: 12px;
}

.subcategory-item {
    font-size: 13px;
    opacity: 0.9;
}

/* -------------------- Поставщики -------------------- */
.supplier-filter {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.supplier-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.supplier-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f54900;
    cursor: pointer;
    margin: 0;
}

.supplier-item:hover {
    color: #f54900;
}

/* -------------------- Цена -------------------- */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-inputs input {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.price-inputs input:focus {
    outline: none;
    border-color: #f54900;
}

.price-inputs span {
    color: #666;
}

/* -------------------- Кнопки фильтров -------------------- */
.apply-filters-btn,
.reset-filters-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.apply-filters-btn {
    background: #f54900;
    color: white;
    border: none;
}

.apply-filters-btn:hover {
    background: #d43f00;
}

.reset-filters-btn {
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: 1px solid #ddd;
}

.reset-filters-btn:hover {
    background: #eee;
}

/* -------------------- Спиннер загрузки -------------------- */
#loader {
    text-align: center;
    padding: 30px;
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #f54900;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.end-message {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* -------------------- Адаптив -------------------- */
@media (max-width: 1024px) {
    .catalog-content {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .catalog-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .catalog-controls {
        width: 100%;
        justify-content: space-between;
    }
}

/* -------------------- Поиск (заголовок) -------------------- */
.search-header {
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.search-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.results-count {
    font-size: 18px;
    color: #666;
    font-weight: normal;
    margin-left: 10px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
}

.no-results svg {
    margin-bottom: 20px;
}

.no-results p {
    font-size: 18px;
    color: #666;
    margin: 10px 0;
}

.no-results-hint {
    font-size: 14px;
    color: #999;
}

.to-catalog-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 24px;
    background: #f54900;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
}

.sort-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.products-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        margin-bottom: 30px;
    }

    @media (max-width: 1400px) {
        .products-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    @media (max-width: 992px) {
        .products-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }

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

    /* Сворачиваемые фильтры */
    .filter-section {
        margin-bottom: 20px;
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
    }

    .filter-section--collapsible .filter-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        user-select: none;
        padding: 8px 0;
    }

    .filter-section--collapsible .filter-header:hover {
        background: #f9f9f9;
    }

    .filter-title {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        color: #333;
    }

    .filter-toggle {
        font-size: 12px;
        color: #999;
        transition: transform 0.3s;
    }

    .filter-section--collapsed .filter-toggle {
        transform: rotate(-90deg);
    }

    .filter-section--collapsed .filter-content {
        display: none;
    }

    .filter-content {
        padding: 10px 0;
    }

    /* Категории */
    .category-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 0;
        cursor: pointer;
    }

    .category-icon {
        width: 24px;
        height: 24px;
        object-fit: cover;
        border-radius: 4px;
        margin-left: auto;
    }

    .subcategories {
        margin-left: 24px;
        border-left: 2px solid #eee;
        padding-left: 12px;
    }

    .subcategory-item {
        font-size: 14px;
        opacity: 0.9;
    }

    /* Поиск в фильтрах */
    .filter-search {
        margin-bottom: 12px;
    }

    .filter-search input {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 14px;
    }

    .filter-search input:focus {
        outline: none;
        border-color: #f54900;
    }

    /* Поставщики */
    .supplier-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 0;
        cursor: pointer;
    }

    /* Цена */
    .price-inputs {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .price-inputs input {
        width: 90px;
        padding: 8px 10px;
        border: 1px solid #ddd;
        border-radius: 6px;
    }

    /* Кнопки */
    .apply-filters-btn, .reset-filters-btn {
        display: block;
        width: 100%;
        padding: 12px;
        margin-top: 10px;
        text-align: center;
        border-radius: 8px;
        cursor: pointer;
    }

    .apply-filters-btn {
        background: #f54900;
        color: white;
        border: none;
    }

    .reset-filters-btn {
        background: #f5f5f5;
        color: #666;
        text-decoration: none;
        border: 1px solid #ddd;
    }

    /* Спиннер */
    .spinner {
        width: 40px;
        height: 40px;
        border: 3px solid #f3f3f3;
        border-top: 3px solid #f54900;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin: 0 auto 10px;
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    .end-message {
        text-align: center;
        padding: 30px;
        color: #666;
        grid-column: 1 / -1;
    }