/**
 * @file
 * Generic print styles for table-based views.
 *
 * This stylesheet provides clean, professional print formatting for any
 * Drupal view that displays tabular data. It hides non-essential UI elements
 * and optimizes table layout for printing.
 *
 * Usage: Attach the 'corporateplus/table-print' library to any view that
 * needs print functionality.
 */

@media print {
  /* Hide non-printable elements */
  .site-header,
  .site-footer,
  .sidebar,
  .view-filters,
  .pager,
  .contextual-links,
  button,
  .btn,
  .ufgs-actions,
  .form-actions,
  nav,
  .breadcrumb,
  .tabs,
  .action-links,
  .messages,
  .messages-status,
  .messages-warning,
  .messages-error,
  .maintenance-msg,
  .system-status-counter,
  #cookie-notice,
  .cookie-notice,
  .eu-cookie-compliance-banner,
  .gdpr-banner,
  #sliding-popup,
  .region-highlighted,
  .contextual-region,
  .local-tasks,
  .skip-link {
    display: none !important;
  }

  /* Page setup with header and footer regions */
  @page {
    margin: 1in 0.5in 0.75in 0.5in;
    size: letter portrait;

    @top-left {
      content: element(header);
    }
  }

  body {
    font-size: 10pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
    margin: 0;
    padding: 0;
  }

  /* Full-width layout - remove container constraints */
  .container,
  .main-content,
  .region-content,
  .view {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Print header styling */
  .print-header {
    position: running(header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 2px solid #333;
    margin-bottom: 15px;
    background: #f5f5f5;
    page-break-after: avoid;
  }

  .print-header img {
    height: 40px;
    width: auto;
  }

  .print-header .document-title {
    font-size: 14pt;
    font-weight: bold;
    color: #333;
  }

  /* Print footer styling */
  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid #333;
    padding: 8px 0.5in;
    font-size: 8pt;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .print-footer .footer-left {
    flex: 1;
    text-align: left;
  }

  .print-footer .footer-center {
    flex: 1;
    text-align: center;
    font-weight: bold;
  }

  .print-footer .footer-right {
    flex: 1;
    text-align: right;
  }

  .print-footer .official-statement {
    margin-top: 2px;
    font-size: 7pt;
    font-style: italic;
    color: #666;
  }

  /* Table styling */
  .view-content table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
  }

  .view-content thead {
    display: table-header-group;
  }

  .view-content tbody {
    display: table-row-group;
  }

  .view-content tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .view-content th,
  .view-content td {
    border: 1px solid #000;
    padding: 6px 8px;
    font-size: 9pt;
    text-align: left;
    vertical-align: top;
  }

  .view-content th {
    background-color: #f0f0f0;
    font-weight: bold;
    border-bottom: 2px solid #000;
  }

  /* Header/title styling */
  .view-header {
    margin-bottom: 1em;
  }

  .view-title,
  h1, h2 {
    font-size: 14pt;
    font-weight: bold;
    margin-bottom: 0.5em;
    color: #000;
  }

  /* Ensure key tables and legends print */
  table.key {
    margin-bottom: 1em;
    border: 1px solid #000;
  }

  table.key th,
  table.key td {
    border: 1px solid #000;
    padding: 4px 6px;
    font-size: 8pt;
  }

  /* Badge styling for print */
  .badge {
    border: 1px solid #000;
    padding: 2px 4px;
    font-size: 8pt;
    background: #fff !important;
    color: #000 !important;
  }

  /* Links */
  a[href]:after {
    content: none; /* Don't print URLs */
  }

  a {
    color: #000;
    text-decoration: none;
  }

  /* Prevent awkward breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  ul, ol, dl {
    page-break-before: avoid;
  }
}
