:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
}

/* ============ 左侧：上传占位 ============ */
.upload-placeholder {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 26px 14px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-placeholder:hover,
.upload-placeholder.drag-over {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.upload-icon { font-size: 36px; }
.upload-text { font-size: 14px; font-weight: 600; color: #374151; }
.upload-hint { font-size: 12px; color: #9ca3af; text-align: center; }

/* ============ 左侧：输入与下拉 ============ */
.text-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.text-input:focus { border-color: #8b5cf6; }
.text-input:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

.format-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    font-size: 13px;
    color: #374151;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.format-select:focus { border-color: #8b5cf6; }
.format-select:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

/* ============ 左侧：格式标签 ============ */
.format-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.format-tag {
    padding: 4px 10px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

/* ============ 左侧：统计 ============ */
.stat-row { display: flex; gap: 12px; }

.stat-box {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 8px;
}

.stat-purple { background: #f5f3ff; }
.stat-green { background: #d1fae5; }

.stat-num { font-size: 20px; font-weight: 700; color: #6d28d9; }
.stat-green .stat-num { color: #059669; }

.stat-label { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* ============ 左侧：提示与进度 ============ */
.info-text {
    padding: 12px;
    font-size: 12px;
    color: #666;
    background: #f9fafb;
    border-radius: 6px;
    margin-top: 12px;
}

.compress-progress {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #f3f4f6;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c4b5fd, #8b5cf6);
    border-radius: 5px;
    transition: width 0.25s ease;
}

.progress-text {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #6d28d9;
    word-break: break-all;
}

/* ============ 右侧：内容容器 ============ */
.preview-body {
    padding: 15px;
    min-height: 320px;
    box-sizing: border-box;
}

/* ============ 上传操作按钮 ============ */
.upload-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-mini {
    flex: 1;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-mini-load:hover:not(:disabled) {
    border-color: #8b5cf6;
    color: #6d28d9;
    background: #f5f3ff;
}

.btn-mini:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 右侧：文件列表（虚拟滚动） ============ */
.file-tree {
    position: relative;
    height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 幽灵行：撑起完整滚动高度 */
.tree-phantom { width: 1px; }

/* 可见区：绝对定位，通过 translateY 位移到当前渲染窗口 */
.tree-visible {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    will-change: transform;
}

/* 行高固定，与 JS 中 ROW_HEIGHT(48px) 一致 */
.tree-item {
    box-sizing: border-box;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.tree-item:hover { background: #f9fafb; }
.tree-item.selected { background: #f5f3ff; }

/* ---- 自定义复选框 ---- */
.tree-checkbox {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tree-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-slider {
    position: absolute;
    inset: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    background: #ffffff;
    transition: all 0.2s;
}

.tree-checkbox input:checked + .checkbox-slider {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.tree-checkbox input:checked + .checkbox-slider::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tree-checkbox input:disabled + .checkbox-slider { opacity: 0.5; cursor: not-allowed; }

.tree-icon { font-size: 18px; flex-shrink: 0; }

.tree-info { flex: 1; min-width: 0; }

.tree-name {
    font-size: 13px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tree-size { font-size: 11px; color: #9ca3af; }
.tree-type {
    font-size: 10px;
    padding: 1px 6px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 8px;
}

.tree-badge {
    font-size: 10px;
    padding: 1px 6px;
    background: #ede9fe;
    color: #6d28d9;
    border-radius: 8px;
}

.tree-actions { display: flex; gap: 6px; flex-shrink: 0; }

.tree-btn {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tree-btn-preview:hover { border-color: #8b5cf6; color: #8b5cf6; }

.tree-btn-remove {
    border-color: #fee2e2;
    background: #fee2e2;
    color: #dc2626;
    padding: 4px 8px;
}

.tree-btn-remove:hover:not(:disabled) { background: #fecaca; }
.tree-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 右侧：压缩结果 ============ */
.result-card {
    background: #ffffff;
    border-radius: 12px;
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.result-body { padding: 15px; }

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #f3f4f6;
    font-size: 13px;
}

.result-item:last-child { border-bottom: none; }

.result-label { color: #6b7280; flex-shrink: 0; }

.result-value {
    color: #374151;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.result-highlight {
    color: #059669;
    font-weight: 700;
}

/* ============ 空状态 ============ */
.empty-state { text-align: center; padding: 40px; color: #9ca3af; }
.empty-icon { font-size: 48px; margin-bottom: 10px; }
.empty-title { font-size: 16px; font-weight: 600; color: #374151; }
.empty-sub { font-size: 13px; margin-top: 8px; }

/* ============ 卡片头部：数量与按钮 ============ */
.header-count { font-size: 12px; color: #6b7280; margin-right: 2px; }

.card-header-right-btn-purple {
    padding: 6px 8px;
    font-size: 12px;
    background: #8b5cf6;
    border: 1px solid #8b5cf6;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.card-header-right-btn-purple:hover:not(:disabled) {
    background: #7c3aed;
    border-color: #7c3aed;
}

.card-header-right-btn-purple:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 预览弹窗 ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(920px, 92vw);
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 52px 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-toolbar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.modal-tool-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-tool-btn:hover:not(:disabled) { border-color: #8b5cf6; color: #6d28d9; }
.modal-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-tool-download {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #ffffff;
    border-color: transparent;
}

.modal-tool-download:hover:not(:disabled) { color: #ffffff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-close:hover { background: #e5e7eb; }

.modal-body {
    padding: 16px;
    overflow: auto;
    max-height: calc(90vh - 62px);
}

/* ---- 弹窗内容 ---- */
.preview-image {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.preview-pdf { width: 100%; height: 70vh; border: none; }

.preview-text {
    margin: 0;
    max-height: 70vh;
    overflow: auto;
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.preview-loading { text-align: center; padding: 40px; color: #9ca3af; }

.preview-unsupported { text-align: center; padding: 40px; color: #6b7280; }
.preview-unsupported-icon { font-size: 48px; margin-bottom: 12px; }
.preview-unsupported-sub { font-size: 12px; color: #9ca3af; margin-top: 6px; }
