/* C:\apps\my_blog_v1\blog\static\blog\css\category_tree.css */

/* 简化的树形容器样式 */
.tree-container {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 30px;
    min-height: 500px;
}

.search-section {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.tree-node {
    position: relative;
    padding-left: 20px;
    margin: 8px 0;
    transition: all 0.3s ease;
}

.tree-node:hover {
    background-color: rgba(0, 123, 255, 0.05);
    border-radius: 5px;
}

.tree-node-content {
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tree-node-content:hover {
    border-color: #e0e0e0;
    background-color: #f8f9fa;
}

.toggle-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.toggle-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.category-name {
    font-weight: 500;
    color: #343a40;
    flex-grow: 1;
    font-size: 15px;
}

.highlight {
    background-color: #fff3cd;
    padding: 0 4px;
    border-radius: 3px;
    color: #856404;
    font-weight: 600;
}

/* 操作按钮样式 */
.browse-btn, .new-post-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    margin-left: 4px;
    flex-shrink: 0;
    min-width: 40px;
}

.tree-node-content:hover .browse-btn,
.tree-node-content:hover .new-post-btn {
    opacity: 1;
}

.browse-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.new-post-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* 编辑和删除按钮样式 */
.edit-btn, .delete-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    margin-left: 4px;
    flex-shrink: 0;
    min-width: 40px;
}

.tree-node-content:hover .edit-btn,
.tree-node-content:hover .delete-btn {
    opacity: 1;
}

.edit-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.delete-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 新建分类按钮样式 */
.add-subcategory-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    margin-left: 4px;
    flex-shrink: 0;
    min-width: 40px;
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.add-subcategory-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #e0a800;
    color: white;
    border-color: #e0a800;
}

/* 移动按钮样式 */
.move-up-btn, .move-down-btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    margin-left: 2px;
    flex-shrink: 0;
    min-width: 40px;
}

.move-up-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.move-down-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

/* 操作按钮组容器 */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

/* 模态框样式 */
.category-tree-modal .modal-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
}

/* 统计卡片 */
.stats-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.stats-card .stat-icon {
    font-size: 2rem;
    color: #6c757d;
    margin-bottom: 10px;
}

.stats-card .stat-number {
    font-size: 2rem;
    font-weight: 600;
    color: #343a40;
}

.stats-card .stat-label {
    color: #6c757d;
    font-size: 14px;
}

/* 加载动画 */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 新建分类模态框特殊样式 */
.add-subcategory-modal .modal-header {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .browse-btn, .new-post-btn, .edit-btn, .delete-btn, 
    .add-subcategory-btn, .move-up-btn, .move-down-btn {
        font-size: 0.7rem;
        padding: 0.1rem 0.3rem;
        min-width: 35px;
    }
    
    .browse-btn i, .new-post-btn i,
    .edit-btn i, .delete-btn i,
    .add-subcategory-btn i,
    .move-up-btn i, .move-down-btn i {
        margin-right: 2px;
    }
    
    .tree-node-content {
        padding: 10px 12px;
    }
    
    .action-buttons {
        margin-left: 4px;
    }
    
    .search-section {
        padding: 15px;
    }
    
    .tree-container {
        padding: 15px;
    }
}

/* 树根容器 */
.tree-root {
    min-height: 300px;
}

/* 子节点容器 */
.children-container {
    margin-left: 25px;
    padding-left: 15px;
    border-left: 1px dashed #dee2e6;
    transition: all 0.3s ease;
}

/* 当节点展开时子容器的动画效果 */
.children-container.showing {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 当节点折叠时子容器的动画效果 */
.children-container.hiding {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 搜索区域优化 */
.search-section .input-group {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-section .input-group .form-control-lg {
    border: none;
    box-shadow: none;
}

.search-section .input-group .btn-light {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
}

.search-section .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 无搜索结果样式 */
.no-results {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #dee2e6;
}

/* 树节点激活状态 */
.tree-node-content.active {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.tree-node-content.active .category-name {
    color: #1976d2;
    font-weight: 600;
}

/* 表单验证样式 */
.category-form .form-control.is-invalid,
.category-form .form-control.is-valid {
    background-position: right calc(0.375em + 0.1875rem) center;
}

.category-form .invalid-feedback,
.category-form .valid-feedback {
    display: block;
}

/* 移动按钮组优化 */
.move-buttons {
    display: flex;
    gap: 1px;
}

.move-buttons .btn {
    padding: 0.15rem 0.3rem;
}

/* 为移动端优化的操作按钮 */
@media (max-width: 576px) {
    .action-buttons {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .action-buttons .btn {
        margin-bottom: 2px;
    }
    
    .category-name {
        min-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* 树形结构的层级指示线 */
.tree-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #dee2e6;
}

.tree-node:last-child::before {
    height: 50%;
}

.tree-node::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 20px;
    height: 1px;
    background: #dee2e6;
}

/* 根节点的样式调整 */
.tree-node[data-level="0"]::before,
.tree-node[data-level="0"]::after {
    display: none;
}

/* 悬停效果增强 */
.tree-node-content:hover .category-name {
    color: #0d6efd;
}

/* 禁用状态按钮 */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 滚动条样式优化 */
.tree-container::-webkit-scrollbar {
    width: 8px;
}

.tree-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tree-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.tree-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 提示信息样式 */
.category-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    line-height: 1.4;
}

/* 模态框中的表单布局优化 */
.modal-body .form-label {
    font-weight: 500;
    color: #495057;
}

.modal-body .form-text {
    font-size: 0.85rem;
}

/* 紧凑统计栏 - 方案二 */
.compact-stats-bar {
    background: white;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.stats-item {
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.stats-icon {
    width: 32px;
    height: 32px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.stats-icon i {
    font-size: 1rem;
}

.stats-content {
    display: flex;
    flex-direction: column;
}

.stats-number {
    font-size: 1.3rem;
    font-weight: 700;
    color: #343a40;
    line-height: 1.2;
}

.stats-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.stats-divider {
    width: 1px;
    height: 40px;
    background: #e9ecef;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .compact-stats-bar {
        padding: 10px 15px;
    }
    
    .stats-item {
        padding: 0 10px;
    }
    
    .stats-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }
    
    .stats-number {
        font-size: 1.1rem;
    }
    
    .stats-label {
        font-size: 0.75rem;
    }
    
    /* 虚拟滚动优化 */
    .virtual-scroll-container {
        position: relative;
        overflow: auto;
        -webkit-overflow-scrolling: touch; /* 平滑滚动 */
    }

    .virtual-scroll-content {
        position: relative;
        will-change: transform; /* 提示浏览器优化 */
    }

    /* 性能优化类 */
    .performance-optimized {
        contain: content; /* 限制重绘范围 */
        will-change: transform;
    }

    /* 懒加载占位符 */
    .lazy-placeholder {
        height: 48px;
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }

    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    /* 搜索优化 */
    .search-highlight {
        background-color: #fff3cd;
        padding: 1px 3px;
        border-radius: 2px;
        color: #856404;
        font-weight: 600;
    }

    /* 节点状态指示器 */
    .node-status {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        margin-right: 6px;
    }

    .node-status-active {
        background-color: #28a745;
    }

    .node-status-inactive {
        background-color: #6c757d;
    }

    /* 紧凑按钮组 */
    .compact-button-group {
        display: flex;
        gap: 2px;
    }

    .compact-button-group .btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
        line-height: 1.2;
    }

    /* 响应式优化 */
    @media (max-width: 576px) {
        .virtual-node-content {
            padding: 8px 10px;
        }
        
        .compact-button-group {
            flex-wrap: wrap;
        }
        
        .compact-button-group .btn {
            flex: 1;
            min-width: 28px;
            font-size: 0.7rem;
        }
    }

    /* 打印优化 */
    @media print {
        .virtual-scroll-container {
            height: auto !important;
            overflow: visible !important;
        }
        
        .action-buttons {
            display: none !important;
        }
    }

/* 在 category_tree.css 中添加 */
.virtual-node {
    position: absolute;
    left: 0;
    right: 0;
    height: 48px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
    
    /* 性能优化：延迟渲染不可见内容 */
    content-visibility: auto;
    contain-intrinsic-size: 0 48px;  /* 预估高度 */
}

/* 对于大量节点的容器 */
.virtual-scroll-container {
    position: relative;
    height: 600px;
    overflow-y: auto;
    will-change: transform;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    
    /* 性能优化 */
    contain: strict;
    content-visibility: auto;
}

.virtual-scroll-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    
    /* 性能优化 */
    contain: content;
}


}



