/* Print Styles for Reports and Documents */

/* Targeted printing: when a specific element is targeted, hide everything else */
@media print {
  body[data-print-selector] > *:not([data-print-selector]) {
    display: none !important;
  }

  body[data-print-selector] {
    background: #fff !important;
  }

  body[data-print-selector] [data-print-selector],
  body[data-print-selector] [data-print-selector] * {
    display: block !important;
    visibility: visible !important;
  }
}

@media print {
  /* Hide non-printable elements */
  .no-print,
  nav,
  header,
  footer,
  .sidebar,
  .toolbar,
  .filter-panel,
  .breadcrumb,
  button,
  .btn,
  .dropdown,
  .form-check,
  input[type="checkbox"],
  input[type="radio"],
  .page-header,
  .alert,
  .modal,
  .toast {
    display: none !important;
  }

  /* Page setup. Owner 2026-11-07 (CL-6): the footer bar of a printed live screen sits in the page's bottom margin on every page
     (the product mark and the page number), so it never overlaps the content. */
  @page {
    size: A4;
    margin: 15mm 15mm 16mm;

    @bottom-left {
      content: "ONOO ERP";
      font: 600 8px Cairo, Tahoma, sans-serif;
      color: #64748b;
    }

    @bottom-right {
      content: counter(page) " / " counter(pages);
      font: 600 8px Cairo, Tahoma, sans-serif;
      color: #64748b;
    }
  }

  /* No gradient line at the top of a printed page. */
  body::before,
  html::before,
  .page-body::before,
  .onoo-page-body::before {
    background-image: none !important;
  }

  /* A value that mixes Arabic with digits or Latin letters takes its own direction from its first letter. */
  table td:not(.numeric):not(.o-num),
  table th,
  .card-title,
  h1,
  h2,
  h3 {
    unicode-bidi: plaintext;
  }

  /* Body styles */
  body {
    margin: 0;
    padding: 0;
    background: white;
    color: black;
    font-size: 12pt;
  }

  /* Preserve colors and backgrounds */
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Container adjustments */
  .container,
  .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Cards and content */
  .card {
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .card-body {
    padding: 0 !important;
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: avoid;
  }

  table thead {
    display: table-header-group;
  }

  table tfoot {
    display: table-footer-group;
  }

  table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  table td,
  table th {
    padding: 8px;
    border: 1px solid #dee2e6;
  }

  /* Typography */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  /* Hide row and col gutters */
  .row {
    margin: 0 !important;
  }

  .col,
  [class*="col-"] {
    padding: 0 !important;
  }

  /* Links */
  a {
    text-decoration: none;
    color: inherit;
  }

  /* Badges and status */
  .badge {
    border: 1px solid currentColor;
    padding: 2px 8px;
  }

  /* Avoid page breaks */
  .no-page-break,
  .card,
  .invoice-template,
  .report-template {
    page-break-inside: avoid;
  }

  /* Grid layout for print */
  .row.g-3 > *,
  .row.g-2 > * {
    margin-bottom: 10px !important;
  }

  /* Hide action columns in tables */
  .table td:last-child,
  .table th:last-child {
    display: table-cell !important;
  }

  /* Ensure visibility of printable content */
  .printable,
  #report-content,
  #statement-content,
  #invoice-content {
    display: block !important;
    visibility: visible !important;
  }
}

/* Print-specific utility classes */
.print-only {
  display: none;
}

@media print {
  .print-only {
    display: block !important;
  }

  .screen-only {
    display: none !important;
  }
}
