/* === print.css === */
/* Reproduit le style du CR de consultation d'anesthésie St-Pierre Perpignan */

@media print {
  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9pt;
    color: #000;
    background: #fff;
  }

  /* Masquer tout l'UI sauf la zone imprimable */
  .topbar,
  .sidebar,
  .ai-panel,
  .section-nav,
  .btn,
  #toggle-ai-btn,
  .nav-item,
  .tag-input,
  .ai-panel-config,
  .info-box { display: none !important; }

  #app { display: block; height: auto; overflow: visible; }
  .layout { display: block; }
  .main { padding: 0; overflow: visible; background: #fff; }

  /* Afficher toutes les sections en print */
  .section { display: block !important; page-break-inside: avoid; }
  .section-title { display: none; }

  /* ============================================================
     EN-TÊTE (reproduit St-Pierre)
  ============================================================ */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000;
    padding-bottom: 6px;
    margin-bottom: 8px;
  }

  .print-header-left { font-size: 8pt; }
  .print-header-right { text-align: right; font-size: 8pt; }

  .print-service-name {
    font-weight: bold;
    font-size: 10pt;
  }

  /* ============================================================
     BLOC PATIENT (bande grise comme le PDF)
  ============================================================ */
  .print-patient-bar {
    display: block !important;
    background: #d0d0d0;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 10pt;
    margin-bottom: 4px;
  }

  .print-vitals-bar {
    display: block !important;
    background: #e0e0e0;
    padding: 4px 8px;
    font-size: 9pt;
    font-weight: bold;
    margin-bottom: 6px;
  }

  /* ============================================================
     GRILLE 2 COLONNES (Hospitalisation | Intervention)
  ============================================================ */
  .print-two-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #000;
    margin-bottom: 6px;
  }
  .print-two-col > div {
    padding: 4px 8px;
    border-right: 1px solid #000;
    font-size: 9pt;
  }
  .print-two-col > div:last-child { border-right: none; }

  /* ============================================================
     SECTIONS AVEC TITRE EN BANDE
  ============================================================ */
  .print-section {
    border: 1px solid #000;
    margin-bottom: 6px;
    page-break-inside: avoid;
  }

  .print-section-title {
    display: block !important;
    background: #c0c0c0;
    padding: 3px 8px;
    font-weight: bold;
    font-size: 9pt;
    text-transform: uppercase;
    border-bottom: 1px solid #000;
  }

  .print-section-body {
    padding: 5px 8px;
    font-size: 9pt;
    line-height: 1.5;
  }

  /* ============================================================
     SYNTHESE 2 COLONNES (Précautions | Allergies)
  ============================================================ */
  .print-synthese-row {
    display: grid !important;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    border: 1px solid #000;
    margin-bottom: 6px;
  }
  .print-synthese-row > div {
    padding: 5px 8px;
    font-size: 9pt;
  }
  .print-synthese-row > div + div { border-left: 1px solid #000; }

  /* Précautions en rouge gras comme l'original */
  .print-precautions { color: #cc0000; font-weight: bold; font-size: 9pt; }

  /* ============================================================
     PROTOCOLE
  ============================================================ */
  .print-protocol-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 5px 8px;
    font-size: 9pt;
  }

  /* ============================================================
     EXAMEN CLINIQUE — grille multi-colonnes
  ============================================================ */
  .print-exam-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #000;
    margin-bottom: 6px;
  }
  .print-exam-cell {
    padding: 4px 8px;
    border-right: 1px solid #aaa;
    border-bottom: 1px solid #aaa;
    font-size: 8.5pt;
    line-height: 1.5;
  }
  .print-exam-cell:nth-child(2n) { border-right: none; }
  .print-exam-cell-title {
    font-style: italic;
    font-weight: bold;
    font-size: 9pt;
  }

  /* ============================================================
     TRAITEMENT
  ============================================================ */
  .print-treatment-item { font-size: 8.5pt; margin-bottom: 2px; }
  .print-treatment-item::before { content: "- "; }

  /* ============================================================
     VISITE PRE-ANESTHESIQUE (encadré final)
  ============================================================ */
  .print-vpa {
    border: 1px solid #000;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 8.5pt;
  }
  .print-vpa-row { display: flex; gap: 20px; margin-bottom: 4px; }
  .print-checkbox::before { content: "□ "; }
  .print-checkbox.checked::before { content: "☑ "; }

  /* ============================================================
     PIED DE PAGE COMMENTAIRES
  ============================================================ */
  .print-comments {
    border-top: 1px solid #000;
    padding-top: 5px;
    margin-top: 5px;
    font-size: 8.5pt;
  }
  .print-comments-title {
    font-style: italic;
    font-weight: bold;
    text-decoration: underline;
    margin-bottom: 3px;
  }

  /* Cards masquées en print (remplacées par print-section) */
  .card { display: none !important; }
  .section-title { display: none !important; }

  /* La zone d'impression propre */
  #print-output {
    display: block !important;
    padding: 10mm;
  }

  @page {
    size: A4;
    margin: 10mm 12mm;
  }
}

/* En mode écran, masquer la zone print */
#print-output { display: none; }
