/* Signature Modal Styles */

.signature-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.signature-modal.show {
  display: flex;
}

.signature-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.signature-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.signature-modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.signature-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
}

.signature-modal-body {
  padding: 24px;
}

.signature-prompt {
  margin: 0 0 24px;
  font-size: 1.05rem;
  color: #475569;
  text-align: center;
}

.signature-choice-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.sig-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.sig-btn:focus {
  outline: 3px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

.sig-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sig-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.sig-btn-primary:active {
  transform: translateY(0);
}

.sig-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.sig-btn-secondary:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.signature-pad-container {
  display: none;
}

.signature-pad-header {
  margin-bottom: 16px;
  text-align: center;
}

.signature-pad-header p {
  margin: 0 0 12px 0;
  color: #64748b;
  font-size: 0.95rem;
}

.signature-method-toggle {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.method-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.method-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.method-btn.active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #3b82f6;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.upload-wrapper {
  width: 100%;
  min-height: 300px;
  margin-bottom: 16px;
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 300px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-area:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.upload-area.drag-over {
  border-color: #3b82f6;
  background: #dbeafe;
}

.upload-area svg {
  color: #94a3b8;
  margin-bottom: 12px;
}

.upload-area p {
  margin: 4px 0;
  color: #475569;
  font-weight: 500;
}

.upload-hint {
  font-size: 0.85rem;
  color: #94a3b8 !important;
}

.preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 300px;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.signature-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.signature-pad-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .signature-modal {
    padding: 12px;
  }

  .signature-modal-content {
    max-height: 95vh;
    border-radius: 12px;
  }

  .signature-modal-header {
    padding: 20px 16px 12px;
  }

  .signature-modal-header h2 {
    font-size: 1.25rem;
  }

  .signature-modal-body {
    padding: 16px;
  }

  .signature-choice-buttons {
    flex-direction: column;
  }

  .sig-btn {
    width: 100%;
    min-width: auto;
  }

  .canvas-wrapper {
    height: 240px;
  }

  .signature-pad-actions {
    flex-direction: column;
  }

  .signature-pad-actions .sig-btn {
    width: 100%;
  }
}

/* Tablet landscape */
@media (min-width: 641px) and (max-width: 1024px) {
  .canvas-wrapper {
    height: 280px;
  }
}

/* Print - hide modal */
@media print {
  .signature-modal {
    display: none !important;
  }
}

/* Accessibility - high contrast mode support */
@media (prefers-contrast: high) {
  .signature-modal-content {
    border: 2px solid #000;
  }

  .canvas-wrapper {
    border-width: 3px;
    border-color: #000;
  }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  .signature-modal-content {
    background: #1e293b;
    color: #f1f5f9;
  }

  .signature-modal-header {
    border-bottom-color: #334155;
  }

  .signature-modal-header h2 {
    color: #f1f5f9;
  }

  .signature-prompt {
    color: #cbd5e1;
  }

  .canvas-wrapper {
    background: #ffffff;
    border-color: #475569;
  }

  .sig-btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
  }

  .sig-btn-secondary:hover {
    background: #475569;
    border-color: #64748b;
  }
}
