/* ===================================================================
   DocScan Pro - Premium Modern Design System
   Color Palette: Obsidian, Deep Slate, Indigo & Cyan Electric Accents
   =================================================================== */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101522;
  --bg-card: rgba(22, 29, 46, 0.75);
  --bg-card-hover: rgba(28, 38, 62, 0.85);
  --bg-input: #151c2e;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #3b82f6 50%, #06b6d4 100%);
  --accent-glow: 0 0 25px rgba(99, 102, 241, 0.35);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

.app-layout {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* 顶部导航栏 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  letter-spacing: 0.05em;
}

.header-center-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
}

/* 响应式按钮文字自适应控制 */
.btn-text-desktop {
  display: inline;
}

.btn-text-mobile {
  display: none;
}

/* 主体容器 */
.main-content {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 120px;
}

/* 上传区域 */
.upload-section {
  margin-bottom: 32px;
}

.dropzone-card {
  position: relative;
  background: var(--bg-card);
  border: 2px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
}

.dropzone-card:hover, .dropzone-card.dragover {
  border-color: var(--accent-primary);
  background: rgba(28, 38, 62, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4), 0 0 30px rgba(99, 102, 241, 0.15);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.upload-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-lg);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #818cf8;
  animation: floatBounce 4s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.upload-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  letter-spacing: -0.01em;
}

.upload-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 22px;
}

.upload-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.upload-actions {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* 工作台工具栏 */
.workspace-section {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

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

.doc-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.counter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.counter-number {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

.global-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.group-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0 6px 0 4px;
  font-weight: 500;
}

.btn-preset {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-preset:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-preset.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.sort-actions,
.order-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-icon-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-text:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-text.btn-add {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}

.btn-icon-text.btn-add:hover {
  background: rgba(99, 102, 241, 0.22);
}

.btn-icon-text.btn-danger {
  color: #f87171;
}

.btn-icon-text.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.drag-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.drag-hint b {
  color: #c7d2fe;
}

/* 卡片排版网格 */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.doc-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
  user-select: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.doc-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 20px rgba(99, 102, 241, 0.15);
}

.doc-card.dragging {
  opacity: 0.4;
  border: 2px dashed var(--accent-primary);
  transform: scale(0.96);
}

.doc-card.dragover-card {
  border: 2px solid #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

/* 卡片顶部栏 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
}

.card-order-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.card-order-badge .drag-icon {
  cursor: grab;
  color: var(--text-muted);
}

.card-quick-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-card-action {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-card-action.btn-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* 卡片缩略图视口 */
.card-thumb-viewport {
  position: relative;
  width: 100%;
  height: 240px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.card-thumb-viewport img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease-out;
}

.card-thumb-viewport:hover .thumb-overlay-hint {
  opacity: 1;
}

.thumb-overlay-hint {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 20, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.card-filter-indicator {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.65);
  color: #cbd5e1;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 卡片控制底部 */
.card-body {
  padding: 14px;
}

.card-file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-filename {
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.card-filesize {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-filter-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.btn-card-filter {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-card-filter:hover {
  color: #fff;
}

.btn-card-filter.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* 底部常驻栏 */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(10, 13, 20, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 14px 32px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

.footer-content {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.footer-tip {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pulse-glow {
  position: relative;
}

.pulse-glow::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius-md) + 3px);
  background: var(--accent-gradient);
  z-index: -1;
  opacity: 0.5;
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0; }
  100% { transform: scale(1); opacity: 0.5; }
}

/* 弹窗系统 (Modals) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container.modal-lg {
  max-width: 980px;
}

.modal-container.modal-result {
  max-width: 620px;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.compare-tip-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

/* 表单组件 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.radio-pill-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.radio-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.radio-pill input[type="radio"] {
  accent-color: var(--accent-primary);
}

.radio-pill input[type="radio"]:checked + span {
  color: #fff;
  font-weight: 600;
}

.margin-slider-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.slider-input {
  flex: 1;
  accent-color: var(--accent-primary);
}

.slider-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  min-width: 48px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 对比弹窗样式 (CamScanner Split Slider) */
.compare-modal-body {
  padding: 16px 24px 24px;
}

.comparison-container {
  position: relative;
  width: 100%;
  height: 540px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  cursor: ew-resize;
  border: 1px solid var(--border-subtle);
}

.comp-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.comp-proc-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  border-left: 2px solid #fff;
}

.comp-proc-wrapper .comp-img-proc {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comp-label {
  position: absolute;
  bottom: 14px;
  z-index: 10;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.label-left {
  left: 14px;
}

.label-right {
  right: 14px;
}

.comp-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 40px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 20;
}

.handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.handle-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.compare-controls {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compare-mode-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.btn-compare-mode {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-compare-mode:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-compare-mode.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* 进度与生成结果 Modal 样式 */
.result-loading-state {
  text-align: center;
  padding: 30px 10px;
}

.spinner-ring {
  width: 58px;
  height: 58px;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  width: 35%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

.result-success-state {
  text-align: center;
  padding: 10px 0;
}

.success-icon-badge {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.25);
}

.success-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
}

.pdf-card-info {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  margin-bottom: 24px;
}

.pdf-file-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.pdf-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.chip-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.preview-accordion {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.btn-toggle-inline-preview {
  background: transparent;
  border: none;
  color: #818cf8;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.btn-toggle-inline-preview:hover {
  background: rgba(99, 102, 241, 0.1);
}

.inline-iframe-wrap {
  margin-top: 12px;
  width: 100%;
  height: 420px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.inline-iframe-wrap iframe {
  width: 100%;
  height: 100%;
}

/* Toast 提示 */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(16, 21, 34, 0.95);
  backdrop-filter: blur(16px);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}

/* 存储保护与生命周期横幅 */
.storage-notice-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: left;
}

.notice-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.notice-text {
  font-size: 0.84rem;
  color: #a7f3d0;
  line-height: 1.45;
}

.notice-text strong {
  color: #fff;
}

.notice-text b {
  color: #6ee7b7;
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-size: 0.88rem;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

.btn-outline-info {
  background: transparent;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.88rem;
}

.btn-outline-info:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.7);
  color: #fff;
}

/* 合成完成常驻面板 */
.completion-banner {
  position: relative;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.completion-banner-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.completion-banner-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.completion-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.completion-banner-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.22);
  border: 1.5px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.completion-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.completion-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.banner-highlight {
  color: #a7f3d0;
  font-weight: 600;
}

.badge-validity {
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.completion-banner-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 响应式调整 (Mobile Optimization) */
@media (max-width: 768px) {
  .app-header {
    padding: 10px 14px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .header-center-info {
    display: none;
  }
  .header-brand .brand-title {
    font-size: 1.15rem;
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  /* 手机端隐藏顶部“一键生成PDF”按钮 */
  #btnGeneratePdf,
  .btn-header-generate {
    display: none !important;
  }
  /* 顶部“PDF输出配置”只保留图标 */
  #btnOpenPdfSettings {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
  }
  #btnOpenPdfSettings .btn-text-desktop {
    display: none !important;
  }
  #btnOpenPdfSettings svg {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
  }
  .header-actions .btn:not(#btnOpenPdfSettings) {
    padding: 7px 12px;
    font-size: 0.82rem;
  }
  /* 响应式按钮文字切换 */
  .btn-text-desktop {
    display: none !important;
  }
  .btn-text-mobile {
    display: inline !important;
  }
  .main-content {
    padding: 16px 12px calc(110px + env(safe-area-inset-bottom, 0px));
  }
  .dropzone-card {
    padding: 28px 14px;
    border-radius: var(--radius-md);
  }
  .upload-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .upload-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }
  .workspace-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  .toolbar-left, .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  .global-filter-group {
    flex-wrap: wrap;
    gap: 6px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* 卡片手机端操作优化：按钮加大方便手指轻触 */
  .card-quick-actions {
    gap: 6px;
  }
  .btn-card-action {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }
  .btn-card-action svg {
    width: 16px;
    height: 16px;
  }
  .card-filter-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .btn-card-filter {
    padding: 8px 4px;
    font-size: 0.8rem;
    text-align: center;
    justify-content: center;
  }
  /* 完成横幅手机端适配 */
  .completion-banner-body {
    flex-direction: column;
    align-items: stretch;
  }
  .completion-banner-btns {
    width: 100%;
    flex-direction: column;
  }
  .completion-banner-btns .btn {
    width: 100%;
    justify-content: center;
  }
  /* 底部固定条手机端严格防撑破宽度 */
  .sticky-footer {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom, 0px)) !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .footer-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }
  .footer-info {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    overflow: hidden !important;
  }
  .footer-badge {
    font-size: 0.78rem !important;
    padding: 2px 8px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .footer-tip {
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    color: var(--text-muted) !important;
  }
  .footer-actions {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
  }
  .footer-actions[style*="display: none"] {
    display: none !important;
  }
  .footer-actions .btn {
    box-sizing: border-box !important;
    padding: 9px 8px !important;
    font-size: 0.84rem !important;
    border-radius: var(--radius-sm) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .footer-actions .btn svg {
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
  }
  /* 制作中状态：配置按钮紧凑，生成导出撑满 */
  #btnFooterSettings {
    flex: 0 0 auto !important;
    padding: 9px 12px !important;
  }
  #btnFooterGenerate {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 9px 6px !important;
  }
  /* 合成完成状态：再次生成和下载等分平铺 */
  #btnFooterReset,
  #btnFooterDownload {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 9px 6px !important;
  }
  /* 禁用伪元素光晕的放大动画，避免边缘子像素溢出 */
  .pulse-glow::after {
    display: none !important;
  }
  /* 弹窗在手机端全屏自适应 */
  .modal-overlay {
    padding: 10px;
  }
  .modal-container {
    max-width: 100%;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
  }
  .modal-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .result-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .comparison-container {
    height: 320px;
  }
}


