/* ==========================================================
   GL FIARA GESTION - Styles d'IMPRESSION partages (V7.2)
   GROUP LA FIARA - Bouake, Cote d'Ivoire

   Objectif : toute impression navigateur (Ctrl+P ou bouton
   Imprimer) sort avec le logo et l'identite de l'entreprise,
   sans menu lateral, sans barres d'actions ni animations.
   ========================================================== */

/* En-tete / pied de marque : masques a l'ecran, visibles a l'impression */
.print-brand-head,
.print-brand-foot,
.print-doc-title,
.print-only { display: none; }

@media print {
  @page { size: A4; margin: 12mm; }

  /* Le mode sombre ne doit jamais partir a l'imprimante : on
     force un rendu papier noir sur blanc, economique en encre. */
  html[data-theme="dark"], html[data-theme="dark"] body {
    background: #fff !important;
    color: #0f172a !important;
  }
  html[data-theme="dark"] .card,
  html[data-theme="dark"] .table-wrap,
  html[data-theme="dark"] .bg-white,
  html[data-theme="dark"] .bg-slate-50,
  html[data-theme="dark"] .bg-slate-100 {
    background: #fff !important;
    color: #0f172a !important;
  }
  html[data-theme="dark"] .text-slate-900,
  html[data-theme="dark"] .text-slate-800,
  html[data-theme="dark"] .text-slate-700,
  html[data-theme="dark"] .text-slate-600,
  html[data-theme="dark"] .text-slate-500,
  html[data-theme="dark"] .text-slate-400 { color: #0f172a !important; }

  body { background: #fff !important; }

  /* Elements d'interface a ne jamais imprimer */
  .sidebar, .no-print, .action-bar-sticky, .theme-toggle,
  #notifPanel, #notifBtn, .pwa-offline-bar, .toast-wrap, #toastWrap,
  header nav, .modal-overlay { display: none !important; }

  .card, .table-wrap {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    break-inside: avoid;
  }
  .fade-up { animation: none !important; }
  a[href]::after { content: ""; }
  thead { display: table-header-group; }
  tr, img { break-inside: avoid; }

  /* ---------- En-tete de marque imprime ---------- */
  .print-brand-head {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 2px solid #178a3e;
  }
  .print-brand-logo {
    width: 62px; height: auto; max-height: 62px;
    object-fit: contain; flex-shrink: 0;
  }
  .print-brand-id { line-height: 1.35; }
  .print-brand-name {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 15pt; font-weight: 800; color: #0b4f24;
    letter-spacing: .2px;
  }
  .print-brand-line { font-size: 8pt; color: #334155; }

  .print-doc-title { display: block !important; text-align: center; margin: 6px 0 12px; }
  .print-doc-title h2 {
    font-size: 13pt; font-weight: 800; text-transform: uppercase;
    letter-spacing: .5px; color: #0f172a; margin: 0;
  }
  .print-doc-title p { font-size: 9pt; color: #475569; margin: 2px 0 0; }

  .print-only { display: block !important; }

  /* Pied de page imprime (mentions + editeur) */
  .print-brand-foot {
    display: block !important;
    margin-top: 14px; padding-top: 6px;
    border-top: 1px solid #cbd5e1;
    font-size: 7.5pt; color: #64748b; text-align: center;
  }

  /* ---------- Impression d'une fenetre modale uniquement ----------
     Le corps recoit la classe .print-modal-only (via printModal()) :
     seule la modale ciblee est envoyee a l'imprimante, avec son
     propre en-tete de marque. */
  body.print-modal-only > * { display: none !important; }
  body.print-modal-only > .print-modal-target {
    display: block !important;
    position: static !important;
    inset: auto !important;
    padding: 0 !important;
    background: none !important;
    backdrop-filter: none !important;
    z-index: auto !important;
  }
  body.print-modal-only .print-modal-target > * {
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    max-height: none !important;
    max-width: none !important;
    width: 100% !important;
    overflow: visible !important;
    display: block !important;
  }
  body.print-modal-only .print-modal-target [id$="Body"] { overflow: visible !important; }
}

/* ============================================================
   V11 — IMPRESSION DES FICHES À ONGLETS (crédit, client, fournisseur)
   window.print() depuis une fiche : tous les onglets s'impriment
   à la suite (sinon seuls les onglets visibles sortaient).
   ============================================================ */
@media print {
  .tabpane { display: block !important; page-break-inside: avoid; }
  .tabpane.hidden { display: block !important; }
  #creditTabs, #custTabs, #supTabs { display: none !important; }
  .modal-backdrop, .modal-overlay { display: none !important; }
  /* Barres d'actions masquées à l'impression */
  .btn { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
  /* Progressions visibles en niveaux de gris */
  .bg-gradient-to-r { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
