/* ==========================================================================
   FOLIO — pages feature styles
   Combine list, crop overlay, resize target, organize panel.
   ========================================================================== */

/* ------------------------------------------------------------------ */
/* Combine                                                            */
/* ------------------------------------------------------------------ */
.pages-combine { display: flex; flex-direction: column; gap: 12px; }
.pages-combine-add {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255, 255, 255, .018);
}
.pages-combine-source { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pages-combine-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.pages-combine-or { font-size: 10px; color: var(--faint); padding-bottom: 9px; }
.pages-combine-files { flex: none; height: 34px; }
.pages-combine-listhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: -6px; }
.pages-combine-hint { font-size: 10px; color: var(--faint); }
.pages-combine-foot { display: flex; flex-direction: column; gap: 9px; }
.pages-combine-note { font-size: 10px; color: var(--faint); line-height: 1.5; }
.pages-combine-keep { margin-top: -2px; }

.combine-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 236px; overflow-y: auto; padding: 5px;
  border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, .16);
}
.combine-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 7px;
  border-radius: 6px; border: 1px solid transparent; background: rgba(255, 255, 255, .025);
  position: relative; cursor: grab;
}
.combine-row:hover { background: rgba(255, 255, 255, .05); }
.combine-row.dragging { opacity: .4; }
.combine-row.drop-before::before,
.combine-row.drop-after::after {
  content: ''; position: absolute; left: 4px; right: 4px; height: 2px;
  background: var(--accent); border-radius: 2px; box-shadow: 0 0 8px var(--accent-glow);
}
.combine-row.drop-before::before { top: -3px; }
.combine-row.drop-after::after { bottom: -3px; }
.combine-grip { color: var(--faint); display: flex; cursor: grab; }
.combine-index {
  width: 20px; height: 20px; flex: none; border-radius: 5px;
  background: var(--panel-3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
}
.combine-ic { color: var(--muted); display: flex; }
.combine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.combine-name { font-size: 11.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combine-meta { font-size: 9.5px; color: var(--faint); }
.combine-actions { display: flex; align-items: center; gap: 1px; flex: none; }
.combine-actions .icon-mini[disabled] { opacity: .28; pointer-events: none; }
.combine-empty {
  padding: 26px 16px; text-align: center; font-size: 11.5px; color: var(--faint); line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Crop dialog                                                        */
/* ------------------------------------------------------------------ */
.pages-crop .dialog-intro { margin-bottom: 12px; }
.crop-shell { display: flex; gap: 16px; align-items: flex-start; }
.crop-stage-wrap {
  flex: none; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 14px; border-radius: 10px; border: 1px solid var(--line);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, .02) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .02) 75%),
    var(--bg-deep);
  background-size: 14px 14px;
  min-width: 220px; min-height: 240px;
  overflow: hidden;
}
.crop-stage { position: relative; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); touch-action: none; }
.crop-stage canvas { display: block; pointer-events: none; }
.crop-stage.no-preview {
  background: repeating-linear-gradient(45deg, #1a1f2a, #1a1f2a 8px, #161b24 8px, #161b24 16px);
  border: 1px dashed var(--line-strong);
}
.crop-rect {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  border: 1.5px solid var(--accent); cursor: move;
  box-shadow: 0 0 0 9999px rgba(6, 8, 12, .56);
  touch-action: none;
}
.crop-rect::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.crop-guides { position: absolute; inset: 0; pointer-events: none; opacity: .55; }
.crop-guides::before, .crop-guides::after {
  content: ''; position: absolute; background: rgba(255, 255, 255, .55);
}
.crop-guides::before { left: 33.33%; right: 33.33%; top: 0; bottom: 0; border-left: 1px solid rgba(255,255,255,.55); border-right: 1px solid rgba(255,255,255,.55); background: none; }
.crop-guides::after { top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-top: 1px solid rgba(255,255,255,.55); border-bottom: 1px solid rgba(255,255,255,.55); background: none; }
.crop-handle {
  position: absolute; width: 9px; height: 9px; border-radius: 2px;
  background: var(--accent); border: 1px solid rgba(0, 0, 0, .55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.crop-handle[data-h="nw"] { left: -5px; top: -5px; cursor: nwse-resize; }
.crop-handle[data-h="n"] { left: 50%; top: -5px; margin-left: -4px; cursor: ns-resize; }
.crop-handle[data-h="ne"] { right: -5px; top: -5px; cursor: nesw-resize; }
.crop-handle[data-h="e"] { right: -5px; top: 50%; margin-top: -4px; cursor: ew-resize; }
.crop-handle[data-h="se"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.crop-handle[data-h="s"] { left: 50%; bottom: -5px; margin-left: -4px; cursor: ns-resize; }
.crop-handle[data-h="sw"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.crop-handle[data-h="w"] { left: -5px; top: 50%; margin-top: -4px; cursor: ew-resize; }
.crop-loading {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--muted); background: rgba(10, 12, 16, .6); border-radius: 10px;
  text-align: center; padding: 12px; line-height: 1.5;
}
.crop-loading.on { display: flex; }
.crop-side { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 11px; }
.crop-pagebar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 3px 4px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0, 0, 0, .16);
}
.crop-page-label { font-size: 11px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.crop-pagebar .icon-mini[disabled], .crop-pagebar .icon-mini.disabled { opacity: .3; pointer-events: none; }
.crop-fields { gap: 9px; }
.crop-fields .input { height: 30px; font-family: var(--mono); font-size: 11px; }
.crop-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.crop-presets .pill { height: 24px; font-size: 10px; }
.crop-summary {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
  border-radius: 7px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025);
  font-size: 10.5px; color: var(--muted);
}
.crop-summary .mono { color: var(--text-soft); font-size: 11px; }
.crop-note { font-size: 10px; color: var(--faint); line-height: 1.5; }

/* ------------------------------------------------------------------ */
/* Resize preview                                                     */
/* ------------------------------------------------------------------ */
.pages-resize-preview {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 11px; border-radius: 7px;
  border: 1px solid rgba(124, 147, 255, .18); background: rgba(124, 147, 255, .06);
  font-size: 10.5px; color: var(--muted);
}
.pages-resize-target {
  font-family: var(--mono); font-size: 11px; color: var(--text);
  font-weight: 600; letter-spacing: .01em;
}

/* ------------------------------------------------------------------ */
/* Organize panel                                                     */
/* ------------------------------------------------------------------ */
.pages-organize { display: flex; flex-direction: column; }
.org-kv {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 10.5px; color: var(--muted); padding: 3px 2px;
}
.org-kv .mono { color: var(--text-soft); font-size: 10px; }
.org-size-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 10.5px; color: var(--muted); padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}
.org-size-row:last-child { border-bottom: 0; }
.org-size-row .mono { color: var(--faint); font-size: 9.5px; }
.org-page-row { gap: 7px; padding: 5px 6px; }
.org-page-row .i { color: var(--faint); }
.org-page-num {
  width: 19px; height: 19px; flex: none; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
}
.org-page-row .row-sub { font-size: 9px; }

.pages-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pages-action {
  display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025);
  color: var(--text-soft); font-size: 10.5px; font-weight: 600; text-align: left;
  min-width: 0;
}
.pages-action span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pages-action svg { color: var(--muted); flex: none; }
.pages-action:hover { background: rgba(255, 255, 255, .07); border-color: var(--line-strong); color: var(--text); }
.pages-action:hover svg { color: var(--accent); }
.pages-action:active { transform: translateY(.5px); }

@media (max-width: 720px) {
  .pages-combine-add { flex-direction: column; align-items: stretch; }
  .pages-combine-or { display: none; }
  .crop-shell { flex-direction: column; }
  .crop-side { min-width: 0; width: 100%; }
}
