/* AI生成 */
/* ============================================================
   PDF 工具前台 — 布局与基础组件样式（浅色主题）
   ============================================================ */
:root {
    --pdf-primary: #4e73df;
    --pdf-primary-dark: #3b5bdb;
    --pdf-danger: #e03131;
    --pdf-success: #2f9e44;
    --pdf-warning: #f08c00;
    --pdf-text: #1f2329;
    --pdf-text-muted: #6b7280;
    --pdf-border: #e5e7eb;
    --pdf-bg: #f5f6f8;
    --pdf-bg-subtle: #f1f3f5;
    --pdf-card-bg: #fff;
    --pdf-radius: 10px;
    --pdf-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --font-sans: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    color: var(--pdf-text);
    background: var(--pdf-bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--pdf-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 顶部导航 ===== */
.pdf-topbar {
    height: 56px; background: #fff; border-bottom: 1px solid var(--pdf-border);
    display: flex; align-items: center; padding: 0 20px; gap: 16px;
    position: sticky; top: 0; z-index: 100;
}
.pdf-logo { font-weight: 800; font-size: 16px; color: var(--pdf-primary); white-space: nowrap; }
.pdf-nav { display: flex; gap: 4px; flex: 1; }
.pdf-nav a {
    padding: 8px 14px; border-radius: 8px; color: var(--pdf-text-muted); font-size: 14px;
}
.pdf-nav a:hover { background: var(--pdf-bg-subtle); text-decoration: none; }
.pdf-nav a.active { background: rgba(78,115,223,.1); color: var(--pdf-primary); font-weight: 600; }
.pdf-user { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.pdf-user .name { font-weight: 600; }
.pdf-user .muted { color: var(--pdf-text-muted); }

/* ===== 通用容器 ===== */
.pdf-main { margin: 0 auto; padding: 20px; }
.pdf-page-title { font-size: 18px; font-weight: 700; margin: 0 0 16px; }

/* ===== 卡片 ===== */
.pdf-card {
    background: var(--pdf-card-bg); border: 1px solid var(--pdf-border);
    border-radius: var(--pdf-radius); box-shadow: var(--pdf-shadow); margin-bottom: 14px;
}
.pdf-card-header {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--pdf-border);
}
.pdf-card-header h4 { margin: 0; font-size: 14px; font-weight: 700; }
.pdf-card-body { padding: 14px 16px; }

/* ===== 表单 ===== */
.pdf-form-group { margin-bottom: 12px; }
.pdf-form-label { display: block; font-size: 13px; color: var(--pdf-text-muted); margin-bottom: 6px; }
.pdf-form-control {
    width: 100%; height: 38px; padding: 6px 10px; border: 1px solid var(--pdf-border);
    border-radius: 8px; font-size: 14px; background: #fff; color: var(--pdf-text);
    font-family: inherit;
}
.pdf-form-control:focus { outline: none; border-color: var(--pdf-primary); box-shadow: 0 0 0 3px rgba(78,115,223,.15); }
textarea.pdf-form-control { height: auto; min-height: 64px; resize: vertical; }
.pdf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pdf-hint { font-size: 12px; color: var(--pdf-text-muted); margin-top: 6px; }
.req { color: var(--pdf-danger); margin-left: 2px; }

/* ===== 按钮 ===== */
.pdf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
    font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all .15s;
}
.pdf-btn:hover { text-decoration: none; }
.pdf-btn-primary { background: var(--pdf-primary); color: #fff; }
.pdf-btn-primary:hover { background: var(--pdf-primary-dark); color: #fff; }
.pdf-btn-primary:disabled { opacity: .6; cursor: default; }
.pdf-btn-secondary { background: #fff; color: var(--pdf-text); border-color: var(--pdf-border); }
.pdf-btn-secondary:hover { background: var(--pdf-bg-subtle); }
.pdf-btn-danger { background: #fff; color: var(--pdf-danger); border-color: var(--pdf-danger); }
.pdf-btn-danger:hover { background: rgba(224,49,49,.08); }
.pdf-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.pdf-btn-block { width: 100%; }
.pdf-btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }

/* ===== 工作台（左：批次菜单，右：主区） ===== */
.workbench {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 16px;
    align-items: stretch;
    min-height: calc(100vh - 96px);
}
/* 左栏：批次列表（持久菜单，切换批次时不刷新） */
.wb-col-left { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; }
/* 右栏主区：承载「编辑面板」或「批次详情 iframe」 */
.wb-col-main { min-width: 0; min-height: 0; align-self: stretch; display: flex; }

/* 编辑面板：内嵌 中(画布) + 右(参数) 两栏 */
#edit-panel {
    flex: 1; min-width: 0; min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 510px;
    grid-template-rows: 1fr;
    gap: 16px; align-items: stretch;
}
/* 批次详情（内联，去 iframe） */
#detail-panel {
    flex: 1; min-width: 0; min-height: 0;
    background: #fff; overflow: auto;
    display: none;
}

.wb-col-center { min-width: 0; min-height: 0; display: flex; }
.wb-col-right { min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }

/* 中间「PDF 页面布局」卡片撑满整列高度，canvas 区域自动填充 */
.wb-col-center > .pdf-card { flex: 1; min-height: 0; height: 100%; margin-bottom: 0; display: flex; flex-direction: column; }
.wb-col-center > .pdf-card > .pdf-card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* canvas 自适应区域 */
#konva-fit-area { min-height: 260px; }

/* ===== 实时预览（固定整窗左下角，可拖动到全屏任意位置） ===== */
.mini-preview {
    position: fixed; left: 16px; bottom: 16px; width: 155px; padding-top: 22px;
    overflow: hidden; border-radius: 8px; z-index: 30; display: none;
    background: #f3f3f3; border: 1px solid var(--pdf-border);
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.mini-preview-inner {
    position: absolute; top: 22px; left: 0; width: 460px;
    transform-origin: top left; transform: scale(0.337);
    background-color: #f3f3f3; background-size: cover; background-position: center; background-repeat: no-repeat;
}
/* 顶部拖拽手柄（按住拖动；右侧复位按钮） */
.mini-preview-handle {
    position: absolute; top: 0; left: 0; right: 0; height: 22px; z-index: 4;
    display: flex; align-items: center; gap: 6px; padding: 0 6px;
    background: rgba(0,0,0,.55); cursor: grab; user-select: none; touch-action: none;
}
.mini-preview-handle:active { cursor: grabbing; }
.mini-preview-badge {
    font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 4px;
    background: transparent; color: #fff; pointer-events: none;
}
.mini-preview-reset {
    margin-left: auto; width: 18px; height: 18px; padding: 0; border: none; border-radius: 4px;
    background: rgba(255,255,255,.15); color: #fff; font-size: 13px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.mini-preview-reset:hover { background: rgba(255,255,255,.32); }
.mini-pv-name {
    position: absolute; display: flex; align-items: center; justify-content: center; text-align: center;
    font-weight: 700; line-height: 1.12; overflow: hidden;
    color: var(--pv-name, #1a1a1a); font-size: 22px; padding: 0 6px;
    text-shadow: 0 1px 3px rgba(255,255,255,.7);
}
.mini-pv-content {
    position: absolute; overflow: hidden; box-sizing: border-box;
    background: var(--pv-bg, rgba(255,255,255,.85));
    padding: var(--pv-pad, 10px);
    border-radius: 12px;
    color: var(--pv-jobs, #333);
}
.mini-pv-intro { font-size: 12px; line-height: 1.4; color: var(--pv-intro, #333); margin-bottom: 6px; overflow: hidden; }
.mini-pv-contact { font-size: 11px; line-height: 1.4; color: var(--pv-contact, #333); margin-bottom: 6px; overflow: hidden; }
.mini-pv-jobs { font-size: 10px; line-height: 1.3; }
.mini-pv-jobs table { width: 100%; border-collapse: collapse; }
.mini-pv-jobs th { background: var(--pv-header-bg, #cc0000); color: var(--pv-header-color, #fff); font-size: 10px; padding: 2px 3px; text-align: left; font-weight: 600; }
.mini-pv-jobs td { padding: 2px 3px; border-bottom: 1px solid rgba(0,0,0,.08); font-size: 10px; color: var(--pv-jobs, #333); vertical-align: top; }
.mini-pv-jobs .pv-salary { color: var(--pv-jobs, #333); white-space: nowrap; }

/* 左栏批次列表 */
.batch-list { list-style: none; margin: 0; padding: 0; }
.batch-item {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
    cursor: pointer; border: 1px solid transparent; margin-bottom: 6px; background: #fff;
}
.batch-item:hover { border-color: var(--pdf-border); background: var(--pdf-bg-subtle); }
.batch-item.active { border-color: var(--pdf-primary); background: rgba(78,115,223,.08); }
.batch-item .bi-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item .bi-meta { font-size: 12px; color: var(--pdf-text-muted); }
.batch-empty { text-align: center; color: var(--pdf-text-muted); padding: 24px 12px; font-size: 13px; }

/* ===== 进度条 / 徽标 ===== */
.pdf-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pdf-badge-warning { background: #fff4e6; color: var(--pdf-warning); }
.pdf-badge-success { background: #ebfbee; color: var(--pdf-success); }
.pdf-badge-danger  { background: #fff5f5; color: var(--pdf-danger); }
.pdf-badge-info   { background: #e7f5ff; color: #1c7ed6; }
.pdf-badge-muted  { background: var(--pdf-bg-subtle); color: var(--pdf-text-muted); }

.pdf-progress { height: 8px; background: var(--pdf-bg-subtle); border-radius: 20px; overflow: hidden; flex: 1; min-width: 120px; }
.pdf-progress-fill { height: 100%; background: var(--pdf-primary); border-radius: 20px; transition: width .3s; }

/* ===== 数据表格（详情页） ===== */
.pdf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pdf-table th, .pdf-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--pdf-border); }
.pdf-table th { background: var(--pdf-bg-subtle); font-weight: 600; color: var(--pdf-text-muted); }
.pdf-table tbody tr:hover { background: var(--pdf-bg-subtle); }
.pdf-table .col-narrow { width: 80px; }

/* ===== Toast ===== */
.pdf-toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pdf-toast {
    min-width: 200px; max-width: 80vw; padding: 10px 18px; border-radius: 8px; color: #fff;
    font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: pdf-toast-in .2s ease;
}
.pdf-toast.success { background: var(--pdf-success); }
.pdf-toast.error   { background: var(--pdf-danger); }
.pdf-toast.warning { background: var(--pdf-warning); }
.pdf-toast.info    { background: #495057; }
@keyframes pdf-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Modal / Drawer ===== */
.pdf-modal-overlay {
    position: fixed; inset: 0; z-index: 2500; display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,.45);
}
.pdf-modal-overlay.active { display: flex; }
.pdf-modal-box {
    background: #fff; border-radius: 12px; width: 92vw; max-width: 640px; max-height: 90vh; overflow: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.pdf-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--pdf-border); }
.pdf-modal-header h4 { margin: 0; font-size: 16px; }
.pdf-modal-close { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--pdf-text-muted); }
.pdf-modal-body { padding: 18px; }
.pdf-modal-footer { padding: 14px 18px; border-top: 1px solid var(--pdf-border); display: flex; justify-content: flex-end; gap: 10px; }

.pdf-drawer-overlay { position: fixed; inset: 0; z-index: 2600; display: none; background: rgba(0,0,0,.4); }
.pdf-drawer-overlay.active { display: block; }
.pdf-drawer {
    position: absolute; top: 0; right: 0; height: 100%; width: 440px; max-width: 92vw;
    background: #fff; box-shadow: -10px 0 40px rgba(0,0,0,.2); display: flex; flex-direction: column;
}
.pdf-drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--pdf-border); }
.pdf-drawer-header h3 { margin: 0; font-size: 16px; }
.pdf-drawer-body { padding: 18px; overflow: auto; flex: 1; }
.pdf-drawer-close { border: none; background: transparent; cursor: pointer; font-size: 20px; color: var(--pdf-text-muted); }

.spinner {
    display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5);
    border-top-color: #fff; border-radius: 50%; animation: pdf-spin .6s linear infinite; vertical-align: -2px;
}
@keyframes pdf-spin { to { transform: rotate(360deg); } }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .workbench { grid-template-columns: 1fr; }
    .wb-col-left, .wb-col-right { position: static; max-height: none; }
}
