/* ==========================================================================
   EasyTools 图片转PDF工作台样式 Image-to-PDF CSS
   ========================================================================== */

/* 顶部面包屑与工具头 */
.tool-header-bar {
  padding: 24px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.breadcrumb-nav a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.breadcrumb-nav a:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: var(--border-hover);
}

.tool-header-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.tool-main-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* 工作台双栏布局 */
.workbench-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
  margin-bottom: 60px;
}

/* 左侧主编辑区 */
.workbench-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 上传拖拽区域 Dropzone */
.dropzone-container {
  background: white;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.dropzone-container:hover, .dropzone-container.drag-over {
  border-color: var(--primary);
  background-color: #f8faff;
  box-shadow: 0 0 0 4px var(--primary-focus);
}

.dropzone-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: transform var(--transition-spring);
}

.dropzone-container:hover .dropzone-icon {
  transform: scale(1.1) translateY(-2px);
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.dropzone-title span {
  color: var(--primary);
}

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

.dropzone-file-input {
  display: none;
}

/* 画廊管理工具栏 (Gallery Toolbar) */
.gallery-toolbar {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.gallery-count-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.gallery-count-pill {
  padding: 2px 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.gallery-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 图片网格与卡片 (Image Grid) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.image-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  cursor: grab;
  touch-action: pan-y;
}

.image-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.image-card:active {
  cursor: grabbing;
}

.image-card.sortable-ghost {
  opacity: 0.3;
  background: #eff6ff;
  border: 2px dashed var(--primary);
}

.image-card.sortable-chosen {
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.image-card.sortable-drag {
  cursor: grabbing;
  opacity: 0.96;
  transform: scale(1.03);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  z-index: 999;
}

/* 缩略图预览区 */
.image-thumb-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 预览比例 */
  background: #f1f5f9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* 让拖拽事件直接穿透至外层卡片 */
}

.image-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  transition: transform var(--transition-normal);
  background-color: #fafbfc;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* 页码徽章 */
.card-page-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  z-index: 2;
  pointer-events: none;
}

/* 拖拽手柄 */
.card-drag-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: var(--shadow-xs);
  pointer-events: none;
}
  background: white;
  color: var(--primary);
}

/* 卡片底部操作栏 */
.card-footer {
  padding: 8px 10px;
  background: white;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-filename {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-btn-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.btn-card-action {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-card-action:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-card-action.btn-card-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* 空状态占位图 */
.gallery-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* 右侧配置面板 Settings Panel */
.settings-panel {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--header-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.setting-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* 单选标签组 (Segmented Control) */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 3px;
}

.segmented-control.two-cols {
  grid-template-columns: repeat(2, 1fr);
}

.segmented-control.four-cols {
  grid-template-columns: repeat(4, 1fr);
}

.segmented-btn {
  padding: 7px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-btn:hover {
  color: var(--text-main);
}

.segmented-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* 下拉选择器与输入框 */
.setting-select, .setting-input {
  width: 100%;
  padding: 9px 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.setting-select:focus, .setting-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

/* 统计与概览小部件 */
.panel-summary-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.summary-value {
  font-weight: 600;
  color: var(--text-main);
}

/* 生成按钮 */
.btn-generate {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
}

/* 进度模态弹窗 (Progress Modal) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  transform: scale(0.94);
  transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.progress-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

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

.progress-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.progress-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: var(--radius-full);
  transition: width 0.2s ease-out;
}

.progress-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

/* 移动端与拍照按钮群 (Mobile & Camera Actions) */
.mobile-action-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.btn-camera-highlight {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-normal);
}

.btn-camera-highlight:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-album-select {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  font-size: 0.96rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-album-select:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-hover);
}

/* 手机扫码弹窗 QR Code Modal */
.qr-modal-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.qr-canvas-wrapper {
  margin: 16px auto;
  padding: 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: inline-block;
  box-shadow: var(--shadow-xs);
}

.qr-canvas-wrapper canvas {
  display: block;
}

.qr-url-input-box {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.qr-url-text {
  flex-grow: 1;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: left;
}

/* 网页内连续拍照取景器 (Live Continuous Camera Viewfinder) */
.camera-viewfinder-modal {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 3000;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.camera-viewfinder-modal.active {
  display: flex;
}

.camera-preview-area {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#camera-stream-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 闪光灯视觉效果 */
.camera-flash-overlay {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out;
  z-index: 3010;
}

.camera-flash-overlay.flashing {
  opacity: 0.85;
}

/* 取景文档对准参考框 */
.camera-doc-frame {
  position: absolute;
  width: 82%;
  height: 65%;
  top: 15%;
  left: 9%;
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  pointer-events: none;
  z-index: 3005;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
}

.camera-doc-tip {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* 取景器顶部工具栏 */
.camera-top-toolbar {
  position: relative;
  z-index: 3020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.camera-shots-pill {
  padding: 5px 14px;
  background: rgba(37, 99, 235, 0.85);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-camera-done {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-camera-done:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* 取景器底部快门栏 */
.camera-bottom-toolbar {
  position: relative;
  z-index: 3020;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 24px 20px 36px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.btn-camera-side {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-camera-side:hover {
  background: rgba(255, 255, 255, 0.35);
}

.btn-shutter-outer {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: pointer;
  transition: transform 0.1s ease-out;
}

.btn-shutter-outer:active {
  transform: scale(0.92);
}

.btn-shutter-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  transition: background-color var(--transition-fast);
}

.btn-shutter-outer:active .btn-shutter-inner {
  background: #cbd5e1;
}

.camera-last-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 2px solid white;
  object-fit: cover;
  background: #333;
}

/* 移动端底部固定吸底操作条 (Mobile Sticky Bottom Bar) */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 99;
}

.mobile-bottom-info {
  display: flex;
  flex-direction: column;
}

.mobile-bottom-count {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.mobile-bottom-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mobile-bottom-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 响应式断点与移动端专属优化 */
@media (max-width: 960px) {
  .workbench-layout {
    grid-template-columns: 1fr;
  }
  .settings-panel {
    position: static;
  }
}

@media (max-width: 768px) {
  .tool-header-bar {
    padding: 16px 0 12px;
  }
  .tool-main-title {
    font-size: 1.35rem;
  }
  .dropzone-container {
    padding: 32px 16px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .image-thumb-wrapper {
    padding-top: 110%;
  }
  .card-drag-handle {
    width: 32px;
    height: 32px;
    touch-action: none;
  }
  .card-btn-group .btn-card-action {
    width: 32px;
    height: 32px;
  }
  .workbench-layout {
    margin-bottom: 90px; /* 避开吸底栏 */
  }
  .mobile-bottom-bar {
    display: flex;
  }
}

/* ==========================================================================
   PDF 提前预览全屏弹窗 (PDF Preview Modal)
   ========================================================================== */
.preview-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.preview-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.preview-modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 95vw;
  max-width: 1060px;
  height: 90vh;
  max-height: 880px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-modal-overlay.active .preview-modal-box {
  transform: scale(1);
}

.preview-modal-header {
  height: 54px;
  min-height: 54px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-modal-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-modal-meta {
  font-size: 0.8rem;
  padding: 3px 9px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

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

.btn-preview-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preview-close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.preview-modal-body {
  flex: 1;
  background: #334155;
  position: relative;
  overflow: hidden;
}

.pdf-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #525659;
}

@media (max-width: 640px) {
  .preview-modal-overlay {
    padding: 0;
  }
  .preview-modal-box {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .preview-modal-header {
    padding: 0 10px;
    height: 50px;
  }
  .preview-modal-title {
    font-size: 0.92rem;
  }
  .preview-modal-meta {
    display: none;
  }
}


