/* Tamaño de página y márgenes del PDF */
@page {
  size: A4;               
  margin: 12mm 12mm 16mm; /* top right bottom left */
}

/* Estilos sólo para impresión */
@media print {
  html, body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #111;
    background: #fff !important;
    font: 12pt/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  }

  /* Oculta elementos que no deben salir en el PDF */
  header, nav, footer, .no-print, .cookie-banner, .chat-widget {
    display: none !important;
  }

  /* Contenedor legible para el PDF */
  main, .print-container {
    max-width: 700px;
    margin: 0 auto;
  }

  /* Imágenes/medios fluidos y sin cortes feos */
  img, svg, canvas, video {
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Tablas sin cortes intermedios si es posible */
  table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
  }
  tr, td, th {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Evitar viudas/huérfanas y cortes justo tras títulos */
  p, h1, h2, h3, h4 {
    orphans: 3;
    widows: 3;
    break-after: avoid;
  }

  /* Clase para forzar salto de página manual */
  .print-page-break {
    page-break-before: always;
    break-before: page;
  }

  /* Mostrar URL tras enlaces (opcional) */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #555;
  }

  /* Quitar animaciones y transiciones */
  * {
    animation: none !important;
    transition: none !important;
  }
}
