/* Print Certificates Suite CSS */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,400&family=Roboto+Serif:ital,opsz,wght@0,8..144,400;0,8..144,600;0,8..144,700;1,8..144,400&family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Body styling scoped to print standalone suite */
body.cert-suite-body {
  background-color: #0F172A;
  color: #334155;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* TOP CONTROLS BAR */
.controls-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: #1E293B;
  border-bottom: 2px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-left strong {
  font-size: 15px;
  letter-spacing: 0.5px;
}

.doc-selector, .search-input {
  background-color: #0F172A;
  color: #F8FAFC;
  border: 1px solid #475569;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.doc-selector:focus, .search-input:focus {
  border-color: #FF9933;
}

.search-input {
  width: 220px;
}

.btn-control {
  background-color: #334155;
  color: #F8FAFC;
  border: 1px solid #475569;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-control:hover {
  background-color: #475569;
  color: #FFFFFF;
}

.btn-print {
  background-color: #FF9933;
  color: #000000;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(255, 153, 51, 0.4);
  transition: all 0.2s ease;
}

.btn-print:hover {
  background-color: #FFB366;
  transform: translateY(-1px);
}

/* PAGE WRAPPER FOR PREVIEW */
.page-wrapper {
  margin-top: 84px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

/* CERTIFICATE CANVAS (A4 LANDSCAPE: 297mm x 210mm) */
.cert-page {
  width: 297mm;
  height: 210mm;
  background-color: #FFFFFF;
  position: relative;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  padding: 12mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ORNAMENTAL BORDER */
.cert-border-outer {
  position: absolute;
  top: 8mm;
  left: 8mm;
  right: 8mm;
  bottom: 8mm;
  border: 3px solid #0B3C5D;
  background: #FFFFFF;
  pointer-events: none;
}

.cert-border-inner {
  position: absolute;
  top: 10mm;
  left: 10mm;
  right: 10mm;
  bottom: 10mm;
  border: 1.5px solid #FF9933;
  pointer-events: none;
}

.cert-corner-accent {
  position: absolute;
  width: 18mm;
  height: 18mm;
  border: 2.5px solid #0B3C5D;
  pointer-events: none;
}
.corner-tl { top: 6mm; left: 6mm; border-right: none; border-bottom: none; }
.corner-tr { top: 6mm; right: 6mm; border-left: none; border-bottom: none; }
.corner-bl { bottom: 6mm; left: 6mm; border-right: none; border-top: none; }
.corner-br { bottom: 6mm; right: 6mm; border-left: none; border-top: none; }

/* INNER CONTENT */
.cert-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  padding: 6mm 10mm;
}

/* HEADER BRANDING */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 3mm;
}

.header-logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo-group img {
  height: 58px;
  width: auto;
}

.header-institution {
  text-align: right;
}

.header-institution h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 14.5pt;
  color: #0B3C5D;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.25;
  text-transform: uppercase;
}

.header-institution p {
  font-family: 'Montserrat', sans-serif;
  font-size: 9pt;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  line-height: 1.2;
}

/* TITLE BLOCK */
.cert-title-block {
  margin-top: 2mm;
}

.cert-presents-tag {
  font-family: 'Montserrat', sans-serif;
  font-size: 9.5pt;
  font-weight: 700;
  color: #FF9933;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  margin-bottom: 1mm;
}

.cert-main-title {
  font-family: 'Cinzel', serif;
  font-size: 28pt;
  font-weight: 900;
  color: #0B3C5D;
  letter-spacing: 3.5px;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(11, 60, 93, 0.1);
}

.cert-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14pt;
  color: #64748B;
  margin-top: 1mm;
  margin-bottom: 0;
}

/* RECIPIENT BLOCK */
.cert-recipient-block {
  margin: 0;
}

.cert-recipient-name {
  font-family: 'Great Vibes', cursive;
  font-size: 46pt;
  font-weight: 500;
  color: #B45309;
  display: block;
  padding: 0 12px;
  margin: 0 auto;
  line-height: 1.15;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.cert-body-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14pt;
  color: #334155;
  line-height: 1.45;
  max-width: 860px;
  margin: 1mm auto 0 auto;
}

.cert-body-text strong {
  color: #0B3C5D;
  font-weight: 700;
}

/* FOOTER & VERIFICATION */
.cert-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1px solid #E2E8F0;
  padding-top: 3mm;
  margin-top: 1mm;
}

.footer-meta {
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  font-size: 8pt;
  color: #64748B;
  line-height: 1.6;
}

.footer-meta strong {
  color: #0F172A;
}

.footer-auth-badge {
  text-align: center;
}

.digital-seal {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #0B3C5D 0%, #1E293B 100%);
  border: 2px solid #FF9933;
  border-radius: 50%;
  margin: 0 auto 3px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(11, 60, 93, 0.2);
}

.seal-inner-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 5pt;
  font-weight: 700;
  color: #CBD5E1;
  letter-spacing: 0.5px;
}

.seal-core {
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  font-weight: 900;
  color: #FF9933;
  letter-spacing: 1px;
  margin-top: 1px;
}

.seal-caption {
  font-family: 'Montserrat', sans-serif;
  font-size: 7.5pt;
  font-weight: 700;
  color: #0B3C5D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-qr {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.qr-canvas-holder {
  width: 68px;
  height: 68px;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 3px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-canvas-holder img, .qr-canvas-holder canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.footer-qr-text {
  font-size: 7.5pt;
  color: #64748B;
  line-height: 1.3;
}

.footer-qr-text code {
  font-weight: 700;
  color: #0B3C5D;
  font-family: monospace;
}

/* MODAL STYLES FOR DATA IMPORTER */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-card {
  background-color: #1E293B;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 90%;
  max-width: 650px;
  padding: 24px;
  color: #F8FAFC;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 16px;
  color: #FF9933;
}

.btn-close {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 20px;
  cursor: pointer;
}

.modal-body label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #CBD5E1;
  margin-bottom: 6px;
}

.modal-body textarea, .modal-body input {
  width: 100%;
  background-color: #0F172A;
  color: #F8FAFC;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  font-family: monospace;
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* PRINT MEDIA SPECIFIC RULES FOR PERFECT A4 LANDSCAPE ALIGNMENT */
@media print {
  @page {
    size: A4 landscape;
    margin: 0mm;
  }

  html, body {
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #FFFFFF !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .controls-bar, .modal-overlay, header, footer {
    display: none !important;
  }

  .page-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
  }

  .cert-page {
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 10mm !important;
    box-sizing: border-box !important;
    position: relative !important;
  }
}
