/* ==========================================================================
   DOMICILE MANAGEMENT SYSTEM - PRINT STYLESHEET
   High-Security Official A4 Certificate, Token Slip & Receipt Formats
   ========================================================================== */

/* Screen Preview Container for Certificate */
.certificate-page-preview {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 2rem auto;
  background: #ffffff;
  padding: 18mm 16mm;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  box-sizing: border-box;
  color: #000000;
  font-family: 'Times New Roman', Times, serif;
}

/* Certificate Outer Decorative Security Frame */
.cert-security-border {
  position: absolute;
  top: 8mm;
  bottom: 8mm;
  left: 8mm;
  right: 8mm;
  border: 4px double #063826;
  pointer-events: none;
  box-sizing: border-box;
}

.cert-security-inner-border {
  position: absolute;
  top: 11mm;
  bottom: 11mm;
  left: 11mm;
  right: 11mm;
  border: 1px solid #b8860b;
  pointer-events: none;
  box-sizing: border-box;
}

/* Guilloche Watermark in center */
.cert-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  opacity: 0.06;
  pointer-events: none;
  background-image: radial-gradient(#063826 2px, transparent 2px);
  background-size: 16px 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 160px;
  font-weight: 900;
  color: #063826;
}

/* Certificate Header */
.cert-header {
  text-align: center;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 2;
}

.cert-state-emblem {
  width: 60px;
  height: 60px;
  margin: 0 auto 6px auto;
  border: 2px solid #063826;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #063826;
}

.cert-gov-title {
  font-size: 14pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #063826;
  margin-bottom: 2px;
}

.cert-office-title {
  font-size: 12pt;
  font-weight: 700;
  color: #111111;
  margin-bottom: 2px;
}

.cert-district-title {
  font-size: 10.5pt;
  font-weight: 600;
  color: #333333;
}

.cert-form-title {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 24px;
  font-size: 13pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: #f4f8f5;
  border-top: 2px solid #063826;
  border-bottom: 2px solid #063826;
  color: #063826;
}

.cert-rule-text {
  font-size: 8.5pt;
  font-style: italic;
  margin-top: 4px;
  color: #555555;
}

/* Certificate Meta Details Row (Cert No, Date, Photo) */
.cert-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 1.25rem 0 1rem 0;
  position: relative;
  z-index: 2;
}

.cert-meta-left {
  font-size: 10pt;
  line-height: 1.6;
}

.cert-number-highlight {
  font-size: 11.5pt;
  font-weight: 800;
  color: #063826;
  font-family: 'Courier New', Courier, monospace;
}

.cert-photo-container {
  width: 32mm;
  height: 38mm;
  border: 1.5px solid #063826;
  padding: 2px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cert-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Certificate Body Text & Particulars Table */
.cert-body-preamble {
  font-size: 10.5pt;
  line-height: 1.65;
  text-align: justify;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
}

.cert-particulars-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 2;
  font-size: 10pt;
}

.cert-particulars-table td {
  padding: 6px 10px;
  border: 1px solid #999999;
  vertical-align: middle;
}

.cert-particulars-table td.label-cell {
  background: #f8fafc;
  font-weight: 700;
  width: 32%;
  color: #111111;
}

.cert-particulars-table td.value-cell {
  font-weight: 600;
  color: #000000;
}

/* Statutory Endorsement */
.cert-statutory-statement {
  font-size: 10pt;
  line-height: 1.6;
  text-align: justify;
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
}

/* Certificate Signature, QR & Stamp Footer */
.cert-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 2rem;
  position: relative;
  z-index: 2;
}

.cert-qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cert-qr-canvas-holder {
  width: 90px;
  height: 90px;
  border: 1px solid #999;
  padding: 3px;
  background: #fff;
}

.cert-qr-caption {
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #444;
  letter-spacing: 0.5px;
}

.cert-embossed-seal-zone {
  width: 95px;
  height: 95px;
  border: 2px dashed #b8860b;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 7.5pt;
  font-weight: 700;
  color: #b8860b;
  text-transform: uppercase;
  padding: 6px;
}

.cert-signature-zone {
  text-align: center;
  width: 220px;
}

.cert-signature-line {
  border-top: 1.5px solid #000000;
  margin-top: 45px;
  padding-top: 4px;
  font-size: 9.5pt;
  font-weight: 700;
  color: #000000;
}

.cert-designation-text {
  font-size: 8.5pt;
  font-weight: 600;
  color: #333333;
}

/* Security Verification Note */
.cert-security-footer-note {
  position: absolute;
  bottom: 12mm;
  left: 16mm;
  right: 16mm;
  text-align: center;
  font-size: 7pt;
  color: #666666;
  border-top: 1px solid #cccccc;
  padding-top: 4px;
}

/* Token Slip (80mm Format) */
.token-slip-print {
  width: 78mm;
  margin: 0 auto;
  padding: 12px;
  background: #ffffff;
  font-family: 'Courier New', Courier, monospace;
  color: #000000;
  border: 1px dashed #999;
  text-align: center;
}

.token-slip-header {
  font-size: 11pt;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.token-slip-number-huge {
  font-size: 26pt;
  font-weight: 900;
  margin: 8px 0;
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  padding: 4px 0;
}

.token-slip-table {
  width: 100%;
  text-align: left;
  font-size: 9pt;
  margin: 8px 0;
}

.token-slip-table td {
  padding: 2px 0;
}

/* Print Media Query */
@media print {
  body * {
    visibility: hidden;
  }
  
  .sidebar, .top-header, .page-title-bar, .card-header, .filter-bar, .modal-footer, .btn, #toast-container {
    display: none !important;
  }

  #print-area, #print-area * {
    visibility: visible;
  }

  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
  }

  .certificate-page-preview {
    box-shadow: none;
    margin: 0 auto;
    page-break-after: always;
  }
}
