/* Full-viewport app layout: site header, one toolbar, then editor | preview. */
body.pdf-splitter {
  --ps-bbox: #2563eb; /* page content-box overlay in the editor */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.ps-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.5rem clamp(0.5rem, 1vw, 1.5rem);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
  font-size: 0.9rem;
}

.ps-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  min-width: 0;
}

.ps-status {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40ch;
}

.ps-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
}

.ps-opt input[type="number"] {
  width: 4.5rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.ps-opt input[type="number"]:focus {
  outline: none;
  border-color: var(--link);
}

.ps-opt input[type="number"]:disabled {
  opacity: 0.45;
}

.pdf-splitter input[type="checkbox"] {
  accent-color: var(--link);
}

.ps-download {
  background: var(--link);
  color: var(--bg);
}

.ps-download:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---- panes ---- */
.ps-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.ps-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ps-pane + .ps-pane {
  border-left: 1px solid var(--border);
}

.ps-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}

@media (max-width: 700px) {
  .ps-main {
    flex-direction: column;
  }
  .ps-pane + .ps-pane {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

.ps-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.ps-empty > div {
  max-width: 46ch;
}

.ps-empty h2 {
  margin-top: 0;
}

.ps-empty p {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-dim);
}

/* ---- editor ---- */
#editorDoc {
  position: relative;
  margin: 20px auto;
  background: #fff;
  border: 1px solid var(--border);
  cursor: crosshair;
}

#editorDoc canvas {
  display: block;
  position: absolute;
  left: 0;
}

.page-sep {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--text-dim);
  pointer-events: none;
}

.bbox {
  position: absolute;
  border: 1px dashed var(--ps-bbox);
  background: rgba(37, 99, 235, 0.04);
  pointer-events: none;
}

.bbox.off {
  border-color: var(--text-dim);
  background: repeating-linear-gradient(45deg, rgba(66, 66, 66, 0.16) 0 6px, rgba(66, 66, 66, 0.06) 6px 12px);
}

.ghost {
  position: absolute;
  left: -12px;
  right: -12px;
  border-top: 2px dashed var(--link);
  opacity: 0.6;
  pointer-events: none;
  display: none;
}

.brk {
  position: absolute;
  left: -12px;
  right: -12px;
  height: 13px;
  margin-top: -6px;
  cursor: ns-resize;
}

.brk::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  border-top: 3px solid var(--accent);
}

.brk .x {
  position: absolute;
  right: -14px;
  top: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

.brk .tag {
  position: absolute;
  left: 14px;
  top: -18px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: #fff;
  padding: 0 4px;
  border-radius: var(--radius);
}

/* include/exclude toggle in the left gutter */
.pick {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 30px;
  padding: 4px 0;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  background: var(--bg-raised);
  border: 1px solid var(--link);
  border-radius: var(--radius);
  color: var(--link);
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

.pick input {
  margin: 0;
  cursor: pointer;
}

.pick.off {
  border-color: var(--border);
  color: var(--text-dim);
}

/* ---- preview ---- */
#preview {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.pv-page {
  position: relative;
}

.pv-page canvas {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
}

.pv-label {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-top: 3px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---- drag & drop overlay ---- */
#drop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(238, 90, 88, 0.1);
  border: 4px dashed var(--link);
  color: var(--link);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  z-index: 100;
  pointer-events: none;
}

body.dragging #drop {
  display: flex;
}
