﻿/* ============================================
   在线盖骑缝章 - 样式表
   参考 imagecut 紫蓝渐变风格，适配PC和手机
   ============================================ */

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1b1b1b;
  background: linear-gradient(135deg, #f6f7fb 0%, #f0f4f9 100%);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }

/* ---- 顶部导航 ---- */
.topbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 0;
}

.topbar .content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: white;
  font-weight: 600;
}

/* ---- 主容器 ---- */
#app {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 40px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- 步骤区域 ---- */
.step-section {
  width: 100%;
  max-width: 640px;
  margin: 16px 16px 0 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.step-num {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.step-body {
  padding: 16px;
}

/* ---- 印章上传 ---- */
.seal-upload-area {
  width: 100%;
}

.seal-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border: 2px dashed rgba(102, 126, 234, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  min-height: 120px;
}

.seal-upload-box:hover,
.seal-upload-box.highlight {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f2ff 0%, #ffffff 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.seal-upload-icon {
  color: #667eea;
  margin-bottom: 10px;
}

.seal-upload-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 4px;
}

.seal-upload-hint {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* 印章预览 */
.seal-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.seal-preview img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  object-fit: contain;
}

.seal-change-btn {
  padding: 6px 16px;
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.seal-change-btn:hover {
  background: rgba(102, 126, 234, 0.15);
}

/* ---- PDF上传 ---- */
.pdf-upload-area {
  width: 100%;
}

.pdf-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border: 2px dashed rgba(102, 126, 234, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  min-height: 120px;
}

.pdf-upload-box:hover,
.pdf-upload-box.highlight {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f2ff 0%, #ffffff 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.pdf-upload-box.loading {
  pointer-events: none;
  opacity: 0.7;
}

.pdf-upload-icon {
  color: #667eea;
  margin-bottom: 10px;
}

.pdf-upload-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 4px;
}

.pdf-upload-hint {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ---- 设置面板 ---- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item.setting-full {
  grid-column: 1 / -1;
}

.setting-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4f4f4f;
}

.setting-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-input-row input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.setting-input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 2px solid #667eea;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.setting-input-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 2px solid #667eea;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.setting-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: #667eea;
  min-width: 40px;
  text-align: right;
}

.setting-page-range {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #4f4f4f;
  flex-wrap: wrap;
}

.page-input {
  width: 56px;
  padding: 6px 8px;
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.page-input:focus {
  border-color: #667eea;
}

.page-all-btn {
  padding: 6px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.page-all-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* ---- 操作按钮 ---- */
.action-section {
  width: 100%;
  max-width: 640px;
  margin: 16px 16px 0 16px;
  display: flex;
  gap: 12px;
}

.btn-primary {
  flex: 1;
  padding: 14px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary {
  flex: 1;
  padding: 14px 20px;
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-secondary:hover {
  background: rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- PDF预览 ---- */
.preview-section {
  width: 100%;
  max-width: 800px;
  margin: 20px 16px 0 16px;
}

.preview-header {
  text-align: center;
  margin-bottom: 12px;
}

.preview-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 4px;
}

.preview-hint {
  font-size: 0.75rem;
  color: #9ca3af;
}

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* PDF页面容器 */
.pdf-page {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  background: white;
  flex-shrink: 0;
  overflow: hidden;
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 完整章（第1页预览用，可拖动Y轴） */
.full-seal {
  position: absolute;
  right: 0;
  cursor: grab;
  z-index: 10;
  user-select: none;
  -webkit-user-drag: none;
}

.full-seal.dragging {
  cursor: grabbing;
  opacity: 0.85;
}

.full-seal img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* 印章拖动提示 */
.seal-drag-hint {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  white-space: nowrap;
  background: rgba(102, 126, 234, 0.9);
  color: #fff;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 20;
  animation: hintPulse 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

@keyframes hintPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.full-seal.dragging .seal-drag-hint {
  display: none;
}

/* 骑缝章切片 */
.qf-seal-clip {
  position: absolute;
  right: 0;
  overflow: hidden;
  z-index: 5;
  pointer-events: none;
}

.qf-seal-clip img {
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* ---- 使用说明 ---- */
.howto-section {
  margin-top: 24px;
  padding: 20px 0;
  width: 100%;
  max-width: 640px;
}

.howto-section h2 {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 16px;
  position: relative;
  padding-top: 12px;
}

.howto-section h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 1px;
}

.howto-section p {
  font-size: 0.9rem;
  color: #4f4f4f;
  line-height: 1.7;
  margin-bottom: 10px;
}

.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-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  font-size: 14px;
  color: #4f4f4f;
  line-height: 1.5;
}

.howto-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.howto-list li strong,
.howto-list dt strong {
  color: #1b1b1b;
}

.howto-list dt {
  font-size: 14px;
  padding: 10px 14px 2px;
  margin-top: 6px;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.howto-list dd {
  font-size: 14px;
  color: #666;
  padding: 2px 14px 12px;
  margin: 0 0 2px;
  background: #fff;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

.toast-error {
  background: rgba(239, 68, 68, 0.9);
}

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

/* ---- 响应式 ---- */
@media (max-width: 767px) {
  .topbar .content {
    padding: 0 12px;
  }

  .brand {
    font-size: 1.2rem;
  }

  .nav-links {
    gap: 14px;
  }

  .nav-links a {
    font-size: 0.85rem;
  }

  .step-section {
    margin: 12px 12px 0 12px;
    width: calc(100% - 24px);
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .action-section {
    margin: 12px 12px 0 12px;
    width: calc(100% - 24px);
    flex-direction: column;
  }

  .preview-section {
    margin: 16px 12px 0 12px;
    width: calc(100% - 24px);
  }

  .preview-container {
    gap: 10px;
  }

  .seal-upload-box,
  .pdf-upload-box {
    padding: 18px 12px;
    min-height: 100px;
  }

  .seal-upload-icon svg,
  .pdf-upload-icon svg {
    width: 24px;
    height: 24px;
  }

  .howto-section {
    padding: 16px 12px;
  }

  .setting-page-range {
    gap: 4px;
  }

  .page-input {
    width: 48px;
    padding: 5px 6px;
    font-size: 0.8rem;
  }
}

@media (min-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}
