/*
 * pdf-editor.css — PDF Editor Pro (ToolBox Etc plugin) v1.6
 * Updated: Added prefers-reduced-motion block; removed font-family select rule.
 */

#pdf-editor-wrap {
  background: #f5f0e8;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
}

/* =====================================================================
   TOOLBAR
   ===================================================================== */
#pdf-editor-wrap #toolbar {
  background: #1a1a2e;
  padding: 10px 16px;
  color: white;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#pdf-editor-wrap .toolbar-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: #2a2a45;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
#pdf-editor-wrap .toolbar-btn:hover {
  background: #3a3a65;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#pdf-editor-wrap .toolbar-btn.active {
  background: #d4a843;
  color: #1a1a2e;
}
#pdf-editor-wrap .toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Branding */
#pdf-editor-wrap .toolbox-brand {
  font-weight: bold;
  color: #d4a843;
  margin-right: 4px;
  white-space: nowrap;
}
#pdf-editor-wrap .brand-pdf {
  color: #d4a843;
}
#pdf-editor-wrap .brand-editor {
  color: white;
}
#pdf-editor-wrap .brand-tagline {
  font-size: 11px;
  color: #888;
  margin-right: 8px;
  white-space: nowrap;
}

/* Font controls */
#pdf-editor-wrap .font-control {
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: #2a2a45;
  color: white;
  font-size: 13px;
  cursor: pointer;
  height: 32px;
  box-sizing: border-box;
  transition: background 0.2s;
}
#pdf-editor-wrap .font-control:hover {
  background: #3a3a65;
}
#pdf-editor-wrap .font-control:focus {
  outline: 2px solid #d4a843;
  outline-offset: 1px;
}
#pdf-editor-wrap #fontSize {
  width: 52px;
  text-align: center;
  -moz-appearance: textfield;
}
#pdf-editor-wrap #fontSize::-webkit-outer-spin-button,
#pdf-editor-wrap #fontSize::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
#pdf-editor-wrap .style-btn {
  padding: 7px 10px;
  font-size: 14px;
  min-width: 32px;
}
#pdf-editor-wrap #italicBtn {
  font-style: italic;
}

/* Toolbar spacer */
#pdf-editor-wrap .toolbar-spacer {
  flex: 1;
  min-width: 8px;
}

/* Page navigation */
#pdf-editor-wrap .page-nav-group {
  display: flex;
  align-items: center;
  gap: 5px;
}
#pdf-editor-wrap .page-nav-btn {
  padding: 7px 12px;
}
#pdf-editor-wrap .page-input {
  width: 52px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: #2a2a45;
  color: white;
  font-size: 13px;
  text-align: center;
}
#pdf-editor-wrap #pageNavLabel {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
}
#pdf-editor-wrap .total-pages {
  font-size: 13px;
  color: #ccc;
}

/* File info */
#pdf-editor-wrap .file-info {
  color: #aaa;
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pdf-editor-wrap .toolbar-divider {
  width: 1px;
  height: 28px;
  background: #3a3a55;
  margin: 0 2px;
  flex-shrink: 0;
}

/* =====================================================================
   VIEWER
   ===================================================================== */
#pdf-editor-wrap .viewer {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

#pdf-editor-wrap .page-wrapper {
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  background: white;
  border-radius: 4px;
  transition: box-shadow 0.2s;
}
#pdf-editor-wrap .page-wrapper:hover {
  box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

#pdf-editor-wrap .field-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
#pdf-editor-wrap .field-layer * {
  pointer-events: all;
}

/* =====================================================================
   PDF FORM FIELDS
   ===================================================================== */
#pdf-editor-wrap .pdf-field {
  position: absolute;
  background: rgba(255,242,201,0.2);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 12px;
  box-sizing: border-box;
}
#pdf-editor-wrap .pdf-field:focus {
  outline: 2px solid #d4a843;
  background: rgba(255,242,201,0.4);
}

/* =====================================================================
   USER TEXT BOXES
   ===================================================================== */
#pdf-editor-wrap .user-box {
  position: absolute;
  min-width: 80px;
  border: 2px solid #3c6ef5;
  border-radius: 4px;
  background: rgba(60,110,245,0.05);
  cursor: move;
  user-select: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#pdf-editor-wrap .user-box.selected {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 2px rgba(255,107,107,0.3);
}

#pdf-editor-wrap .user-box textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 4px 8px;
  box-sizing: border-box;
  cursor: text;
  overflow: hidden;
  display: block;
}

/* Delete button – accessible */
#pdf-editor-wrap .user-box .delete-btn,
#pdf-editor-wrap .user-check .delete-btn {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff4444;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
  display: none;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.15s, transform 0.15s;
}
#pdf-editor-wrap .user-box:hover .delete-btn,
#pdf-editor-wrap .user-check:hover .delete-btn,
#pdf-editor-wrap .user-box .delete-btn:focus,
#pdf-editor-wrap .user-check .delete-btn:focus {
  display: block;
}
#pdf-editor-wrap .user-box .delete-btn:hover,
#pdf-editor-wrap .user-check .delete-btn:hover,
#pdf-editor-wrap .user-box .delete-btn:focus,
#pdf-editor-wrap .user-check .delete-btn:focus {
  background: #ff6666;
  transform: scale(1.1);
}
/* Ensure focus outline is visible */
#pdf-editor-wrap .user-box .delete-btn:focus,
#pdf-editor-wrap .user-check .delete-btn:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Resize handle */
#pdf-editor-wrap .user-box .resize-handle,
#pdf-editor-wrap .user-check .resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: #3c6ef5;
  border-radius: 4px 0 4px 0;
  opacity: 0.4;
  transition: opacity 0.2s;
}
#pdf-editor-wrap .user-box:hover .resize-handle,
#pdf-editor-wrap .user-check:hover .resize-handle,
#pdf-editor-wrap .user-box .resize-handle:focus,
#pdf-editor-wrap .user-check .resize-handle:focus {
  opacity: 1;
}
/* Keyboard focus style for resize handle */
#pdf-editor-wrap .user-box .resize-handle:focus,
#pdf-editor-wrap .user-check .resize-handle:focus {
  outline: 2px solid #d4a843;
  opacity: 1;
}

/* =====================================================================
   USER CHECKMARKS
   ===================================================================== */
#pdf-editor-wrap .user-check {
  position: absolute;
  min-width: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: move;
  user-select: none;
  color: #1a1a2e;
  background: rgba(60,110,245,0.1);
  border: 2px solid #3c6ef5;
  border-radius: 4px;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}
#pdf-editor-wrap .user-check.selected {
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.1);
}
#pdf-editor-wrap .user-check .check-mark {
  pointer-events: none;
  line-height: 1;
}

/* =====================================================================
   STATUS TOAST
   ===================================================================== */
#pdf-editor-wrap .status-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a2e;
  color: white;
  padding: 10px 24px;
  border-radius: 40px;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 200;
}
#pdf-editor-wrap .status-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#pdf-editor-wrap #pageCounter {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}

/* =====================================================================
   LOADING OVERLAY
   ===================================================================== */
#pdf-editor-wrap .loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(245,240,232,0.9);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 15px;
}
#pdf-editor-wrap .loading-overlay.active {
  display: flex;
}

#pdf-editor-wrap .spinner {
  width: 50px;
  height: 50px;
  border: 3px solid #ede8df;
  border-top-color: #1a1a2e;
  border-radius: 50%;
  animation: toolbox-spin 0.8s linear infinite;
}
@keyframes toolbox-spin {
  to { transform: rotate(360deg); }
}

#pdf-editor-wrap .loading-text {
  font-size: 16px;
  color: #1a1a2e;
  font-weight: 500;
}

/* =====================================================================
   FOOTER
   ===================================================================== */
#pdf-editor-wrap .editor-footer {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: #666;
  border-top: 1px solid #ddd;
  margin-top: 40px;
}
#pdf-editor-wrap .editor-footer a {
  color: #1a1a2e;
  text-decoration: none;
}
#pdf-editor-wrap .editor-footer a:hover {
  text-decoration: underline;
}

/* =====================================================================
   QUICK FACTS BAR
   ===================================================================== */
#pdf-editor-wrap .quick-facts {
  background: rgba(212,168,67,.08);
  border-bottom: 1px solid rgba(212,168,67,.18);
  padding: 9px 20px;
}
#pdf-editor-wrap .qf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 22px;
}
#pdf-editor-wrap .qf-list li {
  font-size: 12px;
  color: #1a1a2e;
  line-height: 1.5;
}
#pdf-editor-wrap .qf-list li strong {
  font-weight: 600;
}
#pdf-editor-wrap .quick-facts-footer {
  margin: 10px 0 0;
  font-size: 13px;
  color: #aaa;
  text-align: center;
}
#pdf-editor-wrap .guide-link {
  color: #d4a843;
  text-decoration: none;
}
#pdf-editor-wrap .guide-link:hover {
  text-decoration: underline;
}

/* =====================================================================
   REDUCED MOTION
   ===================================================================== */
@media ( prefers-reduced-motion: reduce ) {
  #pdf-editor-wrap .toolbar-btn,
  #pdf-editor-wrap .page-wrapper,
  #pdf-editor-wrap .user-box,
  #pdf-editor-wrap .user-check,
  #pdf-editor-wrap .user-box .delete-btn,
  #pdf-editor-wrap .user-check .delete-btn,
  #pdf-editor-wrap .user-box .resize-handle,
  #pdf-editor-wrap .user-check .resize-handle,
  #pdf-editor-wrap .status-toast {
    transition: none;
  }
  #pdf-editor-wrap .spinner {
    animation: none;
  }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media ( max-width: 600px ) {
  #pdf-editor-wrap #toolbar {
    gap: 6px;
    padding: 8px 10px;
  }
  #pdf-editor-wrap .toolbar-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  #pdf-editor-wrap .font-control {
    font-size: 12px;
    height: 30px;
  }
  #pdf-editor-wrap .quick-facts { padding: 8px 10px; }
  #pdf-editor-wrap .qf-list     { gap: 3px 14px; }
  #pdf-editor-wrap .qf-list li  { font-size: 11px; }
}