/* ============================================================
   GLOBAL PRINT STYLES – for All XFIX Print Documents
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #e6e9ef;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
    padding: 30px;
}

.print-container {
    max-width: 880px;
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 45px 50px 40px;
    transition: all 0.2s;
}

/* ============================================================
   HEADER
   ============================================================ */
.print-header {
    border-bottom: 3px solid #1a2b4c;
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.print-header .company-logo {
    height: 100px;
    width: auto;
    object-fit: contain;
}

.print-header .company-name {
    color: #1a2b4c;
    letter-spacing: -0.5px;
    font-weight: 700;
}

.print-header .company-details {
    color: #5a6e8a;
    font-size: 13px;
    line-height: 1.5;
}

.print-header .company-details span {
    display: block;
}

.print-header .document-title {
    color: #1a2b4c;
    letter-spacing: 1px;
    font-weight: 600;
}

.print-header .document-meta {
    color: #3d4f6a;
    font-size: 13px;
    line-height: 1.7;
}

.print-header .document-meta strong {
    color: #1a2b4c;
}

/* ============================================================
   BILL TO & DATES
   ============================================================ */
.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 35px;
    flex-wrap: wrap;
    gap: 20px;
}

.bill-to h3,
.dates h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7a8aa0;
    margin-bottom: 6px;
    font-weight: 600;
}

.dates h3 {
    text-align: right;
}

.bill-to p {
    font-size: 16px;
    color: #1a2b4c;
    line-height: 1.6;
    font-weight: 500;
}

.bill-to p span {
    display: block;
    font-weight: 400;
    color: #3d4f6a;
}

.dates .date-item {
    text-align: right;
    font-size: 15px;
    color: #1a2b4c;
    line-height: 1.8;
}

.dates .date-item strong {
    font-weight: 600;
    margin-right: 8px;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 30px;
    width: 100%;
}

table.print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed; /* Prevents columns from stretching unpredictably */
}

/* Column width distribution */
table.print-table colgroup .col-desc {
    width: 40%;
}
table.print-table colgroup .col-qty {
    width: 15%;
}
table.print-table colgroup .col-price {
    width: 20%;
}
table.print-table colgroup .col-total {
    width: 25%;
}

table.print-table thead {
    background: #f2f5fa;
}

table.print-table thead th {
    padding: 12px 14px;
    font-weight: 600;
    color: #1a2b4c;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dce2ec;
    text-align: left;
    white-space: nowrap;
}

/* Align specific columns */
table.print-table thead th.text-center,
table.print-table tbody td.text-center {
    text-align: center;
}

table.print-table thead th.text-right,
table.print-table tbody td.text-right {
    text-align: right;
}

table.print-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f5;
    color: #1f2a3f;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Description column – allow wrapping */
table.print-table tbody td.description-cell {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Quantity, Price, Total columns – keep numeric alignment */
table.print-table tbody td.qty-cell,
table.print-table tbody td.price-cell,
table.print-table tbody td.total-cell {
    white-space: nowrap;
}

table.print-table tbody tr:last-child td {
    border-bottom: none;
}

/* Description small text */
.desc-small {
    font-size: 12px;
    color: #5a6e8a;
    font-weight: 400;
    display: block;
    margin-top: 3px;
}

/* Alternate row shading for better readability (optional) */
table.print-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* ============================================================
   TOTALS - keep consistent with table
   ============================================================ */
.totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #e6eaf0;
}

.totals-grid {
    width: 280px;
}

.totals-grid .line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 15px;
    color: #1f2a3f;
}

.totals-grid .line.sub {
    border-bottom: 1px dashed #d0d7e2;
    padding-bottom: 10px;
    margin-bottom: 6px;
}

.totals-grid .line.grand {
    font-size: 20px;
    font-weight: 700;
    color: #1a2b4c;
    border-top: 2px solid #1a2b4c;
    padding-top: 14px;
    margin-top: 6px;
}

.totals-grid .line .label {
    font-weight: 500;
}

.totals-grid .line .value {
    font-weight: 600;
}

/* ============================================================
   TOTALS
   ============================================================ */
.totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #e6eaf0;
}

.totals-grid {
    width: 280px;
}

.totals-grid .line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 15px;
    color: #1f2a3f;
}

.totals-grid .line.sub {
    border-bottom: 1px dashed #d0d7e2;
    padding-bottom: 10px;
    margin-bottom: 6px;
}

.totals-grid .line.grand {
    font-size: 20px;
    font-weight: 700;
    color: #1a2b4c;
    border-top: 2px solid #1a2b4c;
    padding-top: 14px;
    margin-top: 6px;
}

.totals-grid .line .label {
    font-weight: 500;
}

.totals-grid .line .value {
    font-weight: 600;
}

/* ============================================================
   FOOTER / NOTES
   ============================================================ */
.footer-notes {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    padding-top: 25px;
    border-top: 2px solid #edf0f5;
}

.notes {
    flex: 2;
    min-width: 200px;
}

.notes h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7a8aa0;
    margin-bottom: 8px;
    font-weight: 600;
}

.notes p {
    font-size: 14px;
    color: #3d4f6a;
    line-height: 1.7;
    white-space: pre-wrap;
}

.bank {
    flex: 1;
    min-width: 160px;
}

.bank h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7a8aa0;
    margin-bottom: 8px;
    font-weight: 600;
}

.bank p {
    font-size: 14px;
    color: #1f2a3f;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ============================================================
   SIGNATURE & STAMP
   ============================================================ */
.signature-stamp {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #edf0f5;
}

.signature-stamp .stamp-item {
    text-align: center;
    min-width: 160px;
}

.signature-stamp .stamp-item img {
    display: block;
    margin: 0 auto;
    max-height: 80px;
    width: auto;
}

.signature-stamp .stamp-item .line {
    width: 100%;
    height: 1px;
    border-top: 2px solid #1a2b4c;
    margin: 20px 0 6px;
}

.signature-stamp .stamp-item p {
    font-size: 13px;
    color: #3d4f6a;
    font-weight: 500;
}

.signature-stamp .stamp-item .company {
    font-weight: 700;
    color: #1a2b4c;
}

/* ============================================================
   PRINT SPECIFIC
   ============================================================ */
@media print {
    body {
        background: #fff;
        padding: 0;
    }

    .print-container {
        box-shadow: none;
        border-radius: 0;
        padding: 30px 40px;
    }

    .signature-stamp .stamp-item .line {
        border-top: 2px solid #1a2b4c;
    }

    /* Hide any print‑only elements that shouldn't appear */
    .no-print {
        display: none !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .print-container {
        padding: 25px;
    }

    .print-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .print-header .document-title {
        text-align: left;
        width: 100%;
    }

    .info-row {
        flex-direction: column;
    }

    .dates .date-item {
        text-align: left;
    }

    .dates h3 {
        text-align: left;
    }

    .totals {
        justify-content: flex-start;
    }

    .totals-grid {
        width: 100%;
    }

    .footer-notes {
        flex-direction: column;
    }

    .signature-stamp {
        justify-content: flex-start;
    }
}

/* ============================================================
   SUMMARY CARDS (for payment history)
   ============================================================ */
.summary-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    background: #f8f9fa;
}

.summary-card .amount {
    font-size: 24px;
    font-weight: 700;
}

.summary-card .label {
    color: #6c757d;
    font-size: 14px;
}

.summary-card.paid .amount {
    color: #198754;
}

.summary-card.outstanding .amount {
    color: #ffc107;
}

.summary-card.total .amount {
    color: #6c757d;
}

/* ============================================================
   PROGRESS BAR (for payment history)
   ============================================================ */
.progress {
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    transition: none;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar.bg-success {
    background-color: #198754 !important;
}

.progress-bar.bg-info {
    background-color: #0dcaf0 !important;
}

.progress-bar.bg-warning {
    background-color: #ffc107 !important;
    color: #212529;
}

/* ============================================================
   BADGE STYLES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
}

.badge.bg-primary { background-color: #0d6efd !important; color: #fff; }
.badge.bg-success { background-color: #198754 !important; color: #fff; }
.badge.bg-danger { background-color: #dc3545 !important; color: #fff; }
.badge.bg-warning { background-color: #ffc107 !important; color: #212529; }
.badge.bg-info { background-color: #0dcaf0 !important; color: #212529; }
.badge.bg-secondary { background-color: #6c757d !important; color: #fff; }
.badge.bg-dark { background-color: #212529 !important; color: #fff; }