/* =========================================================================
 * Berita Acara IT Hiring - Print & Screen Preview Stylesheet
 * Optimized for EXACTLY 1 Page F4 (Folio: 215mm x 330mm)
 * SD/SMP ISLAMIC SCHOOL OF RIAU GLOBAL TERPADU
 * Modern Typography with Plus Jakarta Sans
 * ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

/* =========================================================================
 * 1. SCREEN PREVIEW STYLES (Modal Pratinjau di Layar)
 * ========================================================================= */
@media screen {
  .print-only {
    display: none !important;
  }

  /* Container pratinjau cetak: sembunyikan sepenuhnya jika kosong */
  .print-modal-container {
    display: none !important;
  }

  .print-modal-container:not(:empty) {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 100 !important;
    overflow-y: auto !important;
    background-color: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(4px) !important;
  }

  .print-preview-backdrop {
    min-height: 100vh;
    padding-top: 4.5rem;
    padding-bottom: 3rem;
  }

  .print-wrapper {
    max-width: 215mm;
    margin: 0 auto;
  }

  .ba-document-page {
    width: 215mm;
    min-height: 330mm;
    background: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 8mm 10mm;
    margin: 0 auto 30px auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: #0f172a;
  }
}

/* =========================================================================
 * 2. PRINT STYLES (@media print - Fisik Cetak & Export PDF Ukuran F4)
 * ========================================================================= */
@media print {
  /* Sembunyikan seluruh UI dashboard */
  body * {
    visibility: hidden;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 7.5pt !important;
    line-height: 1.2 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-modal-container,
  .print-modal-container * {
    visibility: visible !important;
  }

  .print-modal-container {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }

  /* Hilangkan toolbar layar saat cetak */
  .no-print {
    display: none !important;
  }

  /* Reset wrapper agar tidak menambah padding */
  .print-preview-backdrop,
  .print-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    background: transparent !important;
  }

  /* Pengaturan Ukuran Kertas F4 / Folio (215mm x 330mm) */
  @page {
    size: 215mm 330mm;
    margin: 6mm 8mm 6mm 8mm;
  }

  /* Halaman Dokumen F4: 1 Lembar Pas per Kandidat */
  .ba-document-page {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    height: 316mm !important;
    max-height: 316mm !important;
    overflow: hidden !important;
  }

  /* Setiap lembar kandidat otomatis berganti halaman jika cetak banyak */
  .ba-page-f4 {
    page-break-before: avoid !important;
    break-before: avoid !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .ba-page-f4:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
}

/* =========================================================================
 * 3. ELEMEN KOP SURAT & TIPOGRAFI
 * ========================================================================= */

/* Kop Surat: Logo di Kiri Atas */
.ba-header-kop {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.ba-logo-box {
  flex-shrink: 0;
}

.ba-logo-left {
  max-height: 46px;
  width: auto;
  object-fit: contain;
  display: block;
}

.ba-header-content {
  flex: 1;
  text-align: left;
}

.ba-title {
  font-size: 12pt;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 0;
  color: #0f172a;
  line-height: 1.15;
}

.ba-subtitle {
  font-size: 8.5pt;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin: 1.5px 0 1px 0;
  color: #1e3a8a;
}

.ba-institution {
  font-size: 7.2pt;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.ba-kop-divider {
  border-top: 2px solid #0f172a;
  border-bottom: 0.75px solid #0f172a;
  height: 2px;
  margin-bottom: 4px;
  margin-top: 2px;
}

/* Judul Bagian / Sections */
.section-title {
  font-size: 8.5pt;
  font-weight: 900;
  margin-top: 4px;
  margin-bottom: 1.5px;
  text-transform: uppercase;
  color: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 1px;
}

/* Tabel Identitas Kandidat */
.identity-box {
  width: 100%;
  border: 1px solid #334155;
  border-collapse: collapse;
  margin-bottom: 3px;
  font-size: 7.8pt;
}

.identity-box td {
  padding: 2px 4px;
  vertical-align: middle;
  border: 1px solid #334155;
}

/* Tabel Aspek Penilaian */
.ba-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2px;
  font-size: 7.4pt;
}

.ba-table th, .ba-table td {
  border: 1px solid #334155;
  padding: 1.5px 3.5px;
  vertical-align: middle;
  line-height: 1.15;
}

.ba-table th {
  background-color: #f1f5f9 !important;
  font-weight: 800;
  text-align: left;
  font-size: 7.4pt;
  color: #0f172a;
}

.ba-table th.center, .ba-table td.center {
  text-align: center;
}

.ba-table td.score-cell {
  text-align: center;
  font-weight: 800;
  font-size: 7.8pt;
  color: #1e3a8a;
}

/* Layout Dua Kolom Berdampingan (Side-by-Side Grid) */
.ba-grid-2 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  align-items: stretch !important;
  margin-top: 2px !important;
  margin-bottom: 3px !important;
}

.ba-col-box {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

/* Tabel Teknis 2 Sub-Kolom Aspek */
.ba-table-2col {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.1pt;
  margin-bottom: 2px;
}
.ba-table-2col th, .ba-table-2col td {
  border: 1px solid #334155;
  padding: 1.5px 3px;
  line-height: 1.15;
  vertical-align: middle;
}
.ba-table-2col th {
  background-color: #f1f5f9 !important;
  font-weight: 800;
}

/* Checklist 3 Kolom */
.checklist-col-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  border: 1px solid #334155;
  padding: 2px 4px;
  font-size: 7pt;
  line-height: 1.2;
  background-color: #ffffff;
}

/* Kotak Checkbox */
.checkbox-box {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1.2px solid #0f172a;
  border-radius: 1.5px;
  margin-right: 2px;
  vertical-align: middle;
  text-align: center;
  line-height: 7px;
  font-size: 7.5px;
  font-weight: bold;
}

.checkbox-box.checked::after {
  content: "✓";
  color: #0f172a;
}

/* Kotak Catatan */
.notes-box {
  border: 1px solid #334155;
  padding: 2px 4px;
  min-height: 16px;
  font-size: 7.2pt;
  margin-bottom: 2px;
  background-color: #f8fafc !important;
  line-height: 1.15;
  border-radius: 1.5px;
}

/* Tabel Pengesahan */
.sign-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #334155;
  margin-top: 1px;
  font-size: 7.4pt;
}

.sign-table th, .sign-table td {
  border: 1px solid #334155;
  padding: 2.5px 4px;
  vertical-align: top;
  width: 50%;
}

.sign-table th {
  background-color: #f1f5f9 !important;
  font-weight: 800;
  font-size: 7.4pt;
  color: #0f172a;
}

/* Footer Halaman Dokumen */
.ba-footer {
  text-align: center;
  font-size: 6.8pt;
  font-weight: 600;
  color: #64748b;
  padding-top: 2px;
  border-top: 1px solid #cbd5e1;
  margin-top: auto;
}
