/* Anubis PDF - editor tool (pairs with /assets/js/pdf-editor.js). Theme colours come from luxury-theme.css. */

.viewport-container { overflow: auto; }
#pagesStack { display: flex; flex-direction: column; align-items: center; width: max-content; min-width: 100%; padding-top: 26px; }

.ape-page { position: relative; flex: none; margin: 0 auto 34px; background: #fff; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); }
.ape-badge { position: absolute; top: -22px; inset-inline-end: 0; direction: ltr; font-size: 11px; font-weight: 700; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 6px; padding: 1px 8px; }
.ape-pdf, .ape-ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ape-pdf { z-index: 1; }
.ape-ov { z-index: 2; pointer-events: none; }
.ape-tl { position: absolute; inset: 0; z-index: 3; }

/* drawing tools take the pointer; the text layer steps aside */
#editorWorkspace:not([data-tool="edit-text"]) .ape-tl { pointer-events: none; }
#editorWorkspace:not([data-tool="edit-text"]) .ape-ov { pointer-events: auto; z-index: 4; cursor: crosshair; touch-action: manipulation; }
#editorWorkspace.ape-dragtool .ape-ov { touch-action: none; }

.ape-text { position: absolute; box-sizing: border-box; margin: 0; padding: 0; white-space: pre; color: transparent; border-radius: 2px; outline: 1px solid transparent; cursor: text; -webkit-user-select: none; user-select: none; }
#editorWorkspace[data-tool="edit-text"] .ape-text:hover { outline-color: rgba(180, 83, 9, .5); background: rgba(180, 83, 9, .07); }
.ape-text.ape-editing { color: inherit; background: transparent !important; outline: 1.5px solid var(--accent, #b45309); outline-offset: 2px; z-index: 5; -webkit-user-select: text; user-select: text; }
.ape-text.ape-match { background: rgba(250, 204, 21, .42); }
.ape-text.ape-match-active { background: rgba(249, 115, 22, .5); outline-color: #f97316; }

.ape-img { position: absolute; z-index: 10; border: 1.5px dashed transparent; cursor: move; touch-action: none; }
.ape-img:hover, .ape-img.ape-active { border-color: var(--accent, #b45309); }
.ape-img img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-select: none; user-select: none; }
.ape-img-del, .ape-img-front { position: absolute; top: -13px; width: 26px; height: 26px; border: 0; border-radius: 50%; color: #fff; font-size: 12px; line-height: 26px; padding: 0; cursor: pointer; display: none; }
.ape-img-del { inset-inline-end: -13px; background: #dc2626; }
.ape-img-front { inset-inline-start: -13px; background: #2563eb; }
.ape-img-grip { position: absolute; right: -9px; bottom: -9px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent, #b45309); border: 2px solid #fff; cursor: nwse-resize; display: none; }
.ape-img:hover > button, .ape-img.ape-active > button, .ape-img:hover > .ape-img-grip, .ape-img.ape-active > .ape-img-grip { display: block; }

.ape-toast { position: fixed; z-index: 400; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: min(92vw, 520px); background: #1e293b; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.5; padding: 11px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .3); text-align: center; }
.ape-toast-error { background: #b91c1c; }
.ape-empty { color: var(--text-muted, #64748b); font-size: 11px; text-align: center; padding: 12px 0; margin: 0; }
.ape-dz-title { font-size: 20px; font-weight: 800; color: #0f172a; margin: 0 0 8px; }
.ape-dz-note { color: var(--text-muted, #64748b); font-size: 11px; margin-top: 12px; }
.drop-zone .drop-zone-btn { display: inline-block; }

.layer-del { border: 0; background: transparent; cursor: pointer; font: inherit; padding: 2px 6px; }
.ape-layers > summary { cursor: pointer; list-style: none; }
.ape-layers > summary::-webkit-details-marker { display: none; }
.ape-hint { font-size: 12px; line-height: 1.7; color: #7c2d12; background: rgba(180, 83, 9, .07); border: 1px solid rgba(180, 83, 9, .22); border-radius: 10px; padding: 10px 12px; margin: 0; }
.ape-hint strong { color: #7c2d12; }
.float-toolbar .ft-btn { touch-action: none; }
#ftMove { cursor: move; }
.ape-save-row { display: none; }

@media (max-width: 1024px) {
  .viewport-container { max-height: none; padding: 26px 6px 96px; }
  #editorWorkspace .sidebar { padding: 10px; max-height: none; }
  #editorWorkspace .tool-grid { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  #editorWorkspace .tool-btn { flex: 0 0 74px; }
  #editorWorkspace .ape-desktop { display: none; }
  #editorWorkspace .action-bar { gap: 8px; padding: 8px 10px; }
  #editorWorkspace .action-bar-buttons { gap: 4px; }
  #editorWorkspace .ab-btn .ape-lbl { display: none; }
  #editorWorkspace .ab-btn { min-width: 40px; min-height: 40px; padding: 6px 8px; }
  #editorWorkspace .ab-btn.primary { display: none; }
  .ape-save-row { display: block; position: fixed; z-index: 60; bottom: 10px; inset-inline: 12px; }
  .ape-save-row .ab-btn { display: block !important; width: 100%; min-height: 48px; font-size: 15px; box-shadow: 0 10px 28px rgba(180, 83, 9, .4); }
  .ape-save-row .ab-btn .ape-lbl { display: inline !important; }
  .ape-toast { bottom: 74px; }
  .float-toolbar { flex-wrap: wrap; row-gap: 6px; }
}
