/* css/document-signing.css */

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* Common Components */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-icon {
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  font-size: large;
  transition: background-color 0.15s ease;
}

.btn-icon:hover {
  background-color: var(--border-color);
}

/* Dashboard Styles */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Upload Section */
.upload-section {
  background: var(--surface);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 0.5rem;
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background-color: #f0f9ff;
}

.upload-area.dragover {
  border-color: var(--primary-color);
  background-color: #e0f2fe;
}

.upload-icon {
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

/* Form Styles */
.document-form {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Signers List */
.signers-list {
  margin-bottom: 1rem;
}

.signer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--background);
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.signer-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 30px;
}

.signer-info strong {
  color: var(--text-primary);
}

.signer-info span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
}

.signers-status {
  margin-top: 1rem;
}

.signers-status h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.signer-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.signer-status-item:last-child {
  border-bottom: none;
}

.status-icon {
  font-size: 0.875rem;
  font-weight: 500;
}

.status-icon.completed {
  color: var(--success-color);
}

.status-icon.pending {
  color: var(--warning-color);
}

/* Documents List */
.documents-section {
  background: var(--surface);
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
}

/* Document Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.action-buttons .btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.action-buttons .btn-secondary {
  background: var(--warning-color);
  color: white;
  border: none;
}

.action-buttons .btn-secondary:hover {
  background: #e0a800;
}

/* Edit Badge */
.edit-badge {
  background: var(--warning-color);
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-weight: 500;
}

/* Edit Mode Styling */
.edit-mode-banner {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #8b4513;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.edit-mode-banner .edit-icon {
  margin-right: 0.5rem;
  font-size: 1.2em;
}

.edit-mode-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.edit-mode-actions .btn {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: var(--background);
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
}

.documents-list {
  display: grid;
  gap: 1rem;
  max-width: 95vw;
}

.document-card {
  background: var(--background);
  border-radius: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
  max-width: 80vw !important;
}

.document-card:hover {
  box-shadow: var(--shadow-md);
}

.document-info h3 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.document-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.document-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-partial {
  background: #dbeafe;
  color: #1e40af;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--text-primary);
  color: white;
  border-radius: 0.375rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1001;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success-color);
}

.toast.error {
  background: var(--danger-color);
}

/* Signing Page Styles */
.signing-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

.signing-header {
  background: var(--surface);
  padding: 1rem 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info h1 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.header-info p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

/* Signing Workspace */
.signing-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Toolbar */
.toolbar {
  overflow: hidden;

  z-index: 800;

  background: var(--surface);
  padding: 1rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.tool-group {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100vw !important;
  gap: 0.5rem;
}

nav ul {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  margin: 15px;
  background: var(--primary-color);
}

nav ul li a {
  text-decoration: none;
  color: var(--text-primary);
  padding: 1.5rem;

  border-radius: 0.375rem;
  transition: background-color 0.15s ease;
  background-color: var(--background);

  z-index: 1000;
}
nav ul li a:hover {
  background-color: var(--primary-color);
  color: rgb(255, 255, 255);
  transform: scale(1.05);
}

.tool-btn {
  padding: 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0.375rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--background);
}

.tool-btn.active {
  background: var(--primary-color);
  color: white;
}

.tool-btn svg {
  width: 20px;
  height: 20px;
}

/* PDF Viewer */
.pdf-viewer-container {
  position: sticky;

  z-index: 700;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--secondary-color);
}

.pdf-controls {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  z-index: 600;
  background: var(--surface);
  padding: 1.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.page-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdf-wrapper {
  flex: 1;
  overflow: scroll;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 2rem;
  position: relative;
}

input[type="radio"] {
  max-width: 40px;
  height: auto;
}
label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

#pdfCanvas {
  box-shadow: var(--shadow-lg);
  background: white;
  position: relative; /* Add this to establish positioning context */
}

.annotation-layer {
  position: absolute;
  /* Position will be set dynamically by JavaScript to match canvas exactly */
  pointer-events: none;
  /* The size and position will be set by JavaScript to match canvas dimensions */
}

.annotation-layer.active {
  pointer-events: all;
  cursor: crosshair;
}

/* Signature Panel */
.signature-panel,
.text-panel {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  width: 450px;
  z-index: 1000;
  /* Add smooth animations for panel appearance */
  opacity: 0;
  transform: translateY(-50%) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.signature-panel[style*="display: block"],
.text-panel[style*="display: block"] {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: all;
}

.signature-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sig-tab {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.sig-tab.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

#signatureCanvas {
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: crosshair;
  display: block;
  width: 100%;
}

.sig-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.font-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.font-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
}

.font-options input[type="radio"]:checked + span {
  font-weight: bold;
}

#typedSignature {
  width: 100%;
  padding: 1rem;
  font-size: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
}

.saved-signatures {
  display: grid;
  gap: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.saved-sig-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saved-sig-item:hover {
  border-color: var(--primary-color);
  background: var(--background);
}

.saved-sig-item.selected {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.saved-sig-item img {
  max-width: 100%;
  height: 50px;
  object-fit: contain;
  background: white;
  border-radius: 0.25rem;
  padding: 0.25rem;
}

.saved-sig-item .sig-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.saved-sig-item .sig-info small {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.saved-sig-item .btn-icon {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.875rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.saved-sig-item .btn-icon:hover {
  opacity: 1;
}

.storage-stats {
  padding: 0.5rem;
  background: var(--background);
  border-radius: 0.25rem;
  text-align: center;
  margin-top: 0.5rem;
}

.storage-stats small {
  color: var(--text-secondary);
  font-size: 0.6875rem;
}

.panel-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Text Panel Styles */
.text-options {
  margin-top: 1rem;
}

.text-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

#textInput {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  resize: vertical;
}

/* Annotation Styles */
.annotation {
  position: absolute;
  cursor: move;
  user-select: none;
}

.annotation.signature img {
  max-width: 150px;
  height: auto;
}

.annotation.text {
  background: rgba(255, 255, 255, 0.9);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
}

.annotation.date {
  background: rgba(255, 255, 255, 0.9);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.annotation.checkbox {
  /* Remove default annotation styles for checkbox */
  background: transparent;
  border: none;
  padding: 0;
}

.annotation.checkbox .checkbox-annotation {
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  border: 2px solid #333 !important;
  border-radius: 3px !important;
}

.annotation.checkbox .checkbox-annotation:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.annotation.checkbox .checkbox-annotation:active {
  transform: scale(0.95);
}

/* Checked state styling */
.annotation.checkbox .checkbox-annotation.checked {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.annotation.checkbox .checkbox-annotation.checked:hover {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

.annotation:hover {
  box-shadow: 0 0 0 2px var(--primary-color);
}

.annotation.selected {
  box-shadow: 0 0 0 3px var(--primary-color);
}

.annotation-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  background: var(--danger-color);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.annotation:hover .annotation-delete {
  display: flex;
}

/* Ensure delete button is visible when annotation is selected */
.annotation.selected .annotation-delete {
  display: flex !important;
  opacity: 1;
}

/* Usage Limit Styles */
.usage-limit-banner {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.upgrade-link {
  background: #4caf50;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.upgrade-link:hover {
  background: #45a049;
}

.limit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 10px;
}

.limit-message {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  max-width: 300px;
}

.limit-message h3 {
  color: #ff6b6b;
  margin-bottom: 1rem;
}

.limit-message p {
  margin-bottom: 1.5rem;
  color: #666;
}

.limit-message .btn {
  padding: 0.75rem 1.5rem;
  background: #4caf50;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.limit-message .btn:hover {
  background: #45a049;
}

/* Mobile Touch Enhancements */
@media (max-width: 768px) {
  /* Increase annotation size for better touch targets */
  .annotation {
    min-width: 44px;
    min-height: 44px;
    /* Add touch-specific styles */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Better visual feedback for touch */
    transition: transform 0.1s ease, box-shadow 0.1s ease;
  }

  .annotation:active {
    transform: scale(0.98);
  }

  .pdf-viewer-container {
    width: 100vw;
    right: 0;
  }

  /* Improve touch feedback */
  .annotation.selected {
    box-shadow: 0 0 0 4px var(--primary-color);
    transform: scale(1.05);
  }

  /* Make delete button more accessible on mobile */
  .annotation-delete {
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    font-size: 14px;
    /* Add touch-specific styles */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Better touch feedback */
    transition: transform 0.1s ease;
    /* Ensure better visibility on mobile */
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .annotation-delete:active {
    transform: scale(0.95);
  }

  /* Show delete button when annotation is selected on mobile */
  .annotation.selected .annotation-delete {
    display: flex !important;
    opacity: 1;
  }

  /* Also show on hover for better discoverability */
  .annotation:hover .annotation-delete {
    display: flex;
    opacity: 0.8;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Improve signature panel for mobile */
  .signature-panel {
    position: fixed;
    bottom: 50%;
    left: 10%;
    right: 10%;
    width: 80%;
    top: auto;
    max-height: 80vh;
    border-radius: 1rem 1rem 0 0;
    z-index: 1000;
    /* Mobile-specific animation adjustments */
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.2s ease;
  }

  .text-panel {
    position: fixed;
    bottom: 50%;
    left: 10%;
    right: 10%;
    width: 80%;
    top: auto;
    max-height: 80vh;
    border-radius: 1rem 1rem 0 0;
    z-index: 1000;
    /* Mobile-specific animation adjustments */
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.2s ease;
  }

  .signature-panel[style*="display: block"],
  .text-panel[style*="display: block"] {
    transform: translateY(0);
    opacity: 1;
  }

  .toolbar {
    position: fixed;
    overflow: hidden;
    bottom: 0px;
    left: 0px;

    height: 70px;

    flex-direction: row;
    width: 100vw;
  }

  .tool-group {
    position: fixed;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;

    height: 50px;
    width: 100%;
    padding: 20px;
  }

  .signer-info {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
    scale: 1rem;
  }

  .signing-workspace {
    flex-direction: column;
    width: 100vw;
    min-width: 100vw !important;
    overflow-y: auto;
  }

  /* Add touch-friendly spacing */
  .sig-tabs {
    padding: 0.5rem;
  }

  .sig-tab {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }

  /* Improve canvas touch experience */
  #signatureCanvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  /* Prevent scrolling on annotation layer when interacting */
  .annotation-layer.active {
    touch-action: manipulation;
  }

  /* Improve button sizes for touch */
  .btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  /* Add visual feedback for touch */
  .annotation:active {
    transform: scale(1.02);
  }
}

/* High DPI screens adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  .annotation {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }

  .annotation.signature img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Async Document Retrieval Styles */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  flex: 1;
}

#refreshBtn {
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 0.875rem;
  white-space: nowrap;
}

#refreshBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.documents-section {
  margin-top: 2rem;
}

.filter-tabs {
  margin-top: 1rem;
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--success-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.auto-refresh-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* ...existing annotation styles... */
