.catalog-page {
    padding: 40px 0;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.catalog-header h1 {
    margin: 0;
    font-size: 28px;
}

.catalog-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.search-form input {
    padding: 8px 15px;
    border: none;
    outline: none;
    min-width: 200px;
    font-size: 14px;
}

.search-form button {
    padding: 8px 15px;
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
}

.sort-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
}

.catalog-sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 16px;
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list a {
    display: block;
    padding: 8px 12px;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.category-list a:hover {
    background: #f8f9fa;
}

.category-list a.active {
    background: #3498db;
    color: white;
}

.category-list .count {
    font-size: 12px;
    color: #7f8c8d;
    margin-left: 5px;
}

.price-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.price-inputs input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn-filter {
    width: 100%;
    padding: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.product-card {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.product-image {
    position: relative;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image.no-image {
    font-size: 48px;
    color: #bdc3c7;
}

.product-info {
    padding: 15px;
}

.product-info h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.product-info h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.product-info h3 a:hover {
    color: #3498db;
}

.product-article {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.product-price {
    margin: 10px 0;
}

.old-price {
    text-decoration: line-through;
    color: #95a5a6;
    margin-right: 10px;
}

.new-price {
    color: #e74c3c;
    font-weight: bold;
}

.price {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
}

.product-stock {
    margin-bottom: 10px;
    font-size: 14px;
}

.in-stock {
    color: #27ae60;
}

.out-of-stock {
    color: #e74c3c;
}

.btn-details {
    display: inline-block;
    padding: 8px 15px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.page-link {
    padding: 8px 15px;
    background: white;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.page-link.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-link:hover {
    background: #ecf0f1;
}

.empty-catalog {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.empty-catalog p {
    font-size: 18px;
    color: #7f8c8d;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    
    .catalog-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .catalog-controls {
        flex-direction: column;
    }
    
    .search-form input {
        min-width: 150px;
    }
}

/* Категории */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    overflow-y: auto;
}

.category-list::-webkit-scrollbar {
    width: 6px;
}
.category-list::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
}
.category-list::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

.category-item {
    margin-bottom: 2px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toggle-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: #ecf0f1;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
    color: #7f8c8d;
}

.toggle-btn:hover {
    background: #3498db;
    color: white;
}

.category-item.open .toggle-btn {
    transform: rotate(90deg);
    background: #3498db;
    color: white;
}

.toggle-placeholder {
    width: 20px;
    flex-shrink: 0;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 8px 10px;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.3;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}

.category-link:hover {
    background: #f8f9fa;
    color: #3498db;
}

.category-link.active {
    background: #3498db;
    color: white;
    font-weight: bold;
}

.category-link.active .count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.category-link .count {
    display: inline-block;
    min-width: 28px;
    padding: 1px 6px;
    background: #ecf0f1;
    border-radius: 10px;
    font-size: 11px;
    color: #7f8c8d;
    text-align: center;
    margin-left: 8px;
    font-weight: normal;
    flex-shrink: 0;
}

/* Подкатегории */
.subcategory-list {
    list-style: none;
    padding: 0 0 0 24px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-item.open .subcategory-list {
    max-height: 1000px;
    margin-top: 2px;
}

.subcategory-list .category-link {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: normal;
    color: #555;
    border-left: 2px solid #ecf0f1;
    border-radius: 0 6px 6px 0;
}

.subcategory-list .category-link:hover {
    background: #f8f9fa;
    border-left-color: #3498db;
    color: #3498db;
}

.subcategory-list .category-link.active {
    background: #e8f4fd;
    color: #3498db;
    border-left-color: #3498db;
    font-weight: bold;
}

.subcategory-list .category-link.active .count {
    background: #3498db;
    color: white;
}