/* ==========================================================================
   ToolFlect PDF Tools — styles.css
   Modern, responsive SaaS UI. Single source of truth for the tool's look.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --brand: #5b5ce2;
  --brand-600: #4a4bd0;
  --brand-050: #eef0ff;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --good: #16a34a;
  --good-bg: #ecfdf5;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 10px 30px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #f7f8ff 0%, #ffffff 260px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }

.container { width: min(1080px, 100% - 2rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--brand); font-size: 1.35rem; line-height: 1; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: 1.05rem; font-weight: 700; }
.brand__tag { font-size: .7rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.site-header__cta { margin-left: .5rem; }

/* ---------- Hero ---------- */
.hero { padding: 3.25rem 0 2rem; text-align: center; }
.breadcrumb { display: flex; gap: .4rem; justify-content: center; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--muted); }
.crumb-sep { color: var(--line-strong); }
.hero__title { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .75rem; }
.hero__subtitle { max-width: 640px; margin: 0 auto 1.5rem; color: var(--ink-soft); font-size: 1.06rem; }
.hero__actions { margin-bottom: 1.5rem; }
.hero__trust { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; justify-content: center; padding: 0; margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-600); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-soft); }
.btn--lg { padding: .85rem 1.6rem; font-size: 1rem; }
.btn--sm { padding: .4rem .7rem; font-size: .82rem; }

/* ---------- Tool card ---------- */
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; margin: .75rem 0 3rem; }
.tool-card__head { margin-bottom: 1.25rem; }
.tool-card__title { font-size: 1.4rem; }
.tool-card__sub { color: var(--muted); margin: 0; font-size: .95rem; }
.tool-error { background: var(--bad-bg); border: 1px solid #fecaca; color: var(--bad); padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .92rem; }

/* ---------- Dropzone ---------- */
.dz {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
  padding: 2.25rem 1rem;
  text-align: center;
}
.dz:hover, .dz--active { border-color: var(--brand); background: var(--brand-050); }
.dz--active { transform: scale(1.005); }
.dz__icon { color: var(--brand); margin-bottom: .5rem; }
.dz__title { margin: 0; font-weight: 600; font-size: 1.05rem; }
.dz__sub { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; }
.dz__browse { color: var(--brand); font-weight: 600; }
.dz__browse:hover { text-decoration: underline; }
.dz__privacy { margin: .75rem 0 0; color: var(--muted); font-size: .78rem; }

/* ---------- Progress ---------- */
.progress-wrap { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.25rem; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .2s ease; }
.progress__label { font-size: .82rem; color: var(--muted); }

/* ---------- Panels / toolbar ---------- */
.panel { margin-top: 1.25rem; }
.panel__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0 .6rem; }
.panel__label { font-weight: 700; color: var(--ink-soft); font-size: .95rem; }
.panel__hint { color: var(--muted); font-size: .82rem; }
.toolbar__row { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; }
.toolbar__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 180px; }
.field--range { flex: 1 1 240px; }
.field__label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.field__value { color: var(--brand); font-weight: 700; }
.select, .input {
  font: inherit; font-size: .92rem; color: var(--ink);
  padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
.select:focus, .input:focus { outline: 2px solid var(--brand-050); border-color: var(--brand); }

/* ---------- Badge ---------- */
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 999px; }
.badge--dst { background: var(--brand-050); color: var(--brand-600); }

/* ---------- Merge file list ---------- */
.file-list { display: flex; flex-direction: column; gap: .5rem; }
.list-hint { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.file-row {
  display: flex; align-items: center; gap: .7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem;
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: grab;
}
.file-row:hover { border-color: var(--line-strong); }
.file-row.is-dragging { opacity: .5; border-color: var(--brand); }
.file-row__grip { color: var(--line-strong); letter-spacing: -2px; user-select: none; }
.file-row__icon { font-size: 1.1rem; }
.file-row__body { flex: 1; min-width: 0; }
.file-row__name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row__meta { font-size: .78rem; color: var(--muted); }

/* ---------- Page grid ---------- */
.page-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem;
}
.pg-card {
  border: 2px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease;
  user-select: none;
}
.pg-card:hover { border-color: var(--line-strong); }
.pg-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-050); }
.pg-card.is-dragging { opacity: .5; }
.pg-thumb { aspect-ratio: 3 / 4; background: var(--surface-soft); display: grid; place-items: center; overflow: hidden; }
.pg-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pg-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: .35rem .5rem; font-size: .78rem; border-top: 1px solid var(--line);
}
.pg-num { font-weight: 700; color: var(--ink-soft); }
.pg-check {
  width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center;
  font-size: .7rem; font-weight: 800; color: #fff; background: var(--line-strong);
  transition: background .12s ease;
}
.pg-card.is-selected .pg-check { background: var(--brand); }

/* ---------- Image results ---------- */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.results-summary { font-weight: 700; color: var(--ink-soft); }
.results { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.res-card {
  display: grid; grid-template-columns: 52px 1fr auto; gap: .9rem; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem; background: var(--surface);
}
.res-thumb { width: 52px; height: 64px; border-radius: 6px; overflow: hidden; background: var(--surface-soft); display: grid; place-items: center; }
.res-thumb img { width: 100%; height: 100%; object-fit: contain; }
.res-body { min-width: 0; }
.res-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-meta { font-size: .78rem; color: var(--muted); }

/* ---------- SEO sections ---------- */
.seo-section { margin: 3rem 0; }
.seo-section__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 1.25rem; }

/* How-to */
.ht-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.ht-step { display: flex; gap: 1rem; align-items: flex-start; }
.ht-step__num {
  flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 999px;
  background: var(--brand-050); color: var(--brand-600); font-weight: 800;
  display: grid; place-items: center; margin-top: .1rem;
}
.ht-step__title { margin: 0 0 .15rem; font-size: 1.02rem; }
.ht-step__text { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* Features */
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.feature-item { display: flex; gap: .85rem; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; }
.feature-item__icon { color: var(--brand); font-size: 1.2rem; line-height: 1.4; }
.feature-item__title { margin: 0 0 .2rem; font-size: .98rem; }
.feature-item__text { margin: 0; color: var(--ink-soft); font-size: .88rem; }

/* Comparison table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.comparison-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
.comparison-table th, .comparison-table td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.comparison-table thead th { background: var(--surface-soft); font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.comparison-table tbody tr:last-child th, .comparison-table tbody tr:last-child td { border-bottom: none; }
.comparison-table tbody th { font-weight: 600; color: var(--ink); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: .6rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.faq-item__q { cursor: pointer; padding: .85rem 1rem; font-weight: 600; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item__q::after { content: "+"; font-size: 1.2rem; color: var(--brand); transition: transform .15s ease; }
.faq-item[open] .faq-item__q::after { transform: rotate(45deg); }
.faq-item__a { padding: 0 1rem 1rem; color: var(--ink-soft); font-size: .9rem; }

/* Related tools */
.related-tools { display: flex; flex-wrap: wrap; gap: .6rem; }
.rt-chip {
  display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink-soft); font-size: .85rem; font-weight: 500;
  transition: border-color .15s ease, background .15s ease;
}
.rt-chip:hover { border-color: var(--brand); background: var(--brand-050); text-decoration: none; }

/* ---------- Tools directory grid (landing page) ---------- */
.tools-directory { margin-top: 3rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-top: 1rem; }
.tools-grid__card {
  display: flex; flex-direction: column; gap: .25rem; padding: .85rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tools-grid__card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.tools-grid__card strong { font-size: .92rem; }
.tools-grid__card small { font-size: .76rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.75rem 0; color: var(--muted); font-size: .85rem; text-align: center; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: center; margin-bottom: .75rem; font-weight: 500; }
.site-footer__nav a { color: var(--ink-soft); }
.site-footer__nav a:hover { color: var(--brand); }
.site-footer__nav--legal { font-size: .8rem; gap: 1rem; }
.site-footer__nav--legal a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .tool-card { padding: 1.1rem; }
  .field { min-width: 100%; }
  .hero { padding-top: 2.5rem; }
  .site-header__cta { display: none; }
  .brand__tag { display: none; }
  .res-card { grid-template-columns: 48px 1fr; }
  .res-card .btn { grid-column: 1 / -1; justify-self: end; }
}
