/**
 * invoice-print.css — Invoice/UPO visualization styles
 * Used both in browser preview (inside .preview-paper) and
 * server-side Puppeteer rendering for PDF generation.
 */

/* === Invoice Container === */
.invoice {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    color: #1a1a2e;
    line-height: 1.45;
    max-width: 210mm;
}

/* === Helper Utilities === */
.text-right {
    text-align: right;
}

/* === Header === */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 3px solid var(--accent-primary, #6366f1);
}

.inv-title {
    font-size: 18px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.inv-number {
    font-size: 13px;
    color: #374151;
}

.inv-ksef-number {
    font-size: 10px;
    color: var(--accent-primary, #6366f1);
    margin-top: 4px;
}

.inv-header-right {
    text-align: right;
}

.inv-schema {
    font-size: 9px;
    color: #9ca3af;
    font-weight: 500;
}

.inv-generated {
    font-size: 9px;
    color: #9ca3af;
    margin-top: 2px;
}

/* === Parties (Sprzedawca / Nabywca) === */
.inv-parties {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.inv-party {
    flex: 1;
    padding: 12px 14px;
    background: #f8f9fc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.inv-party-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary, #6366f1);
    margin-bottom: 6px;
}

.inv-party-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 3px;
}

.inv-party-nip {
    font-size: 11px;
    color: #4b5563;
    font-weight: 500;
    margin-bottom: 3px;
}

.inv-party-addr {
    font-size: 10.5px;
    color: #6b7280;
}

.inv-party-contact {
    font-size: 9.5px;
    color: #9ca3af;
    margin-top: 4px;
}

.inv-party-client {
    font-size: 9.5px;
    color: var(--accent-primary, #6366f1);
    margin-top: 4px;
    font-weight: 500;
}

/* === Details Row === */
.inv-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 10px 14px;
    background: #fafbff;
    border-radius: 6px;
    border: 1px solid #e8eaf0;
    margin-bottom: 16px;
}

.inv-detail-item {
    font-size: 10.5px;
}

.inv-detail-label {
    color: #9ca3af;
    font-weight: 500;
}

.inv-detail-value {
    color: #374151;
    font-weight: 600;
}

/* === Section === */
.inv-section {
    margin-bottom: 16px;
}

.inv-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

/* === Tables === */
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.inv-table thead {
    background: var(--accent-primary, #6366f1);
    color: white;
}

.inv-table th {
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.inv-table th.num {
    text-align: right;
}

.inv-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f4;
    color: #374151;
}

.inv-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.inv-table td.small {
    font-size: 8.5px;
    color: #9ca3af;
}

.inv-table tbody tr:nth-child(even) {
    background: #fafbff;
}

.inv-table tbody tr:hover {
    background: #f0f1ff;
}

.inv-table-total td {
    border-top: 2px solid var(--accent-primary, #6366f1);
    background: #f8f9fc !important;
    padding-top: 8px;
}

/* === Summary Table === */
.inv-summary {
    margin-bottom: 16px;
}

.inv-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
    max-width: 400px;
    margin-left: auto;
}

.inv-summary-table thead {
    background: #f0f1ff;
}

.inv-summary-table th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #4b5563;
}

.inv-summary-table th.num {
    text-align: right;
}

.inv-summary-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f0f0f4;
    color: #374151;
}

.inv-summary-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.inv-summary-total td {
    border-top: 2px solid var(--accent-primary, #6366f1);
    background: #f0f1ff;
    padding: 8px 10px;
    font-size: 12px;
}

/* === Mini Table (Rozliczenie, DodatkoweOpisy) === */
.inv-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
}

.inv-mini-table td {
    padding: 4px 10px;
    border-bottom: 1px solid #f0f0f4;
    color: #374151;
}

.inv-mini-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.inv-mini-table td.label {
    font-weight: 600;
    color: #4b5563;
}

.inv-mini-table .inv-table-total td {
    border-top: 2px solid #e5e7eb;
    background: #fafbff;
}

/* === Total Due === */
.inv-total-due {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f1ff, #ede9fe);
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a2e;
    text-align: right;
    border: 1px solid #c7d2fe;
}

/* === Payment === */
.inv-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
}

.inv-payment-item {
    font-size: 10.5px;
    padding: 4px 0;
    color: #374151;
}

.inv-payment-item .label {
    color: #9ca3af;
    font-weight: 500;
}

.inv-payment-item.inv-paid {
    color: #059669;
    font-weight: 600;
}

.inv-account {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* === Footer === */
.inv-footer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.inv-footer-content {
    font-size: 9px;
    color: #9ca3af;
    text-align: center;
    font-weight: 400;
}

/* === UPO Specific === */
.upo .inv-header {
    border-bottom-color: #059669;
}

.upo .inv-subtitle {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.upo-organ {
    font-size: 10px;
    color: #374151;
    font-weight: 600;
}

.upo-table {
    width: 100%;
    border-collapse: collapse;
}

.upo-table tr {
    border-bottom: 1px solid #f0f0f4;
}

.upo-table td {
    padding: 8px 12px;
    font-size: 11px;
    vertical-align: top;
}

.upo-label {
    color: #9ca3af;
    font-weight: 500;
    width: 200px;
    white-space: nowrap;
}

.upo-highlight {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 12px;
}

.upo-status {
    font-weight: 600;
    color: #059669;
}

.upo-hash-value {
    padding: 10px 14px;
    background: #f8f9fc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 10px;
    color: #6b7280;
}

.upo-hash-value code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 9px;
    word-break: break-all;
    color: #374151;
}

.upo-footer .inv-footer-content {
    color: #059669;
    font-weight: 500;
}

/* === QR Code Section (on invoice from UPO data) === */
.inv-qr-section {
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 14px;
    background: #f8f9fc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.inv-qr-container {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.inv-qr-code {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.inv-qr-code canvas {
    display: block;
}

.inv-qr-info {
    flex: 1;
    padding-top: 4px;
}

.inv-qr-detail {
    font-size: 10.5px;
    color: #374151;
    padding: 3px 0;
}

.inv-qr-detail .label {
    color: #9ca3af;
    font-weight: 500;
}

.inv-qr-detail strong {
    color: var(--accent-primary, #6366f1);
}

.inv-qr-detail code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 8px;
    color: #6b7280;
    background: #f0f0f4;
    padding: 1px 4px;
    border-radius: 3px;
}

/* === Watermark (simpleapp.pl) === */
.inv-watermark {
    text-align: center;
    color: #c0c0c0;
    font-size: 8px;
    margin-top: 30px;
    padding-top: 8px;
}

.inv-watermark a {
    color: #c0c0c0;
    text-decoration: none;
}

/* === Print media query === */
@media print {
    .invoice {
        padding: 0;
        font-size: 10px;
    }

    .inv-table tbody tr:hover {
        background: inherit;
    }

    .inv-qr-code {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}