* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #2C2C2C;
    background: linear-gradient(135deg, #e8f0e3 0%, #d4e8c5 50%, #c8dfb8 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(90deg, #2A3B2D, #3d5a40);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background-color: #4A7C59;
    color: white;
    border-color: #4A7C59;
}

.btn-primary:hover {
    background-color: #3d6a4b;
    border-color: #3d6a4b;
    color: white;
    text-decoration: none;
}

.btn-outline {
    background-color: transparent;
    color: white;
    border-color: white;
}

.btn-outline:hover {
    background-color: white;
    color: #4A7C59;
    text-decoration: none;
}

/* Card style matching register page */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}

.card-accent {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.10);
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
}

.card-accent::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4A7C59, #8B6F47);
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #8B7D6B;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.user-avatar:hover {
    background-color: #4E3219;
}

.user-greeting {
    font-size: 1.1rem;
    color: white;
    white-space: nowrap;
    font-weight: 600;
    line-height: 40px;
}

#userMenu {
    align-items: center;
    gap: 10px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 150px;
    z-index: 1000;
    display: none;
    margin-top: 5px;
    overflow: hidden;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
    color: #333;
    text-decoration: none;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

header h1 {
    font-size: 1.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

main {
    padding: 2rem 0;
    flex: 1;
}

.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, #4A7C59 0%, #3d6a4b 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

section {
    margin-bottom: 3rem;
}

section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2C2C2C;
}

.promotions-grid,
.products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.promotion-card,
.product-card {
    background: white;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    position: relative;
}

/* Бейдж акции на карточке товара */
.product-card .promo-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: #C0392B;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    letter-spacing: 0.3px;
}

.product-card.has-promo {
    border: 1px solid rgba(192,57,43,0.25);
}

/* Цена со скидкой: старая зачёркнутая + новая выделенная */
.product-card .price-old {
    color: #999;
    text-decoration: line-through;
    font-size: 0.95rem;
    font-weight: 500;
    margin-right: 8px;
}

.product-card .price-new {
    color: #C0392B;
    font-weight: 700;
}

/* Промо-баннер и цены на странице товара (product.html) */
.promo-banner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(192,57,43,0.1);
    color: #C0392B;
    border: 1px solid rgba(192,57,43,0.25);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.promo-banner .promo-percent {
    background: #C0392B;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.product-price-stock .price-old {
    color: #999;
    text-decoration: line-through;
    margin-right: 10px;
    font-weight: 500;
}

.product-price-stock .price-new {
    color: #C0392B;
    font-weight: 700;
}

.promotion-card:hover,
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.promotion-card img,
.product-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    margin: 0;
    display: block;
}

.product-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2C2C2C;
    line-height: 1.4;
    min-height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card .description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    min-height: 4.2em;
}

.promotion-card h3,
.product-card .price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4A7C59;
    margin: 0.5rem 0;
}

.product-card .stock {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.btn {
    background-color: #4A7C59;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background-color: #3d6a4b;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.search-scope {
    padding: 0.75rem 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    color: #555;
    background: white;
    cursor: pointer;
    max-width: 180px;
    outline: none;
}

.search-scope:focus {
    border-color: #4A6E4D;
}

.cart-section {
    position: fixed;
    bottom: 20px;
    right: 20px;
}

.cart-btn {
    position: relative;
    background-color: #674422;
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.cart-btn:hover {
    background-color: #4E3219;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content input,
.modal-content textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.modal-content textarea {
    min-height: 100px;
    resize: vertical;
}

footer {
    background: linear-gradient(90deg, #2A3B2D, #3d5a40);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #8B7D6B;
    font-size: 1.2rem;
    font-weight: bold;
}

.product-card .stock {
    font-size: 0.9rem;
    color: #666;
    margin: 5px 0;
}

.product-card .stock.stock-low {
    color: #f39c12;
    font-weight: 600;
    background: #fef3e7;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #f39c12;
}

.product-card .stock.stock-out {
    color: #dc3545;
    font-weight: 600;
    background: #f8d7da;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dc3545;
}

.product-card .btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.product-card .btn:disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

.discount {
    color: #C62828;
    font-weight: bold;
}

/* Современная пагинация */
.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-controls .btn {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 14px;
    padding: 0 12px;
}

.pagination-controls .btn:hover:not(:disabled) {
    background: #4A7C59;
    color: white;
    border-color: #4A7C59;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 124, 89, 0.3);
}

.pagination-controls .btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.pagination-controls .btn:disabled {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pagination-controls .btn-primary {
    background: #4A7C59;
    color: white;
    border-color: #4A7C59;
}

.pagination-controls .btn-primary:hover:not(:disabled) {
    background: #3d6a4b;
    border-color: #3d6a4b;
}

.pagination-controls .btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.pagination-controls .btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    border-color: #5a6268;
}

.pagination-controls .btn-outline {
    background: white;
    color: #3498db;
    border-color: #3498db;
}

.pagination-controls .btn-outline:hover:not(:disabled) {
    background: #3498db;
    color: white;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    color: #6c757d;
    font-weight: 500;
    font-size: 16px;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    font-size: 14px;
}

.pagination-info .total-products {
    font-weight: 500;
    color: #495057;
}

/* Улучшенные состояния для товаров */
.products-grid {
    transition: opacity 0.3s ease;
    min-height: 400px;
}

.no-products, .error-message {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
}

.no-products p, .error-message p {
    margin: 0;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

/* Анимации для плавных переходов */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card {
    animation: fadeIn 0.3s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

/* Ноутбуки и небольшие десктопы (769–1200px): 4 колонки */
@media (min-width: 769px) and (max-width: 1200px) {
    .promotions-grid,
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Планшеты и меньше (≤768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    /* Header: вертикальная компоновка */
    header .container {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        text-align: center;
    }

    header h1 {
        font-size: 1.2rem;
        width: 100%;
    }

    .main-nav {
        gap: 12px;
        font-size: 0.9rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-nav a {
        margin-left: 0;
    }

    .user-area {
        width: 100%;
        justify-content: center;
    }

    .user-greeting {
        display: none;
    }

    .auth-buttons {
        gap: 6px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Hero */
    .hero {
        padding: 2rem 1rem;
        border-radius: 8px;
    }

    .hero h2 {
        font-size: 1.6rem;
    }

    /* Сетка товаров: 2 колонки */
    .promotions-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Каталог: sidebar скрыт, кнопка открытия видна */
    .sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    .catalog-sidebar:not(.collapsed) ~ .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .catalog-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        height: 100vh;
        max-height: 100vh;
        margin-left: -280px;
        width: 280px;
        min-width: 280px;
        box-shadow: 2px 0 20px rgba(0,0,0,0.15);
        transition: margin-left 0.25s ease;
    }

    .catalog-sidebar:not(.collapsed) {
        margin-left: 0;
    }

    .sidebar-open-btn {
        display: inline-flex;
    }

    .sidebar-toggle {
        display: block;
    }

    .catalog-main {
        padding: 12px;
    }

    .catalog-topbar {
        gap: 8px;
    }

    .catalog-breadcrumb {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }

    .product-card img {
        height: 180px;
    }

    .product-card-content {
        padding: 10px;
    }

    .product-card h3 {
        font-size: 0.95rem;
        min-height: auto;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .product-card .price {
        font-size: 1.1rem;
    }

    .product-card .description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        min-height: auto;
    }

    .product-card .stock {
        font-size: 0.78rem;
    }

    /* Поиск */
    .search-box {
        flex-direction: column;
        gap: 8px;
    }

    .search-box input {
        width: 100%;
    }

    .search-box button {
        width: 100%;
    }

    .search-scope {
        max-width: 100%;
        font-size: 0.8rem;
    }

    /* Модальные окна */
    .modal-content {
        margin: 10% auto;
        padding: 16px;
        width: 95%;
        max-height: 85vh;
        border-radius: 8px;
    }

    .modal-content h2 {
        font-size: 1.2rem;
    }

    /* Корзина — кнопка меньше */
    .cart-btn {
        width: 48px;
        height: 48px;
        padding: 0;
        border-radius: 50%;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-section {
        bottom: 16px;
        right: 16px;
    }

    /* Пагинация */
    .pagination-wrapper {
        gap: 10px;
        margin: 20px 0;
    }

    .pagination-controls {
        gap: 4px;
    }

    .pagination-controls .btn {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
        padding: 0 6px;
    }

    .pagination-ellipsis {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .pagination-info {
        font-size: 12px;
    }

    /* Footer */
    footer {
        padding: 1.2rem 0;
        font-size: 0.85rem;
    }

    section h2 {
        font-size: 1.3rem;
    }
}

/* Телефоны (≤480px) */
@media (max-width: 480px) {
    /* Сетка товаров: 2 колонки как в Ozon/WB */
    .promotions-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card img {
        height: 140px;
    }

    .product-card-content {
        padding: 8px;
    }

    .product-card h3 {
        font-size: 0.82rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        min-height: auto;
    }

    .product-card .price {
        font-size: 0.95rem;
        margin: 4px 0;
    }

    .product-card .stock {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .product-card .btn {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    /* Header ещё компактнее */
    header h1 {
        font-size: 1.1rem;
    }

    .main-nav {
        gap: 8px;
        font-size: 0.8rem;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Модалки на весь экран */
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 20px 14px;
    }

    /* Корзина — элементы компактнее */
    .cart-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 0;
    }

    /* Пагинация — кнопки меньше */
    .pagination-controls .btn {
        min-width: 32px;
        height: 32px;
        font-size: 11px;
        padding: 0 4px;
    }

    .pagination-ellipsis {
        min-width: 28px;
        height: 32px;
        font-size: 11px;
    }

    /* Скрываем кнопки «в начало/в конец» на очень узких экранах */
    #firstPageBtn, #lastPageBtn {
        display: none;
    }
}

/* ========================================
   КАТАЛОГ: LAYOUT (sidebar + main)
   ======================================== */
.catalog-layout {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 0;
    padding: 0;
    flex: 1;
}

/* --- SIDEBAR --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 999;
}

.catalog-sidebar {
    width: 250px;
    min-width: 250px;
    background: #FAFBFA;
    border-right: 1px solid #E8EDE8;
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    position: sticky;
    top: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #E8EDE8;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #2A3B2D;
    margin: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    background: #E8EDE8;
    color: #555;
}

.sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid #E8EDE8;
}

.sidebar-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #D8DDD8;
    border-radius: 6px;
    font-size: 0.82rem;
    background: white;
    color: #333;
    outline: none;
    box-sizing: border-box;
}

.sidebar-search input:focus {
    border-color: #4A6E4D;
    box-shadow: 0 0 0 2px rgba(74,110,77,0.12);
}

/* --- CATEGORY TREE --- */
.category-tree {
    padding: 6px 0;
}

.tree-loading {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #444;
    transition: background 0.12s;
    border-left: 3px solid transparent;
    user-select: none;
    gap: 6px;
}

.tree-item:hover {
    background: #EDF3ED;
}

.tree-item.active {
    background: #E2EDE3;
    color: #2A3B2D;
    font-weight: 600;
    border-left-color: #4A6E4D;
}

.tree-item .tree-icon {
    width: 18px;
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.tree-item.expanded .tree-icon {
    transform: rotate(90deg);
}

.tree-item .tree-icon.leaf {
    visibility: hidden;
}

.tree-item .tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item .tree-count {
    font-size: 0.72rem;
    color: #aaa;
    background: #f0f0f0;
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.tree-children {
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.tree-children.collapsed {
    max-height: 0 !important;
}

.tree-children .tree-item {
    padding-left: 36px;
    font-size: 0.84rem;
}

.tree-item.hidden-by-filter {
    display: none;
}

/* --- MAIN AREA --- */
.catalog-main {
    flex: 1;
    min-width: 0;
    padding: 20px 24px;
}

.catalog-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sidebar-open-btn {
    display: none;
    white-space: nowrap;
}

.catalog-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #888;
    flex-wrap: wrap;
    margin-left: auto;
}

.breadcrumb-item {
    color: #888;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.12s;
    white-space: nowrap;
}

.breadcrumb-item:hover {
    background: #f0f0f0;
    color: #555;
}

.breadcrumb-item.active {
    color: #2A3B2D;
    font-weight: 600;
}

.breadcrumb-sep {
    color: #ccc;
}

/* ========================================
   ФИЛЬТР ПО КАТЕГОРИЯМ (чипы) — оставлен для обратной совместимости
   ======================================== */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chip {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid #ccc;
    background: #f9f9f9;
    color: #555;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.3;
}

.chip:hover {
    border-color: #4A6E4D;
    color: #2A3B2D;
    background: #EDF3ED;
}

.chip.active {
    background: #4A6E4D;
    border-color: #4A6E4D;
    color: white;
    font-weight: 600;
}

/* Второй ряд — подкатегории */
.subcategory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -10px 0 20px;
    padding: 10px 16px;
    background: #F4F8F4;
    border-radius: 10px;
    border: 1px dashed #C7D8C8;
}

.subcategory-chips[hidden] {
    display: none;
}

.chip-sub {
    padding: 5px 12px;
    font-size: 0.82rem;
    background: white;
    border-color: #C7D8C8;
    color: #2A3B2D;
}

.chip-sub.active {
    background: #6FA374;
    border-color: #6FA374;
    color: white;
}

.chip-arrow {
    font-size: 0.7em;
    margin-left: 4px;
    opacity: 0.7;
}

@media (max-width: 480px) {
    .category-chips {
        gap: 6px;
        padding: 10px 12px;
    }
    .chip {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
    .subcategory-chips {
        gap: 5px;
        padding: 8px 12px;
    }
    .chip-sub {
        padding: 4px 10px;
        font-size: 0.78rem;
    }
}

