/* Knowledge Editor Styles */

.knowledge-layout {
    display: flex;
    height: calc(100vh - 3.5rem);
    overflow: hidden;
}

.knowledge-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
}

.dark .knowledge-sidebar {
    background: #1f2937;
    border-right-color: #374151;
}

.knowledge-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    max-width: 100%;
}

.knowledge-content.full-width {
    max-width: 100%;
}

.knowledge-content-inner {
    max-width: 800px;
    margin: 0 auto;
}

.knowledge-content.full-width .knowledge-content-inner {
    max-width: 100%;
}

/* Tree sidebar */
.tree-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 0.75rem 1rem 0.25rem;
    font-weight: 600;
}

.dark .tree-section-title {
    color: #9ca3af;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    margin: 0 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s;
    gap: 0.25rem;
}

.tree-item:hover {
    background-color: #e5e7eb;
}

.dark .tree-item {
    color: #d1d5db;
}

.dark .tree-item:hover {
    background-color: #374151;
}

.tree-item.active {
    background-color: #dbeafe;
    color: #1d4ed8;
    font-weight: 500;
}

.dark .tree-item.active {
    background-color: #1e3a5f;
    color: #60a5fa;
}

.tree-item-icon {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

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

.tree-toggle {
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #9ca3af;
    transition: transform 0.15s;
    cursor: pointer;
    border-radius: 0.25rem;
}

.tree-toggle:hover {
    background-color: #d1d5db;
}

.dark .tree-toggle:hover {
    background-color: #4b5563;
}

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

.tree-children {
    padding-left: 1rem;
}

.tree-item-actions {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

.tree-item:hover .tree-item-actions {
    display: flex;
}

.tree-action-btn {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    color: #9ca3af;
    font-size: 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
}

.tree-action-btn:hover {
    background-color: #d1d5db;
    color: #374151;
}

.dark .tree-action-btn:hover {
    background-color: #4b5563;
    color: #d1d5db;
}

/* Editor toolbar */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    background: #f9fafb;
}

.dark .editor-toolbar {
    background: #1f2937;
    border-color: #374151;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .toolbar-btn:hover {
    background: #374151;
    color: #d1d5db;
}

.toolbar-btn-active {
    background: #dbeafe;
    color: #2563eb;
}

.dark .toolbar-btn-active {
    background: #1e3a5f;
    color: #60a5fa;
}

.toolbar-separator {
    width: 1px;
    height: 1.5rem;
    background: #e5e7eb;
    margin: 0.25rem 0.25rem;
    align-self: center;
}

.dark .toolbar-separator {
    background: #374151;
}

/* Editor content area */
.editor-wrapper {
    position: relative;
}

.knowledge-editor-content {
    min-height: 400px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 0.5rem 0.5rem;
    outline: none;
    font-size: 1rem;
    line-height: 1.75;
    color: #111827;
}

.dark .knowledge-editor-content {
    border-color: #374151;
    color: #f3f4f6;
    background: #111827;
}

.knowledge-editor-content:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* TipTap content styles */
.knowledge-editor-content h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    line-height: 1.2;
}

.knowledge-editor-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    line-height: 1.3;
}

.knowledge-editor-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    line-height: 1.4;
}

.knowledge-editor-content p {
    margin: 0.5rem 0;
}

.knowledge-editor-content ul,
.knowledge-editor-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.knowledge-editor-content li {
    margin: 0.25rem 0;
}

.knowledge-editor-content ul[data-type="taskList"] {
    list-style: none;
    padding-left: 0;
}

.knowledge-editor-content ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.knowledge-editor-content ul[data-type="taskList"] li label {
    margin-top: 0.25rem;
}

.knowledge-editor-content blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: #6b7280;
}

.dark .knowledge-editor-content blockquote {
    border-left-color: #4b5563;
    color: #9ca3af;
}

.knowledge-editor-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875rem;
}

.knowledge-editor-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875em;
}

.dark .knowledge-editor-content code {
    background: #374151;
}

.knowledge-editor-content pre code {
    background: none;
    padding: 0;
}

.knowledge-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

.knowledge-editor-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 1.5rem 0;
}

.dark .knowledge-editor-content hr {
    border-top-color: #374151;
}

.knowledge-editor-content mark {
    background-color: #fef08a;
    padding: 0.125rem 0;
    border-radius: 0.125rem;
}

.dark .knowledge-editor-content mark {
    background-color: #854d0e;
}

.knowledge-editor-content a {
    color: #2563eb;
    text-decoration: underline;
}

.dark .knowledge-editor-content a {
    color: #60a5fa;
}

.knowledge-editor-content .is-empty::before {
    content: attr(data-placeholder);
    float: left;
    color: #9ca3af;
    pointer-events: none;
    height: 0;
}

/* Slash command menu */
.slash-menu {
    position: fixed;
    z-index: 50;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 0.25rem;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.dark .slash-menu {
    background: #1f2937;
    border-color: #374151;
}

.slash-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
    text-align: left;
}

.slash-menu-item:hover {
    background: #f3f4f6;
}

.dark .slash-menu-item {
    color: #d1d5db;
}

.dark .slash-menu-item:hover {
    background: #374151;
}

.slash-menu-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.dark .slash-menu-icon {
    background: #374151;
}

/* Save indicator */
.save-indicator {
    transition: opacity 0.3s;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Article title input */
.article-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    background: transparent;
    padding: 0;
    margin-bottom: 0.5rem;
}

.article-title-input::placeholder {
    color: #d1d5db;
}

.dark .article-title-input {
    color: #f3f4f6;
}

.dark .article-title-input::placeholder {
    color: #4b5563;
}

/* Search */
.knowledge-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    outline: none;
}

.knowledge-search-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .knowledge-search-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

/* Empty state */
.knowledge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.knowledge-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .knowledge-sidebar {
        display: none;
    }

    .knowledge-content {
        padding: 1rem;
    }
}
