/* ═══════════════════════════════════════════════════════════════
   certificate.css — شهادة «أفق للتكوين» — A4 أفقي (1123 × 794 px)
   ═══════════════════════════════════════════════════════════════ */
.ofq-cert-stage { position: relative; overflow: hidden; margin: 0 auto; max-width: 1123px; }
.ofq-cert {
  width: 1123px; height: 794px; position: absolute; top: 0; right: 0;
  transform-origin: top right; box-sizing: border-box;
  background: #fdfdfb; color: #0f172a; direction: rtl; text-align: center;
  font-family: 'Cairo', 'Noto Naskh Arabic', 'Amiri', Arial, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  overflow: hidden;
}
.ofq-cert *, .ofq-cert *::before, .ofq-cert *::after { box-sizing: border-box; }
/* إطار مزدوج أزرق داكن */
.ofq-cert-border { position: absolute; inset: 18px; border: 3px solid #12305f; border-radius: 4px; pointer-events: none; }
.ofq-cert-border::before { content: ''; position: absolute; inset: 7px; border: 1px solid #9fb2d1; border-radius: 2px; }
.ofq-cert-border::after { content: ''; position: absolute; inset: -18px; background:
  linear-gradient(135deg, #12305f 0 38px, transparent 38px) top right / 60px 60px no-repeat,
  linear-gradient(225deg, #12305f 0 38px, transparent 38px) top left / 60px 60px no-repeat; opacity: .08; }

.ofq-cert-inner { position: relative; z-index: 2; height: 100%; padding: 46px 78px 34px; display: flex; flex-direction: column; align-items: center; }

.ofq-cert-head { line-height: 1.35; }
.ofq-cert-brand { font-size: 30px; font-weight: 900; color: #12305f; letter-spacing: 0; }
.ofq-cert-sub { font-size: 15px; font-weight: 600; color: #475569; margin-top: 2px; }
.ofq-cert-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.ofq-cert-rule span { display: block; width: 120px; height: 1.5px; background: #c8962e; }
.ofq-cert-rule i { display: block; width: 9px; height: 9px; background: #c8962e; transform: rotate(45deg); }

.ofq-cert-title { font-size: 46px; font-weight: 900; color: #12305f; margin: 16px 0 8px; line-height: 1.3; font-family: 'Cairo', 'Amiri', serif; }

.ofq-cert-body { line-height: 1.6; }
.ofq-cert-line { font-size: 19px; color: #334155; margin: 2px 0; font-weight: 500; }
.ofq-cert-name { font-size: 36px; font-weight: 800; color: #0b2347; margin: 4px auto 6px; padding: 0 36px 4px; border-bottom: 1.5px solid #c9d5ea; display: inline-block; min-width: 380px; font-family: 'Noto Naskh Arabic', 'Amiri', 'Cairo', serif; }
.ofq-cert-course { font-size: 26px; font-weight: 800; color: #1d4f91; margin: 4px 0 6px; font-family: 'Noto Naskh Arabic', 'Amiri', 'Cairo', serif; }

.ofq-cert-meta { display: flex; justify-content: center; gap: 0; margin: 12px 0 0; padding: 0; }
.ofq-cert-meta > div { padding: 2px 26px; border-left: 1px solid #c9d5ea; }
.ofq-cert-meta > div:last-child { border-left: 0; }
.ofq-cert-meta dt { font-size: 12.5px; color: #64748b; font-weight: 700; margin: 0; }
.ofq-cert-meta dd { font-size: 15px; color: #0f172a; font-weight: 800; margin: 0; }

/* الجزء السفلي: التوقيع والختم يمينًا، QR يسارًا */
.ofq-cert-bottom { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.ofq-cert-signzone { display: flex; align-items: flex-end; gap: 18px; }
.ofq-cert-sign { display: flex; flex-direction: column; align-items: center; min-width: 210px; }
.ofq-cert-sign-title { font-size: 15px; font-weight: 800; color: #12305f; }
.ofq-cert-sign-img { display: flex; align-items: center; justify-content: center; margin: 2px 0; }
.ofq-cert-sign-img img { display: block; height: auto; max-width: none; background: transparent; }
.ofq-cert-sign-name { font-size: 16px; font-weight: 800; color: #0f172a; border-top: 1px solid #94a3b8; padding-top: 3px; min-width: 170px; }
.ofq-cert-stamp { display: flex; align-items: flex-end; }
.ofq-cert-stamp img { display: block; width: auto; max-width: none; background: transparent; opacity: .92; }
.ofq-cert-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ofq-cert-qr img, .ofq-cert-qr-ph { width: 112px; height: 112px; display: block; background: #fff; padding: 5px; border: 1px solid #c9d5ea; border-radius: 4px; }
.ofq-cert-qr-ph { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-weight: 800; }
.ofq-cert-qr span { font-size: 12px; font-weight: 700; color: #334155; }

.ofq-cert-foot { width: 100%; margin-top: 12px; padding-top: 8px; border-top: 1px solid #dbe3f0; line-height: 1.5; }
.ofq-cert-domain { font-size: 13px; font-weight: 800; color: #12305f; }
.ofq-cert-disclaimer { font-size: 11.5px; color: #64748b; }

/* وضع النموذج التجريبي */
.ofq-cert-watermark { position: absolute; z-index: 3; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 120px; font-weight: 900; color: rgba(220, 38, 38, .10); white-space: nowrap; pointer-events: none; font-family: 'Cairo', sans-serif; }
.ofq-cert-demo-badge { position: absolute; z-index: 4; top: 30px; left: 34px; background: #dc2626; color: #fff; font-weight: 900; font-size: 15px; padding: 4px 14px; border-radius: 6px; font-family: 'Cairo', sans-serif; }

/* الطباعة: صفحة A4 أفقية واحدة */
@media print {
  @page { size: A4 landscape; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body.ofq-printing > *:not(.ofq-print-host) { display: none !important; }
  .ofq-print-host { display: block !important; position: static !important; }
  /* 1123 × 794 px ≈ 297 × 210 mm à 96 dpi : la mise en page interne reste identique */
  .ofq-print-host .ofq-cert { position: relative !important; transform: none !important; width: 297mm !important; height: 209.5mm !important; page-break-after: avoid; break-after: avoid; }
}
