/* Dedicated Print Stylesheet - Complete Layout Reset for Printing */

/* 
 * IMPORTANT: All styles here are wrapped in @media print to ensure they ONLY apply during printing.
 * However, Safari on macOS has a known bug where print styles can sometimes persist after closing
 * print preview. If you see print styles affecting your normal app view:
 * 
 * 1. Close print preview completely
 * 2. Reload the page (Cmd+R) - this will reset CSS
 * 
 * The stylesheet is correctly loaded with media="print" in index.html and all rules are 
 * wrapped in @media print, so they should NOT affect screen media. If they do, it's a Safari bug.
 */

@media print {
  /* Page margins - ensure consistent spacing regardless of browser print settings */
  @page {
    margin: 0.75in 0.5in 0.75in 0.625in; /* top, right, bottom, left (gutter) - consistent with book-print.css */
  }
  
  /* Force all containers to be visible and remove visual effects */
  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    background-image: none !important;
    background-attachment: initial !important;
  }
  
  /* Reset all layout constraints that might hide content */
  html, body, #root {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    transform: none !important;
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Remove all position constraints from MUI components */
  .MuiBox-root, 
  .MuiContainer-root, 
  .MuiPaper-root,
  .MuiCard-root,
  .MuiAccordion-root,
  .MuiAccordionSummary-root,
  .MuiAccordionDetails-root {
    position: static !important;
    transform: none !important;
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  /* Force content visibility - ensure all content is displayed */
  main, 
  article, 
  section, 
  div, 
  span,
  p,
  h1, h2, h3, h4, h5, h6 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: black !important;
    background: transparent !important;
    position: static !important;
    transform: none !important;
    overflow: visible !important;
  }
  
  /* Ensure spans and inline elements are visible */
  span, 
  .MuiTypography-root,
  .MuiChip-root {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Hide interactive elements that shouldn't print */
  button, 
  .MuiButton-root, 
  .no-print, 
  nav, 
  header, 
  footer,
  .MuiIconButton-root,
  .MuiFab-root,
  .MuiSpeedDial-root {
    display: none !important;
  }
  
  /* Ensure accordions are expanded and visible */
  .MuiAccordionDetails-root {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Remove accordion expand icons */
  .MuiAccordionSummary-expandIconWrapper {
    display: none !important;
  }
  
  /* Ensure typography is readable */
  .MuiTypography-root {
    color: black !important;
    background: transparent !important;
  }
  
  /* Page break controls */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid-page;
  }
  
  /* Allow content to flow naturally */
  .print-atom {
    page-break-inside: auto;
    break-inside: auto;
  }
  
  /* Ensure content wrapper doesn't constrain content */
  .MuiContainer-root {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Remove any sticky positioning */
  .MuiAppBar-root,
  .MuiToolbar-root,
  [style*="position: sticky"],
  [style*="position: fixed"] {
    position: static !important;
    display: none !important;
  }
  
  /* Ensure tables and lists are visible */
  table, 
  tr, 
  td, 
  th,
  ul, 
  ol, 
  li {
    display: block !important;
    visibility: visible !important;
    color: black !important;
    background: transparent !important;
  }
  
  /* Force table cells to display properly */
  td, th {
    display: table-cell !important;
  }
  
  /* Ensure list items are visible */
  li {
    display: list-item !important;
  }
}
