/* Spa Guy Portal — Tax Filing Print Stylesheet v2
   FIXES: full-report printing (was clipping to one screen) */

@media print {

  /* ---------- 1. KILL ALL HEIGHT/OVERFLOW CLIPPING ---------- */
  /* React dashboards wrap content in 100vh flex containers with overflow:hidden.
     That clips print output to one screen. Force everything to flow naturally. */
  html, body, #root, #root > *, main, main > *, main > * > *,
  div, section, article, aside,
  [class*="container"], [class*="wrapper"], [class*="layout"],
  [class*="scroll"], [class*="overflow"], [class*="content"],
  [class*="page"], [class*="main"], [class*="dashboard"],
  [class*="flex"], [class*="grid"] {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    position: static !important;
    transform: none !important;
    contain: none !important;
  }

  /* Fixed/sticky elements lifted out of normal flow break print. Force them static. */
  *[style*="position: fixed"],
  *[style*="position:fixed"],
  *[style*="position: sticky"],
  *[style*="position:sticky"],
  [class*="fixed"], [class*="sticky"] {
    position: static !important;
  }

  /* ---------- 2. PAGE COLOR RESET (white paper, black ink) ---------- */
  html, body, #root, * {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
  }

  /* Subtle borders so cards still read as boxes */
  *, *::before, *::after {
    border-color: #999999 !important;
  }

  /* ---------- 3. HIDE NAV / SIDEBAR / BUTTONS ---------- */
  nav, aside, header > nav, .sidebar, .navbar, .topbar,
  [class*="sidebar"], [class*="Sidebar"],
  [class*="navbar"], [class*="Navbar"],
  [class*="topbar"], [class*="TopBar"],
  [role="navigation"],
  button, .no-print,
  [class*="toolbar"], [class*="Toolbar"],
  [class*="menu"]:not([class*="menuitem"]),
  [class*="header"][class*="bar"] {
    display: none !important;
  }

  /* ---------- 4. MAIN CONTENT — FULL WIDTH ---------- */
  main, [role="main"], #root > div > div:last-child,
  [class*="main-content"], [class*="MainContent"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
  }

  /* ---------- 5. STACK TN + FL VERTICALLY (single column) ---------- */
  /* Override Tailwind grid classes that put TN/FL side-by-side */
  [class*="grid-cols-2"],
  [class*="grid-cols-3"],
  [class*="grid-cols-"],
  [class*="md:grid"],
  [class*="lg:grid"] {
    display: block !important;
    grid-template-columns: none !important;
  }

  [class*="grid-cols-2"] > *,
  [class*="grid-cols-"] > * {
    display: block !important;
    width: 100% !important;
    margin-bottom: 16pt !important;
  }

  /* ---------- 6. CARD / TABLE STYLING ---------- */
  [class*="card"], [class*="Card"] {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    border-radius: 4px !important;
    margin: 0 0 12pt 0 !important;
    padding: 10pt !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto;
    font-size: 9.5pt !important;
  }

  th, td {
    border: 1px solid #aaaaaa !important;
    padding: 3pt 5pt !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  thead {
    background: #eeeeee !important;
    display: table-header-group;
  }
  thead th { background: #eeeeee !important; }

  tr { page-break-inside: avoid; break-inside: avoid; }

  /* ---------- 7. HEADINGS ---------- */
  h1, h2, h3, h4 {
    color: #000000 !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  h1 { font-size: 18pt !important; margin: 8pt 0 6pt 0 !important; }
  h2 { font-size: 14pt !important; margin: 8pt 0 4pt 0 !important; }
  h3 { font-size: 12pt !important; margin: 6pt 0 3pt 0 !important; }

  /* ---------- 8. WORKSHEETS / SURTAX BREAKDOWN — KEEP TOGETHER ---------- */
  [class*="worksheet"], [class*="Worksheet"],
  [class*="surtax"], [class*="Surtax"],
  [class*="dor"], [class*="DOR"],
  [class*="dr-15"], [class*="DR-15"],
  [class*="breakdown"], [class*="Breakdown"] {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-top: 8pt !important;
  }

  /* Big section (Florida) starts on new page if it doesn't fit */
  [class*="florida"], [class*="Florida"],
  main > div > div > [class*="card"]:nth-of-type(2),
  main > div > [class*="grid"] > *:nth-child(2) {
    page-break-before: auto;
  }

  /* ---------- 9. PAGE SETUP ---------- */
  @page {
    size: letter portrait;
    margin: 0.4in 0.5in 0.5in 0.5in;
  }

  body {
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.35 !important;
  }

  /* ---------- 10. FOOTER WITH PRINT DATE ---------- */
  body::after {
    content: "Spa Guy Portal — Sales Tax Filing Record";
    display: block;
    font-size: 8pt !important;
    color: #555555 !important;
    text-align: center;
    margin-top: 18pt;
    border-top: 1px solid #999999;
    padding-top: 4pt;
  }

  /* ---------- 11. CURRENCY EMPHASIS ---------- */
  [class*="amount"], [class*="total"], [class*="currency"],
  [class*="Amount"], [class*="Total"], [class*="Currency"] {
    font-weight: 600 !important;
    color: #000000 !important;
  }

  /* ---------- 12. LINKS — show URL inline ---------- */
  a, a:link, a:visited {
    color: #000000 !important;
    text-decoration: none !important;
  }

  /* ---------- 13. KILL ANIMATIONS / TRANSITIONS ---------- */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
