/* ═══════════════════════════════════════════════════════════════════════════
   Print Layout — @media print
   Hides chrome (sidebar, header, footer), forces white background,
   shows URLs after links, and prevents page breaks inside cards/tables.
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  /* ── Hide non-printable chrome ────────────────────────────────────────── */
  #sidebar,
  #sidebar-overlay,
  body > div > header,
  body > div > footer,
  footer,
  #offline-banner,
  #pwa-install-banner,
  #global-search-modal,
  #zm-toast-container,
  .zm-modal,
  #support-chat-container-REMOVED,
  #aurien-chat-widget,
  [data-action="toggle-panel"],
  .no-print,
  button[data-action],
  nav[aria-label="paginacao"],
  .htmx-indicator {
    display: none !important;
  }

  /* ── Remove sidebar margin from content ───────────────────────────────── */
  .md\:ml-64 {
    margin-left: 0 !important;
  }

  /* ── White background, black text ─────────────────────────────────────── */
  html, body, main, .bg-background, .bg-card {
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── Force dark mode content to print in light colors ─────────────────── */
  html.dark body,
  html.dark main {
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* ── Remove decorative gradients and backdrop effects ─────────────────── */
  .gradient-bg,
  .card-gradient,
  .glass-effect {
    background: #ffffff !important;
    backdrop-filter: none !important;
  }

  /* ── Ensure all text is dark on print ─────────────────────────────────── */
  .text-foreground,
  .text-muted-foreground,
  .text-card-foreground,
  p, span, h1, h2, h3, h4, h5, h6, td, th, li, label, div {
    color: #000000 !important;
  }

  /* ── Show URLs after links ────────────────────────────────────────────── */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #666666;
    font-weight: normal;
  }
  /* Don't show URL for anchors, javascript:, or fragment links */
  a[href^="#"]::after,
  a[href^="javascript:"]::after,
  a[href^="data:"]::after {
    content: none;
  }
  /* Don't show URL for nav links (sidebar, pagination, breadcrumbs) */
  nav a::after,
  .pagination a::after {
    content: none;
  }

  /* ── Prevent page breaks inside cards, tables, and form groups ────────── */
  .rounded-xl,
  .rounded-lg,
  .border,
  table,
  thead,
  tr,
  .card,
  .space-y-2,
  figure,
  blockquote,
  pre {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Headings should not be orphaned ──────────────────────────────────── */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* ── Tables: borders visible for print ────────────────────────────────── */
  table {
    border-collapse: collapse !important;
  }
  td, th {
    border: 1px solid #cccccc !important;
    padding: 4px 8px !important;
  }

  /* ── Remove shadows and animations ────────────────────────────────────── */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  /* ── Set page margins ─────────────────────────────────────────────────── */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  /* ── Images: prevent overflow ─────────────────────────────────────────── */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* ── Full width for main content ──────────────────────────────────────── */
  main {
    padding: 0 !important;
    overflow: visible !important;
  }
  .max-w-7xl {
    max-width: 100% !important;
  }

  /* ── Remove border colors that may not print well ─────────────────────── */
  .border-border,
  .border-border\/40 {
    border-color: #cccccc !important;
  }
}
