/* ==========================================================================
   MASJID PRO - Official Certificates & Print Stylesheet
   Nikah Certificate, Mosque NOC Letter, Death / Cemetery Pass, Salary Slip
   ========================================================================== */

/* Arabic Typography */
.arabic-text {
  font-family: 'Amiri', serif;
  direction: rtl;
}

/* Certificate Outer Wrapper */
.doc-preview-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
}

/* ==========================================================================
   1. ISLAMIC NIKAH CERTIFICATE
   ========================================================================== */
.nikah-cert-sheet {
  width: 100%;
  max-width: 820px;
  background: #fffdf9;
  color: #1a202c;
  border: 14px solid #064e3b;
  outline: 4px solid #d97706;
  outline-offset: -9px;
  border-radius: 4px;
  padding: 2.8rem 3.2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  position: relative;
  background-image: radial-gradient(rgba(6, 78, 59, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.cert-corner-ornament {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid #d97706;
}
.cert-corner-ornament.tl { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.cert-corner-ornament.tr { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.cert-corner-ornament.bl { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.cert-corner-ornament.br { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.cert-bismillah-head {
  font-family: 'Amiri', serif;
  font-size: 1.9rem;
  color: #065f46;
  text-align: center;
  margin-bottom: 0.2rem;
  direction: rtl;
}

.cert-title-section {
  text-align: center;
  border-bottom: 2px solid #d97706;
  padding-bottom: 1.1rem;
  margin-bottom: 1.4rem;
}

.cert-arabic-title {
  font-family: 'Amiri', serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: #064e3b;
  line-height: 1.2;
}

.cert-eng-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #92400e;
}

.cert-meta-bar {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 0.6rem;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
  color: #4b5563;
}

.cert-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.2rem 0;
  background: rgba(6, 95, 70, 0.03);
  padding: 1.2rem;
  border-radius: 6px;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.cert-box h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #065f46;
  border-bottom: 1px solid rgba(6, 95, 70, 0.2);
  padding-bottom: 0.3rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cert-item-row {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: #334155;
}

.cert-item-row strong {
  color: #0f172a;
}

.cert-sign-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
  text-align: center;
}

.cert-sign-line {
  border-top: 1.5px solid #475569;
  margin-top: 3.2rem;
  padding-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.cert-seal-badge {
  position: absolute;
  bottom: 35px;
  right: 40px;
  width: 95px;
  height: 95px;
  border: 3px double #d97706;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #065f46;
  font-weight: 900;
  font-size: 0.65rem;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  background: rgba(254, 243, 199, 0.8);
  transform: rotate(-12deg);
}

/* ==========================================================================
   2. MOSQUE OFFICIAL NOC LETTER
   ========================================================================== */
.noc-letter-sheet {
  width: 100%;
  max-width: 800px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 3.5rem 3.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1.7;
}

.noc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px double #065f46;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.noc-logo-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  color: #065f46;
  font-weight: 900;
}

.noc-logo-title p {
  font-size: 0.82rem;
  color: #64748b;
}

.noc-ref-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.noc-subject-line {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #065f46;
  text-decoration: underline;
  margin: 1.5rem 0;
}

/* ==========================================================================
   3. DEATH & BURIAL PERMIT PASS
   ========================================================================== */
.death-cert-sheet {
  width: 100%;
  max-width: 800px;
  background: #fff;
  border: 4px solid #1e293b;
  padding: 2.5rem 3rem;
  color: #0f172a;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
  position: relative;
}

.death-cert-header {
  text-align: center;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.qabarsthan-badge-box {
  background: #f1f5f9;
  border: 2px dashed #065f46;
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ==========================================================================
   4. STAFF PAYROLL SALARY SLIP
   ========================================================================== */
.salary-slip-sheet {
  width: 100%;
  max-width: 750px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2rem 2.5rem;
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.slip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #065f46;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.slip-grid-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
}

.slip-grid-table th, .slip-grid-table td {
  border: 1px solid #e2e8f0;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
}

.slip-grid-table th {
  background: #f8fafc;
  font-weight: 800;
  color: #334155;
}

/* ==========================================================================
   PRINT MEDIA RULES (Universal High-Fidelity Print Engine)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm;
  }

  *,
  *::before,
  *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    text-shadow: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 11pt !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Non-printable chrome */
  .sidebar,
  .sidebar-backdrop,
  .top-navbar,
  .bottom-nav,
  .toast-container,
  .no-print,
  .modal-close-btn,
  .modal-header,
  .modal-footer,
  .admin-tab-nav-wrapper,
  .nav-tabs,
  .search-box,
  .action-bar,
  .btn,
  button {
    display: none !important;
  }

  /* Hide background app layout when a modal is open */
  body:has(.modal-overlay.active) .app-container {
    display: none !important;
  }

  /* Modal un-framing for print */
  .modal-overlay {
    display: none !important;
  }

  .modal-overlay.active {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .modal-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    animation: none !important;
  }

  .modal-body {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
  }

  /* App container when printing direct pages (Reports, Ledgers) */
  .app-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
  }

  .content-area {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Printable Sheet Wrappers */
  .printable-target,
  .salary-slip-sheet,
  .nikah-cert-sheet,
  .noc-letter-sheet,
  .death-cert-sheet {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border-radius: 0 !important;
  }

  /* Tables in printable sheets & reports */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto !important;
  }

  thead {
    display: table-header-group !important;
  }

  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  th, td {
    border-color: #cbd5e1 !important;
  }

  .card {
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    margin-bottom: 1rem !important;
  }
}
