/* EPUB to PDF Converter — Techofera v2 house style.
   Animated modern UI, responsive, keyboard-focus visible,
   prefers-reduced-motion respected. Print rules at the bottom. */
:root {
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-soft: #dbeafe;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #15803d;
  --warn-bg: #fef9c3;
  --warn-ink: #854d0e;
  --err-bg: #fee2e2;
  --err-ink: #991b1b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
main { max-width: 860px; margin: 0 auto; padding: 0 20px 64px; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.15; margin: .4em 0 .2em; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin: 2em 0 .5em; letter-spacing: -.01em; }
p { margin: .5em 0; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.site-header {
  max-width: 860px; margin: 0 auto; padding: 18px 20px 0;
  display: flex; align-items: baseline; gap: 12px;
}
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: .9rem; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }

/* ---------------------------------------------------------- dropzone */
.dropzone {
  margin: 28px 0 16px;
  border: 2px dashed #93c5fd;
  border-radius: var(--radius);
  background: var(--card);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  animation: rise .45s ease both;
}
.dropzone:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.dropzone.dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, .18), var(--shadow);
  transform: scale(1.01);
}
.drop-icon { font-size: 2.2rem; color: var(--blue); line-height: 1; animation: float 2.6s ease-in-out infinite; }
.drop-hint { color: var(--muted); font-size: .92rem; }
.linklike { color: var(--blue); text-decoration: underline; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ------------------------------------------------------------- alerts */
.alert { border-radius: 10px; padding: 12px 16px; margin: 12px 0; animation: rise .3s ease both; }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert p { margin: 0; }

/* ----------------------------------------------------------- file card */
.file-card {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 12px 0; box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
.file-info { display: flex; gap: 12px; align-items: center; min-width: 0; }
.file-icon { font-size: 1.6rem; color: var(--blue); }
.file-name { font-weight: 700; word-break: break-all; }
.file-meta { color: var(--muted); font-size: .9rem; }
.file-actions { display: flex; gap: 10px; }

/* ------------------------------------------------------------- buttons */
.btn {
  font: inherit; font-weight: 650; cursor: pointer;
  border-radius: 10px; padding: 10px 18px; border: 1px solid transparent;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(29, 78, 216, .35); }
.btn-primary:not(:disabled):hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn-primary:not(:disabled):active { transform: translateY(0); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-large { font-size: 1.1rem; padding: 14px 26px; }

/* ------------------------------------------------------------- options */
.options {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 14px 18px 18px; margin: 16px 0;
  display: grid; gap: 12px;
}
.options legend { font-weight: 700; padding: 0 6px; }
.opt-group { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.opt-label { font-weight: 650; min-width: 92px; color: var(--muted); }
.opt-group label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.opt-checks label { font-weight: 550; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--blue); width: 17px; height: 17px; }

/* ------------------------------------------------------------ progress */
.progress-wrap { margin: 18px 0; animation: rise .3s ease both; }
.progress-track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  transition: width .25s ease;
}
.progress-label { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }

/* ------------------------------------------------------------- results */
.results {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin: 20px 0; box-shadow: var(--shadow);
  animation: rise .4s ease both;
}
.results h2 { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 24px; margin: 0; }
.stats div { border-top: 1px solid var(--line); padding-top: 8px; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 2px 0 0; font-weight: 650; word-break: break-word; }
.print-actions { margin-top: 20px; }
.print-help { color: var(--muted); font-size: .95rem; max-width: 62ch; }

/* ------------------------------------------------------------- preview */
.preview-wrap {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin: 20px 0;
}
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-head h2 { margin: 0; }
.preview-note { color: var(--muted); font-size: .95rem; }
.print-view {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  max-height: 70vh; overflow: auto; padding: 24px 28px;
}
.print-view.preview-collapsed { display: none; }
/* Screen preview of the print document: single-column reading view. */
.print-view #print-root { max-width: 640px; margin: 0 auto; }

/* ------------------------------------------------------------- privacy */
.privacy {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius);
  padding: 20px 22px; margin: 28px 0;
}
.privacy h2 { margin-top: 0; }
.net-line { font-size: 1.05rem; }
.net-line strong { font-size: 1.3rem; color: var(--ok); }
.privacy-ok { color: var(--ok); font-weight: 700; }
.verify { color: var(--muted); font-size: .95rem; }

/* --------------------------------------------------------------- guide */
.steps { padding-left: 22px; }
.steps li { margin: .6em 0; }
.faq details {
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  padding: 12px 16px; margin: 10px 0;
}
.faq summary { font-weight: 650; cursor: pointer; }
.faq summary::marker { color: var(--blue); }
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0; color: var(--muted); font-size: .92rem; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 600px) {
  main { padding: 0 14px 48px; }
  .dropzone { padding: 30px 16px; }
  .file-card { flex-direction: column; align-items: stretch; }
  .file-actions { justify-content: stretch; }
  .file-actions .btn { flex: 1; }
  .print-view { padding: 16px; max-height: 60vh; }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- print
   Only the assembled book prints. The preview wrapper's scroll/height
   constraints are removed so nothing is clipped. */
@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  #print-view, #print-view * { visibility: visible; }
  #print-view {
    position: absolute; top: 0; left: 0; width: 100%;
    max-height: none !important; overflow: visible !important;
    border: none; border-radius: 0; padding: 0;
  }
  #print-view #print-root { max-width: none; }
  .no-print { display: none !important; }
}
