/* Modern Clean Styling & Legal Document A4 Print Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sarabun:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --accent: #d97706;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  background-color: #f1f5f9;
  -webkit-font-smoothing: antialiased;
}

/* Legal Document Styles (A4 Page Perfect Fit) */
.legal-doc {
  font-family: 'Sarabun', 'TH Sarabun New', sans-serif;
  color: #000000;
  line-height: 1.4;
  font-size: 11.5pt;
  background: white;
  width: 210mm;
  height: 297mm;
  max-height: 297mm;
  padding: 16mm 20mm 15mm 20mm;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  page-break-after: always;
  break-after: page;
}

.legal-doc.doc-compact {
  font-size: 10.5pt;
  line-height: 1.34;
  padding: 14mm 18mm 14mm 18mm;
}

.legal-doc p {
  margin-bottom: 0.45em;
  text-align: justify;
  text-justify: inter-cluster;
}

.legal-indent {
  text-indent: 2.2em;
}

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

.legal-header-right {
  text-align: left;
  font-size: 10pt;
  line-height: 1.35;
  color: #111827;
}

.legal-header-right-en {
  font-size: 8.5pt;
  color: #374151;
}

.legal-subject-box {
  margin: 0.8rem 0;
  font-size: 11.5pt;
  line-height: 1.4;
}

.legal-signature-section {
  margin-top: 1rem;
  page-break-inside: avoid;
}

/* Dot filler line */
.fill-dot {
  font-weight: 600;
  color: #1e3a8a;
  padding: 0 4px;
  border-bottom: 1px dotted #475569;
  display: inline-block;
}

/* Canvas styling */
.sig-canvas-container {
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  background: #ffffff;
  position: relative;
  touch-action: none;
  overflow: hidden;
  transition: border-color 0.2s;
}

.sig-canvas-container:hover {
  border-color: #3b82f6;
}

.sig-canvas {
  width: 100%;
  height: 200px;
  display: block;
  cursor: crosshair;
}

/* Print Rules - Exact A4 fit */
@page {
  size: A4 portrait;
  margin: 0mm;
}

@media print {
  html, body {
    width: 210mm;
    height: auto;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .no-print {
    display: none !important;
  }
  .legal-doc {
    box-shadow: none !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    page-break-after: always !important;
    break-after: page !important;
    overflow: hidden !important;
  }
}

/* Smooth step animations */
.fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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