:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --border: #e2e8f0;
  --coffee: #ffdd00;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}
.logo {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo .logo-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 0.9rem;
}
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.bmc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--coffee);
  color: #1f1300 !important;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
  white-space: nowrap;
}
.bmc:hover { transform: scale(1.04); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 56px 0 36px; }
.hero h1 { font-size: 2.3rem; line-height: 1.2; letter-spacing: -0.02em; }
.hero .subtitle {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 640px;
  margin: 14px auto 0;
}
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid #bbf7d0;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

/* ---------- Tool grid (homepage) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 24px 0 48px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: block;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.tool-card .icon { font-size: 1.8rem; }
.tool-card h3 { margin: 10px 0 4px; font-size: 1.05rem; }
.tool-card p { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 28px 0 4px;
}

/* ---------- Tool page ---------- */
.tool-hero { text-align: center; padding: 40px 0 24px; }
.tool-hero h1 { font-size: 2rem; letter-spacing: -0.02em; }
.tool-hero p { color: var(--muted); max-width: 620px; margin: 10px auto 0; font-size: 1.05rem; }

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 8px auto 40px;
  max-width: 760px;
}

.dropzone {
  border: 2px dashed #c7d2fe;
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #e0e7ff; }
.dropzone .dz-icon { font-size: 2.2rem; }
.dropzone p { margin-top: 8px; color: var(--text); font-weight: 600; }
.dropzone small { color: var(--muted); display: block; margin-top: 4px; }
.dropzone input[type="file"] { display: none; }

.file-list { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.file-item button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 9px;
  font-size: 0.85rem;
  color: var(--muted);
}
.file-item button:hover { border-color: var(--accent); color: var(--accent); }

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}
.options-row label { font-weight: 600; font-size: 0.92rem; }
.options-row select, .options-row input[type="text"], .options-row input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}
.options-row input[type="range"] { accent-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
  margin-top: 20px;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { background: #c7d2fe; cursor: not-allowed; }
.btn.secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.secondary:hover { background: var(--accent-soft); }

.status { margin-top: 14px; text-align: center; color: var(--muted); font-size: 0.95rem; min-height: 1.4em; }
.status.success { color: var(--green); font-weight: 600; }
.status.error { color: #dc2626; font-weight: 600; }

.result-box {
  margin-top: 18px;
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  display: none;
}
.result-box.show { display: block; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.preview-grid .preview-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.preview-grid img, .preview-grid canvas { width: 100%; display: block; }
.preview-grid .preview-item .meta { padding: 6px; }

/* ---------- Content / FAQ ---------- */
.content-section { max-width: 760px; margin: 0 auto 48px; }
.content-section h2 { font-size: 1.5rem; margin: 32px 0 12px; letter-spacing: -0.01em; }
.content-section h3 { font-size: 1.1rem; margin: 20px 0 8px; }
.content-section p, .content-section li { color: #334155; }
.content-section ol, .content-section ul { padding-left: 24px; margin: 10px 0; }
.content-section li { margin: 6px 0; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 10px 0;
}
.faq-item h3 { margin: 0 0 6px; font-size: 1.02rem; }
.faq-item p { margin: 0; font-size: 0.95rem; }

/* ---------- Related tools ---------- */
.related-tools { max-width: 760px; margin: 0 auto 56px; }
.related-tools h2 { font-size: 1.3rem; margin-bottom: 14px; }
.related-list { display: flex; flex-wrap: wrap; gap: 10px; }
.related-list a {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.related-list a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Coffee banner ---------- */
.coffee-banner {
  max-width: 760px;
  margin: 0 auto 48px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.coffee-banner h2 { font-size: 1.25rem; margin-bottom: 6px; }
.coffee-banner p { color: #78716c; font-size: 0.95rem; max-width: 480px; margin: 0 auto 16px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0;
  margin-top: 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 24px;
}
.footer-grid h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin: 6px 0; }
.footer-grid a { color: var(--text); font-size: 0.92rem; }
.footer-brand p { color: var(--muted); font-size: 0.9rem; margin-top: 8px; max-width: 280px; }
.footer-bottom {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ---------- Clickable page picker (Split PDF) ---------- */
.page-pick .preview-item {
  cursor: pointer;
  user-select: none;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.1s ease, background 0.1s ease;
}
.page-pick .preview-item:hover { outline-color: #c7d2fe; }
.page-pick .preview-item.selected {
  outline-color: var(--accent);
  background: var(--accent-soft);
}
.page-pick .preview-item.selected .meta { color: var(--accent); font-weight: 700; }
.picker-hint { margin-top: 14px; font-size: 0.88rem; color: var(--muted); text-align: center; }

/* ---------- Merge PDF document cards ---------- */
.merge-grid .preview-item { position: relative; }
.merge-grid .order-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.merge-grid .thumb-fallback { font-size: 2.2rem; padding: 28px 0; text-align: center; background: #fff; }
.merge-grid .meta .file-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.merge-grid .card-actions { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.merge-grid .card-actions button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.merge-grid .card-actions button:hover { border-color: var(--accent); color: var(--accent); }
.merge-grid .merge-card[draggable="true"] { cursor: grab; }
.merge-grid .merge-card.dragging { opacity: 0.45; cursor: grabbing; }
.merge-grid .merge-card.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

/* ---------- Floating coffee button ---------- */
.bmc-floating {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--coffee);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
  transition: transform 0.15s ease;
}
.bmc-floating:hover { transform: scale(1.12); text-decoration: none; }

/* ---------- Misc ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

textarea.big-text {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
}
textarea.big-text:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.stat-card .num { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat-card .label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

@media (max-width: 720px) {
  .hero h1 { font-size: 1.7rem; }
  .tool-hero h1 { font-size: 1.5rem; }
  .nav-links a.nav-text { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .tool-panel { padding: 18px; }
}
