/* Print styles for invoice show page */

/* Hide print header on screen */
.print-header {
  display: none;
}

@media print {
  /* Hide navigation and UI elements */
  .sidebar,
  .navbar,
  .level.mb-5,
  .pagination,
  #sidebar,
  header,
  nav,
  footer,
  .sidebar-toggle,
  .button,
  .no-print,
  .impersonation-banner {
    display: none !important;
  }

  /* Show print header as two-column: logo left, company info right */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
  }

  .print-logo .logo {
    width: 300px;
    height: auto;
  }

  .print-company-info {
    text-align: right;
    font-size: 10pt;
    line-height: 1.6;
    color: black !important;
  }

  .print-company-info p {
    color: black !important;
    margin: 0;
  }

  .print-company-name {
    font-weight: bold;
    font-size: 11pt;
    margin-bottom: 2px;
  }

  /* Reset body and container for print */
  body,
  html {
    background: white !important;
    background-color: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.4;
  }

  /* Reset all potential dark mode backgrounds */
  .main-content,
  .container,
  .columns,
  .column,
  div,
  section {
    background: white !important;
    background-color: white !important;
  }

  .main-content,
  .container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Make the invoice box full width and remove shadow */
  .box {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    background-color: white !important;
  }

  /* Table styling for print */
  .table {
    font-size: 11pt;
    border-collapse: collapse;
    width: 100%;
    min-width: 0 !important;
  }

  /* Column widths - use class selectors so they work regardless of column count */
  .invoice-line-items .invoice-date-col {
    width: 90px;
    white-space: nowrap;
  }

  .invoice-line-items .invoice-qty-col {
    width: 40px;
    white-space: nowrap;
  }

  .invoice-line-items .invoice-unit-price-col {
    width: 80px;
    white-space: nowrap;
  }

  .invoice-line-items .invoice-amount-col {
    width: 100px;
    white-space: nowrap;
  }

  .table th,
  .table td {
    border: 2px solid #333 !important;
    padding: 8px !important;
    background: white !important;
    color: black !important;
  }

  .table thead th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  /* Ensure last line item row has bottom border */
  .table tbody tr:last-child td {
    border-bottom: 2px solid #333 !important;
  }

  .table tfoot td {
    background: white !important;
  }

  /* Balance row styling */
  .invoice-balance-row td {
    font-weight: bold;
  }

  .invoice-balance-row.is-unpaid td {
    background: #fff3cd !important;
    color: black !important;
  }

  .invoice-balance-row.is-paid td {
    background: #d4edda !important;
    color: black !important;
  }

  /* Status tags for print */
  .tag {
    border: 1px solid #333;
    padding: 2px 8px;
    font-weight: bold;
    background: white !important;
    color: black !important;
  }

  .tag.is-success {
    background: #d4edda !important;
  }

  .tag.is-warning {
    background: #fff3cd !important;
  }

  /* Ensure all text is readable */
  .has-text-grey {
    color: #333 !important;
  }

  /* Force all text inside the invoice box to black */
  .box,
  .box p,
  .box div,
  .box strong {
    color: black !important;
  }

  code {
    background: #f0f0f0 !important;
    color: black !important;
    padding: 2px 4px;
  }

  /* Notification/message box */
  .notification {
    border: 1px solid #ccc;
    padding: 10px;
    background: #f9f9f9 !important;
    color: black !important;
  }

  /* Links should be plain text */
  a {
    color: black !important;
    text-decoration: none !important;
  }

  /* Page settings */
  @page {
    margin: 1cm;
    size: letter;
  }

  /* Avoid page breaks inside important elements */
  .table,
  .columns {
    page-break-inside: avoid;
  }

  /* Ensure invoice header stays together */
  .columns.mb-5 {
    page-break-inside: avoid;
    page-break-after: avoid;
  }
}
