/**
 * TillerPro™ E-Signature Styles
 * Professional styling for signature request UI
 */

/* ============================================
   E-SIGNATURE SECTION
   ============================================ */

.signature-section {
  background: linear-gradient(135deg, rgb(139 92 246 / 5%) 0%, rgb(99 102 241 / 5%) 100%);
  border: 2px solid rgb(139 92 246 / 20%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.signature-section h3 {
  color: var(--color-primary, #8b5cf6);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.signature-section h3::before {
  content: '✍️';
  font-size: 1.75rem;
}

.signature-section p {
  color: var(--color-text-secondary, #64748b);
  margin-bottom: 1.5rem;
}

/* ============================================
   SIGNATURE ACTIONS
   ============================================ */

.signature-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-sign-electronically {
  flex: 1;
  min-width: 200px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgb(139 92 246 / 30%);
}

.btn-sign-electronically:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgb(139 92 246 / 40%);
}

.btn-sign-electronically:active {
  transform: translateY(0);
}

.btn-sign-electronically::before {
  content: '✍️';
  font-size: 1.5rem;
}

.btn-sign-later {
  flex: 1;
  min-width: 200px;
  background: white;
  color: var(--color-primary, #8b5cf6);
  border: 2px solid var(--color-primary, #8b5cf6);
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn-sign-later:hover {
  background: rgb(139 92 246 / 5%);
}

/* ============================================
   SIGNATURE STATUS
   ============================================ */

.signature-status {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.status-badge {
  padding: 0.375rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.pending {
  background: rgb(251 191 36 / 15%);
  color: #d97706;
}

.status-badge.partially-signed {
  background: rgb(59 130 246 / 15%);
  color: #2563eb;
}

.status-badge.completed {
  background: rgb(34 197 94 / 15%);
  color: #16a34a;
}

.status-badge.expired {
  background: rgb(239 68 68 / 15%);
  color: #dc2626;
}

.signers-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.signer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid rgb(0 0 0 / 5%);
}

.signer-item:last-child {
  border-bottom: none;
}

.signer-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.signer-name {
  font-weight: 600;
  color: var(--color-text-primary, #1e293b);
}

.signer-email {
  font-size: 0.875rem;
  color: var(--color-text-secondary, #64748b);
}

.signer-status {
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.signer-status.signed {
  color: #16a34a;
}

.signer-status.signed::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #16a34a;
  color: white;
  border-radius: 50%;
  font-weight: bold;
}

.signer-status.awaiting::before {
  content: '⏳';
  font-size: 1.125rem;
}

/* ============================================
   SIGNATURE MODAL
   ============================================ */

.signature-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0%;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.signature-modal.active {
  opacity: 100%;
  visibility: visible;
}

.signature-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.signature-modal.active .signature-modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 2rem;
  border-bottom: 1px solid rgb(0 0 0 / 10%);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--color-primary, #8b5cf6);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-secondary, #64748b);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background: rgb(0 0 0 / 5%);
  color: var(--color-text-primary, #1e293b);
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid rgb(0 0 0 / 10%);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ============================================
   PROVIDER BADGES
   ============================================ */

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgb(0 0 0 / 5%);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary, #64748b);
}

.provider-badge::before {
  content: '🔒';
  font-size: 1rem;
}

.provider-badge.docusign {
  background: rgb(255 0 0 / 10%);
  color: #dc2626;
}

.provider-badge.hellosign {
  background: rgb(59 130 246 / 10%);
  color: #2563eb;
}

.provider-badge.adobesign {
  background: rgb(239 68 68 / 10%);
  color: #dc2626;
}

/* ============================================
   TEST MODE BANNER
   ============================================ */

.test-mode-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.test-mode-banner::before {
  content: '⚠️';
  font-size: 1.25rem;
}

/* ============================================
   SIGNATURE IFRAME EMBED
   ============================================ */

.signature-embed {
  width: 100%;
  height: 600px;
  border: 2px solid rgb(139 92 246 / 20%);
  border-radius: 8px;
  background: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .signature-section {
    padding: 1.5rem;
  }

  .signature-actions {
    flex-direction: column;
  }

  .btn-sign-electronically,
  .btn-sign-later {
    width: 100%;
    min-width: unset;
  }

  .modal-header {
    padding: 1.5rem;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .modal-footer {
    padding: 1rem 1.5rem;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pulse-signature {
  0%,
  100% {
    box-shadow: 0 4px 12px rgb(139 92 246 / 30%);
  }

  50% {
    box-shadow: 0 8px 24px rgb(139 92 246 / 50%);
  }
}

.btn-sign-electronically.pulse {
  animation: pulse-signature 2s ease-in-out infinite;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .signature-modal,
  .signature-modal-content,
  .btn-sign-electronically,
  .btn-sign-later,
  .modal-close {
    transition: none;
  }

  .btn-sign-electronically.pulse {
    animation: none;
  }
}

/* Focus styles */
.btn-sign-electronically:focus-visible,
.btn-sign-later:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid var(--color-primary, #8b5cf6);
  outline-offset: 2px;
}
