/* ============================================================
   INVOICE PRINT / PDF STYLES
   Clean white professional layout for tax invoice
   ============================================================ */

.invoice-preview-container {
    max-width: 820px;
    margin: 0 auto;
}

.invoice-preview-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* The actual invoice that gets rendered to PDF */
#invoice-render {
    background: #ffffff;
    color: #1a1a1a;
    padding: 40px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

#invoice-render * { color: #1a1a1a; }

/* Invoice Header */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 2px solid #1a1a1a;
    margin-bottom: 20px;
}

.inv-company { display: flex; align-items: center; gap: 14px; }

.inv-company img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.inv-company-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.inv-title-block { text-align: right; }

.inv-title {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.inv-meta-table { font-size: 11px; }
.inv-meta-table td { padding: 2px 0; }
.inv-meta-table td:first-child {
    font-weight: 600;
    padding-right: 12px;
    text-align: right;
    color: #555;
}
.inv-meta-table td:last-child { font-weight: 600; }

/* Supplier & Client Section */
.inv-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 24px;
}

.inv-party-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 6px;
}

.inv-party-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.inv-party-org {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 3px;
}

.inv-party-detail {
    font-size: 11px;
    color: #444;
    line-height: 1.6;
}

.inv-party-detail strong { color: #1a1a1a; }

/* Supply Details Row */
.inv-supply-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #ddd;
    border: 1px solid #ddd;
    margin-bottom: 24px;
    font-size: 10px;
}

.inv-supply-cell {
    background: #f8f8f8;
    padding: 8px 12px;
}

.inv-supply-cell .label {
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 9px;
}

.inv-supply-cell .value {
    font-weight: 700;
    font-size: 11px;
    margin-top: 2px;
}

/* Items Table */
.inv-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 11px;
}

.inv-items-table thead th {
    background: #1a1a1a;
    color: #ffffff !important;
    padding: 8px 10px;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.inv-items-table thead th:last-child,
.inv-items-table thead th.text-right { text-align: right; }

.inv-items-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.inv-items-table tbody tr:last-child td { border-bottom: 2px solid #1a1a1a; }

.inv-items-table .item-name { font-weight: 600; }
.inv-items-table .item-desc { font-size: 10px; color: #666; margin-top: 2px; }

/* Totals */
.inv-totals-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.inv-totals-table {
    width: 280px;
    font-size: 11px;
}

.inv-totals-table .row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.inv-totals-table .row .label { color: #555; }
.inv-totals-table .row .value { font-weight: 600; }

.inv-totals-table .row.grand-total {
    border-top: 2px solid #1a1a1a;
    border-bottom: none;
    margin-top: 4px;
    padding-top: 8px;
    font-size: 14px;
    font-weight: 800;
}

.inv-totals-table .row.grand-total .label,
.inv-totals-table .row.grand-total .value { color: #1a1a1a; }

/* Amount in Words */
.inv-words {
    padding: 10px 14px;
    background: #f8f8f8;
    border: 1px solid #eee;
    font-size: 11px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.inv-words .label {
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.05em;
}

.inv-words .value { font-weight: 600; margin-top: 2px; }

/* Bank Details */
.inv-bank {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 16px 0;
    border-top: 1px solid #ddd;
    margin-bottom: 20px;
    font-size: 11px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.inv-bank-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 6px;
}

.inv-bank-row {
    display: flex;
    gap: 8px;
    padding: 2px 0;
}

.inv-bank-row .label { color: #888; font-weight: 500; min-width: 100px; }
.inv-bank-row .value { font-weight: 600; }

/* Terms */
.inv-terms {
    font-size: 10px;
    color: #888;
    padding-top: 12px;
    border-top: 1px solid #eee;
    margin-bottom: 20px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.inv-terms-title {
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.inv-terms ol {
    padding-left: 16px;
    line-height: 1.7;
}

/* Signature Block */
.inv-signature {
    text-align: right;
    padding-top: 40px;
    font-size: 11px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.inv-signature .company-name {
    font-weight: 800;
    font-size: 12px;
    margin-bottom: 30px;
}

.inv-signature .sig-line {
    border-top: 1px solid #aaa;
    display: inline-block;
    width: 180px;
    padding-top: 6px;
    font-size: 10px;
    color: #888;
}

/* Print overrides */
@media print {
    body { background: white; }
    #sidebar, .invoice-preview-actions, #toast-container { display: none !important; }
    #main-content { margin: 0; padding: 0; }
    #invoice-render { box-shadow: none; padding: 20px; border-radius: 0; }

    @page {
        margin-bottom: 1.2cm;
        @bottom-center {
            content: "Page " counter(page) " of " counter(pages);
            font-size: 8pt;
            color: #999;
            font-family: 'Inter', Arial, sans-serif;
        }
    }
}

/* Status tab count badges */
.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 4px;
}

