/* ai-datasheet-translator — 三栏工作台样式（左栏模板 + 输入 / 中栏预览即编辑 / 右栏 AI + 导出）
   三栏网格与吸顶列走模板里的工具类（grid-cols-1 lg:grid-cols-3 xl:grid-cols-3-wide-center，
   侧栏 position:sticky;top:88px 让位 72px 顶部搜索栏）；窄屏自动上下堆叠。 */

/* 模板选择：下拉框 + 删除按钮并排，下拉框占满剩余宽，中间留 8px 间距 */
.ds-template-row {
    display: flex;
    gap: var(--twc-space-2);
    align-items: stretch;
}

.ds-template-row .twc-select {
    flex: 1;
    min-width: 0;
}

.ds-template-row .twc-input {
    flex: 1;
    min-width: 0;
}

/* 文档版式：版式下拉框 + 恢复按钮并排，与模板行同款间距 */
.ds-theme-row {
    display: flex;
    gap: var(--twc-space-2);
    align-items: stretch;
}

.ds-theme-row .twc-select {
    flex: 1;
    min-width: 0;
}

/* 品牌颜色：取色器 + 常用色圆点并排，留 8px 间距 */
.ds-brand-row {
    display: flex;
    gap: var(--twc-space-2);
    align-items: center;
    flex-wrap: wrap;
}

.ds-color {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--twc-line);
    border-radius: var(--twc-radius-control);
    background: var(--twc-surface);
    cursor: pointer;
}

.ds-swatch {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid var(--twc-surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--twc-line);
    cursor: pointer;
}

.ds-swatch.is-active {
    box-shadow: 0 0 0 2px var(--twc-accent);
}

/* 原文与术语表输入框 */
.ds-textarea {
    width: 100%;
    height: 200px;
    font-family: var(--twc-font-mono);
    font-size: var(--twc-text-xs);
    padding: var(--twc-space-3);
    border: 1px solid var(--twc-line);
    border-radius: var(--twc-radius-control);
    background: var(--twc-surface);
    color: var(--twc-text);
    resize: vertical;
}

/* 术语表粘贴框：复用 ds-textarea，高度收短 */
.ds-glossary {
    height: 120px;
}

/* 中栏工具条：随文档滚动吸顶，与侧栏同高让位搜索栏 */
.ds-editor-toolbar {
    position: sticky;
    top: 88px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--twc-space-3);
    padding: var(--twc-space-3) var(--twc-space-4);
    background: var(--twc-surface);
    border: 1px solid var(--twc-line);
    border-radius: var(--twc-radius-card);
}

.ds-toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--twc-space-2);
    flex-wrap: wrap;
}

/* A4 纸张预览容器：margin auto 居中（不用 justify-content:center，避免横向溢出时裁掉左缘） */
.ds-preview-container {
    background: var(--twc-bg-alt);
    border: 1px solid var(--twc-line);
    border-radius: var(--twc-radius-panel);
    padding: var(--twc-space-6) var(--twc-space-4);
    overflow-x: auto;
    display: flex;
    justify-content: flex-start;
    min-height: 600px;
}

.ds-preview-container .ds-doc {
    flex: none;
    margin: 0 auto;
    box-shadow: var(--twc-shadow-md);
    transform-origin: top center;
    transition: transform 0.2s ease;
}

/* 状态与通知文本 */
.ds-status-bar {
    font-size: var(--twc-text-xs);
    color: var(--twc-muted);
    padding: 4px 8px;
    background: var(--twc-bg-alt);
    border-radius: var(--twc-radius-control);
}

.ds-status-bar:empty {
    display: none;
}

/* 行内常驻确认行：换模板 / 超长截取共用，不用 confirm 弹窗 */
.ds-confirm-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--twc-space-2);
    padding: var(--twc-space-3) var(--twc-space-4);
    background: var(--twc-accent-soft);
    border: 1px solid var(--twc-accent-line);
    border-radius: var(--twc-radius-card);
    font-size: var(--twc-text-sm);
    color: var(--twc-text);
}

.ds-confirm-row[hidden] {
    display: none;
}

/* 源文本折叠区：默认收起的只读原文，供编辑时核对 */
.ds-source-fold {
    background: var(--twc-surface);
    border: 1px solid var(--twc-line);
    border-radius: var(--twc-radius-card);
    padding: var(--twc-space-3) var(--twc-space-4);
}

.ds-source-fold summary {
    font-size: var(--twc-text-sm);
    font-weight: 600;
    color: var(--twc-text);
    cursor: pointer;
}

.ds-source-fold pre {
    margin: var(--twc-space-2) 0 0;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--twc-font-mono);
    font-size: var(--twc-text-xs);
    line-height: 1.6;
    color: var(--twc-muted);
}

/* 板块目录：左栏模板面板下方的板块列表，行内控件全部常显（不靠 hover） */
.ds-outline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ds-outline-empty {
    margin: 0;
    font-size: var(--twc-text-sm);
    color: var(--twc-faint);
}

.ds-outline-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-outline-title {
    flex: 1;
    min-width: 0;
    text-align: left;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--twc-text);
    font-family: inherit;
    font-size: var(--twc-text-sm);
    line-height: 1.4;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-outline-title:hover {
    background: var(--twc-bg-alt);
}

.ds-outline-prompt.is-set {
    color: var(--twc-accent);
    font-weight: 700;
}

.ds-outline-del {
    flex: none;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--twc-line);
    border-radius: 6px;
    background: var(--twc-surface);
    color: #dc2626;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.ds-outline-del:hover {
    background: #fef2f2;
}

.ds-outline-del:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.ds-outline-prompt-row {
    margin: 0 0 4px;
}

.ds-outline-prompt-row textarea {
    display: block;
    width: 100%;
    min-height: 56px;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid var(--twc-line);
    border-radius: 6px;
    background: var(--twc-bg-alt);
    font-size: var(--twc-text-sm);
    line-height: 1.5;
    color: var(--twc-text);
    outline: none;
    font-family: inherit;
}

.ds-outline-prompt-row textarea:focus {
    border-color: var(--twc-accent);
    background: var(--twc-surface);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

/* 目录定位：中栏板块留出吸顶工具条高度，定位后短暂描边高亮 */
.ds-preview-container .ds-sec {
    scroll-margin-top: 100px;
}

.ds-preview-container .ds-sec.ds-flash {
    outline: 2px solid var(--twc-accent);
    outline-offset: 2px;
    border-radius: 4px;
}
