/* Основные стили модуля */
.jb-categories-module {
    font-family: Arial, sans-serif;
    margin: 20px 0;
}

/* Общие стили */
.category-count,
.badge,
.count {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    margin-left: 5px;
}

.btn-view,
.view-category {
    background: #007bff4a;
    color: white;
    padding: 5px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin-left: 10px;
}

.btn-view:hover,
.view-category:hover {
    background: #0056b3;
    text-decoration: none;
}

/* Стили для древовидного макета */
.jb-layout-tree .jb-category-tree {
    list-style: none;
    padding-left: 0;
}

.jb-layout-tree .category-item {
   margin-bottom: 10px;
   /*  border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px; */
}

.jb-layout-tree .category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.jb-layout-tree .category-image {
    width: 50px;
    height: 50px;
    margin-right: 15px;
}

.jb-layout-tree .category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.jb-layout-tree .category-info {
    flex-grow: 1;
}

.jb-layout-tree .category-title {
    margin: 0;
    font-size: 1.1em;
}

.jb-layout-tree .category-actions {
    display: flex;
    gap: 10px;
}

.jb-layout-tree .toggle-children {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.jb-layout-tree .toggle-children:hover {
    background: #218838;
}

.jb-layout-tree .category-children {
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
}

/* Стили для плитки */
.jb-layout-grid .categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.jb-layout-grid .category-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.jb-layout-grid .category-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.jb-layout-grid .card-image {
    height: 150px;
    overflow: hidden;
}

.jb-layout-grid .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.jb-layout-grid .category-card:hover .card-image img {
    transform: scale(1.05);
}

.jb-layout-grid .card-body {
    padding: 15px;
}

.jb-layout-grid .card-title {
    margin: 0 0 10px 0;
}

.jb-layout-grid .card-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* Стили для списка */
.jb-layout-list .categories-list {
    list-style: none;
    padding: 0;
}

.jb-layout-list .list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.jb-layout-list .list-item:last-child {
    border-bottom: none;
}

.jb-layout-list .list-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
}

.jb-layout-list .list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.jb-layout-list .list-content {
    flex-grow: 1;
}

.jb-layout-list .list-title {
    margin: 0 0 5px 0;
}

.jb-layout-list .list-description {
    color: #666;
    font-size: 0.9em;
}

/* Стили для облака тегов */
.jb-layout-tagcloud .tagcloud {
    text-align: center;
    line-height: 2.5;
}

.jb-layout-tagcloud .tag-item {
    display: inline-block;
    margin: 5px 10px;
}

.jb-layout-tagcloud .tag-link {
    color: #333;
    text-decoration: none;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 20px;
    transition: all 0.3s;
}

.jb-layout-tagcloud .tag-link:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
}

.jb-layout-tagcloud .tag-count {
    font-size: 0.8em;
    opacity: 0.8;
}
/* Добавляем в конец файла */

/* Колоночная верстка */
.columns-2 .jb-category-tree.level-1 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.columns-3 .jb-category-tree.level-1 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Для вложенных уровней оставляем одну колонку */
.columns-2 .jb-category-tree.level-2,
.columns-2 .jb-category-tree.level-3,
.columns-3 .jb-category-tree.level-2,
.columns-3 .jb-category-tree.level-3 {
    display: block;
    grid-template-columns: 1fr;
}

/* Стили для строки категории с возможностью клика */
.category-row {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
   /* margin-bottom: 10px; */
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.category-row:hover {
    background: #f8f9fa;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-color: #007bff;
}

/* Контент категории */
.category-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-grow: 1;
    min-height: 40px;
}

.category-info {
    flex-grow: 1;
}

.category-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.category-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.category-title a:hover {
    color: #007bff;
}

.category-count {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

/* Итоговые суммы */
.module-totals {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
}

.total-categories, .total-offers {
    flex: 1;
    text-align: center;
}

.total-categories strong, .total-offers strong {
    color: #007bff;
    font-size: 18px;
    display: block;
    margin-top: 5px;
}

/* Кнопки действий */
.category-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

.toggle-children {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.toggle-children:hover {
    background: #218838;
    transform: scale(1.1);
}

.toggle-children.expanded {
    background: #dc3545;
}

.toggle-children.expanded:hover {
    background: #c82333;
}

.view-category {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #007bff4a;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.view-category:hover {
    background: #0056b3;
    transform: scale(1.1);
}

/* Подкатегории */
.category-children {
    margin-left: 30px;
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
    display: none;
}

.category-children.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .columns-2 .jb-category-tree.level-1,
    .columns-3 .jb-category-tree.level-1 {
        grid-template-columns: 1fr;
    }
    
    .module-totals {
        flex-direction: column;
        gap: 10px;
    }
    
    .category-row {
        padding: 8px 12px;
    }
    
    .category-title {
        font-size: 14px;
    }
    
    .category-count {
        font-size: 11px;
        padding: 1px 6px;
    }
}
