/* COMPARE tool page — rebuilt to iLovePDF's compare layout (client
   2026-10-17: "check compare of ilovepdf … miror it our"). Toolbar on top,
   the two documents side by side (own zoom pills + close), the Compare PDF
   panel right: mode cards, search, change report, red Download report. */

.compare-page.tool-page { max-width: none; padding: 20px 22px 26px; }

/* ------------------------------------------------------------ upload ---- */
#cmp-start { max-width: 940px; margin: 0 auto; }
.cmp-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmp-slot { border-radius: 16px; }
.cmp-slot-tag {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px;
  border-radius: 999px; background: #e8f5f2; color: #1f7a6d;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.cmp-tag-b { background: #f0ebff; color: #6d4bc0; }
.cmp-slot-name { max-width: 32ch; margin: 6px auto 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.cmp-slot.has-file { border-color: #7cc9b8; background: #f7fdfb; }
.cmp-slot.is-b.has-file { border-color: #b7a6e8; background: #fbf9ff; }
.cmp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 14px; margin-top: 18px; }
.cmp-hint { color: #7a8894; }

/* --------------------------------------------------------------- app ---- */
.cp-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 364px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top panel" "stage panel";
  height: calc(100vh - var(--header-h, 64px) - 30px);
  min-height: 540px;
  overflow: hidden;
  background: #eef1f5;
  border: 1px solid #e3e8ee;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(23, 43, 66, .08);
}
.cp-app.is-nopanel { grid-template-columns: minmax(0, 1fr) 0; }
.cp-app.is-nopanel .cp-panel { display: none; }

/* ------------------------------------------------------------- topbar --- */
.cp-top {
  grid-area: top;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e3e8ee;
}
.cp-tool {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border: 0; border-radius: 8px;
  background: none; color: #5d6f83;
  font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.cp-tool i { font-size: 17px; }
.cp-tool:hover { color: #33475b; background: #f6f9fc; }
.cp-tool.is-on { color: #e5322d; background: #fff1f0; }
.cp-panelbtn {
  margin-left: auto; width: 40px; padding: 0;
  justify-content: center;
  border: 1.5px solid #e5322d; border-radius: 8px; color: #e5322d;
}
.cp-panelbtn[aria-pressed="false"] { border-color: #e3e8ee; color: #93a1b1; }

/* -------------------------------------------------------------- stage --- */
.cp-stage {
  grid-area: stage;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  min-height: 0;
  background: #eef1f5;
}
.cp-stage.is-overlay { grid-template-columns: 1fr; }
.cp-stage.is-overlay .cp-pane { display: none; }
.cp-stage.is-pan .cp-scroll { cursor: grab; }
.cp-pane {
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
  background: #fff;
  border: 2px solid #cfd8e3;
  border-radius: 8px;
  transition: border-color .15s;
}
.cp-pane.is-active { border-color: #3c78bd; }
.cp-close {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  width: 26px; height: 26px;
  border: 0; border-radius: 6px;
  background: rgba(255, 255, 255, .92); color: #5d6f83;
  font-size: 17px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 35, 60, .18);
}
.cp-close:hover { color: #e5322d; }
.cp-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 22px 14px 46px;
}
.cp-sheet { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cp-pagebox {
  position: relative;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 6px 20px rgba(15, 35, 60, .16), 0 1px 3px rgba(15, 35, 60, .08);
}
.cp-pagebox img { display: block; width: 100%; height: auto; border-radius: 3px; }
/* The change boxes (iLovePDF highlights the changed text in place) —
   positioned in percentages, so they follow any zoom. */
.cp-hl {
  position: absolute; border-radius: 2px;
  pointer-events: none;
}
.cp-hl.is-removed { background: rgba(229, 50, 45, .20); border: 1.5px solid rgba(229, 50, 45, .78); }
.cp-hl.is-added { background: rgba(34, 150, 90, .18); border: 1.5px solid rgba(34, 150, 90, .72); }
.cp-zoompill {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  z-index: 6;
  padding: 3px 6px; border-radius: 8px;
  background: #3b3b3b;
  box-shadow: 0 6px 16px rgba(15, 35, 60, .25);
}
.cp-zoompill select {
  height: 26px; padding: 0 4px;
  border: 1px solid #fff; border-radius: 5px;
  background: transparent; color: #fff;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.cp-zoompill option { color: #1f2d3d; }

/* Content overlay: both pages stacked, B ghosted over A. */
.cp-overlayview { grid-column: 1 / -1; display: flex; min-height: 0; overflow: hidden; }
.cp-overlayview[hidden] { display: none; }
.cp-sheet-o { background: transparent; }
.cp-pagestack { position: relative; width: 100%; }
.cp-pagestack .cp-base { display: block; width: 100%; border-radius: 3px; }
.cp-pagestack .cp-ghost {
  position: absolute; inset: 0; width: 100%;
  opacity: .55; mix-blend-mode: multiply; border-radius: 3px;
}
.cp-pagestack .cp-hl { position: absolute; }

/* -------------------------------------------------------------- panel --- */
.cp-panel {
  grid-area: panel;
  display: flex; flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 16px;
  background: #fff;
  border-left: 1px solid #e3e8ee;
}
.cp-title {
  margin: 2px 0 16px;
  font-size: 1.52rem; text-align: center; color: #1f2d3d;
}
.cp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.cp-mode {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 8px 10px;
  border: 1px solid #dfe6ee; border-radius: 10px;
  background: #fff; color: #5d6f83;
  font: inherit; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cp-mode:hover { border-color: #c9d6e3; }
.cp-mode b { font-size: 13px; color: #33475b; }
.cp-mode-note { font-size: 11px; color: #93a1b1; }
.cp-mode.is-on { border-color: #cfdbe7; background: #fbfdff; }
.cp-mode.is-on b { color: #1f2d3d; }
.cp-mode-check {
  position: absolute; top: -9px; left: -9px;
  display: none; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #3aa76d; color: #fff; font-size: 11px;
  box-shadow: 0 2px 6px rgba(30, 90, 60, .35);
}
.cp-mode.is-on .cp-mode-check { display: flex; }

.cp-info {
  margin: 0 0 14px; padding: 12px 14px;
  border: 1px solid #bcd9f5; border-radius: 10px;
  background: #eaf4ff; color: #21578c;
  font-size: 13px; line-height: 1.5;
}
.cp-searchrow { margin-bottom: 14px; }
.cp-searchrow input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid #dbe3ec; border-radius: 10px;
  font: inherit; font-size: 14px; color: #2f3f52;
  transition: border-color .15s, box-shadow .15s;
}
.cp-searchrow input::placeholder { color: #9aa9ba; }
.cp-searchrow input:focus {
  outline: none; border-color: #9fc3e8;
  box-shadow: 0 0 0 3px rgba(47, 111, 181, .12);
}

/* Working strip (the run takes a couple of seconds; the AI a little more). */
.cp-working {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding: 10px 12px;
  border: 1px solid #dbe7f2; border-radius: 10px;
  background: #fff; font-size: 13px; color: #37474f;
  box-shadow: 0 6px 18px rgba(15, 35, 60, .06);
}
.cp-working[hidden] { display: none; }
.cp-working.cw-ok { border-color: #c3e5cf; background: #f4fbf6; color: #1e6b3f; }
.cp-working.cw-err { border-color: #f0c4c4; background: #fff7f7; color: #a94442; }
.cw-spin {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid #cfe0f0; border-top-color: #1f7a6d;
  animation: cwspin .8s linear infinite;
}
.cp-working.cw-ok .cw-spin, .cp-working.cw-err .cw-spin { display: none; }
.cp-working.cw-ok::before { content: "\2713"; font-weight: 700; }
.cp-working.cw-err::before { content: "\26a0"; font-weight: 700; }
@keyframes cwspin { to { transform: rotate(360deg); } }

/* The AI lock card (account / credits / model offline). */
.cp-aiblock {
  margin-bottom: 12px; padding: 12px 14px;
  border: 1px solid #f3e2bf; border-radius: 10px;
  background: #fffaf0; color: #7a5a1f;
  font-size: 13px; line-height: 1.5;
}
.cp-aiblock[hidden] { display: none; }
.cp-aiblock b { display: block; margin-bottom: 4px; color: #5f4718; }
.cp-aiblock a, .cp-aiblock button {
  display: inline-block; margin-top: 8px;
  padding: 0; border: 0; background: none;
  color: #17599c; font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer;
}

/* AI findings card. */
.cp-ai {
  margin-bottom: 12px; padding: 12px 14px;
  border: 1px solid #e6ecf3; border-radius: 10px;
  background: #fcfdff;
}
.cp-ai[hidden] { display: none; }
.cp-ai-head { display: flex; align-items: center; gap: 8px; }
.cp-ai-head h3 { margin: 0; font-size: 13.5px; color: #1f2d3d; }
.cmp-ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: #efe9ff; color: #6d4bc0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.cmp-ai-badge.is-local { background: #eef3f8; color: #42546a; }
.cmp-ai-badge.is-local svg { display: none; }
.cp-ai-note { margin-left: auto; font-size: 11.5px; color: #93a1b1; }
.cp-ai p { margin: 8px 0; font-size: 13px; line-height: 1.5; color: #37474f; }
.cp-ai ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cp-ai li { display: flex; gap: 8px; font-size: 12.8px; line-height: 1.45; color: #37474f; }
.cai-chip {
  flex: 0 0 auto; height: 18px; padding: 0 7px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700;
  line-height: 18px; text-transform: capitalize;
  background: #eef3f8; color: #5a6d83;
}
.cai-added { background: #eaf7ef; color: #1e6b3f; }
.cai-removed { background: #fdeeee; color: #a3352f; }
.cai-moved { background: #fff6e6; color: #8a5a12; }
.cai-changed { background: #eef3f8; color: #42546a; }

/* Change report — the iLovePDF list of page-grouped old/new cards. */
.cp-report { flex: 1 1 auto; }
.cp-report h3 { margin: 4px 0 10px; font-size: 15px; color: #1f2d3d; }
.cp-group h4 {
  margin: 12px 0 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #93a1b1;
}
.cp-change {
  margin-bottom: 9px; padding: 10px 11px;
  border: 1px solid #eef2f7; border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 35, 60, .04);
}
.cp-ch-head {
  display: flex; justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11.5px; font-weight: 700; color: #66788b;
}
.cp-ch-old, .cp-ch-new {
  margin-top: 6px; padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.6px; line-height: 1.45; color: #37474f;
  word-break: break-word;
}
.cp-ch-old { background: #fff1f0; }
.cp-ch-new { background: #f0faf4; }
.cp-ch-old b, .cp-ch-new b {
  display: block; margin-bottom: 2px;
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
}
.cp-ch-old b { color: #a3352f; }
.cp-ch-new b { color: #1e6b3f; }
.cp-ch-line + .cp-ch-line { margin-top: 2px; }
.cp-empty { margin: 8px 0; font-size: 13px; color: #93a1b1; }
.cp-empty[hidden] { display: none; }

.cp-download {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: 58px; margin-top: 14px;
  border: 0; border-radius: 10px;
  background: #e5322d; color: #fff;
  font: inherit; font-size: 17px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(229, 50, 45, .28);
}
.cp-download:hover { background: #d42b26; }
.cp-download:disabled { opacity: .55; }
.cp-arr {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, .9);
  font-size: 14px;
}

/* --------------------------------------------------------- responsive --- */
@media (max-width: 1180px) {
  .cp-app { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 900px) {
  .compare-page.tool-page { padding: 12px 10px 20px; }
  .cmp-slots { grid-template-columns: 1fr; }
  .cp-app {
    display: block; height: auto; min-height: 0;
  }
  .cp-panel { border-left: 0; border-top: 1px solid #e3e8ee; }
  .cp-stage { min-height: 60vh; }
  .cp-pane { border-width: 1px; }
}
