/**
 * Print stylesheet for Client Check web app.
 * Optimizes invoices, estimates, daily logs, and reports for printing.
 */

@media print {
  /* ── Hide non-printable UI ─────────────────────────────────── */
  nav,
  [data-testid="tab-bar"],
  [data-testid="sidebar"],
  [data-testid="quick-create"],
  [data-testid="toast"],
  [data-testid="network-banner"],
  [data-testid="cookie-consent"],
  [role="navigation"],
  [role="tablist"],
  button:not([data-print]),
  .fab,
  .toast,
  .sidebar,
  .tab-bar,
  .bottom-nav,
  .top-nav,
  .network-banner,
  .cookie-consent {
    display: none !important;
  }

  /* ── Base styles ────────────────────────────────────────────── */
  html, body, #root {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* ── Layout ─────────────────────────────────────────────────── */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Linearize to single column */
  [data-testid="content-container"],
  .content-container,
  main {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── Cards ──────────────────────────────────────────────────── */
  [data-testid="card"] {
    background: white !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
    margin-bottom: 8pt !important;
    padding: 8pt !important;
  }

  /* ── Text colors for print ─────────────────────────────────── */
  h1, h2, h3, h4, h5, h6,
  p, span, div, td, th, li {
    color: black !important;
  }

  /* ── Tables (invoices, estimates) ──────────────────────────── */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 4pt 8pt !important;
    text-align: left !important;
    color: black !important;
    background: white !important;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: bold !important;
  }

  /* ── Invoice specific ──────────────────────────────────────── */
  .invoice-total,
  [data-testid="invoice-total"] {
    font-size: 14pt !important;
    font-weight: bold !important;
    border-top: 2pt solid black !important;
  }

  /* ── Page breaks ────────────────────────────────────────────── */
  h1, h2, h3 {
    break-after: avoid;
  }

  tr {
    break-inside: avoid;
  }

  /* ── Links ──────────────────────────────────────────────────── */
  a {
    color: black !important;
    text-decoration: underline !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  /* ── Badges / Status indicators ────────────────────────────── */
  [data-testid="badge"] {
    border: 1px solid #333 !important;
    background: white !important;
    color: black !important;
    padding: 1pt 4pt !important;
  }

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

  /* ── Footer with URL ────────────────────────────────────────── */
  @page {
    margin: 1cm;
  }
}
