/* =====================================================
 * PDF 转图片工具 - 样式
 * 深色主题，与火焰演示项目视觉风格保持一致
 * ===================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: radial-gradient(ellipse at 50% 0%, #141a26 0%, #0b0e14 60%);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #e8ecf4;
}

.hidden {
  display: none !important;
}

/* ---------------- 顶栏 ---------------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(14, 18, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar .logo {
  font-size: 22px;
}

.toolbar h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.toolbar .subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.back-link {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.15s ease;
}

.back-link:hover {
  color: #fff;
  border-color: rgba(255, 140, 26, 0.6);
  background: rgba(255, 140, 26, 0.08);
}

/* ---------------- 主容器 ---------------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------------- 上传区 ---------------- */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
  outline: none;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.dragover {
  border-color: #ff8c1a;
  background: rgba(255, 140, 26, 0.06);
}

.upload-zone:active {
  transform: scale(0.995);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 14px rgba(255, 140, 26, 0.5));
}

.upload-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* ---------------- 设置区 ---------------- */
.settings {
  background: rgba(18, 22, 32, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* 文件信息条 */
.file-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.file-badge-icon {
  font-size: 30px;
}

.file-badge-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.ghost-btn {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ghost-btn:hover {
  border-color: rgba(255, 140, 26, 0.7);
  color: #ffb84d;
}

/* 设置网格 */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
}

.setting-note {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.32);
}

/* 分段选择控件 */
.seg-control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  width: fit-content;
}

.seg-control button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-control button:hover {
  color: #fff;
}

.seg-control button.active {
  background: linear-gradient(135deg, #ff6a00, #ff9a3d);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 106, 0, 0.45);
}

/* 质量滑块 */
.quality-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quality-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  max-width: 220px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3a2a12, #ff8c1a);
  outline: none;
  cursor: pointer;
}

.quality-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9c9, #ff8c1a 70%);
  border: 2px solid #fff3;
  box-shadow: 0 0 10px rgba(255, 140, 26, 0.7);
  cursor: pointer;
}

.quality-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9c9, #ff8c1a 70%);
  border: 2px solid #fff3;
  box-shadow: 0 0 10px rgba(255, 140, 26, 0.7);
  cursor: pointer;
}

.quality-value {
  color: #ffb84d;
  font-size: 13px;
  font-weight: 600;
  min-width: 44px;
}

/* 主按钮 */
.primary-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ff6a00, #ff9a3d);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 106, 0, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 22px rgba(255, 106, 0, 0.65);
}

.primary-btn:active {
  transform: translateY(1px) scale(0.97);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.primary-btn.small {
  padding: 9px 18px;
  font-size: 13px;
  border-radius: 10px;
}

/* ---------------- 进度区 ---------------- */
.progress {
  background: rgba(18, 22, 32, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-bar-wrap {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #ff6a00, #ffb84d);
  box-shadow: 0 0 12px rgba(255, 140, 26, 0.6);
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------------- 结果区 ---------------- */
.result {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-title {
  font-size: 16px;
  font-weight: 600;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.page-card {
  background: rgba(18, 22, 32, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.page-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 140, 26, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

.page-thumb {
  background: #f4f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.page-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.page-card-body {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.page-info {
  min-width: 0;
}

.page-label {
  font-size: 13px;
  font-weight: 600;
}

.page-size {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.download-btn:hover {
  border-color: rgba(255, 140, 26, 0.7);
  color: #ffb84d;
  background: rgba(255, 140, 26, 0.08);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  background: rgba(30, 36, 48, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  animation: toastIn 0.25s ease;
}

.toast.error {
  border-color: rgba(255, 90, 90, 0.55);
  color: #ff9d9d;
}

.toast.success {
  border-color: rgba(74, 222, 128, 0.45);
  color: #7ee2a4;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  .toolbar {
    padding: 12px 16px;
  }

  .toolbar .subtitle {
    display: none;
  }

  .container {
    padding: 20px 14px 48px;
  }

  .upload-zone {
    padding: 40px 16px;
  }

  .settings {
    padding: 16px;
  }

  .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
