/*
 * print_a4.css — Règles d'impression pour les factures au format A4.
 *
 * Ce fichier centralise toutes les règles @media print spécifiques au gabarit
 * A4 portrait (210×297 mm, marges 5 mm). Il est conçu pour fonctionner
 * conjointement avec faccontrol-documents.css (styles écran + print communs).
 *
 * Il ne contient AUCUNE règle écran. Ne pas y ajouter de styles hors @media print.
 *
 * Extension future : pour ajouter un gabarit A5 ou A4 paysage, créer un
 * fichier print_a5.css ou print_a4_landscape.css sur le même modèle.
 */

@media print {

  /* ── Page ────────────────────────────────────────────────────────────── */
  @page {
    size: A4 portrait;
    margin: 5mm;
  }

  /* ── Corps ───────────────────────────────────────────────────────────── */
  body {
    background: #fff;
    margin: 0;
    font-size: 11pt;
    color: #000;
  }

  /* ── Masquage éléments navigation ───────────────────────────────────── */
  .no-print          { display: none !important; }
  .sidebar           { display: none !important; }
  .header            { display: none !important; }
  .footer            { display: none !important; }

  /* ── Mise en page principale ─────────────────────────────────────────── */
  .main {
    margin: 0;
    padding: 0;
    min-height: auto;
    width: 100% !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
  }
  .container,
  .row,
  .col-lg-10,
  .col-12 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── Typographie compacte ────────────────────────────────────────────── */
  img   { max-height: 80px !important; }
  h2    { font-size: 1rem !important; }
  h3    { font-size: 1rem !important; }
  h5    { font-size: 0.9rem !important; }

  /* ── Tableau lignes facture ──────────────────────────────────────────── */
  .table td,
  .table th {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.9rem;
    background: #fff !important;
  }

  /* ── Neutralisation encadrés Bootstrap ───────────────────────────────── */
  .border,
  .card-body {
    border: none !important;
    padding: 0 !important;
  }
  .mt-4 { margin-top: 1rem !important; }
  .mb-3 { margin-bottom: 0.5rem !important; }

  /* ── Fond blanc forcé sur tous les éléments ──────────────────────────── */
  .table,
  .table tbody tr,
  .table thead,
  .table tfoot,
  .table tr,
  [class*="bg-"] {
    background: #fff !important;
    background-color: #fff !important;
  }

  /* ── Liens : texte pur, sans couleur ni soulignement ─────────────────── */
  a {
    text-decoration: none;
    color: #000;
  }

  /* ── Filigrane DUPLICATA ─────────────────────────────────────────────── */
  body.is-duplicata::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── Composants document (faccontrol-documents.css overrides) ─────────── */
  /* Ces règles renforcent ou ajustent les valeurs déjà définies dans
     faccontrol-documents.css @media print, pour le gabarit A4 uniquement. */

  .document-sheet-body    { padding: 0 !important; }
  .document-header-row    { margin-bottom: 0.45rem !important; }
  .document-company-logo  { max-height: 74px !important; margin-bottom: 0.35rem !important; }
  .document-company-column h2 { margin-bottom: 0.15rem; }
  .document-company-meta  { line-height: 1.18; }
  .document-regime-label,
  .document-company-meta > div:last-child { margin-top: 0.18rem !important; }
  .document-title-banner  { margin-bottom: 0.25rem !important; }
  .document-title-number  { margin-bottom: 0.15rem; }
  .document-meta-column > h5 { margin-bottom: 0.15rem; }
  .document-client-row    { margin-bottom: 0.45rem !important; }
  .document-client-box    { padding: 0.35rem 0.5rem !important; }

  .document-lines-shell > .table {
    margin-bottom: 0.5rem !important;
    border: 1.4px solid #000 !important;
    border-top: 1.6px solid #000 !important;
    font-size: 0.88rem !important;
  }
  .document-lines-shell > .table > thead {
    border-top: 1.6px solid #000 !important;
  }
  .document-lines-shell > .table > thead > tr:first-child > th {
    border-top: 1.6px solid #000 !important;
    border-color: #000 !important;
  }
  .document-lines-shell > .table > thead > tr > th {
    background: #0d6efd !important;
    color: #fff !important;
    border-color: #000 !important;
    padding: 0.45rem 0.5rem !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .document-lines-shell > .table > tbody > tr > *,
  .document-lines-shell > .table > tfoot > tr > * {
    border-color: #9ca3af !important;
    padding: 0.42rem 0.5rem !important;
  }
  .document-lines-shell > .table > tbody > tr:nth-of-type(even) > *,
  .document-lines-shell > .table > tfoot > tr > * {
    background: #f5f7fb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .document-lines-shell > .table > tfoot tr.bg-light > * {
    background: #eaf2ff !important;
    border-top-color: #000 !important;
    border-bottom-color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

}
