/**
 * Styles d'impression et d'export PDF
 * Masque l'interface utilisateur et assure une pagination propre
 */

@media print {
  /* Masquer tous les composants UI */
  .app-header,
  .editor-pane,
  .resizer-divider,
  .style-drawer,
  .lightbox-modal,
  .toast-container,
  .quick-toolbar,
  .code-copy-btn,
  .btn-print-hide,
  .md-heading-anchor,
  #mobile-toggle-view {
    display: none !important;
  }

  /* Configuration de la page */
  @page {
    margin: 1.8cm 1.5cm;
    size: auto;
  }

  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .app-layout {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-pane {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .markdown-body {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  /* Éviter les coupures de page gênantes */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  pre, blockquote, table, .md-figure, .markdown-alert {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .md-figure, .md-img-container, img {
    page-break-inside: avoid;
    break-inside: avoid;
    max-width: 95% !important;
  }

  /* Amélioration du contraste pour impression */
  a {
    color: #000000 !important;
    text-decoration: underline !important;
  }

  pre {
    border: 1px solid #cccccc !important;
    background: #f8f8f8 !important;
    color: #222222 !important;
  }

  table {
    border-collapse: collapse !important;
  }

  th, td {
    border: 1px solid #dddddd !important;
  }
}
