<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <title>Bon de Commande A4</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <style>
    @page {
      size: A4;
      margin: 0;
    }

    @media print {
      html, body {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        overflow: hidden;
      }

      .print-area {
        padding: 20mm;
        box-sizing: border-box;
        width: 100%;
        height: 100%;
      }

      .no-print {
        display: none !important;
      }
    }

    body {
      font-family: 'Segoe UI', sans-serif;
      background: #fff;
      color: #000;
    }

    h2 {
      text-align: center;
      margin-bottom: 20px;
      font-size: 24px;
    }

    .bordered {
      border: 1px solid #dee2e6;
      padding: 10px;
      border-radius: 5px;
      font-size: 14px;
    }

    .table th, .table td {
      vertical-align: middle;
      font-size: 14px;
    }

    .signature {
      margin-top: 60px;
    }

    .signature-line {
      border-top: 1px solid #000;
      height: 2px;
      margin-top: 40px;
      width: 200px;
    }

    footer {
      margin-top: 30px;
      font-size: 12px;
      text-align: center;
      color: #555;
    }
  </style>
</head>
<body>

<div class="print-area">
  <div class="container">
    <h2>BON DE COMMANDE</h2>

    <div class="row mb-3">
      <div class="col-6 bordered">
        <strong>Fournisseur :</strong><br>
        Magilux Peinture SARL<br>
        Lot 101, Andraharo, Antananarivo<br>
        Tél: 032 12 345 67<br>
        Email: contact@magilux.mg
      </div>
      <div class="col-6 bordered text-end">
        <strong>Commande N° :</strong> BC-2025-001<br>
        <strong>Date :</strong> 27/06/2025<br>
        <strong>Client :</strong> Magilux - Dépôt Ankorondrano
      </div>
    </div>

    <table class="table table-bordered">
      <thead class="table-light">
        <tr>
          <th>#</th>
          <th>Article</th>
          <th>Description</th>
          <th>Quantité</th>
          <th>Prix Unitaire</th>
          <th>Total</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>Peinture Blanche</td>
          <td>Seau de 20L</td>
          <td>5</td>
          <td>25 000 MGA</td>
          <td>125 000 MGA</td>
        </tr>
        <tr>
          <td>2</td>
          <td>Durcisseur</td>
          <td>Flacon 1L</td>
          <td>3</td>
          <td>10 000 MGA</td>
          <td>30 000 MGA</td>
        </tr>
      </tbody>
      <tfoot class="table-light">
        <tr>
          <th colspan="5" class="text-end">Total HT</th>
          <th>155 000 MGA</th>
        </tr>
        <tr>
          <th colspan="5" class="text-end">TVA (20%)</th>
          <th>31 000 MGA</th>
        </tr>
        <tr>
          <th colspan="5" class="text-end">Total TTC</th>
          <th>186 000 MGA</th>
        </tr>
      </tfoot>
    </table>

    <p class="mt-3"><strong>Remarques :</strong> Livraison attendue sous 7 jours ouvrables. Le paiement se fera à la réception de la marchandise.</p>

    <div class="row signature justify-content-between">
      <div class="col-auto text-start">
        <p>Signature Client</p>
        <div class="signature-line"></div>
      </div>
      <div class="col-auto text-end">
        <p>Signature Fournisseur</p>
        <div class="signature-line"></div>
      </div>
    </div>

    <footer>
      Document généré automatiquement - Bon de Commande officiel
    </footer>
  </div>
</div>

<!-- Bouton Imprimer -->
<div class="text-center mt-4 no-print">
  <button onclick="window.print()" class="btn btn-primary">Imprimer / Enregistrer en PDF</button>
</div>

</body>
</html>
