/* ==========================================================================
   Shared styles for the four page-operation tools — Merge, Split, Rotate and
   Delete. They are four pages because that is how people search: someone
   after "rotate pdf" should land on a page about rotating, not on a general
   organiser that happens to rotate. Behind the markup they are one tool, so
   the look lives here rather than four times over.

   tools/pdf-pages.js carries the behaviour; tools/pdf-engine.js the PDF work.
   ========================================================================== */

/* ---- the loaded files ------------------------------------------------ */
.srcs { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }

.src {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 10px;
}
.src.fail { border-color: var(--danger-line); }
.src.locked { border-color: var(--warn-line); }
.src .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.src .nm {
  flex: 1 1 auto; min-width: 0; font-size: var(--fs-cap); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src .meta { font: var(--fs-label)/1 var(--mono); color: var(--faint); flex: none; }
.src .pwrow { display: flex; gap: 6px; width: 100%; margin-top: 8px; }
.src .pwrow .ob-input { flex: 1 1 auto; }
.src.needs { flex-wrap: wrap; }

/* ---- the page grid --------------------------------------------------- */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
}

.pg {
  position: relative; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg2); padding: 9px 7px 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: border-color .12s, background .12s;
}
.pg:hover { border-color: var(--line2); }
.pg.sel { border-color: var(--accent-line); background: var(--accent-wash); }
.pg.drag { opacity: .35; }
.pg.over-before { box-shadow: -3px 0 0 var(--accent2); }
.pg.over-after { box-shadow: 3px 0 0 var(--accent2); }

/* A sheet of paper at the page's real aspect ratio, turned the way the
   page is turned. It is not a preview of the content — nothing here
   renders a PDF — but it does show size, orientation and rotation, which
   is what you need to know when reordering. */
.pg .paper {
  background: #e9edf4; border-radius: 2px; flex: none;
  box-shadow: 0 1px 3px rgba(22,20,15,.3);
  display: flex; align-items: center; justify-content: center;
  color: #6b7686; font: 600 var(--fs-label)/1 var(--mono);
}
.pg .paperwrap {
  height: 72px; display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.pg .no { font: 600 var(--fs-cap)/1 var(--mono); color: var(--text); }
.pg .sub { font: var(--fs-label)/1.3 var(--mono); color: var(--faint); text-align: center; }
.pg .tag {
  position: absolute; top: 5px; left: 5px;
  width: 8px; height: 8px; border-radius: 2px;
}
.pg .rot {
  position: absolute; top: 4px; right: 5px;
  font: var(--fs-label)/1 var(--mono); color: var(--accent2); letter-spacing: .02em;
}

.pg .acts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 3px;
  opacity: 0; transition: opacity .12s;
}
.pg:hover .acts, .pg:focus-within .acts { opacity: 1; }
@media (hover: none) { .pg .acts { opacity: 1; } }

.pg .acts button {
  width: var(--tap); height: var(--tap); padding: 0; border-radius: var(--r);
  border: 1px solid var(--edge); background: var(--bg3);
  color: var(--muted); font: var(--fs-cap)/1 var(--mono); cursor: pointer;
}
.pg .acts button:hover { color: var(--ink); border-color: var(--edge-hover); background: var(--sheet-2); }
/* Under a finger the five page actions are 44px each, which needs a wider
   tile: three to a row inside it, two tiles to a row on a phone. */
@media (pointer: coarse) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); }
}
.pg .acts button.x:hover { color: var(--danger); border-color: var(--danger-line); }

/* Where one output file ends and the next begins, in split mode. */
.cut { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; }
.cut::before, .cut::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--line2);
}
.cut span {
  font: var(--fs-label)/1 var(--mono); color: var(--faint); letter-spacing: .04em;
  text-transform: uppercase;
}

.note {
  margin: 16px 0 0; padding: 12px 13px;
  background: var(--bg2); border: 1px solid var(--line);
  border-left: 2px solid var(--accent-line);
  border-radius: var(--r);
  font-size: var(--fs-cap); line-height: 1.65; color: var(--muted);
}
.note b { color: var(--text); font-weight: 600; }
.note + .note { margin-top: 10px; }

.minirow { display: flex; gap: 6px; }
.minirow .ob-btn { flex: 1 1 0; padding-left: 0; padding-right: 0; }

/* While a page is being dragged the file dropzone should stop offering to
   accept it. */
body.reordering .ob-drop { opacity: .4; pointer-events: none; }

/* Full size while there is nothing else to look at, a strip once there is:
   the page grid is what you came for. It still accepts a drop either way. */
body.loaded .ob-drop { padding: 12px; margin-bottom: 12px !important; }
body.loaded .ob-drop .big { font-size: var(--fs-ui); }
body.loaded .ob-drop .sub { display: none; }
