.documentation-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 1rem;
    min-height: calc(100vh - 120px);
    padding: 1rem;
    color: #f2f2f2;
}

.documentation-sidebar {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(160, 160, 160, 0.2);
    border-radius: 12px;
    padding: 1rem;
    overflow: auto;
}

.doc-tree {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.doc-tree-node {
    display: block;
}

.doc-tree-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.doc-tree-children {
    margin-left: 1rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255,255,255,0.1);
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.doc-tree-link {
    flex: 1;
    min-width: 0;
    text-align: left;
    background: transparent;
    color: #f3f3f3;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.doc-tree-link:hover,
.doc-tree-node.selected .doc-tree-link {
    background: rgba(180, 120, 255, 0.18);
    border-color: rgba(180, 120, 255, 0.5);
}

.doc-tree-edit {
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #bdbdbd;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.doc-tree-item:hover .doc-tree-edit,
.doc-tree-edit:focus-visible {
    opacity: 1;
}

.doc-tree-edit:hover,
.doc-tree-edit:focus-visible {
    color: #ffffff;
    background: rgba(180, 120, 255, 0.18);
    border-color: rgba(180, 120, 255, 0.5);
}

.doc-tree-chevron {
    flex: 0 0 0.75rem;
    font-size: 0.65rem;
    color: #bdbdbd;
}

.documentation-content-toolbar {
    display: none;
}

.documentation-content {
    background: rgba(16, 16, 16, 0.9);
    border: 1px solid rgba(160, 160, 160, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    overflow: auto;
}

.documentation-empty {
    color: #bdbdbd;
    padding: 1rem 0;
}

.documentation-editor-layout {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 1.5rem;
    background: rgba(24,24,24,0.92);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    color: #f3f3f3;
}

.documentation-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.documentation-editor-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.documentation-editor-textarea {
    width: 100%;
    min-height: 520px;
    resize: vertical;
    background: rgba(0,0,0,0.2);
    color: #f3f3f3;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 1rem;
    font-family: Consolas, monospace;
}

.documentation-related-assets {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(0,0,0,0.16);
}

.documentation-related-assets-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.documentation-related-assets-heading h4 {
    margin: 0;
    font-size: 1rem;
}

.documentation-related-assets-heading span {
    color: #bdbdbd;
    font-size: 0.85rem;
}

.documentation-related-assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.documentation-asset {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(24,24,24,0.8);
}

.documentation-asset img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #101010;
}

.documentation-asset-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem;
    flex-wrap: wrap;
}

.documentation-asset-details span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f3f3f3;
    font-size: 0.85rem;
}

.documentation-asset-details .btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
}

.documentation-delete-confirmation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    color: #ffe8e8;
    background: rgba(150, 30, 30, 0.2);
    border: 1px solid rgba(255, 120, 120, 0.45);
    border-radius: 8px;
}

.documentation-delete-confirmation > div {
    display: flex;
    gap: 0.5rem;
}

.documentation-editor-status {
    margin-top: 1rem;
    color: #c7f9cc;
}

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

.markdown-viewer {
    color: #f3f3f3;
    line-height: 1.7;
}

.markdown-viewer h1,
.markdown-viewer h2,
.markdown-viewer h3,
.markdown-viewer h4,
.markdown-viewer h5,
.markdown-viewer h6 {
    color: #f0d3ff;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-viewer p,
.markdown-viewer ul,
.markdown-viewer ol,
.markdown-viewer blockquote,
.markdown-viewer table {
    margin-bottom: 1rem;
}

.markdown-viewer img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.markdown-viewer pre {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}

.markdown-viewer code {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.markdown-viewer a {
    color: #d9a5ff;
}

@media (max-width: 768px) {
    .documentation-layout {
        grid-template-columns: 1fr;
        display: block;
        padding: 0.75rem;
    }

    .documentation-sidebar {
        display: none;
        max-height: none;
        margin-bottom: 0.75rem;
    }

    .documentation-sidebar.is-open {
        display: block;
    }

    .documentation-layout.has-document:not(:has(.documentation-sidebar.is-open)) .documentation-content {
        min-height: calc(100vh - 100px);
    }

    .documentation-content {
        min-height: 0;
        padding: 1rem;
    }

    .documentation-content-toolbar {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .documentation-mobile-action {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        padding: 0.45rem 0.65rem;
        color: #f3f3f3;
        background: rgba(180, 120, 255, 0.14);
        border: 1px solid rgba(180, 120, 255, 0.4);
        border-radius: 6px;
        cursor: pointer;
    }

    .documentation-mobile-edit {
        margin-left: auto;
    }
}

@media (max-width: 600px) {
    .documentation-delete-confirmation {
        align-items: stretch;
        flex-direction: column;
    }
}
