/* 功能九：PDF阅读与OCR解析样式 - 重构版 */

/* 功能九宽屏模式 - 让容器更宽 */
#pdf_ocr_reader-tab {
    max-width: 1600px;
    margin: 0 auto;
}

/* 主容器 - 两栏布局（加宽版） */
.pdf-ocr-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    padding: 16px;
    background: #f8fafc;
    height: calc(100vh - 80px);
    overflow: hidden;
    position: relative;
}

/* 左侧面板 */
.pdf-ocr-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    min-height: 0;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.pdf-ocr-sidebar::-webkit-scrollbar {
    width: 6px;
}

.pdf-ocr-sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.pdf-ocr-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.pdf-ocr-sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 左侧边栏中的面板 */
.pdf-ocr-sidebar .ocr-panel {
    flex-shrink: 0;
}

/* 识别结果面板可以伸缩 */
.pdf-ocr-sidebar .results-panel {
    flex: 1 1 auto;
    min-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 悬浮识别文本面板 */
.floating-text-panel {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 450px;
    min-width: 300px;
    min-height: 200px;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
}

.floating-text-panel.minimized {
    max-height: 52px;
    resize: none;
}

.floating-text-panel.minimized .panel-content,
.floating-text-panel.minimized .panel-details {
    display: none;
}

/* 悬浮面板标题栏 - 绿色主题 */
.floating-text-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    cursor: move;
    user-select: none;
}

.floating-text-panel .panel-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-text-panel .panel-controls {
    display: flex;
    gap: 4px;
}

.floating-text-panel .control-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}

.floating-text-panel .control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.floating-text-panel .control-btn.close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* 悬浮面板内容区 */
.floating-text-panel .panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    overflow: hidden;
}

/* 当前选中区块区域 */
.floating-text-panel .current-block-section {
    margin-bottom: 12px;
    flex-shrink: 0;
}

.floating-text-panel .current-block-section .section-header {
    margin-bottom: 8px;
}

.floating-text-panel .current-block-section .block-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

/* 全部原文区域（可折叠） */
.floating-text-panel .full-text-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.floating-text-panel .full-text-section .section-header {
    padding: 10px 12px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.floating-text-panel .full-text-section .section-header:hover {
    background: #f1f5f9;
}

.floating-text-panel .full-text-section .toggle-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.floating-text-panel .full-text-section.collapsed .toggle-icon {
    transform: rotate(0deg);
}

.floating-text-panel .full-text-section:not(.collapsed) .toggle-icon {
    transform: rotate(90deg);
}

.floating-text-panel .full-text-section .section-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.floating-text-panel .full-text-section.collapsed .section-body {
    display: none;
}

.floating-text-panel .content-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.floating-text-panel .tab-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #64748b;
}

.floating-text-panel .tab-btn.active {
    background: #22c55e;
    color: white;
}

.floating-text-panel .tab-btn:hover:not(.active) {
    background: #e2e8f0;
}

.floating-text-panel .content-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.floating-text-panel .ocr-text-tab {
    display: none;
}

.floating-text-panel .ocr-text-tab.active {
    display: block;
}

.floating-text-panel .text-content {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Markdown渲染样式 */
.floating-text-panel .markdown-body {
    font-size: 14px;
    line-height: 1.6;
}

.floating-text-panel .markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.floating-text-panel .markdown-body table th,
.floating-text-panel .markdown-body table td {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    text-align: left;
}

.floating-text-panel .markdown-body table th {
    background: #f3f4f6;
    font-weight: 600;
}

.floating-text-panel .markdown-body table tr:nth-child(even) {
    background: #f9fafb;
}

.floating-text-panel .markdown-body code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.floating-text-panel .markdown-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
}

.floating-text-panel .markdown-body pre code {
    background: transparent;
    color: inherit;
}

.floating-text-panel .markdown-body blockquote {
    border-left: 4px solid #22c55e;
    padding-left: 12px;
    margin: 8px 0;
    color: #64748b;
}

.floating-text-panel .markdown-body h1,
.floating-text-panel .markdown-body h2,
.floating-text-panel .markdown-body h3 {
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.floating-text-panel .markdown-body h1 { font-size: 18px; }
.floating-text-panel .markdown-body h2 { font-size: 16px; }
.floating-text-panel .markdown-body h3 { font-size: 15px; }

.floating-text-panel .markdown-body ul,
.floating-text-panel .markdown-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.floating-text-panel .markdown-body li {
    margin: 4px 0;
}

/* 悬浮面板详情区 */
.floating-text-panel .panel-details {
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.floating-text-panel .details-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

/* 中间主区域 */
.pdf-ocr-main {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

/* 通用面板样式 */
.ocr-panel {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.panel-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 文件上传区 */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.upload-placeholder svg {
    color: #94a3b8;
    margin-bottom: 8px;
}

.upload-placeholder p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #475569;
}

.upload-placeholder .hint {
    font-size: 12px;
    color: #94a3b8;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 13px;
    gap: 8px;
}

.file-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.remove-file-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* 表单控件 */
.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* 页面范围输入框 */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-hint {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* 缓存状态指示 */
.cache-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}

.cache-status .cache-icon {
    font-size: 14px;
}

.cache-status.cached {
    background: #dcfce7;
    color: #166534;
}

.cache-status.no-cache {
    background: #fef3c7;
    color: #92400e;
}

.cache-status.partial {
    background: #dbeafe;
    color: #1e40af;
}

.cache-status.disabled {
    background: #f1f5f9;
    color: #64748b;
}

/* OCR状态标记（缩略图上） */
.ocr-status {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e2e8f0;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ocr-status.parsed {
    background: #22c55e;
    color: white;
}

/* 按钮 */
.btn-primary {
    width: 100%;
    padding: 10px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
}

.btn-small:hover {
    background: #e2e8f0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
}

.btn-icon:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* 识别结果操作按钮 - 绿色主题（重构版） */
.content-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.ocr-action-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ocr-action-btn span {
    color: white;
}

.ocr-action-btn.copy-btn {
    background: #22c55e;
    color: white;
}

.ocr-action-btn.copy-btn:hover {
    background: #16a34a;
}

.ocr-action-btn.translate-btn {
    background: #3b82f6;
    color: white;
}

.ocr-action-btn.translate-btn:hover {
    background: #2563eb;
}

.ocr-action-btn.ask-btn {
    background: #8b5cf6;
    color: white;
}

.ocr-action-btn.ask-btn:hover {
    background: #7c3aed;
}

.btn-toggle {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}

.btn-toggle:hover {
    background: #f8fafc;
}

/* 进度条 */
.progress-wrap {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-wrap span {
    font-size: 12px;
    color: #64748b;
}

/* 结果列表 */
.results-panel {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.filter-bar {
    margin-bottom: 12px;
}

.results-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}

.empty-tip {
    text-align: center;
    padding: 24px;
    color: #94a3b8;
    font-size: 13px;
}

/* 导出按钮 */
.export-btns {
    display: flex;
    gap: 8px;
}

.btn-export {
    flex: 1;
    padding: 8px 12px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
}

.btn-export:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* 工具栏 */
.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #475569;
}

.page-info input {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

/* 查看器区域 */
.viewer-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: auto;
    background: #f1f5f9;
    display: block;
    padding: 20px;
    text-align: center;
}

.viewer-container {
    position: relative;
    display: inline-block;
    text-align: left;
}

.viewer-container .pdf-page-canvas,
.viewer-container .pdf-image-display {
    display: block;
    max-width: none;
    position: relative;
    z-index: 1;
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: #94a3b8;
}

.empty-state svg {
    margin-bottom: 16px;
    color: #cbd5e1;
}

.empty-state p {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #64748b;
}

.empty-state .hint {
    font-size: 13px;
    color: #94a3b8;
}

/* 区块层 - 相对于viewer-container定位 */
.blocks-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 50;
}

.blocks-layer .ocr-block-overlay {
    pointer-events: auto;
    position: absolute;
}

/* 选择层 */
.selection-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: text;
    z-index: 100;
}

/* 底部信息栏 */
.viewer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 13px;
    color: #64748b;
    flex-shrink: 0;
}

.footer-right {
    display: flex;
    gap: 16px;
}

.footer-right b {
    color: #1e293b;
    margin-left: 4px;
}

/* 右侧内容面板 */
.content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.content-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.tab-btn {
    padding: 6px 12px;
    background: none;
    border: none;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
}

.tab-btn:hover {
    background: #f1f5f9;
}

.tab-btn.active {
    background: #3b82f6;
    color: white;
}

.content-body {
    flex: 1;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 功能九右侧内容区域标签页 */
.pdf-ocr-rightbar .ocr-text-tab {
    display: none;
}

.pdf-ocr-rightbar .ocr-text-tab.active {
    display: block;
}

.text-content {
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 区块详情 */
.block-details {
    font-size: 13px;
}

.block-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.block-type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.block-type-badge.text { background: #dcfce7; color: #16a34a; }
.block-type-badge.table { background: #dbeafe; color: #2563eb; }
.block-type-badge.formula { background: #f3e8ff; color: #9333ea; }
.block-type-badge.image { background: #ffedd5; color: #ea580c; }
.block-type-badge.multi { background: #fef3c7; color: #d97706; }

.block-page {
    font-size: 12px;
    color: #64748b;
}

.block-details-content {
    margin-bottom: 12px;
}

.detail-section {
    margin-bottom: 8px;
}

.detail-section label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.detail-text {
    padding: 8px;
    background: #f8fafc;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
}

.detail-code {
    display: block;
    padding: 8px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
}

.block-details-actions {
    display: flex;
    gap: 8px;
}

.block-details-actions .btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.block-details-actions .btn-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.block-details-actions .btn-primary:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.block-details-actions .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.block-details-actions .btn-secondary:hover {
    background: #e2e8f0;
}

/* OCR区块覆盖层 */
.ocr-block-overlay {
    position: absolute;
    border: 2px solid;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    overflow: hidden;
    background-color: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
    min-width: 20px;
    min-height: 20px;
}

.ocr-block-overlay.type-text { background-color: rgba(34, 197, 94, 0.3); border-color: #22c55e; }
.ocr-block-overlay.type-table { background-color: rgba(59, 130, 246, 0.3); border-color: #3b82f6; }
.ocr-block-overlay.type-formula { background-color: rgba(168, 85, 247, 0.3); border-color: #a855f7; }
.ocr-block-overlay.type-image { background-color: rgba(249, 115, 22, 0.3); border-color: #f97316; }

.ocr-block-overlay:hover {
    z-index: 100;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.ocr-block-label {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 0 0 4px 0;
    white-space: nowrap;
    max-width: fit-content;
}

/* 划词选中框 */
.ocr-selection-box {
    position: absolute;
    background: rgba(59, 130, 246, 0.15);
    border: 1px dashed #3b82f6;
    pointer-events: none;
    z-index: 101;
}

/* 高亮覆盖层 */
.ocr-highlight-overlay {
    position: absolute;
    background: rgba(59, 130, 246, 0.25);
    border: 1px solid #3b82f6;
    pointer-events: none;
    z-index: 99;
}

/* 悬浮工具栏 */
.floating-toolbar {
    position: fixed;
    display: flex;
    gap: 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 6px;
    z-index: 1000;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
}

.toolbar-btn:hover {
    background: #f1f5f9;
}

/* 结果列表项 */
.ocr-content-item {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ocr-content-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.ocr-content-item.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.content-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.content-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 500;
}

.content-type-badge.text { background: #dcfce7; color: #166534; }
.content-type-badge.table { background: #dbeafe; color: #1e40af; }
.content-type-badge.formula { background: #f3e8ff; color: #6b21a8; }
.content-type-badge.image { background: #ffedd5; color: #9a3412; }
.content-type-badge.title { background: #fef3c7; color: #92400e; }

.content-page {
    font-size: 11px;
    color: #94a3b8;
}

.content-item-body {
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
}

.content-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

/* AI对话弹窗样式 - 绿色主题 */
.ocr-chat-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ocr-chat-popup .popup-header {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}

.ocr-chat-popup .popup-header *,
.ocr-chat-popup .popup-title,
.ocr-chat-popup .popup-close {
    color: white !important;
}

.ocr-chat-popup .chat-message.user .message-content {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white !important;
}

.ocr-chat-popup .send-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white !important;
    font-weight: 500;
}

.ocr-chat-popup .send-btn:hover {
    opacity: 0.9;
}

.ocr-chat-popup .send-btn * {
    color: white !important;
}

/* 翻译结果弹窗样式 - 绿色主题 */
.ocr-translate-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ocr-translate-popup .popup-header {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}

.ocr-translate-popup .popup-header *,
.ocr-translate-popup .popup-title,
.ocr-translate-popup .popup-close {
    color: white !important;
}

.ocr-translate-popup .translate-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    color: white !important;
}

.ocr-translate-popup .translate-btn * {
    color: white !important;
}

/* 多页拼接弹窗样式 */
.multi-page-concat-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    width: 550px;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.multi-page-concat-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.multi-page-concat-popup .popup-title {
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.multi-page-concat-popup .popup-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
    padding: 4px 8px;
    min-width: 32px;
}

.multi-page-concat-popup .popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.multi-page-concat-popup .popup-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.multi-page-concat-popup .page-select-section {
    margin-bottom: 16px;
}

.multi-page-concat-popup .section-label {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 8px;
}

.multi-page-concat-popup .concat-page-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
}

.multi-page-concat-popup .concat-page-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.multi-page-concat-popup .concat-page-item:hover {
    background: #e2e8f0;
}

.multi-page-concat-popup .concat-page-item.selected {
    background: #ede9fe;
}

.multi-page-concat-popup .concat-page-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.multi-page-concat-popup .page-label {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.multi-page-concat-popup .page-info {
    font-size: 12px;
    color: #64748b;
}

.multi-page-concat-popup .select-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.multi-page-concat-popup .concat-preview-section {
    flex: 1;
}

.multi-page-concat-popup .concat-preview-content {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}

.multi-page-concat-popup .preview-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.multi-page-concat-popup .popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.multi-page-concat-popup .btn-action {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
}

.multi-page-concat-popup .btn-action:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.multi-page-concat-popup .btn-action:not(:disabled) {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.multi-page-concat-popup .btn-action:not(:disabled):hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 翻译后内容样式 */
.translated-content {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* 恢复按钮样式 */
.restore-btn {
    transition: all 0.2s;
}

.restore-btn:hover {
    background: #ea580c !important;
}
