﻿@media print {
    /* Apply these styles only when printing */
    body {
        margin: 0px;
        padding: 0px;
    }
    /* Add additional styles as needed to reset margins for specific elements */


    .page-break {
        page-break-before: always;
    }



    @page {
        margin: 10px; /* for page 3 but not work*/
        size: auto;
    }
}



.table1 {
    margin-bottom: 30px; /* Adjust this value to match the footer height */
    word-wrap: break-word;
    table-layout: fixed;
    width: 100%;
    height: 100%;
}


.infoInvoice {
}

.infoInvoice-content {
    display: flex;
    margin: 0px 0px;
    margin-bottom: 0px;
    color: #7a1a1f;
    font-size: 13px;
    font-weight: bold;
    transition: top 0.3s;
}
/* Add CSS styling here */
.table1, .table2 {
    border: 2px solid #7a1a1f;
    margin-bottom: 5px;
    color: #7a1a1f;
}

    .table1 th, .table2 th, .table1 td, .table2 td {
        border: 2px solid #7a1a1f;
        color: #7a1a1f;
        padding: 0px;
        text-align: center;
    }

    .table1 th, .table2 th {
        background-color: #f7f0d8;
        color: #7a1a1f;
        font-size: 14px;
        padding: 4px;
    }

    .table1 td, .table2 td {
        color: #7a1a1f;
        font-size: 13px;
        padding: 4px;
        border: 2px solid #7a1a1f;
    }

img {
    height: auto;
}

.flex-container {
    display: flex;
    margin-bottom: 10px;
    color: #7a1a1f;
    font-size: 13px;
    font-weight: bold;
}

.spacer {
    flex: 0.01; /* Adjust the width of the spacing as needed */
}
/* Style for the first div (2 columns, no border) */
.div1 {
    flex: 1; /* Take up 2/3 of the available space */
    padding: 0px;
    border: 2px solid #7a1a1f; /* Add a border */
    display: flex; /* Enable flex display for child elements */
    align-items: center; /* Vertically center child elements */
}

/* Style for the second div (1 column, with border) */
.div2 {
    flex: 1; /* Take up 1/3 of the available space */
    padding: 0px;
    border: 2px solid #7a1a1f; /* Add a border */
    display: flex; /* Enable flex display for child elements */
    align-items: center; /* Vertically center child elements */
}

.div3 {
    flex: 2; /* Take up 2/3 of the available space */
    padding: 0px;
    display: flex; /* Enable flex display for child elements */
    /* Vertically center child elements */
}

/* Style for the second div (1 column, with border) */
.div4 {
    flex: 1; /* Take up 1/3 of the available space */
    padding: 0px;
    border: 0px solid #7a1a1f; /* Add a border */
    display: flex; /* Enable flex display for child elements */
    align-items: center; /* Vertically center child elements */
}

.column {
    flex: 1; /* Equal width for both columns */
    border: 0px solid #7a1a1f; /* Add a border */
    padding: 10px;
}

.header1 {
    background-color: #f7f0d8;
    position: fixed;
    top: 0;
    width: 100%;
}

.header1-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-height: 100px;
}


.footer2 {
    background-color: #f7f0d8;
    position: fixed;
    bottom: 0;
    height: 30px;
    width: 100%;
    border-top: 1px solid #000; /* Add top border */
    border-bottom: 1px solid #000; /* Add bottom border */
}

.footer2-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.right-content {
    text-align: right;
}

.center-content {
    text-align: center;
}

.footer1 {
    position: fixed;
    bottom: 0;
    width: 100%;
}

.footer1-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 150px;
}


/*Sale*/

.header1Sale {
    background-color: #f7f0d8;
    position: fixed;
    top: 0;
    width: 100%;
}

.header1Sale-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 100px;
    border: 13px solid #7a1a1f;
    padding: 0px;
}

    .header1Sale-content h3 {
        font-weight: bold;
        font-family: Arial;
    }

.table1Sale {
    margin-bottom: 30px; /* Adjust this value to match the footer height */
}


/* Add CSS styling here */
.table1Sale, .table2sale {
    margin-bottom: 5px;
    color: #7a1a1f;
}

    .table1Sale .borderSale {
        border: none;
    }

.table2sale {
    border: 1px solid black;
    border-collapse: collapse;
    text-align: right;
    direction: rtl;
}

.table1Sale th, .table1Sale td {
    border: 2px solid #7a1a1f;
    color: #7a1a1f;
    padding: 0px;
    text-align: center;
    padding: 10px;
}

.table1Sale th {
    background-color: #f7f0d8;
    color: #7a1a1f;
    font-size: 14px;
    padding: 4px;
}

.table2sale th {
    background-color: #f7f0d8;
    color: #7a1a1f;
    font-size: 14px;
    padding: 4px;
}

.table2sale td {
    color: #7a1a1f;
    font-size: 14px;
    padding: 4px;
}

.flex-containerSale {
    margin-top: 10px;
    margin-bottom: 10px;
    color: #7a1a1f;
    float: left;
    margin-left: 60%;
    font-size: 13px;
    width: 40%;
}


/* =====================================================================
   Grace Pharma sales invoice  (/app/invoice/{id})
   ===================================================================== */
.gp-inv {
    --inv-red: #9e2329;
    --inv-red-dark: #7a1a1f;
    --inv-gold: #cbae2f;
    --inv-gold-soft: #faf5e2;
    --inv-ink: #2b2b2b;
    --inv-muted: #6b6760;
    --inv-line: #e6e0d2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 24px 70px;
    background: #fff;
    color: var(--inv-ink);
    font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

    .gp-inv * {
        box-sizing: border-box;
    }

/* ---------- Header ---------- */
.gp-inv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 14px;
}

.gp-inv-title h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    color: var(--inv-red);
    line-height: 1.2;
}

.gp-inv-number {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 14px;
    border-radius: 999px;
    background: var(--inv-gold-soft);
    border: 1px solid var(--inv-gold);
    color: var(--inv-red-dark);
    font-weight: 700;
    font-size: 14px;
    direction: ltr;
}

.gp-inv-subtitle {
    margin-top: 6px;
    color: var(--inv-muted);
    font-weight: 600;
    font-size: 14px;
}

.gp-inv-logo img {
    height: 62px;
    width: auto;
}

.gp-inv-stripe {
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--inv-red) 0 50%, var(--inv-gold) 50% 100%);
}

/* ---------- Info cards ---------- */
.gp-inv-info {
    display: flex;
    gap: 14px;
    margin: 16px 0 12px;
}

.gp-inv-card {
    flex: 1;
    border: 1px solid var(--inv-line);
    border-top: 3px solid var(--inv-red);
    border-radius: 8px;
    padding: 10px 14px;
}

.gp-inv-card-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--inv-red);
    margin-bottom: 6px;
}

.gp-inv-card dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 4px 10px;
    margin: 0;
}

.gp-inv-card dt {
    color: var(--inv-muted);
    font-weight: 600;
}

.gp-inv-card dd {
    margin: 0;
    font-weight: 700;
}

.gp-inv-notes {
    background: var(--inv-gold-soft);
    border-right: 4px solid var(--inv-gold);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

    .gp-inv-notes strong {
        color: var(--inv-red-dark);
    }

/* ---------- Items table ---------- */
.gp-inv-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    word-wrap: break-word;
}

    .gp-inv-table thead {
        display: table-header-group; /* repeat header on every printed page */
    }

    .gp-inv-table .gp-inv-cell-plain {
        padding: 0;
        border: 0;
    }

.gp-inv-head th {
    background: var(--inv-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    padding: 8px 4px;
    border-left: 1px solid rgba(255, 255, 255, .25);
}

    .gp-inv-head th:first-child {
        border-top-right-radius: 8px;
    }

    .gp-inv-head th:last-child {
        border-top-left-radius: 8px;
        border-left: 0;
    }

.gp-inv-table tbody td {
    padding: 7px 5px;
    text-align: center;
    border-bottom: 1px solid var(--inv-line);
    vertical-align: middle;
}

.gp-inv-table tbody tr:nth-child(even) td {
    background: #fcfaf3;
}

.gp-inv-table tbody tr:last-child td {
    border-bottom: 2px solid var(--inv-red);
}

.gp-inv-text {
    text-align: right !important;
}

.gp-inv-num {
    direction: ltr;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.gp-inv-strong {
    font-weight: 700;
    color: var(--inv-red-dark);
}

.gp-inv-batch span {
    display: block;
    font-size: 11px;
    line-height: 1.5;
}

    .gp-inv-batch span:first-child {
        font-weight: 700;
    }

/* ---------- Totals ---------- */
.gp-inv-summary {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-top: 16px;
    page-break-inside: avoid;
}

.gp-inv-words {
    flex: 1;
    border: 1px dashed var(--inv-gold);
    border-radius: 8px;
    padding: 10px 14px;
    background: #fffdf6;
}

    .gp-inv-words p {
        margin: 0;
        font-weight: 700;
        line-height: 1.7;
    }

.gp-inv-totals {
    width: 40%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--inv-line);
    border-radius: 8px;
    overflow: hidden;
}

    .gp-inv-totals td {
        padding: 8px 12px;
        border-bottom: 1px solid var(--inv-line);
        font-weight: 600;
    }

        .gp-inv-totals td.gp-inv-num {
            text-align: left;
            font-weight: 700;
        }

    .gp-inv-totals .gp-inv-grand td {
        background: var(--inv-red);
        color: #fff;
        font-size: 16px;
        font-weight: 800;
        border-bottom: 0;
    }

/* ---------- Footer ---------- */
.gp-inv-footer {
    margin-top: 28px;
}

.gp-inv-footer-content {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px 0;
    color: var(--inv-muted);
    font-size: 12px;
    font-weight: 600;
}

/* several invoices on one page (multi-invoice) */
.gp-inv + .gp-inv {
    margin-top: 32px;
    border-top: 1px dashed var(--inv-line);
}

.gp-inv-footer {
    break-inside: avoid;
}

/* ---------- Signatures (purchase order) ---------- */
.gp-inv-signatures {
    display: flex;
    gap: 40px;
    margin-top: 48px;
    break-inside: avoid;
}

    .gp-inv-signatures > div {
        flex: 1;
        border-top: 1px solid var(--inv-ink);
        padding-top: 6px;
        text-align: center;
        font-weight: 700;
        color: var(--inv-muted);
    }

    .gp-inv-signatures > div small {
        display: block;
        margin-top: 2px;
        font-weight: 600;
        color: var(--inv-ink);
    }

/* ---------- Left-to-right documents (purchase order) ---------- */
.gp-inv[dir="ltr"] .gp-inv-text {
    text-align: left !important;
}

.gp-inv[dir="ltr"] .gp-inv-num {
    text-align: right;
}

.gp-inv[dir="ltr"] .gp-inv-totals td.gp-inv-num {
    text-align: right;
}

.gp-inv[dir="ltr"] .gp-inv-notes {
    border-right: 0;
    border-left: 4px solid var(--inv-gold);
}

.gp-inv[dir="ltr"] .gp-inv-head th {
    border-left: 0;
    border-right: 1px solid rgba(255, 255, 255, .25);
}

    .gp-inv[dir="ltr"] .gp-inv-head th:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 0;
        border-right: 0;
    }

    .gp-inv[dir="ltr"] .gp-inv-head th:last-child {
        border-top-right-radius: 8px;
        border-top-left-radius: 0;
    }

.gp-inv[dir="ltr"] .gp-inv-title {
    text-align: right;
}

/* ---------- Print: A4 landscape for invoices and purchase orders only ---------- */
@page gp-doc {
    size: A4 landscape;
    margin: 8mm 10mm 10mm;

    @bottom-center {
        content: counter(page);
        font-size: 9pt;
        color: #6b6760;
    }
}

/* ---------- Print ---------- */
@media print {
    body,
    .page-wrapper {
        background: #fff !important;
    }

    .gp-inv {
        max-width: none;
        padding: 0;
        font-size: 11px;
        page: gp-doc;
    }

        /* every invoice starts on a new sheet */
        .gp-inv + .gp-inv {
            break-before: page;
            margin-top: 0;
            border-top: 0;
        }

    .gp-inv-title h1 {
        font-size: 24px;
    }

    .gp-inv-logo img {
        height: 46px;
    }

    .gp-inv-header {
        padding-bottom: 10px;
    }

    .gp-inv-info {
        margin: 10px 0 8px;
    }

    .gp-inv-card {
        padding: 8px 12px;
    }

    .gp-inv-head th {
        font-size: 10.5px;
        padding: 6px 3px;
    }

    /* a row is never split across two pages */
    .gp-inv-table tbody tr {
        break-inside: avoid;
    }

    .gp-inv-table tbody td {
        padding: 5px 3px;
    }

    /* landscape has room for batch / expiry / qty on one line */
    .gp-inv-batch span {
        display: inline;
        font-size: 10px;
    }

        .gp-inv-batch span + span::before {
            content: " / ";
            color: #b5ae9f;
        }

    .gp-inv-totals .gp-inv-grand td {
        font-size: 14px;
    }

    .gp-inv-summary {
        margin-top: 10px;
    }

    .gp-inv-totals td {
        padding: 4px 10px;
    }

    .gp-inv-words {
        padding: 8px 12px;
    }

    .gp-inv-stripe {
        height: 4px;
    }

    .gp-inv-signatures {
        margin-top: 20px;
        break-after: avoid;
    }

    .gp-inv-footer {
        margin-top: 12px;
        break-before: avoid;
    }
}
