/* ============================================================
   PDFBatchSigner — interactive app demo
   Faithful, data-driven replica of the macOS app's "Sign documents"
   view: drop a mix of PDFs, each is auto-matched to a template,
   unrecognized pages are skipped and reported, then sealed in one pass.
   The window sits directly on the page.
   ============================================================ */

.app-demo {
  --d-bg: #1c1c1f;
  --d-sidebar: #242427;
  --d-line: rgba(255, 255, 255, 0.08);
  --d-line-strong: rgba(255, 255, 255, 0.14);
  --d-sel: #0a84ff;
  --d-sel-soft: rgba(10, 132, 255, 0.16);
  --d-text: #f4f4f6;
  --d-text-2: #9c9ca4;
  --d-text-3: #6c6c74;
  --d-green: #30d158;
  --d-amber: #ff9f0a;
  --d-accent: var(--accent, #6a57e0);
  --d-radius: 13px;

  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border-radius: var(--d-radius);
  background: var(--d-bg);
  color: var(--d-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.35;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 2px 6px rgba(23, 22, 27, 0.16), 0 40px 80px -34px rgba(23, 22, 27, 0.5);
  outline: 1px solid rgba(23, 22, 27, 0.12);
  outline-offset: -1px;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ---- title bar ---- */
.app-demo__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--d-line);
  background: rgba(255, 255, 255, 0.015);
}
.app-demo__lights { display: flex; gap: 8px; }
.app-demo__lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.app-demo__lights i:nth-child(1) { background: #ff5f57; }
.app-demo__lights i:nth-child(2) { background: #febc2e; }
.app-demo__lights i:nth-child(3) { background: #28c840; }
.app-demo__bartitle {
  flex: 1; text-align: center;
  font-size: 12.5px; font-weight: 550; color: var(--d-text-2); letter-spacing: -0.01em;
}
.app-demo__bar-spacer { width: 44px; }

/* ---- body: sidebar + main ---- */
.app-demo__body { display: grid; grid-template-columns: 256px 1fr; min-height: 520px; }

/* ---- sidebar ---- */
.app-demo__sidebar {
  background: var(--d-sidebar);
  border-right: 1px solid var(--d-line);
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.app-demo__sidetools {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 2px 6px 8px;
}
.app-demo__sidetools .ico { width: 19px; height: 19px; color: var(--d-sel); opacity: 0.9; }
.app-demo__sidetools .ico--muted { color: var(--d-text-2); }

.app-demo__nav {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 9px; cursor: pointer;
  background: var(--d-sel); color: #fff; font-weight: 550; font-size: 14px;
}
.app-demo__nav .ico { width: 18px; height: 18px; }

.app-demo__grouphead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 4px; margin-top: 14px;
  font-size: 11.5px; font-weight: 600; color: var(--d-text-3); letter-spacing: 0.01em;
}
.app-demo__plus { width: 16px; height: 16px; color: var(--d-text-3); cursor: pointer; }

.app-demo__row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: 7px; color: var(--d-text);
}
.app-demo__row .ico { width: 15px; height: 15px; opacity: 0.8; flex: none; }
.app-demo__rowlabel {
  flex: 1; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-demo__rowmeta { font-size: 11.5px; color: var(--d-text-3); white-space: nowrap; }

.app-demo__sig {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 9px; border-radius: 7px; cursor: pointer;
}
.app-demo__sig:hover { background: rgba(255, 255, 255, 0.05); }
.app-demo__sigpill {
  width: 62px; height: 30px; border-radius: 6px; background: #fff;
  display: grid; place-items: center; flex: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.app-demo__sigpill svg { width: 46px; height: 20px; }
.app-demo__signame { flex: 1; min-width: 0; }
.app-demo__signame b { font-weight: 550; font-size: 13px; }
.app-demo__signame span { display: block; font-size: 11px; color: var(--d-text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-demo__sig .app-demo__rowmeta { color: var(--d-sel); }

/* ---- main ---- */
.app-demo__main { display: flex; flex-direction: column; position: relative; min-width: 0; }
.app-demo__maintitle { font-size: 26px; font-weight: 640; letter-spacing: -0.02em; padding: 22px 26px 14px; }

.app-demo__scroll { flex: 1; overflow-y: auto; padding: 0 26px 8px; max-height: 420px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
.app-demo__scroll::-webkit-scrollbar { width: 9px; }
.app-demo__scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }

/* drop zone */
.app-demo__drop {
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 22px 24px 24px;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.app-demo__drop:hover, .app-demo__drop.is-drag { border-color: var(--d-sel); background: rgba(10, 132, 255, 0.06); }
.app-demo__drop-ico { width: 38px; height: 38px; color: var(--d-text-2); margin: 0 auto 10px; display: block; }
.app-demo__drop h4 { font-size: 17px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.app-demo__drop p { font-size: 12.5px; color: var(--d-text-2); margin: 0 auto 14px; max-width: 48ch; line-height: 1.5; }
.app-demo__addbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--d-sel-soft); color: var(--d-sel);
  font-size: 13.5px; font-weight: 560; padding: 10px 18px; border-radius: 9px;
  border: none; cursor: pointer;
}
.app-demo__addbtn:hover { background: rgba(10, 132, 255, 0.24); }

/* ready list */
.app-demo__ready { font-size: 13.5px; color: var(--d-text-2); margin: 22px 2px 6px; }
.app-demo__ready b { color: var(--d-text); font-weight: 600; }
.app-demo__skipnote { color: var(--d-amber); }
.app-demo__cols {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 8px; font-size: 11.5px; color: var(--d-text-3);
  border-bottom: 1px solid var(--d-line);
}

.app-demo__doc {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 6px; border-bottom: 1px solid var(--d-line);
}
.app-demo__docico { width: 15px; height: 18px; flex: none; opacity: 0.72; }
.app-demo__docname {
  flex: 1; font-size: 13.5px; color: var(--d-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-demo__detected {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--d-sel); font-weight: 500; white-space: nowrap;
}
.app-demo__detected .seal { width: 17px; height: 17px; flex: none; }
.app-demo__pending { color: var(--d-text-3); font-weight: 400; }
.app-demo__skip { color: var(--d-amber); font-weight: 500; }
.app-demo__spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, 0.22); border-top-color: #fff;
  animation: appdemo-spin 0.7s linear infinite; flex: none;
}
@keyframes appdemo-spin { to { transform: rotate(360deg); } }
@keyframes appdemo-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.app-demo__doc.is-new { animation: appdemo-in 0.28s ease both; }
.app-demo__doc.is-signing { background: rgba(10, 132, 255, 0.08); }
.app-demo__seal-pop { transform: scale(0); animation: appdemo-pop 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes appdemo-pop { to { transform: scale(1); } }

/* bottom bar */
.app-demo__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 20px; border-top: 1px solid var(--d-line);
  background: rgba(255, 255, 255, 0.015);
}
.app-demo__link {
  font-size: 13.5px; color: var(--d-sel); font-weight: 500; cursor: pointer;
  padding: 6px 10px; border-radius: 6px;
}
.app-demo__link:hover { background: var(--d-sel-soft); }
.app-demo__link[hidden] { display: none; }
.app-demo__sign {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--d-sel); color: #fff; font-size: 13.5px; font-weight: 560;
  padding: 10px 18px; border-radius: 9px; border: none; cursor: pointer;
  white-space: nowrap; transition: filter 0.15s ease, transform 0.08s ease;
}
.app-demo__sign:hover { filter: brightness(1.08); }
.app-demo__sign:active { transform: translateY(1px); }
.app-demo__sign[disabled] { opacity: 0.5; cursor: default; filter: none; }

/* progress bar */
.app-demo__progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; z-index: 4; }
.app-demo__progress i { display: block; height: 100%; width: 0; background: var(--d-accent); transition: width 0.25s ease; }

/* success overlay */
.app-demo__done {
  position: absolute; inset: 0;
  background: rgba(20, 20, 22, 0.9); backdrop-filter: blur(8px);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px; z-index: 5;
}
.app-demo__done.is-open { display: flex; animation: appdemo-fade 0.3s ease; }
@keyframes appdemo-fade { from { opacity: 0; } to { opacity: 1; } }
.app-demo__donebadge {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--d-green); color: #04210d;
  display: grid; place-items: center; font-size: 30px; font-weight: 800;
  margin-bottom: 20px; box-shadow: 0 0 0 10px rgba(48, 209, 88, 0.14);
  animation: appdemo-pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.app-demo__done h4 { font-size: 19px; font-weight: 640; margin: 0 0 6px; letter-spacing: -0.02em; }
.app-demo__done p { font-size: 13.5px; color: var(--d-text-2); margin: 0 0 22px; max-width: 36ch; line-height: 1.5; }
.app-demo__done small { display: block; font-size: 11.5px; color: var(--d-text-3); margin-top: 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.02em; }
.app-demo__reset {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid var(--d-line-strong);
  font-size: 13.5px; font-weight: 540; padding: 11px 22px; border-radius: 9px; cursor: pointer;
}
.app-demo__reset:hover { background: rgba(255, 255, 255, 0.16); }

/* responsive */
@media (max-width: 720px) {
  .app-demo__body { grid-template-columns: 1fr; }
  .app-demo__sidebar { flex-direction: row; align-items: center; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--d-line); padding: 10px; gap: 8px; scrollbar-width: none; }
  .app-demo__sidebar::-webkit-scrollbar { display: none; }
  .app-demo__sidetools, .app-demo__grouphead, .app-demo__sig-group, .app-demo__side-templates { display: none; }
  .app-demo__nav { flex: none; margin: 0; }
  .app-demo__maintitle { font-size: 22px; padding: 16px 18px 10px; }
  .app-demo__scroll { padding: 0 16px 8px; max-height: 360px; }
}
@media (max-width: 480px) {
  .app-demo { font-size: 13px; }
  .app-demo__foot { padding: 10px 14px; }
  .app-demo__detected, .app-demo__skip { font-size: 12px; }
  .app-demo__cols span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app-demo__spin { animation: none; }
  .app-demo__seal-pop, .app-demo__donebadge, .app-demo__doc.is-new { animation: none; transform: none; }
}
