/* ===================================================================
   PDFTools — Design System
   =================================================================== */

:root {
  --accent: #4F46E5;
  --accent-dark: #4338CA;
  --accent-light: #EEF0FF;
  --accent-lighter: #F5F6FF;

  --ink-900: #0F1222;
  --ink-700: #3D4159;
  --ink-500: #6B7089;
  --ink-300: #A8ACC2;

  --surface: #FFFFFF;
  --surface-alt: #F8F9FC;
  --border: #E6E8F0;
  --border-strong: #D5D8E6;

  --success: #16A34A;
  --success-bg: #ECFDF3;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 18, 34, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 18, 34, 0.06), 0 1px 3px rgba(15, 18, 34, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 18, 34, 0.10);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--surface-alt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; color: var(--ink-500); }

/* ============================= Header ============================= */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo-mark {
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 13px;
  font-weight: 700;
  margin-right: 4px;
}

.site-nav {
  display: flex;
  gap: 24px;
  margin-left: 8px;
}

.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-500);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--ink-900); }

.badge-free {
  margin-left: auto;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

/* ============================= Hero ============================= */

.hero {
  padding: 72px 0 48px;
  text-align: center;
}

.hero h1 {
  font-size: 42px;
  line-height: 1.15;
  max-width: 720px;
  margin: 0 auto;
}

.text-accent { color: var(--accent); }

.hero-sub {
  max-width: 560px;
  margin: 18px auto 0;
  font-size: 17px;
}

/* ============================= Tool grid ============================= */

.tool-group {
  padding: 40px 0 8px;
}

.tool-group h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  margin-bottom: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.tool-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.tool-card p {
  font-size: 13px;
  color: var(--ink-500);
}

/* ============================= Why section ============================= */

.why-section { padding: 56px 0 80px; }
.why-section h2 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 32px;
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.why-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.why-card h3 { font-size: 16px; margin-bottom: 8px; }
.why-card p { font-size: 14px; }

/* ============================= Tool page ============================= */

.tool-page {
  max-width: 640px;
  padding-top: 48px;
  padding-bottom: 80px;
}

.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
}

.tool-icon-lg {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-header h1 { font-size: 26px; margin-bottom: 6px; }
.tool-header p { font-size: 15px; }

/* ============================= Dropzone ============================= */

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-lighter);
}

.dropzone-icon { color: var(--accent); margin-bottom: 12px; }
.dropzone-title { font-size: 16px; font-weight: 600; color: var(--ink-900); margin-bottom: 6px; }
.dropzone-sub { font-size: 13px; color: var(--ink-300); margin-bottom: 14px; }
.dropzone-hint { font-size: 12px; color: var(--ink-300); margin-top: 14px; }

/* ============================= File list ============================= */

.file-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}

.file-list .file-name { flex: 1; color: var(--ink-700); font-weight: 500; }
.file-list .file-size { color: var(--ink-300); }
.file-list .file-remove {
  cursor: pointer;
  color: var(--ink-300);
  background: none;
  border: none;
  display: flex;
  align-items: center;
}
.file-list .file-remove:hover { color: var(--danger); }

/* Merge PDF only — drag-to-reorder file list */
.file-list--reorderable li { cursor: grab; transition: background 0.15s, box-shadow 0.15s; }
.file-list--reorderable li.dragging { opacity: 0.4; cursor: grabbing; }
.file-list--reorderable li.drag-over { background: var(--accent-light); box-shadow: inset 0 2px 0 var(--accent); }

.file-drag-handle { color: var(--ink-300); flex-shrink: 0; display: flex; align-items: center; cursor: grab; }
.file-drag-handle:active { cursor: grabbing; }

.file-order {
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================= Options / form fields ============================= */

.option-row {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}

.option-row select,
.option-row input[type="password"],
.option-row input[type="text"],
.option-row input[type="url"],
.option-row input[type="number"] {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink-900);
}

.option-row select:focus,
.option-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================= Compare PDF (two-slot) ============================= */

.compare-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .compare-slots { grid-template-columns: 1fr; }
}

.compare-slot-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}

.dropzone-sm { padding: 28px 16px; }
.dropzone-sm .dropzone-icon { margin-bottom: 8px; }

/* ============================= Fill PDF Form ============================= */

#fields-list .option-row:first-child { margin-top: 0; }
#fields-list .option-row label { word-break: break-word; }

/* ============================= Reorder thumbnails ============================= */

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.thumb {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 8px;
  text-align: center;
  cursor: grab;
  user-select: none;
  transition: border-color 0.15s, opacity 0.15s;
}

.thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.thumb-label {
  display: block;
  font-size: 12px;
  color: var(--ink-300);
  margin-top: 6px;
}

.thumb.dragging { opacity: 0.4; border-color: var(--accent); }

/* ============================= Buttons ============================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, opacity 0.15s;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled {
  background: var(--ink-300);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-500);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-alt); }

.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; margin-top: 22px; }

/* ============================= Progress / result / error panels ============================= */

.hidden { display: none !important; }

.progress-panel,
.result-panel,
.error-panel {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 8px;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.result-check { color: var(--success); margin-bottom: 12px; }
.result-panel h3 { font-size: 18px; margin-bottom: 20px; }
.result-panel .btn { margin: 0 6px; }
.result-warning {
  background: #FFFBEB;
  color: #B45309;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: -8px 0 20px;
}

.error-panel { border-color: var(--danger-bg); background: var(--danger-bg); }
.error-panel p { color: var(--danger); font-weight: 500; margin-bottom: 16px; }

/* ============================= Footer ============================= */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  padding: 48px 24px 32px;
}

.footer-brand { max-width: 280px; }
.footer-brand p { font-size: 13px; margin-top: 12px; }

.footer-links {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-links h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-300);
  margin-bottom: 12px;
}

.footer-links a {
  display: block;
  font-size: 13px;
  color: var(--ink-500);
  padding: 4px 0;
}
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  font-size: 12px;
  color: var(--ink-300);
}

/* ============================= Responsive ============================= */

@media (max-width: 720px) {
  .hero h1 { font-size: 30px; }
  .site-nav { display: none; }
  .header-inner { gap: 16px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ============================= Ad Slots ============================= */

.ad-slot { width: 100%; overflow: hidden; text-align: center; }
.ad-slot--header { max-width: 1100px; margin: 0 auto; padding: 12px 24px 0; }
.ad-slot--footer { max-width: 1100px; margin: 0 auto; padding: 24px 24px 0; }
.ad-slot--sidebar { max-width: 640px; margin: 24px auto 0; padding: 0 24px; }

.ad-slot:empty { display: none; }

.ad-slot::before {
  content: 'Advertisement';
  display: block;
  font-size: 10px;
  color: var(--ink-300);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.ad-slot:empty::before { display: none; }

/* ============================= Tab toggle (Text to PDF) ============================= */

.tab-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.tab-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink-500);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { background: var(--surface-alt); color: var(--ink-900); }
.tab-btn--active { background: var(--accent); color: #ffffff; }
.tab-btn--active:hover { background: var(--accent-dark); color: #ffffff; }

/* ============================= Tool Content Sections ============================= */

.tool-content-section {
  max-width: 640px;
  margin: 48px auto 0;
  padding: 0 24px;
}

.tool-content-block {
  margin-bottom: 40px;
}

.tool-content-h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.tool-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: steps;
}

.tool-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  counter-increment: steps;
  font-size: 14px;
  color: var(--ink-700);
  line-height: 1.6;
}

.tool-steps li:last-child { border-bottom: none; }

.tool-steps li::before {
  content: counter(steps);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.tool-steps li strong {
  color: var(--ink-900);
  display: block;
  margin-bottom: 2px;
}

.tool-features {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-features li {
  padding: 10px 0 10px 24px;
  position: relative;
  font-size: 14px;
  color: var(--ink-700);
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.tool-features li:last-child { border-bottom: none; }

.tool-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.tool-features li strong { color: var(--ink-900); }

.tool-faq { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-q::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: 12px;
}

details[open] .faq-q::after { content: "−"; }

.faq-a {
  padding: 0 16px 14px;
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.7;
}

.tool-related {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.related-tool-link {
  display: inline-block;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.related-tool-link:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}
