/* OpenPDF Studio - Styles */

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Tool Tab Styling */
.tool-tab {
  color: #64748b;
  background-color: transparent;
  transition: all 0.15s ease-in-out;
}

.tool-tab:hover {
  color: #0f172a;
  background-color: rgba(0, 0, 0, 0.04);
}

.dark .tool-tab {
  color: #94a3b8;
}

.dark .tool-tab:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.05);
}

.tool-tab.active {
  color: #16a34a;
  background-color: #dcfce7;
}

.dark .tool-tab.active {
  color: #4ade80;
  background-color: rgba(22, 163, 74, 0.2);
}

/* Button Classes */
.btn-primary {
  background-color: #16a34a;
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background-color: #15803d;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
}

.dark .btn-secondary {
  background-color: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.dark .btn-secondary:hover {
  background-color: #334155;
}

/* Page Card & Drag Styles */
.page-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.page-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.page-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.page-card.drag-over {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px #22c55e;
}

/* Color buttons for signature */
.sig-color-btn.active {
  ring-width: 2px;
  box-shadow: 0 0 0 2px #22c55e;
}

/* Scrollbar customization */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Draggable Annotation Item on Canvas */
.annotation-box {
  position: absolute;
  cursor: move;
  border: 2px dashed #16a34a;
  background: rgba(34, 197, 94, 0.08);
  border-radius: 4px;
}

.annotation-box:hover {
  border-color: #15803d;
}

.annotation-box .delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Editor Mode Buttons */
.edit-mode-btn {
  color: #64748b;
  background-color: transparent;
}
.edit-mode-btn:hover {
  color: #0f172a;
  background-color: rgba(0, 0, 0, 0.05);
}
.dark .edit-mode-btn:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.08);
}
.edit-mode-btn.active {
  color: #16a34a;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.dark .edit-mode-btn.active {
  color: #4ade80;
  background-color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Editor Overlay Items */
.editor-item {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
}
.editor-item:hover, .editor-item.selected {
  outline: 1.5px dashed #22c55e;
}
.editor-item .item-delete-btn {
  display: none;
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 100;
}
.editor-item:hover .item-delete-btn, .editor-item.selected .item-delete-btn {
  display: flex;
}

/* Whiteout item */
.editor-whiteout {
  background-color: #ffffff;
  border: 1px dashed #cbd5e1;
}
.dark .editor-whiteout {
  background-color: #ffffff; /* keep white to erase white paper */
}

/* Highlight item */
.editor-highlight {
  background-color: rgba(254, 240, 138, 0.45);
  pointer-events: auto;
}

/* Text item */
.editor-text-input {
  outline: none;
  background: transparent;
  width: 100%;
  height: 100%;
  min-width: 60px;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: text;
}

/* Interactive PDF Text Lines for Direct In-Place Editing */
.pdf-text-line {
  position: absolute;
  box-sizing: border-box;
  line-height: 1.15;
  color: #000000;
  background-color: #ffffff;
  cursor: text;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  padding: 1px 3px;
  z-index: 10;
}

.pdf-text-line:hover {
  border-color: #2563eb !important;
  border-style: solid !important;
  box-shadow: 0 0 0 1px #2563eb !important;
  cursor: text !important;
  z-index: 40 !important;
}

.pdf-text-line::selection {
  background: rgba(59, 130, 246, 0.35);
}

/* When actively focused and editing: opaque white background covers canvas text cleanly, and text is sharp and readable in black */
.pdf-text-line.is-editing {
  background-color: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #2563eb !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25) !important;
  z-index: 50 !important;
  outline: none !important;
}

/* When modified: opaque white background covers canvas text, and modified text remains clearly visible in black with green indicator border */
.pdf-text-line.is-modified {
  background-color: #ffffff !important;
  color: #000000 !important;
  border: 1.5px solid #16a34a !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.15) !important;
  z-index: 20 !important;
}

/* In whiteout/highlight drag mode, let mouse drag pass through to overlay layer */
.mode-drag-box .pdf-text-line {
  pointer-events: none !important;
}

.pdf-text-line .delete-text-btn {
  display: none;
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  z-index: 70;
}

.pdf-text-line.is-editing .delete-text-btn,
.pdf-text-line:hover .delete-text-btn {
  display: flex;
}

/* Custom newly added text items */
.custom-text-item {
  position: absolute;
  box-sizing: border-box;
  background-color: #ffffff;
  border: 1.5px solid #22c55e;
  border-radius: 4px;
  padding: 2px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 30;
  cursor: move;
}

.custom-text-item:hover, .custom-text-item.selected {
  border-color: #16a34a;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.custom-text-item .delete-btn {
  display: none;
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 40;
}

.custom-text-item:hover .delete-btn {
  display: flex;
}
