/* Usage Page Styles */
.kui-usage {
    display: flex;
    gap: 20px;
    height: 100%;
    padding: 20px;
    background: transparent;
    min-height: 0;
}

/* Left Panel */
.kui-usage > .left {
    width: 280px;
    min-width: 280px;
    background: var(--kui-bgcolor, #fff);
    border-radius: 12px;
    border: 1px solid var(--kui-color-border, #e8e8e8);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar */
.kui-usage > .left > .toolbar {
    display: flex;
    gap: 6px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--kui-color-border, #e8e8e8);
    background: rgba(24, 144, 255, 0.02);
}

.kui-usage > .left > .toolbar .kui-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 1px solid var(--kui-color-border, #d9d9d9);
    background: var(--kui-bgcolor, #fff);
    color: var(--kui-color, #2c3e50);
    user-select: none;
}

.kui-usage > .left > .toolbar .kui-btn:hover {
    border-color: var(--kui-primary-color, #1890ff);
    color: var(--kui-primary-color, #1890ff);
    background: rgba(24, 144, 255, 0.04);
}

.kui-usage > .left > .toolbar .kui-btn.primary {
    border-color: var(--kui-primary-color, #1890ff);
    background: var(--kui-primary-color, #1890ff);
    color: #fff;
}

.kui-usage > .left > .toolbar .kui-btn.primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

.kui-usage > .left > .toolbar .kui-btn.danger {
    color: #ff4d4f;
    border-color: #ff4d4f;
}

.kui-usage > .left > .toolbar .kui-btn.danger:hover {
    background: #ff4d4f;
    color: #fff;
}

/* Tree Area */
.kui-usage > .left .ant-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.kui-usage > .left .ant-tree .ant-tree-node-content-wrapper {
    padding: 4px 12px;
    border-radius: 6px;
    margin: 2px 8px;
    transition: all 0.15s ease;
    word-break: break-word;
    overflow-wrap: break-word;
}

.kui-usage > .left .ant-tree .ant-tree-node-content-wrapper:hover {
    background: rgba(24, 144, 255, 0.06);
}

.kui-usage > .left .ant-tree .ant-tree-node-selected .ant-tree-node-content-wrapper {
    background: rgba(24, 144, 255, 0.1);
    color: var(--kui-primary-color, #1890ff);
    font-weight: 500;
}

.kui-usage > .left .ant-tree .ant-tree-title {
    font-size: 13px;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Right Panel */
.kui-usage > .right {
    flex: 1;
    min-width: 0;
    background: var(--kui-bgcolor, #fff);
    border-radius: 12px;
    border: 1px solid var(--kui-color-border, #e8e8e8);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 16px 32px 28px;
    overflow-y: auto;
}

/* Empty State */
.kui-usage > .right .kui-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #bbb;
    font-size: 15px;
    flex-direction: column;
}

.kui-usage > .right .kui-empty::before {
    content: "📚";
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* Markdown Content */
.kui-usage > .right .kui-markdown {
    line-height: 1.8;
    color: var(--kui-color, #2c3e50);
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.kui-usage > .right .kui-markdown h1,
.kui-usage > .right .kui-markdown h2,
.kui-usage > .right .kui-markdown h3,
.kui-usage > .right .kui-markdown h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--kui-color, #1a1a2e);
    line-height: 1.4;
}

.kui-usage > .right .kui-markdown h1 {
    font-size: 22px;
    border-bottom: 2px solid var(--kui-primary-color, #1890ff);
    padding-bottom: 8px;
}

.kui-usage > .right .kui-markdown h2 {
    font-size: 18px;
    border-bottom: 1px solid var(--kui-color-border, #e8e8e8);
    padding-bottom: 6px;
}

.kui-usage > .right .kui-markdown h3 {
    font-size: 16px;
}

.kui-usage > .right .kui-markdown p {
    margin-bottom: 12px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.kui-usage > .right .kui-markdown ul,
.kui-usage > .right .kui-markdown ol {
    margin: 8px 0 12px 20px;
}

.kui-usage > .right .kui-markdown li {
    margin-bottom: 4px;
}

.kui-usage > .right .kui-markdown a {
    color: var(--kui-primary-color, #1890ff);
    text-decoration: none;
}

.kui-usage > .right .kui-markdown a:hover {
    text-decoration: underline;
}

.kui-usage > .right .kui-markdown img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid var(--kui-color-border, #e8e8e8);
}

.kui-usage > .right .kui-markdown blockquote {
    margin: 12px 0;
    padding: 10px 16px;
    border-left: 4px solid var(--kui-primary-color, #1890ff);
    background: rgba(24, 144, 255, 0.04);
    border-radius: 0 6px 6px 0;
    color: #666;
}

.kui-usage > .right .kui-markdown pre {
    margin: 12px 0;
    padding: 16px;
    background: #f6f8fa;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid var(--kui-color-border, #e8e8e8);
    white-space: pre-wrap;
    word-break: break-word;
}

.kui-usage > .right .kui-markdown code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    padding: 2px 6px;
    background: rgba(24, 144, 255, 0.06);
    border-radius: 4px;
    color: #d63384;
    word-break: break-word;
}

.kui-usage > .right .kui-markdown pre code {
    background: none;
    padding: 0;
    color: inherit;
    word-break: break-word;
}

.kui-usage > .right .kui-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.kui-usage > .right .kui-markdown th,
.kui-usage > .right .kui-markdown td {
    padding: 8px 12px;
    border: 1px solid var(--kui-color-border, #e8e8e8);
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
}

.kui-usage > .right .kui-markdown th {
    background: rgba(24, 144, 255, 0.04);
    font-weight: 600;
}

.kui-usage > .right .kui-markdown tr:hover {
    background: rgba(24, 144, 255, 0.02);
}

.kui-usage > .right .kui-markdown hr {
    border: none;
    border-top: 1px solid var(--kui-color-border, #e8e8e8);
    margin: 20px 0;
}

/* Form Styles */
.kui-usage > .right .kui-form {
    max-width: 700px;
}

.kui-usage > .right .kui-form .ant-form-item {
    margin-bottom: 16px;
}

.kui-usage > .right .kui-form .ant-form-item-label {
    padding-bottom: 4px;
}

.kui-usage > .right .kui-form .ant-form-item-label label {
    font-weight: 500;
    font-size: 13px;
    color: var(--kui-color, #2c3e50);
}

.kui-usage > .right .kui-form input,
.kui-usage > .right .kui-form textarea,
.kui-usage > .right .kui-form .ant-input {
    border-radius: 6px;
    border: 1px solid var(--kui-color-border, #d9d9d9);
    padding: 6px 11px;
    transition: all 0.2s ease;
}

.kui-usage > .right .kui-form input:focus,
.kui-usage > .right .kui-form textarea:focus,
.kui-usage > .right .kui-form .ant-input:focus {
    border-color: var(--kui-primary-color, #1890ff);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.kui-usage > .right .kui-form textarea {
    min-height: 200px;
    resize: vertical;
    line-height: 1.6;
}

/* Form Actions */
.kui-usage > .right .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--kui-color-border, #e8e8e8);
    margin-bottom: 8px;
}

.kui-usage > .right .form-actions .kui-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    border: 1px solid var(--kui-color-border, #d9d9d9);
    background: var(--kui-bgcolor, #fff);
    color: var(--kui-color, #2c3e50);
    user-select: none;
}

.kui-usage > .right .form-actions .kui-btn:hover {
    border-color: var(--kui-primary-color, #1890ff);
    color: var(--kui-primary-color, #1890ff);
}

.kui-usage > .right .form-actions .kui-btn.primary {
    border-color: var(--kui-primary-color, #1890ff);
    background: var(--kui-primary-color, #1890ff);
    color: #fff;
}

.kui-usage > .right .form-actions .kui-btn.primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
}

/* Upload Component */
.kui-usage > .right .kui-upload {
    margin: 12px 0;
}

/* Dark Theme Adjustments */
:root[data-theme=dark] .kui-usage > .left,
:root[data-theme=dark] .kui-usage > .right {
    background: var(--kui-bgcolor, #141414);
    border-color: var(--kui-color-border, #434343);
}

:root[data-theme=dark] .kui-usage > .left > .toolbar {
    background: rgba(24, 144, 255, 0.03);
}

:root[data-theme=dark] .kui-usage > .right .kui-markdown pre {
    background: #1e1e1e;
    border-color: #333;
}

:root[data-theme=dark] .kui-usage > .right .kui-markdown blockquote {
    background: rgba(24, 144, 255, 0.06);
}

:root[data-theme=dark] .kui-usage > .right .kui-markdown code {
    background: rgba(24, 144, 255, 0.08);
}

:root[data-theme=dark] .kui-usage > .right .kui-markdown th {
    background: rgba(24, 144, 255, 0.06);
}

:root[data-theme=dark] .kui-usage > .right .kui-markdown h1 {
    border-bottom-color: var(--kui-primary-color, #1890ff);
}

/* Right-side scrollable form layout */
.kui-form-page > .kui-form-right-scroll {
    display: flex;
    gap: 16px;
    height: 100%;
    min-height: 0;
}
.kui-form-right-scroll > .left {
    width: 300px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 8px;
}
.kui-form-right-scroll > .right {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-left: 16px;
    border-left: 1px solid var(--kui-color-border, #e8e8e8);
    overflow: hidden;
}
.kui-form-right-scroll > .right .form-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.kui-form-right-scroll > .right .form-scroll .kui-form-body-scroll {max-height:calc(100vh - 300px);overflow-y:auto;}
.kui-form-right-scroll > .right .form-scroll .kui-form {
    padding-top: 0;
}
.kui-form-right-scroll > .right .flow-scroll {
    max-height: 300px;
    min-height: 0;
    overflow-y: auto;
    border-top: 1px solid var(--kui-color-border, #e8e8e8);
    margin-top: 8px;
    padding-top: 8px;
}
.kui-form-right-scroll > .left .kui-form-action {
    padding: 0;
    border: none;
    position: static;
}

/* 表单滚动框 - 字段过多时滚动 */
.kui-form-body-scroll {max-height:calc(100vh - 500px);overflow-y:auto;}
.oa-form .kui-form-body {max-height:calc(100vh - 220px);overflow-y:auto;}
.oa-form .kui-form-page .kui-form-body {max-height:calc(100vh - 260px);overflow-y:auto;}

/* 表单加宽 */
.kui-modal-wide .ant-modal {width:960px !important;}
.kui-modal-wider .ant-modal {width:1200px !important;}
.oa-form .kui-form-page {max-width:1400px;}
