/* Custom CSS for DocuFill */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
  }
}

.glow-active {
  animation: pulseGlow 2s infinite ease-in-out;
}

/* Paper-like styling for docx preview */
.docx-wrapper {
  background: transparent !important;
  padding: 0 !important;
}

.docx-wrapper > section.docx {
  background: white !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  margin-bottom: 2rem !important;
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
}

/* Mobile responsive docx wrapper scaling */
@media (max-width: 640px) {
  .docx-wrapper > section.docx {
    padding: 1.25rem !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Radio & Checkbox Pills */
.radio-pill {
  transition: all 0.15s ease-in-out;
  user-select: none;
}
.radio-pill:hover {
  transform: translateY(-1px);
}
.radio-pill.active {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

/* Subgroup Card Styling */
.subgroup-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.subgroup-card:hover {
  border-color: #cbd5e1;
}

/* Photo Upload Zone Styling */
.photo-upload-zone {
  transition: all 0.2s ease-in-out;
}
.photo-upload-zone.dragover {
  border-color: #4f46e5 !important;
  background-color: rgba(238, 242, 255, 0.8) !important;
}
.photo-box-preview {
  aspect-ratio: 3 / 4;
}

/* Nav Tab Active States */
.nav-tab.active {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Language Switcher Buttons */
.lang-btn {
  color: #64748b;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
}
.lang-btn:hover {
  color: #0f172a;
}
.lang-btn.active {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* Signature Pad Drawing Canvas */
#drawCanvas {
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
}

/* Cursive Fonts for Type Mode */
.font-caveat {
  font-family: 'Caveat', cursive;
}
.font-dancing {
  font-family: 'Dancing Script', cursive;
}
.font-greatvibes {
  font-family: 'Great Vibes', cursive;
}
.font-sacramento {
  font-family: 'Sacramento', cursive;
}

.sig-font-card {
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.sig-font-card:hover {
  border-color: #a855f7;
  background-color: #faf5ff;
}
.sig-font-card.active {
  border-color: #9333ea;
  background-color: #f3e8ff;
  box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.3);
}

/* Draggable & Resizable Signature Overlay */
.signature-overlay-item {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  border: 2px dashed #9333ea;
  background-color: rgba(147, 51, 234, 0.06);
  border-radius: 8px;
  pointer-events: auto !important;
  z-index: 25;
  transition: box-shadow 0.15s ease;
}

.signature-overlay-item:hover {
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}

.signature-overlay-item.dragging {
  cursor: grabbing;
  opacity: 0.9;
  border-color: #7e22ce;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Prominent Delete Button on Top-Right Corner */
.signature-overlay-item .btn-sig-delete-corner {
  position: absolute;
  top: -11px;
  right: -11px;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background-color: #ef4444;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 35;
  pointer-events: auto !important;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.signature-overlay-item .btn-sig-delete-corner:hover {
  background-color: #dc2626;
  transform: scale(1.15);
}

/* Drag Handle Badge at Top-Center */
.signature-overlay-item .sig-drag-badge {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

/* Resize Handle on Bottom-Right Corner */
.signature-overlay-item .sig-resize-handle {
  position: absolute;
  bottom: -9px;
  right: -9px;
  width: 18px;
  height: 18px;
  background-color: #9333ea;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: se-resize;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
  pointer-events: auto !important;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.signature-overlay-item .sig-resize-handle:hover {
  background-color: #7e22ce;
  transform: scale(1.2);
}

/* PDF Viewport & Canvas Centering (Safe Center & Auto-Fit to prevent cutoff) */
#pdfViewportContainer {
  display: flex;
  align-items: flex-start;
  justify-content: safe center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

#pdfPageWrapper {
  margin: 0 auto 2rem auto;
  flex-shrink: 0;
  max-width: none !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

#pdfRenderCanvas {
  display: block;
  max-width: none !important;
}

