/* 레벨별 스타일 */
.level-1 .category-name {
    font-weight: 600;
    font-size: 1.0rem;
}

.level-2 .category-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.level-3 .category-name {
    font-weight: 400;
    font-size: 0.8rem;
    /*color: #495057;*/
}

/* 태그 클라우드 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.tag:hover {
    background-color: #bbdefb;
}


/* 카테고리 트리 */
/* 카테고리 헤더 스타일 */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e9ecef;
}

.category-controls {
    display: flex;
    gap: 0.25rem;
}

.btn-category-expand,
.btn-category-collapse {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.btn-category-expand:hover,
.btn-category-collapse:hover {
    background-color: #f8f9fa;
}

/* 카테고리 트리 스타일 개선 */
.category-tree {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.category-tree::-webkit-scrollbar {
    width: 6px;
}

.category-tree::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.category-tree::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.category-tree::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.category-tree-root {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.category-node {
    margin-bottom: 0.1rem;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 0.2rem 0.1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.category-header:hover {
    background-color: #f8f9fa;
}

.expand-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 0.3rem;
    text-align: center;
    font-size: 0.7rem;
    color: #6c757d;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.expand-icon:not(.collapsed) {
    transform: rotate(90deg);
}

.expand-placeholder {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 0.3rem;
}

.category-name {
    flex: 1;
    color: #333;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.05rem 0.2rem;
    border-radius: 3px;
    transition: all 0.2s ease;
    line-height: 1;
}

.category-name:hover {
    background-color: #e3f2fd;
    color: #1976d2;
}

.category-name.selected {
    background-color: #1976d2;
    color: white;
    font-weight: 600;
}

.category-count {
    font-size: 0.65rem;
    color: #6c757d;
    margin-left: 0.3rem;
    padding: 0.05rem 0.3rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.1;
}

/* 에러 및 로딩 상태 */
.category-tree .loading {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.category-tree .error {
    text-align: center;
    padding: 1rem;
    color: #dc3545;
    font-size: 0.9rem;
}

.category-tree .no-categories {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
}

/* 서브카테고리 스타일 */
.subcategory-list,
.subsubcategory-list {
    list-style: none;
    padding-left: 0.8rem;
    margin: 0.1rem 0;
    border-left: 1px solid #e9ecef;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.subcategory-list.collapsed,
.subsubcategory-list.collapsed {
    max-height: 0;
    opacity: 0;
}

.subcategory-list:not(.collapsed),
.subsubcategory-list:not(.collapsed) {
    max-height: 500px;
    opacity: 1;
}

/* 버튼 스타일 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-outline {
    background-color: transparent;
    color: #333;
    border: 1px solid #ddd;
}

.btn-outline:hover {
    background-color: #f8f9fa;
}

/* 문서 목록 카테고리 스타일 */
.document-category {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 문서 목록 아이템 개선 */
.document-item .document-category {
    margin-bottom: 0.8rem;
}

.category-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    margin-right: 0.2rem;
}

.category-path {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.category-item {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    padding: 0.3rem 0.7rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(25, 118, 210, 0.2);
}

.category-item:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    color: #1565c0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-separator {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0 0.2rem;
}

/* 모바일에서 카테고리 스타일 */
@media (max-width: 768px) {
    .document-category {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .category-label {
        margin-bottom: 0.2rem;
    }
    
    .category-path {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.2rem;
    }
    
    .category-item {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
}


.tab-button {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #6c757d;
    transition: all 0.2s;
}

.tab-button.active {
    background-color: #fff;
    color: #333;
    border-bottom: 2px solid #3498db;
}

.tab-content {
    display: none;
    padding: 1rem;
}

.tab-content.active {
    display: block;
}

.tab-content textarea {
    width: 100%;
    height: 400px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}


.document-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.document-actions .btn-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.document-actions .btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.document-actions .btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.document-actions .btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.document-actions .btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
    transform: translateY(-1px);
}

.document-actions .btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.document-actions .btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
}

.document-actions .btn-outline-secondary {
    background: white;
    color: #6c757d;
    border-color: #6c757d;
}

.document-actions .btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.document-actions .btn-outline-secondary.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.document-actions .markdown-toggle .markdown-btn-icon {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.document-actions .markdown-toggle.active .markdown-btn-icon {
    transform: rotate(180deg);
}

.document-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.actions-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.view-actions-group {
    display: flex;
    gap: 0.5rem;
}