/* ==========================================================================
   Invoice Print Stylesheet
   Used both as @media print fallback AND for the dedicated ?print view.
   ========================================================================== */

/* ── Screen-only helpers for ?print preview page ── */
.print-actions {
    text-align: right;
    padding: 1em 0;
}
.print-actions button {
    cursor: pointer;
}

/* ── @media print — universal rules ── */
@media print {

    /* Hide interactive / chrome elements */
    .print-actions,
    .no-print,
    .ui.top.menu,
    .ui.top.borderless.menu,
    #manager-menu,
    .announcement-bar,
    .show-main-sidebar,
    .ui.compact.success.message,
    footer,
    #AjaxResponder,
    .admin-actions,
    #print-payment-options,
    #simple-checkout-overlay,
    #gateway-frame-container,
    #checkoutBackupFormPlaceholder,
    .sign-in,
    .ui.dropdown.item .menu,
    a[href*="/account/profile"] {
        display: none !important;
    }

    /* Page setup */
    @page {
        margin: 12mm 10mm;
        size: A4;
    }

    body {
        margin: 0;
        padding: 0;
        font-size: 11pt;
        line-height: 1.5;
        color: #000 !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Remove decorative box styles */
    .ui.segment,
    .ui.basic.segment,
    .ui.secondary.segment,
    .ui.padded.segment {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    /* Full width */
    .ui.container,
    .ui.grid > .column,
    .ui.grid > .row > .column {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Links: plain black text */
    a, a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* Prevent page breaks inside key sections */
    .invoice-document,
    .invoice-header-table,
    .invoice-lines-table,
    .ui.grid,
    .ui.segment,
    #invoiceContainer {
        page-break-inside: avoid;
    }

    /* Ensure images print */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Always show desktop table in print, hide mobile cards */
    .invoice-lines-desktop {
        display: table !important;
    }
    .invoice-lines-mobile {
        display: none !important;
    }

    /* Sidebar should not print */
    .mobile-order-first.no-print {
        display: none !important;
    }

    /* Stamps */
    .invoice-stamp img {
        max-height: 120px !important;
        opacity: 0.3 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Total due box */
    .invoice-amount-due-box {
        background-color: #1b1c1d !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide edit links */
    .invoice-edit-link {
        display: none !important;
    }
}

/* ── Dedicated print view shell (?print) — screen styles ── */
.print-view-shell {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
    color: #000;
    background: #fff;
}

/* ── Invoice document layout (used in ?print view) ── */
.invoice-document {
    font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
    color: #000;
    line-height: 1.5;
}

.invoice-document table {
    font-size: inherit;
}

.invoice-document th {
    font-weight: 700;
}

.invoice-lines-table tbody tr:last-child {
    border-bottom: 2px solid #333;
}

/* ── Print view: amount due box ── */
.invoice-amount-due-box {
    background: #1b1c1d;
    color: #fff;
    padding: 0.8em 1em;
    margin-top: 1em;
    text-align: right;
    font-size: 1.1em;
}

/* ── Print view: VOID / PAID stamp ── */
.invoice-stamp {
    text-align: center;
    margin: 1.5em 0 0.5em;
}

.invoice-stamp img {
    max-height: 120px;
    width: auto;
    opacity: 0.35;
}
