/**
 * Print Stylesheet
 * Optimizes pages for printing
 */

@media print {
  /* General print styles */
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Page setup */
  @page {
    margin: 2cm;
    size: auto;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  /* Hide non-essential elements */
  header,
  nav,
  footer,
  .no-print,
  .newsletter-popup,
  .cookie-consent,
  .skip-to-content,
  button:not(.print-button),
  [role="banner"],
  [role="navigation"],
  [role="complementary"],
  .search-modal,
  .mobile-menu,
  aside,
  .sidebar {
    display: none !important;
  }

  /* Ensure main content is visible */
  main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Typography */
  h1 {
    font-size: 24pt;
    margin-bottom: 12pt;
    page-break-after: avoid;
  }

  h2 {
    font-size: 18pt;
    margin-top: 18pt;
    margin-bottom: 10pt;
    page-break-after: avoid;
  }

  h3 {
    font-size: 14pt;
    margin-top: 14pt;
    margin-bottom: 8pt;
    page-break-after: avoid;
  }

  h4, h5, h6 {
    font-size: 12pt;
    margin-top: 12pt;
    margin-bottom: 6pt;
    page-break-after: avoid;
  }

  p {
    margin-bottom: 8pt;
    orphans: 3;
    widows: 3;
  }

  /* Links */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Show URLs for external links */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #555;
  }

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

  /* Lists */
  ul, ol {
    margin-left: 20pt;
    margin-bottom: 10pt;
  }

  li {
    margin-bottom: 4pt;
  }

  /* Tables */
  table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 12pt;
  }

  th, td {
    border: 1px solid #ddd;
    padding: 8pt;
    text-align: left;
  }

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

  /* Avoid page breaks inside these elements */
  blockquote,
  pre,
  code,
  table,
  figure,
  img {
    page-break-inside: avoid;
  }

  /* Code blocks */
  pre {
    border: 1px solid #ccc;
    padding: 10pt;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 10pt;
    margin-bottom: 12pt;
    background: #f5f5f5 !important;
  }

  code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 10pt;
    background: #f5f5f5 !important;
    padding: 2pt 4pt;
    border: 1px solid #ddd;
  }

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

  /* Blockquotes */
  blockquote {
    border-left: 4px solid #ccc;
    padding-left: 12pt;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
    page-break-inside: avoid;
  }

  /* Alerts/Callouts */
  .alert,
  .callout,
  .notice {
    border: 1px solid #ccc !important;
    padding: 10pt;
    margin-bottom: 12pt;
    page-break-inside: avoid;
  }

  /* Page header (printed on every page) */
  .print-header {
    display: block !important;
    margin-bottom: 20pt;
    padding-bottom: 10pt;
    border-bottom: 2px solid #000;
  }

  .print-header::before {
    content: "Legal Advice Basics";
    font-size: 14pt;
    font-weight: bold;
  }

  /* Page footer (printed on every page) */
  .print-footer {
    display: block !important;
    margin-top: 20pt;
    padding-top: 10pt;
    border-top: 1px solid #ccc;
    font-size: 9pt;
    color: #666;
  }

  /* Page numbers */
  @page {
    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
    }
  }

  /* Disclaimer (always print) */
  .disclaimer {
    display: block !important;
    border: 2px solid #000 !important;
    padding: 10pt;
    margin: 20pt 0;
    font-size: 10pt;
    page-break-inside: avoid;
  }

  /* Forms (hide input styling, show values) */
  input,
  textarea,
  select {
    border: none;
    border-bottom: 1px solid #000;
    background: transparent;
  }

  /* Remove shadows and effects */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Specific page types */

  /* State Guide Pages */
  .state-guide .city-list {
    column-count: 2;
    column-gap: 20pt;
  }

  /* Legal Dictionary Pages */
  .dictionary-entry {
    page-break-inside: avoid;
    margin-bottom: 12pt;
  }

  /* Topic Pages */
  .topic-content h2 {
    border-bottom: 1px solid #000;
    padding-bottom: 4pt;
  }

  /* Hide interactive elements */
  .interactive-tool,
  .quiz,
  .calculator,
  .simulator,
  form:not(.print-form) {
    display: none !important;
  }

  /* Show a message for interactive content */
  .interactive-tool::before {
    content: "[Interactive tool available online at legal-advicebasics.com]";
    display: block !important;
    font-style: italic;
    color: #666;
    margin-bottom: 10pt;
  }

  /* Breadcrumbs */
  .breadcrumb {
    font-size: 9pt;
    margin-bottom: 12pt;
    color: #666;
  }

  /* Tags/Categories */
  .tag,
  .category {
    display: inline;
    padding: 2pt 4pt;
    margin-right: 4pt;
    border: 1px solid #ccc;
    font-size: 9pt;
  }

  /* Date stamps */
  .date {
    font-size: 10pt;
    color: #666;
  }

  /* Author info */
  .author {
    font-size: 10pt;
    font-style: italic;
  }
}

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

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

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