/* 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 {
    display: none !important;
  }

  /* Show print header */
  .print-header {
    display: block !important;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
  }

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

  /* 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%;
  }

  /* Column widths - minimal for Date and Code, widest for Description */
  .table th:nth-child(1),
  .table td:nth-child(1) {
    width: 90px;  /* Date - minimal */
    white-space: nowrap;
  }

  .table th:nth-child(2),
  .table td:nth-child(2) {
    width: 80px;  /* Code - minimal */
    white-space: nowrap;
  }

  .table th:nth-child(3),
  .table td:nth-child(3) {
    width: auto;  /* Description - takes remaining space */
  }

  .table th:nth-child(4),
  .table td:nth-child(4) {
    width: 100px;  /* Amount */
    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 bill to and invoice header text to black */
  .columns.mb-5,
  .columns.mb-5 p,
  .columns.mb-5 div,
  .columns.mb-5 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;
  }
}
