/**
 * Print Styles for Guide Pages
 * These styles ensure that only the main content is printed,
 * hiding all navigation, headers, footers, and action drawers.
 */

@media print {
  /* Hide all non-content elements */
  header,
  footer,
  nav,
  .MuiDrawer-root,
  .MuiDrawer-paper,
  .MuiSwipeableDrawer-root,
  .MuiAppBar-root,
  .MuiToolbar-root,
  .guidesNavigation,
  .guidesDrawer,
  [class*="MuiDrawer"],
  [class*="SwipeableDrawer"],
  [role="banner"],
  [role="navigation"],
  [role="contentinfo"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Remove any potential page breaks before content */
  * {
    page-break-before: auto !important;
  }

  /* Show only main content */
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  main {
    display: block !important;
    background: white !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    page-break-before: avoid !important;
  }

  /* Ensure guidesContentMain is visible and full width */
  .guidesContentMain {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 20px !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
  }

  /* Content should be visible */
  .guidesContentMain * {
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Optimize text for printing */
  * {
    color: black !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Links */
  a {
    text-decoration: underline !important;
    color: #0000EE !important;
  }

  /* Page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  /* Avoid breaks in certain elements */
  p, blockquote, pre, code {
    page-break-inside: avoid !important;
  }

  /* Show full URLs for external links */
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666 !important;
  }

  /* Don't show URLs for anchor links */
  a[href^="#"]:after {
    content: "";
  }

  /* Inline elements should remain inline */
  span,
  strong,
  em,
  a,
  code,
  small,
  b,
  i,
  u {
    display: inline !important;
  }

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

  /* Lists */
  ul, ol {
    page-break-before: avoid !important;
  }

  /* Remove fixed positioning */
  * {
    position: static !important;
  }

  /* Tables */
  table {
    border-collapse: collapse !important;
  }

  table, th, td {
    border: 1px solid #ddd !important;
  }
}

