/* ========== СТРАНИЦА КАТЕГОРИИ ========== */
.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* ========== БОКОВАЯ ПАНЕЛЬ ========== */
.category-sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e7e7e7;
}

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

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #111;
}

/* Дерево категорий в боковой панели */
.category-tree {
    margin-top: 0.5rem;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.tree-link {
    color: #0066c0;
    text-decoration: none;
}

.tree-link:hover {
    color: #c45500;
    text-decoration: underline;
}

.tree-arrow {
    color: #999;
    font-size: 0.8rem;
}

.tree-current {
    font-weight: 600;
    color: #111;
}

.tree-children {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e7e7e7;
}

.tree-item.child {
    margin-bottom: 0.3rem;
}

.tree-item.child .tree-link {
    color: #0066c0;
    font-size: 0.85rem;
}

/* Фильтр цен */
.price-filter {
    margin-top: 0.5rem;
}

.price-filter input[type="range"] {
    width: 100%;
    margin-bottom: 0.8rem;
}

.price-inputs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.price-inputs input {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    box-sizing: border-box;
}

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

/* Фильтр брендов */
.filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-list li {
    margin-bottom: 0.5rem;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #111;
}

.filter-checkbox input {
    cursor: pointer;
}

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

/* Кнопки фильтров */
.btn-apply-filter {
    width: 100%;
    padding: 10px;
    background-color: #ff9900;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.btn-apply-filter:hover {
    background-color: #e68900;
}

.btn-reset-filters {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 8px;
    background-color: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-reset-filters:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* Стили для полей ввода цены */
.price-inputs {
    display: flex;
    gap: 10px;
}

.price-inputs input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

/* Стили для чекбоксов */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.filter-checkbox input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-checkbox:hover {
    color: #ff9900;
}
/* Блок активных фильтров */
.active-filters {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.active-filters-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    color: #333;
    transition: all 0.2s;
}

.filter-tag:hover {
    border-color: #ff9900;
    background: #fffaf0;
}

.filter-tag-label {
    font-weight: 500;
}

.filter-tag-value {
    color: #666;
}

.filter-tag-remove {
    cursor: pointer;
    color: #999;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.filter-tag-remove:hover {
    color: #ff4444;
}

.btn-clear-all {
    background: none;
    border: none;
    color: #ff9900;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 20px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-clear-all:hover {
    background: #fff0e0;
    color: #e68900;
}

/* Стили для кнопки сброса в сайдбаре (скрываем, так как теперь есть сверху) */
.sidebar-section .btn-reset-filters,
.sidebar-section .reset-filters-btn {
    display: none;
}

/* ========== ОСНОВНОЙ КОНТЕНТ ========== */
.brand-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand-header .brand-logo {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
}

.brand-header h1 {
    margin: 0;
    font-size: 28px;
}

.brand-header p {
    margin: 10px 0 0;
    color: #666;
}

.category-header {
    margin-bottom: 1.5rem;
}

.category-header h1 {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #111;
}

.category-description {
    color: #565959;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.category-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 0.8rem 0;
    border-top: 1px solid #e7e7e7;
    border-bottom: 1px solid #e7e7e7;
}

.category-sort label {
    font-size: 0.85rem;
    color: #565959;
}

.category-sort select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
    cursor: pointer;
}

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

/* ========== СЕТКА ТОВАРОВ ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Изображение товара */
.product-image {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    background: #f8f8f8;
    border-radius: 4px;
    overflow: hidden;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-placeholder {
    font-size: 3rem;
    color: #ccc;
}

/* Ссылка изображения товара */
.product-image-link {
    display: block;
    text-decoration: none;
}

.product-image-link:hover .product-image {
    opacity: 0.9;
}

/* Название товара */
.product-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #111;
    text-decoration: none;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-title:hover {
    color: #c45500;
    text-decoration: underline;
}

/* Рейтинг */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.stars {
    color: #ffa41c;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.rating-count {
    color: #666;
    font-size: 0.75rem;
}

/* Цена */
.product-price {
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 52px;
}

.old-price {
    text-decoration: line-through;
    color: #666;
    font-size: 0.8rem;
    line-height: 1.3;
    display: block;
}

.current-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #b12704;
    line-height: 1.2;
    display: block;
}

.product-price:not(:has(.old-price))::before {
    content: "";
    display: block;
    height: 20px;
    visibility: hidden;
}
@media (max-width: 480px) {
    .product-price {
        min-height: 44px;
        gap: 2px;
    }
    
    .old-price {
        font-size: 0.7rem;
    }
    
    .current-price {
        font-size: 1rem;
    }
    
    .product-price:not(:has(.old-price))::before {
        height: 16px;
    }
}

/* Кнопка добавления в корзину */
.btn-add-to-cart {
    width: 100%;
    padding: 0.6rem;
    background: #ff9900;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #000000;
    transition: background 0.2s;
}

.btn-add-to-cart:hover {
    background: #e68900;
}

/* ========== ПАГИНАЦИЯ ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.page-link,
.page-current {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #111;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f7f7f7;
    border-color: #c45500;
    color: #c45500;
}

.page-current {
    background: #c9daf8;
    border-color: #c9daf8;
    font-weight: 500;
}

.page-dots {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    color: #666;
    font-size: 0.85rem;
}

/* ========== СООБЩЕНИЕ ОБ ОТСУТСТВИИ ТОВАРОВ ========== */
.no-products {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1rem;
    background: #fff;
    border-radius: 8px;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .category-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-sidebar {
        order: 2;
    }
    
    .category-main {
        order: 1;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.8rem;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-title {
        font-size: 0.85rem;
        min-height: 2.5rem;
    }
    
    .current-price {
        font-size: 1rem;
    }
    
    .category-header h1 {
        font-size: 1.4rem;
    }
    
    .category-sort {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.6rem;
    }
    
    .product-card {
        padding: 0.6rem;
    }
    
    .product-image {
        height: 120px;
    }
    
    .btn-add-to-cart {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    .price-inputs {
        flex-wrap: wrap;
    }
    
    .price-inputs input {
        width: 100%;
    }
}

.btn-add-to-cart.disabled,
.btn-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-add-to-cart.disabled:hover,
.btn-add-to-cart:disabled:hover {
    background: #ccc;
}

/* Скрываем кнопку на десктопе */
.toggle-filters-checkbox,
.toggle-filters-label {
    display: none;
}

@media (max-width: 768px) {
    .category-layout {
        display: flex;
        flex-direction: column;
    }
    
    .category-sidebar {
        order: 1;
        margin-bottom: 1rem;
        background: #fff;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .category-main {
        order: 2;
    }
    
    /* Показываем чекбокс и кнопку на мобильных */
    .toggle-filters-checkbox {
        display: none !important;
    }
    
    .toggle-filters-label {
        display: block;
        padding: 12px 16px;
        background: #f8f9fa;
        font-weight: 600;
        font-size: 14px;
        cursor: pointer;
        border-bottom: 1px solid #e7e7e7;
        user-select: none;
        position: relative;
        margin: 0;
    }
    
    .toggle-filters-label::after {
        content: "▼";
        position: absolute;
        right: 16px;
        font-size: 12px;
        transition: transform 0.2s;
    }
    
    /* Скрываем форму по умолчанию на мобильных */
    .category-sidebar > form {
        display: none;
    }
    
    /* Показываем форму при активации чекбокса */
    .toggle-filters-checkbox:checked ~ form {
        display: block;
    }
    
    /* Меняем стрелку при открытии */
    .toggle-filters-checkbox:checked + .toggle-filters-label::after {
        transform: rotate(180deg);
    }
    
    /* Стили для секций внутри формы */
    .category-sidebar .sidebar-section {
        padding: 12px 16px;
        border-bottom: 1px solid #e7e7e7;
        margin-bottom: 0;
    }
    
    .category-sidebar .sidebar-section:last-child {
        border-bottom: none;
    }
}