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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* 头部样式 */
header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
  display: grid;
  grid-template-columns: 320px 1fr 200px;
  gap: 20px;
  height: calc(100vh - 80px);
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

/* 左侧控制面板 */
.control-panel {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  height: fit-content;
  max-height: 100%;
}

.control-panel h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  border-bottom: 2px solid #e74c3c;
  padding-bottom: 8px;
}

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

.file-input-group {
  margin-bottom: 15px;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  border: none;
  font-size: 14px;
}

.file-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.file-icon {
  font-size: 16px;
}

.file-name {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #7f8c8d;
  font-style: italic;
}

/* 页面导航 */
.navigation-section {
  margin-bottom: 30px;
}

.page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 12px;
}

.nav-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

.nav-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#page-info {
  font-weight: 600;
  color: #2c3e50;
  min-width: 60px;
  text-align: center;
}

/* 印章设置 */
.stamp-settings {
  margin-bottom: 30px;
}

.setting-group {
  margin-bottom: 15px;
}

.setting-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #2c3e50;
  font-size: 14px;
}

.setting-group input {
  width: 100%;
  padding: 10px;
  border: 2px solid #ecf0f1;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.setting-group input:focus {
  outline: none;
  border-color: #3498db;
}

/* 按钮样式 */
.action-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.action-btn.primary {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
}

.action-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.action-btn.secondary {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

.action-btn.secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.action-btn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 印章列表 */
.stamp-list-section {
  margin-bottom: 30px;
}

.stamp-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.stamp-actions .action-btn {
  flex: 1;
  margin-bottom: 0;
  padding: 8px;
  font-size: 12px;
}

.stamp-list {
  list-style: none;
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #ecf0f1;
  border-radius: 6px;
  padding: 10px;
}

.stamp-list li {
  padding: 8px;
  margin-bottom: 5px;
  background: #f8f9fa;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-size: 12px;
}

.stamp-list li:hover {
  background: #e9ecef;
}

.stamp-list li.selected {
  background: #3498db;
  color: white;
}

/* 进度条 */
.progress-container {
  margin-top: 15px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #ecf0f1;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2980b9);
  width: 0%;
  transition: width 0.3s ease;
}

#progress-text {
  font-size: 12px;
  color: #7f8c8d;
  text-align: center;
  display: block;
}

/* 右侧预览面板 */
.preview-panel {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e74c3c;
}

.preview-header h3 {
  color: #2c3e50;
  font-size: 1.2rem;
  font-weight: 600;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zoom-btn {
  width: 35px;
  height: 35px;
  border: none;
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: all 0.3s ease;
}

.zoom-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(155, 89, 182, 0.4);
}

#zoom-level {
  font-weight: 600;
  color: #2c3e50;
  min-width: 50px;
  text-align: center;
}

/* 预览容器 */
.preview-container {
  flex: 1;
  position: relative;
  overflow: auto;
  border: 2px dashed #bdc3c7;
  border-radius: 10px;
  background: #f8f9fa;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px;
}

.pdf-canvas {
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: white;
  border: 1px solid #ccc;
  cursor: crosshair;
  display: block;
}

.stamp-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

.stamp {
  position: absolute;
  cursor: move;
  pointer-events: auto;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

.stamp:hover {
  border-color: #3498db;
}

.stamp.selected {
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.stamp img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 2px;
}

/* 拖拽区域 */
.drop-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 249, 250, 0.95);
  border: 3px dashed #bdc3c7;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.drop-zone.drag-over {
  border-color: #3498db;
  background: rgba(52, 152, 219, 0.1);
}

.drop-zone.hidden {
  display: none;
}

.drop-message {
  text-align: center;
  color: #7f8c8d;
}

.drop-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.drop-message p {
  font-size: 16px;
  line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 300px 1fr;
  }

  .control-panel {
    padding: 20px;
  }
}

/* 收款二维码区域样式 */
.donation-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
}

.coffee-icon {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 15px auto;
}

.donation-panel h3 {
  margin: 0;
  color: #333;
  font-size: 16px;
  text-align: center;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.donation-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qr-code {
  max-width: 120px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.qr-code:hover {
  transform: scale(1.05);
}

.donation-text {
  margin: 0;
  font-size: 12px;
  color: #666;
  text-align: center;
  font-weight: 500;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
    height: auto;
  }

  .control-panel {
    order: 2;
    max-height: none;
  }

  .preview-panel {
    order: 1;
    min-height: 400px;
  }

  .donation-panel {
    order: 3;
    flex-direction: row;
    justify-content: center;
    padding: 15px;
  }

  .coffee-icon {
    width: 100%;
    max-width: 120px;
    margin-bottom: 10px;
  }

  .donation-item {
    gap: 8px;
  }

  .qr-code {
    max-width: 80px;
    height: auto;
  }

  .donation-text {
    font-size: 11px;
  }

  header h1 {
    font-size: 2rem;
  }

  .stamp-actions {
    flex-direction: column;
    gap: 5px;
  }

  .page-controls {
    flex-direction: column;
    gap: 10px;
  }

  .nav-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  .control-panel,
  .preview-panel {
    padding: 15px;
    border-radius: 10px;
  }

  .zoom-controls {
    flex-direction: column;
    gap: 5px;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-panel,
.preview-panel {
  animation: fadeIn 0.6s ease-out;
}

/* 加载状态 */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
