/* =====================================================================
   AR-POS Food — Impresión universal (@media print)
   - .no-print   → se oculta en papel (navegación, botones, filtros)
   - .print-only → sólo aparece en papel (encabezado con marca)
   - body[data-paper="thermal80|thermal58"] → formato de ticket térmico
   El tamaño de página (@page) lo inyecta printPage() en app.js.
   ===================================================================== */

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 11pt;
  }

  .no-print, nav, aside, header.app-header, .fixed, [data-print="hide"] { display: none !important; }
  .print-only { display: block !important; }

  main, .print-area { margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; }

  .shadow-card, .shadow-pop, .shadow-stamp, [class*="shadow-"] { box-shadow: none !important; }
  [class*="rounded-"] { border-radius: 4px !important; }
  [class*="bg-"]:not(.keep-bg) { background: transparent !important; }

  a { color: #000 !important; text-decoration: none !important; }

  section, .card, table, .chart-box { break-inside: avoid; page-break-inside: avoid; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  table { width: 100% !important; border-collapse: collapse !important; }
  th, td { border-bottom: 1px solid #bbb !important; padding: 4px 6px !important; }
  th { border-bottom: 1.5px solid #000 !important; }

  canvas { max-width: 100% !important; height: auto !important; }

  /* Encabezado impreso */
  .print-header { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
  .print-header .ph-brand { display: flex; align-items: center; gap: 10px; }
  .print-header .ph-logo { width: 42px; height: 42px; object-fit: contain; }
  .print-header strong { display: block; font-size: 14pt; }
  .print-header small { display: block; font-size: 8pt; color: #444; }
  .print-header .ph-title { margin-top: 6px; font-size: 13pt; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
  .print-header .ph-meta { font-size: 8pt; color: #444; }

  /* ---------- Modo ticket térmico ---------- */
  body[data-paper^="thermal"] {
    font-family: "JetBrains Mono", ui-monospace, monospace !important;
    font-size: 8.5pt;
    line-height: 1.3;
  }
  body[data-paper="thermal80"] main, body[data-paper="thermal80"] .print-area { width: 72mm !important; }
  body[data-paper="thermal58"] main, body[data-paper="thermal58"] .print-area { width: 48mm !important; }
  body[data-paper^="thermal"] .grid { display: block !important; }
  body[data-paper^="thermal"] .grid > * { margin-bottom: 6px; }
  body[data-paper^="thermal"] h1, body[data-paper^="thermal"] h2, body[data-paper^="thermal"] h3 { font-size: 10pt !important; margin: 6px 0 2px !important; }
  body[data-paper^="thermal"] .text-3xl, body[data-paper^="thermal"] .text-4xl, body[data-paper^="thermal"] .text-2xl { font-size: 12pt !important; }
  body[data-paper^="thermal"] th, body[data-paper^="thermal"] td { padding: 1px 2px !important; font-size: 7.5pt !important; border-bottom: 1px dashed #999 !important; }
  body[data-paper^="thermal"] .thermal-hide, body[data-paper^="thermal"] .chart-box { display: none !important; }
  body[data-paper^="thermal"] .print-header { text-align: center; border-bottom: 1px dashed #000; }
  body[data-paper^="thermal"] .print-header .ph-brand { flex-direction: column; gap: 2px; }
  body[data-paper^="thermal"] img:not(.ph-logo) { display: none !important; }
  body[data-paper="thermal58"] .thermal58-hide { display: none !important; }
}
