/* css/print.css - Styles de mise en page haute fidélité conformes aux modèles officiels MK CENTRALIS */

/* --- APERÇU À L'ÉCRAN --- */
.gp-print-modal-backdrop {
  z-index: 250;
  padding: 0;
  overflow-y: auto;
}

.gp-print-modal {
  max-width: 960px;
  width: 95%;
  margin: 20px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  overflow: visible;
}

.gp-print-toolbar {
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.gp-print-toolbar-title {
  font-size: 13.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.gp-print-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gp-print-paper-wrapper {
  padding: 30px;
  background: #080a0f;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* --- FEUILLE INDIVIDUELLE OU MULTI-PAGES A4 CONFORME AU MODÈLE MK --- */
.gp-print-sheet.gp-model-sheet,
.gp-print-page {
  width: 100%;
  max-width: 820px;
  min-height: 1120px;
  background: #ffffff !important;
  color: #000000 !important;
  padding: 40px 48px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.4;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 1. EN-TÊTE SUPÉRIEUR ENTREPRISE (Modèle Identique) */
.gp-mk-pdf-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 8px;
}

.gp-mk-pdf-logo-img {
  max-width: 135px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.gp-mk-pdf-co-info {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.gp-mk-pdf-co-name {
  font-size: 18px;
  font-weight: 900;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gp-mk-pdf-co-manager {
  font-size: 14px;
  font-weight: 800;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.gp-mk-pdf-co-activity {
  font-size: 13px;
  font-weight: 500;
  color: #111111;
  margin-bottom: 2px;
}

.gp-mk-pdf-co-sub {
  font-size: 12px;
  color: #222222;
}

/* Bandeau horizontal des identifiants fiscaux */
.gp-mk-legal-banner-strip {
  border-top: 1.5px solid #000000;
  border-bottom: 1.5px solid #000000;
  padding: 4px 0;
  margin: 10px 0 18px 0;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  color: #000000;
  letter-spacing: 0.3px;
  font-family: 'Inter', Arial, sans-serif;
}

/* 2. TITRE DU DOCUMENT ET NUMÉROTATION */
.gp-mk-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.gp-mk-title-text {
  font-size: 24px;
  font-weight: 900;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gp-mk-title-num {
  font-size: 24px;
  font-weight: 900;
  color: #000000;
  text-align: right;
}

.gp-mk-title-date-under {
  font-size: 13px;
  font-weight: 800;
  color: #000000;
  text-align: right;
  margin-top: 2px;
}

/* 3. BLOC CLIENT (Barre verticale noire à gauche) */
.gp-mk-client-box-exact {
  border-left: 3.5px solid #000000;
  padding-left: 10px;
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #000000;
}

.gp-mk-client-box-exact .line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.gp-mk-client-box-exact .lbl {
  font-weight: 800;
  min-width: 65px;
}

.gp-mk-client-box-exact .val {
  font-weight: 500;
  color: #000000;
}

/* 4. RÉFÉRENCES CROISÉES SOUS LE BLOC CLIENT */
.gp-mk-refs-exact {
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.45;
  color: #000000;
}

.gp-mk-refs-exact .ref-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.gp-mk-refs-exact .ref-lbl {
  font-weight: 800;
}

.gp-mk-refs-exact .ref-val {
  font-weight: 500;
}

/* 5. TABLEAU STANDARD DES ARTICLES (Modèle Exact) */
.gp-mk-table-exact {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border: 1px solid #000000;
  margin-bottom: 0;
}

.gp-mk-table-exact th {
  background: #d1d5db !important; /* Gris moyen conforme au modèle */
  color: #000000 !important;
  font-weight: 800;
  padding: 6px 8px;
  border: 1px solid #000000;
  text-transform: uppercase;
  font-size: 11.5px;
  text-align: center;
}

.gp-mk-table-exact td {
  padding: 6px 8px;
  border: 1px solid #000000;
  color: #000000;
  vertical-align: middle;
}

.gp-mk-empty-row td {
  height: 28px;
}

/* 6. SOUS-TABLEAU DES TOTAUX (Aligné à Droite) */
.gp-mk-totals-subtable {
  width: 320px;
  margin-left: auto;
  border-collapse: collapse;
  border: 1px solid #000000;
  margin-top: -1px; /* Jointure fluide avec le tableau du haut */
}

.gp-mk-totals-subtable td {
  padding: 5px 10px;
  border: 1px solid #000000;
  font-size: 12px;
}

.gp-mk-totals-subtable td.lbl {
  background: #d1d5db !important;
  font-weight: 800;
  color: #000000;
  text-transform: uppercase;
  width: 45%;
}

.gp-mk-totals-subtable td.val {
  text-align: right;
  font-weight: 800;
  color: #000000;
}

/* 7. ARRÊTÉ EN LETTRES */
.gp-mk-arrete-section {
  margin-top: 25px;
  font-size: 11.5px;
  color: #000000;
}

.gp-mk-arrete-lbl {
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: 0.3px;
}

.gp-mk-arrete-words {
  font-weight: 500;
  font-style: italic;
  font-size: 12px;
}

/* 8. BAS DE PAGE / SIGNATURE / CACHET */
.gp-mk-footer-row {
  margin-top: auto;
  padding-top: 30px;
  display: flex;
  justify-content: flex-end;
}

.gp-mk-footer-right {
  text-align: center;
  min-width: 250px;
}

.gp-mk-footer-date {
  font-size: 12px;
  font-weight: 800;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.gp-mk-footer-manager {
  font-size: 13px;
  font-weight: 900;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.gp-mk-stamp-img-exact {
  width: 240px;
  height: 130px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.gp-mk-stamp-empty-space {
  height: 110px;
  display: block;
}

/* Double signature sur Bon de Livraison */
.gp-mk-bl-signatures-row {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.gp-mk-bl-sig-box {
  width: 45%;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
}

.gp-mk-bl-sig-box .line1 {
  font-weight: 500;
  font-style: italic;
}

.gp-mk-bl-sig-box .line2 {
  font-weight: 900;
  text-transform: uppercase;
}

/* 9. STYLES SPÉCIFIQUES FICHE DE COMMANDE CLIENT (FCC) */
.gp-fcc-section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  margin-bottom: 6px;
}

.gp-fcc-section-title {
  font-size: 19px;
  font-weight: 900;
  text-transform: uppercase;
  color: #000000;
}

.gp-fcc-section-meta {
  font-size: 13px;
  font-weight: 800;
  color: #000000;
}

.gp-fcc-split-totals {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: -1px;
}

.gp-fcc-subtable-left {
  border-collapse: collapse;
  border: 1px solid #000000;
}

.gp-fcc-subtable-left th {
  background: #d1d5db !important;
  border: 1px solid #000000;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
}

.gp-fcc-subtable-left td {
  border: 1px solid #000000;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

/* Tableau analytique 11 colonnes de calcul */
.gp-fcc-calcule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  border: 1px solid #000000;
}

.gp-fcc-calcule-table th {
  background: #d1d5db !important;
  border: 1px solid #000000;
  padding: 4px 4px;
  font-size: 9.5px;
  font-weight: 800;
  text-align: center;
  color: #000000;
}

.gp-fcc-calcule-table td {
  border: 1px solid #000000;
  padding: 4px 4px;
  color: #000000;
  font-size: 10px;
}

/* Tableau Récapitulatif 7 colonnes */
.gp-fcc-recap-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #000000;
  margin-top: 4px;
}

.gp-fcc-recap-table th {
  background: #d1d5db !important;
  border: 1px solid #000000;
  padding: 6px 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  color: #000000;
}

.gp-fcc-recap-table td {
  border: 1px solid #000000;
  padding: 6px 6px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
  color: #000000;
}

.gp-fcc-recap-table th.net,
.gp-fcc-recap-table td.net {
  background: #bbf7d0 !important; /* Vert émeraude clair conforme au document Sheraton */
  color: #052e16 !important;
  font-weight: 900 !important;
}

/* 10. AFFICHAGE DU BON DE COMMANDE UPLOADÉ */
.gp-attached-po-wrapper {
  width: 100%;
  min-height: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  padding: 20px;
}

.gp-attached-po-img {
  max-width: 100%;
  max-height: 980px;
  object-fit: contain;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.gp-attached-po-frame {
  width: 100%;
  height: 950px;
  border: none;
}

/* --- RÈGLES SPÉCIFIQUES @MEDIA PRINT --- */
@page {
  size: A4;
  margin: 6mm 8mm;
}

@media print {
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Masquer tous les composants d'interface ERP */
  .gp-sidebar,
  .gp-top-mobile-bar,
  .gp-main-area,
  .gp-print-toolbar,
  #toast-container,
  .mobile-overlay,
  .gp-modal-backdrop::before {
    display: none !important;
  }

  .gp-print-modal-backdrop {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .gp-print-modal {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .gp-print-paper-wrapper {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    gap: 0 !important;
  }

  .gp-print-sheet.gp-model-sheet,
  .gp-print-page {
    box-shadow: none !important;
    border: none !important;
    padding: 10mm 12mm !important;
    max-width: 100% !important;
    min-height: 290mm !important;
    width: 100% !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .gp-print-page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  table {
    page-break-inside: avoid;
  }

  tr {
    page-break-inside: avoid;
  }
}
