/* ============================================================
   Panda Converter — 样式参考 pdf.fangge.net/merge-pdf
   紫色主题 · 白色卡片 · 简洁中性
   ============================================================ */

:root {
  /* 品牌色 */
  --brand: #8b5cf6;        /* violet-500 主色 */
  --brand-hover: #7c3aed;  /* violet-600 hover */
  --brand-soft: #ede9fe;   /* violet-100 */
  --logo: #8b3dff;

  /* 中性色 */
  --bg: #f8fafc;           /* slate-50 页面背景 */
  --surface: #ffffff;      /* 卡片背景 */
  --ink: #0f172a;          /* slate-900 主文字 */
  --text-secondary: #64748b; /* slate-500 次要文字 */
  --text-tertiary: #94a3b8;  /* slate-400 更浅文字 */
  --text-heading: #334155;   /* slate-700 小标题 */
  --border: #e2e8f0;         /* slate-200 边框 */
  --border-soft: #f1f5f9;    /* slate-100 细分隔 */

  /* 语义色 */
  --green-50: #f0fdf4;
  --green-700: #15803d;
  --blue-50: #eff6ff;
  --blue-600: #2563eb;
  --rose-50: #fff1f2;
  --rose-600: #e11d48;
  --amber-50: #fffbeb;
  --amber-600: #d97706;
  --emerald-50: #ecfdf5;
  --emerald-600: #059669;
  --cyan-50: #ecfeff;
  --cyan-600: #0891b2;
  --indigo-50: #eef2ff;
  --indigo-600: #4f46e5;
  --teal-50: #f0fdfa;
  --teal-600: #0d9488;
  --sky-50: #f0f9ff;
  --sky-600: #0284c7;
  --violet-50: #f5f3ff;
  --violet-600: #7c3aed;

  /* 圆角 */
  --radius-sm: 0.5rem;     /* 按钮 */
  --radius: 0.75rem;       /* 小卡片 */
  --radius-lg: 1rem;       /* 主卡片 rounded-2xl */

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

  /* 容器 */
  --max-w: 72rem;          /* max-w-6xl */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--logo);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
}

/* 主题图标：浅色显示月亮，暗黑显示太阳 */
.icon-sun { display: none; }

/* ---------- Main ---------- */
.main-container {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1rem;
  width: 100%;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 1.5rem;
}

.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { margin: 0 0.5rem; }
.breadcrumb .current { color: var(--text-secondary); }

/* ---------- Tool Card (主容器) ---------- */
.tool-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .tool-card { padding: 2rem; }
}

/* ---------- Tool Header (图标 + 标题 + 描述) ---------- */
.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tool-icon-box {
  flex-shrink: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-50);
  color: var(--blue-600);
}

.tool-icon-box svg { width: 26px; height: 26px; }

.tool-title-block h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.tool-title-block p {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---------- Upload Area ---------- */
.upload-box {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: all 0.15s;
  cursor: pointer;
  background: var(--surface);
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--brand);
  background: var(--violet-50);
}

.upload-icon {
  color: var(--brand);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
}

.upload-hint {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.upload-limit {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 1.25rem;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
  text-decoration: none;
}

.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--surface);
  color: var(--text-heading);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--bg); }

/* ---------- Progress / Result / Error ---------- */
.progress-box,
.result-box,
.error-box {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 1.5rem;
  text-align: center;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

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

.result-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.result-filename { font-weight: 600; margin-bottom: 1.25rem; word-break: break-all; color: var(--text-heading); }

.error-box {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.hidden { display: none !important; }

/* ---------- Privacy Bar ---------- */
.privacy-bar {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  color: var(--green-700);
  font-size: 0.75rem;
  line-height: 1.4;
}

.privacy-bar svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------- SEO Content / About Section ---------- */
.about-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.about-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.about-section .lead {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-section h3 {
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-heading);
}

.about-section ol {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  list-style-type: decimal;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-section ol li { margin-bottom: 0.25rem; }

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.faq-item summary {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.faq-item[open] summary::after { content: "−"; }

.faq-item p {
  padding: 0 1rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ---------- Related Tools Grid ---------- */
.related-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.related-section > h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}

.related-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all 0.15s;
}

.related-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.related-icon-box {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.related-card:hover .related-icon-box { transform: scale(1.1); }

.related-icon-box svg { width: 22px; height: 22px; }

.related-info { min-width: 0; flex: 1; }
.related-info h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.related-info p {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 图标背景色变体 */
.icon-blue { background: var(--blue-50); color: var(--blue-600); }
.icon-rose { background: var(--rose-50); color: var(--rose-600); }
.icon-green { background: var(--emerald-50); color: var(--emerald-600); }
.icon-amber { background: var(--amber-50); color: var(--amber-600); }
.icon-cyan { background: var(--cyan-50); color: var(--cyan-600); }
.icon-indigo { background: var(--indigo-50); color: var(--indigo-600); }
.icon-teal { background: var(--teal-50); color: var(--teal-600); }
.icon-sky { background: var(--sky-50); color: var(--sky-600); }
.icon-violet { background: var(--violet-50); color: var(--violet-600); }

/* ============================================================
   Home page — 布局参考 pdf.fangge.net 首页
   ============================================================ */

/* ---------- Hero ---------- */
.home-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 4.5rem 1rem 3.5rem;
}

.home-hero-inner {
  max-width: 48rem;
  margin: 0 auto;
  text-align: center;
}

.home-hero h1 {
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hp-brand { color: var(--brand); }

.home-hero-sub {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* 圆角胶囊搜索框 */
.hp-search-wrap {
  position: relative;
  max-width: 28rem;
  margin: 0 auto;
}

.hp-search {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 9999px;
  padding: 0.875rem 1.25rem 0.875rem 3rem;
  font-size: 0.9375rem;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.hp-search::placeholder { color: var(--text-tertiary); }

.hp-search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.hp-search::-webkit-search-cancel-button { -webkit-appearance: none; }

.hp-search-icon {
  position: absolute;
  left: 1.125rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ---------- Tools: tabs + card grid ---------- */
.home-tools {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

.hp-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: 3rem;
}

.hp-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-heading);
  border-radius: 9999px;
  padding: 0.5rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

.hp-tab:hover { border-color: var(--brand); color: var(--brand); }

.hp-tab.is-active {
  border-color: var(--brand);
  background: var(--violet-50);
  color: var(--brand-hover);
}

.tool-group { margin-bottom: 3rem; }
.tool-group:last-of-type { margin-bottom: 0; }

.tool-group-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.125rem;
}

.tool-group-head h2 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-group-sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.tool-group-count {
  margin-left: auto;
  border-radius: 9999px;
  background: var(--bg);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.hp-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.hp-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.125rem 1.25rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.hp-card:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-md);
}

.hp-card-icon {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.hp-card:hover .hp-card-icon { transform: scale(1.1); }

.hp-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.hp-card-body strong {
  font-size: 0.9375rem;
  font-weight: 600;
}

.hp-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hp-card-arrow {
  flex-shrink: 0;
  display: inline-flex;
  color: var(--text-tertiary);
  transition: transform 0.15s, color 0.15s;
}

.hp-card:hover .hp-card-arrow {
  transform: translateX(0.25rem);
  color: var(--brand);
}

.hp-no-result {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  padding: 1rem 0 0;
}

.hidden { display: none !important; }

/* ---------- Features: why choose us ---------- */
.home-features {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4rem 1rem;
}

.home-features-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.home-features h2 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 2.5rem;
}

.hp-feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.hp-feature {
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

.hp-feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--violet-50);
  color: var(--brand);
  margin-bottom: 1rem;
}

.hp-feature h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hp-feature p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---------- Home page responsive ---------- */
@media (min-width: 640px) {
  .hp-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .hp-cards { grid-template-columns: repeat(3, 1fr); }
  .hp-feature-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 1rem;
  text-align: center;
  margin-top: auto;
}

.footer-copy {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.footer-privacy {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .home-hero { padding: 3rem 1rem 2.5rem; }
  .home-hero h1 { font-size: 1.625rem; }
  .tool-header { gap: 0.75rem; }
  .tool-icon-box { width: 3rem; height: 3rem; }
  .tool-icon-box svg { width: 22px; height: 22px; }
  .tool-title-block h1 { font-size: 1.25rem; }
  .main-container { padding: 1.5rem 1rem; }
}

/* ============================================================
   Dark Mode — 触发：html.dark
   ============================================================ */
.dark {
  color-scheme: dark;

  --bg: #171717;            /* neutral-900 页面背景 */
  --surface: #262626;       /* neutral-800 卡片 */
  --ink: #f5f5f5;           /* neutral-100 主文字 */
  --text-secondary: #a3a3a3;/* neutral-400 */
  --text-tertiary: #737373; /* neutral-500 */
  --text-heading: #d4d4d4;  /* neutral-300 */
  --border: #404040;        /* neutral-700 */
  --border-soft: #262626;   /* neutral-800 */

  /* 品牌浅底 → brand-500/10 */
  --violet-50: rgba(139, 92, 246, 0.1);

  /* 隐私提示条：green-500/10 + green-400 */
  --green-50: rgba(34, 197, 94, 0.1);
  --green-700: #4ade80;

  /* 语义色：统一 *-500/10 底 + *-400 图标 */
  --blue-50: rgba(59, 130, 246, 0.1);
  --blue-600: #60a5fa;
  --rose-50: rgba(244, 63, 94, 0.1);
  --rose-600: #fb7185;
  --emerald-50: rgba(16, 185, 129, 0.1);
  --emerald-600: #34d399;
  --amber-50: rgba(69, 26, 3, 0.4);
  --amber-600: #fbbf24;
  --cyan-50: rgba(6, 182, 212, 0.1);
  --cyan-600: #22d3ee;
  --indigo-50: rgba(99, 102, 241, 0.1);
  --indigo-600: #818cf8;
  --teal-50: rgba(20, 184, 166, 0.1);
  --teal-600: #2dd4bf;
  --sky-50: rgba(14, 165, 233, 0.1);
  --sky-600: #38bdf8;
  --violet-600: #a78bfa;
}

/* 头部：毛玻璃白 → 毛玻璃 neutral-800/80 */
.dark .site-header {
  background: rgba(38, 38, 38, 0.8);
}

/* 图标按钮 hover：深色底 */
.dark .icon-btn:hover {
  background: #404040;
  color: var(--ink);
}

/* 主题图标交换：隐藏月亮，显示太阳 */
.dark .icon-moon { display: none; }
.dark .icon-sun { display: block; }

/* 错误框深色版 */
.dark .error-box {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
