/* ─────────────────────────────────────────────
   统一研究对话块（可折叠卡片）
───────────────────────────────────────────── */
.research-unified-block {
    background: #1a1a1a;
    border: 1px solid var(--toolbar-border);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: border-color 0.3s;
}

.research-unified-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
}

.research-unified-header:hover {
    background: rgba(255,255,255,0.02);
}

.shimmer-text {
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(90deg, #666 0%, #fff 50%, #666 100%);
    background-size: 200% auto;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    animation: shimmer-wave 2s linear infinite;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shimmer-text.static {
    all: unset;
    color: var(--text);
}

@keyframes shimmer-wave {
    to { background-position: 200% center; }
}

.research-collapse-icon {
    color: var(--summary-text);
    transition: transform 0.3s ease;
    font-size: 12px;
}

.research-unified-block.collapsed .research-collapse-icon {
    transform: rotate(-90deg);
}

.research-unified-body {
    padding: 0 20px 20px;
    border-top: 1px dashed var(--toolbar-border);
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.research-unified-block.collapsed .research-unified-body {
    max-height: 0;
    padding: 0;
    border-top: none;
    opacity: 0;
    overflow: hidden;
}

/* ─────────────────────────────────────────────
   右侧文档侧边栏
───────────────────────────────────────────── */
:root {
    --doc-panel-width: 800px;
}

.doc-side-panel {
    position: fixed;
    inset: 0 0 0 auto;
    width: var(--doc-panel-width);
    height: 100vh;
    background: var(--chat-bg);
    border-left: 1px solid var(--toolbar-border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}

.doc-side-panel.open {
    transform: translateX(0);
}

.main-content.right-open-doc { margin-right: var(--doc-panel-width); }
.input-box.right-open-doc   { right: var(--doc-panel-width); }

.doc-panel-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
}

.doc-panel-body :where(h1,h2,h3) {
    margin: 1.5em 0 0.5em;
    color: var(--text);
}

.doc-panel-body pre {
    background: var(--code-bg);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}

/* ─────────────────────────────────────────────
   文档骨架屏
───────────────────────────────────────────── */
.doc-skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 30px;
    transition: opacity 0.3s ease;
}

.skeleton-line {
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, #2a2d30 25%, #3f4448 50%, #2a2d30 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
}

.skeleton-line.title  { height: 24px; width: 40%; margin: 10px 0; }
.skeleton-line.text-full { width: 100%; }
.skeleton-line.text-90   { width: 90%; }
.skeleton-line.text-80   { width: 80%; }
.skeleton-line.text-60   { width: 60%; }

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

[data-theme="light"] .skeleton-line {
    background: linear-gradient(90deg, #e0e0e0 25%, #f5f5f5 50%, #e0e0e0 75%);
}

/* ─────────────────────────────────────────────
   右侧文档内代码块（常驻工具栏 + 美化）
───────────────────────────────────────────── */
.doc-panel-body .code-toolbar {
    position: relative;
    margin: 1.5em 0;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.doc-panel-body .code-toolbar > .toolbar {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 8px 15px;
    background: #252526;
    border-bottom: 1px solid #333;
    z-index: 20;
}

.doc-panel-body .code-toolbar > .toolbar .toolbar-item {
    display: flex;
    align-items: center;
    margin: 0;
}

/* 语言标签推到最左 */
.doc-panel-body .code-toolbar > .toolbar .toolbar-item:not(:has(button)) {
    order: 1;
    margin-right: auto;
}

/* 复制按钮排第二，下载排第三（视实际 class 调整顺序） */
.doc-panel-body .code-toolbar > .toolbar .toolbar-item:has(.copy-to-clipboard-button) { order: 2; }
.doc-panel-body .code-toolbar > .toolbar .toolbar-item:has(.download-code-btn)       { order: 3; }

.doc-panel-body .code-toolbar .toolbar-item > span {
    font: 700 13px Consolas, monospace;
    color: #858585;
    text-transform: uppercase;
    cursor: default;
}

.doc-panel-body .code-toolbar button {
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #b0b0b0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.doc-panel-body .code-toolbar button:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.doc-panel-body .code-toolbar button::before,
.doc-panel-body .code-toolbar button::after {
    display: none !important;
    content: none !important;
}

.doc-panel-body .code-toolbar pre[class*="language-"] {
    order: 2;
    margin: 0;
    border: none;
    border-radius: 0 0 10px 10px;
    background: transparent;
    padding: 1.5em 1.2em;
    overflow-x: auto;
    font: 1.6/1 'JetBrains Mono', Consolas, monospace;
}

/* ─────────────────────────────────────────────
   右侧文档表格
───────────────────────────────────────────── */
.doc-panel-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em 0;
    border: 1px solid #333;
    border-radius: 8px;
}

.doc-panel-body thead th {
    background: #252526;
    color: #e0e0e0;
    font-weight: 600;
    text-align: left;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

.doc-panel-body tbody td {
    padding: 10px 15px;
    color: #ccc;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    line-height: 1.6;
    min-width: 100px;
}

.doc-panel-body tbody tr:last-child td { border-bottom: none; }

.doc-panel-body tbody tr:hover td {
    background: #2a2d2e;
}

/* 滚动条美化 */
.doc-panel-body table {
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.doc-panel-body table::-webkit-scrollbar {
    height: 6px;
}

.doc-panel-body table::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.doc-panel-body table::-webkit-scrollbar-track {
    background: transparent;
}

/* 亮色模式（可选，根据实际主题系统保留或删除） */
[data-theme="light"] .doc-panel-body table {
    border-color: #d0d7de;
}

[data-theme="light"] .doc-panel-body thead th {
    background: #f6f8fa;
    color: #24292e;
    border-bottom-color: #d0d7de;
}

[data-theme="light"] .doc-panel-body tbody td {
    color: #24292e;
    background: white;
    border-bottom-color: #d0d7de;
}

[data-theme="light"] .doc-panel-body tbody tr:hover td {
    background: #f6f8fa;
}

[data-theme="light"] .doc-panel-body table::-webkit-scrollbar-thumb {
    background: #ccc;
}