/* ============================================
   在线文档扫描工具 - 样式表
   蓝白清爽风格，响应式适配
   ============================================ */

/* ---- 全局 ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #333;
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f4f8 50%, #e3edf5 100%);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }

/* ---- 顶部导航 ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 24px;
  background: rgba(255,255,255,0.9);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  border-radius: 0;
  backdrop-filter: blur(10px);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: #1e40af;
}

.nav-links a {
  font-size: 14px;
  color: #555;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-links a:hover {
  background: #e8f4fd;
  color: #2563eb;
}

.logged-in {
  font-size: 13px;
  color: #059669;
  font-weight: 600;
}

/* ---- 主容器 ---- */
#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ---- 页面标题 ---- */
.page-header {
  text-align: center;
  padding: 30px 0 20px;
}

.page-header h1 {
  font-size: 34px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.5px;
}

.page-header .subtitle {
  margin-top: 10px;
  font-size: 16px;
  color: #64748b;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- 选项栏 ---- */
.options-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.option-group {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
}

.option-icon {
  font-size: 16px;
  color: #64748b;
}

.option-label select {
  border: none;
  outline: none;
  font-size: 14px;
  color: #1e293b;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  min-width: 120px;
}

/* ---- 上传区域 ---- */
.upload-section {
  margin: 16px 0 8px;
}

.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.25s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.06);
}

.upload-icon {
  color: #94a3b8;
  margin-bottom: 12px;
}

.drop-text {
  font-size: 17px;
  font-weight: 500;
  color: #334155;
}

.browse-link {
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
}

.drop-hint {
  margin-top: 10px;
  font-size: 13px;
  color: #94a3b8;
}

/* ---- 文件列表 ---- */
.file-list {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.file-list-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
}

/* ---- 文件卡片（缩略图 + 信息 + 操作） ---- */
.progress-section {
  margin: 16px 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

#progressText { color: #334155; }
#progressPercent { color: #2563eb; font-weight: 600; }

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

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

/* ---- 按钮 ---- */
.action-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(37,99,235,0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.btn-outline:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-text {
  background: none;
  color: #94a3b8;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 400;
}

.btn-text:hover { color: #ef4444; }

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

/* ---- 结果列表 ---- */
.result-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.result-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #1e293b;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

.result-item.success { border-left: 3px solid #16a34a; padding-left: 10px; }
.result-item.error { border-left: 3px solid #ef4444; padding-left: 10px; color: #b91c1c; }

/* ---- 文件卡片（缩略图 + 信息 + 操作） ---- */
.file-items {
  max-height: none;
  overflow-y: visible;
}

.file-card {
  display: flex;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: visible;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  height: 110px;
  min-height: 110px;
  border: 2px solid #e2e8f0;
  cursor: grab;
}

.file-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #93c5fd;
}

.file-card.processing {
  border-color: #3b82f6;
}

.file-card.done {
  border-color: #16a34a;
}

.file-card.error {
  border-color: #ef4444;
}

/* 序号角标 */
.file-card-number {
  width: 26px;
  height: 26px;
  background-color: #3b82f6;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  position: absolute;
  border-radius: 6px;
  top: 6px;
  left: 6px;
  z-index: 10;
}

.file-card.done .file-card-number {
  background-color: #16a34a;
}

.file-card.error .file-card-number {
  background-color: #ef4444;
}

.file-card.processing .file-card-number {
  animation: pulse-blue 1.5s ease-in-out infinite;
}

@keyframes pulse-blue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 删除按钮 */
.file-card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.85);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.2s ease;
  padding: 0;
}

.file-card-delete:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

.file-card-delete svg {
  width: 14px;
  height: 14px;
}

/* 状态角标 */
.file-card-status {
  position: absolute;
  top: 6px;
  right: 40px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  z-index: 10;
  display: none;
}

.file-card-status.processing {
  display: inline-flex;
  background: #3b82f6;
  color: white;
  animation: pulse-blue 1.5s ease-in-out infinite;
}

.file-card-status.success {
  display: inline-flex;
  background: #16a34a;
  color: white;
}

.file-card-status.fail {
  display: inline-flex;
  background: #ef4444;
  color: white;
}

/* 缩略图区域 */
.file-card-preview {
  width: 86px;
  min-width: 86px;
  height: 86px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  margin: 10px;
  align-self: center;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.file-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* 信息区域 */
.file-card-info {
  flex: 1;
  padding: 12px 6px 12px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  max-height: 100%;
  overflow: hidden;
}

.file-card-name {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: #1e293b;
  padding-bottom: 6px;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-card-size {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* 操作按钮区域 */
.file-card-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: auto;
  width: 100%;
  max-width: 100%;
  padding-bottom: 4px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.card-action-btn {
  padding: 3px 4px;
  border: none;
  background-color: #f1f5f9;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  justify-content: center;
  text-align: center;
  margin: 0 2px;
}

.card-action-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  color: #1e293b;
}

.card-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.card-action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* 卡片内下载按钮 */
.file-card-download {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 4px 12px;
  background: #2563eb;
  color: white;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  z-index: 10;
}

.file-card-download:hover {
  background: #1d4ed8;
  color: white;
}

/* Sortable 拖拽 */
.sortable-ghost {
  opacity: 0.3;
}

.sortable-chosen {
  box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
}

.sortable-drag {
  opacity: 0.9;
}

/* ---- 功能介绍 ---- */
.features-section {
  margin-top: 40px;
  padding: 20px 0;
}

.features-section h2,
.howto-section h2 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 20px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.feature-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.feature-card strong {
  display: block;
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
}

/* ---- 使用说明 ---- */
.howto-section {
  margin-top: 36px;
  padding: 20px 0;
}

.howto-section p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.8;
  margin-bottom: 10px;
}

.howto-section dt {
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 4px;
}

.howto-section dd {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
}

.howto-list {
  list-style: none;
  counter-reset: step-counter;
  padding: 0;
}

.howto-list li {
  counter-increment: step-counter;
  position: relative;
  padding: 14px 14px 14px 52px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

.howto-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.howto-list li strong {
  color: #1e293b;
}

/* ---- Footer ---- */
.page-footer {
  text-align: center;
  padding: 30px 20px;
  color: #94a3b8;
  font-size: 13px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: fadeInUp 0.3s ease;
}

.toast-error {
  background: #dc2626;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .page-header h1 { font-size: 26px; }

  .options-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .file-card {
    height: 100px;
    min-height: 100px;
    margin-bottom: 10px;
  }

  .file-card-preview {
    width: 72px;
    min-width: 72px;
    height: 72px;
    margin: 8px;
  }

  .file-card-info {
    padding: 10px 4px 10px 0;
  }

  .file-card-name {
    font-size: 0.85rem;
    padding-bottom: 4px;
    max-height: 2.4em;
    line-height: 1.2;
  }

  .file-card-size {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }

  .file-card-actions {
    padding: 2px 3px;
    font-size: 0.8rem;
    margin: 0 1px;
  }

  .card-action-btn {
    padding: 2px 3px;
    font-size: 0.8rem;
    margin: 0 1px;
  }

  .card-action-btn svg {
    width: 14px;
    height: 14px;
  }

  .file-card-number {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    top: 6px;
    left: 6px;
  }

  .file-card-delete {
    width: 24px;
    height: 24px;
    top: 6px;
    right: 6px;
  }

  .file-card-delete svg {
    width: 12px;
    height: 12px;
  }

  .file-card-status {
    top: 6px;
    right: 36px;
    font-size: 10px;
    padding: 1px 6px;
  }

  .btn {
    padding: 10px 18px;
    font-size: 14px;
  }
}
