/* --- Print Invoice Styles for both Screen and Print --- */

/* Basic styles for the invoice container */
#invoice-container {
    /* max-width and margin REMOVED to allow Tailwind grid to control layout */
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* 
  This class is used by the JS invoice generators to prevent tables and other elements 
  from splitting across page breaks when printing.
*/
.break-inside-avoid {
    page-break-inside: avoid;
    display: block; /* Ensures the element is treated as a block for page-break-inside to work reliably. */
}

/* The styles for the generated inner invoice content are now primarily handled by 
   Tailwind classes in public/inv/public-invoice.js. The rules below are kept 
   for print compatibility and to style elements not covered by Tailwind. */

#invoice-container header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 3px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

#invoice-container .logo {
    max-width: 200px; /* Slightly larger logo */
    height: auto;
}

#invoice-container .invoice-title {
    text-align: right;
}

#invoice-container .invoice-title h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.8em; /* Larger, more impactful title */
    color: #1a1a1a;
    margin: 0;
    font-weight: 700;
}

#invoice-container .invoice-title p {
    font-size: 1em;
    color: #888;
    margin: 0;
}

#invoice-container .details-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

#invoice-container .details-section h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

#invoice-container .details-section address,
#invoice-container .details-section p {
    font-style: normal;
    color: #555;
    margin: 0;
}

#invoice-container .details-section .details-right {
    text-align: right;
}

#invoice-container .items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

#invoice-container .items-table th,
#invoice-container .items-table td {
    border-bottom: 1px solid #dee2e6;
    padding: 15px 0; /* Increased padding for readability */
    text-align: left;
}

#invoice-container .items-table thead th {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8em;
    text-transform: uppercase;
    color: #888;
    border-top: 1px solid #dee2e6;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

#invoice-container .items-table .text-right {
    text-align: right;
}

#invoice-container .items-table tbody tr:last-child td {
    border-bottom: none;
}

#invoice-container .items-table strong {
    font-weight: 600;
    color: #333;
}

#invoice-container .totals-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

#invoice-container .totals-wrapper {
    width: 100%;
    max-width: 340px; /* Slightly wider totals section */
}

#invoice-container .totals-line {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 5px;
}

#invoice-container .totals-line span {
    font-weight: 600;
    color: #555;
}

#invoice-container .totals-line.total {
    border-top: 2px solid #dee2e6;
    margin-top: 10px;
    padding-top: 15px;
}

#invoice-container .totals-line.total span {
    font-size: 1.4em;
    font-weight: 700;
    color: #212529;
}

#invoice-container .totals-line.balance-due {
    margin-top: 10px;
    padding: 15px;
    font-size: 1.3em;
    font-weight: 700;
}

#invoice-container .notes-section {
    border-top: 1px solid #dee2e6;
    padding-top: 20px;
    margin-top: 20px;
    color: #6c757d;
    font-size: 0.9em;
}

/* Print-specific styles */
@media print {
    body {
        background-color: #fff; /* Ensure background is white for printing */
    }

    .no-print,
    .no-print *,
    #payment-section,
    #payment-column {
        display: none !important;
    }

    #invoice-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        border: none;
    }
}
