/* PDF Editor Modal Styles */

.pdf-editor-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.9) !important;
  z-index: 99999 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

.pdf-editor-modal.active {
  display: flex !important;
  flex-direction: column !important;
}

.pdf-editor-modal-content {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  background: #f5f5f5 !important;
  overflow: hidden !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Toolbar */
.pdf-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--border-color, #ddd);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 1001;
  flex-shrink: 0;
}

.pdf-editor-toolbar-left,
.pdf-editor-toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pdf-editor-toolbar-center {
  flex: 1;
  text-align: center;
}

.pdf-editor-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--heading-color, #333);
}

.button-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Tools Panel */
.pdf-editor-tools {
  background: white;
  border-bottom: 1px solid var(--border-color, #ddd);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pdf-editor-tool-group {
  display: flex;
  gap: 0.5rem;
}

.pdf-editor-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-small, 4px);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-color, #666);
  font-size: 0.85rem;
  min-width: 80px;
}

.pdf-editor-tool-btn:hover {
  background: var(--card-bg, #f9f9f9);
  border-color: var(--border-color, #ddd);
}

.pdf-editor-tool-btn.active {
  background: var(--link, #007bff);
  color: white;
  border-color: var(--link, #007bff);
}

.pdf-editor-tool-btn i {
  font-size: 1.2rem;
}

.pdf-editor-tool-btn span {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Canvas Container */
.pdf-editor-canvas-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.pdf-editor-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem;
  color: var(--muted-text, #999);
}

.pdf-editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem;
  text-align: center;
  color: var(--muted-text, #999);
}

.pdf-editor-empty-icon {
  font-size: 4rem;
  color: var(--border-color, #ddd);
  margin-bottom: 1rem;
}

.pdf-editor-empty h3 {
  margin: 0;
  color: var(--heading-color, #333);
}

.pdf-editor-pages {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 1200px;
}

.pdf-editor-page {
  position: relative;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin: 0 auto;
  border-radius: 4px;
  overflow: visible;
}

.pdf-editor-page canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

/* Editable Elements */
.pdf-editor-element {
  position: absolute;
  cursor: move;
  border: 1px dashed transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.pdf-editor-element:hover {
  border-color: var(--link, #007bff);
  z-index: 10;
}

.pdf-editor-element.selected {
  border-color: var(--link, #007bff);
  background: rgba(0, 123, 255, 0.05);
  z-index: 10;
}

.pdf-editor-element.dragging {
  opacity: 0.7;
  z-index: 100;
}

.pdf-editor-element-controls {
  position: absolute;
  top: -30px;
  right: 0;
  display: flex;
  gap: 0.25rem;
  background: var(--link, #007bff);
  border-radius: 4px 4px 0 0;
  padding: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pdf-editor-element.selected .pdf-editor-element-controls {
  opacity: 1;
}

.pdf-editor-element-controls button {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 3px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-color, #333);
  transition: background 0.2s ease;
}

.pdf-editor-element-controls button:hover {
  background: white;
}

/* Signature/Initials Display */
.pdf-editor-signature,
.pdf-editor-initials {
  font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
  font-size: 2rem;
  color: var(--text-color, #333);
  white-space: nowrap;
  padding: 0.5rem;
  min-width: 100px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-editor-text {
  font-size: 1rem;
  color: var(--text-color, #333);
  padding: 0.5rem;
  min-width: 100px;
  min-height: 30px;
  display: flex;
  align-items: center;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Configuration Modal */
.pdf-editor-config-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.pdf-editor-config-content {
  background: white;
  border-radius: var(--radius-large, 8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pdf-editor-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color, #ddd);
}

.pdf-editor-config-header h3 {
  margin: 0;
  color: var(--heading-color, #333);
}

.pdf-editor-config-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color, #666);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.pdf-editor-config-close:hover {
  color: var(--link, #007bff);
}

.pdf-editor-config-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pdf-editor-config-preview {
  background: #f9f9f9;
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-small, 4px);
  padding: 1rem;
}

.pdf-editor-preview-label {
  font-size: 0.9rem;
  color: var(--muted-text, #999);
  margin-bottom: 0.5rem;
}

.pdf-editor-preview-box {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-small, 4px);
  border: 1px solid var(--border-color, #ddd);
}

.pdf-editor-config-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pdf-editor-config-options label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pdf-editor-config-options label span {
  font-weight: 600;
  color: var(--heading-color, #333);
  font-size: 0.9rem;
}

.pdf-editor-config-options input[type='text'],
.pdf-editor-config-options input[type='number'],
.pdf-editor-config-options select,
.pdf-editor-config-options input[type='color'] {
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-small, 4px);
  font-size: 1rem;
}

.pdf-editor-config-options input[type='color'] {
  width: 100%;
  height: 40px;
  cursor: pointer;
}

.pdf-editor-config-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color, #ddd);
}

/* Drag and Drop Animations */
@keyframes dragStart {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

@keyframes dragEnd {
  from {
    transform: scale(1.05);
  }
  to {
    transform: scale(1);
  }
}

.pdf-editor-element.dragging {
  animation: dragStart 0.2s ease forwards;
}

.pdf-editor-element.drag-end {
  animation: dragEnd 0.2s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
  .pdf-editor-toolbar {
    padding: 0.5rem 1rem;
  }

  .pdf-editor-title {
    font-size: 1rem;
  }

  .pdf-editor-tools {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .pdf-editor-tool-btn {
    min-width: 60px;
    padding: 0.5rem 0.75rem;
  }

  .pdf-editor-tool-btn span {
    font-size: 0.7rem;
  }

  .pdf-editor-canvas-container {
    padding: 1rem;
  }

  .pdf-editor-config-content {
    max-width: 95%;
    margin: 1rem;
  }
}
