/*
|--------------------------------------------------------------------------
| SWCSS Buyer Invoice - Screen View
|--------------------------------------------------------------------------
*/

.swcss-buyer-invoice {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 35px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    color: #222222;
}


/*
|--------------------------------------------------------------------------
| Business Header
|--------------------------------------------------------------------------
*/

.swcss-invoice-header {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #222222;
}

.swcss-business-name {
    margin: 0 0 8px 0;
    font-size: 26px;
    line-height: 1.2;
}

.swcss-business-address {
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #555555;
}

.swcss-business-phone {
    margin: 4px 0 18px 0;
    font-size: 14px;
    color: #555555;
}

.swcss-invoice-header h1 {
    margin: 18px 0 0 0;
    font-size: 24px;
    letter-spacing: 1px;
}


/*
|--------------------------------------------------------------------------
| Invoice Meta
|--------------------------------------------------------------------------
*/

.swcss-invoice-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 22px;
    background: #fafafa;
    border: 1px solid #dddddd;
    border-radius: 5px;
    font-size: 14px;
}


/*
|--------------------------------------------------------------------------
| Invoice Sections
|--------------------------------------------------------------------------
*/

.swcss-invoice-section {
    margin-top: 24px;
}

.swcss-invoice-section h3 {
    margin: 0 0 10px 0;
    font-size: 17px;
}


/*
|--------------------------------------------------------------------------
| Buyer Details
|--------------------------------------------------------------------------
*/

.swcss-buyer-details {
    padding: 14px 16px;
    border: 1px solid #dddddd;
    border-radius: 5px;
    background: #fafafa;
}

.swcss-buyer-details p {
    margin: 5px 0;
    line-height: 1.5;
}


/*
|--------------------------------------------------------------------------
| Invoice Table
|--------------------------------------------------------------------------
*/

.swcss-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.swcss-invoice-table th,
.swcss-invoice-table td {
    padding: 11px 10px;
    border: 1px solid #cccccc;
    vertical-align: middle;
}

.swcss-invoice-table th {
    text-align: left;
    background: #f2f2f2;
    font-weight: 700;
}

.swcss-invoice-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.swcss-invoice-table .swcss-number {
    text-align: right;
}


/*
|--------------------------------------------------------------------------
| Financial Summary
|--------------------------------------------------------------------------
*/

.swcss-invoice-summary {
    width: 100%;
    max-width: 420px;
    margin: 26px 0 0 auto;
    padding: 16px 18px;
    box-sizing: border-box;
    border: 1px solid #cccccc;
    border-radius: 5px;
    background: #fafafa;
}

.swcss-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 9px 0;
    border-bottom: 1px solid #e5e5e5;
    font-size: 14px;
}

.swcss-summary-row:last-child {
    border-bottom: none;
}

.swcss-summary-row:first-child {
    padding-top: 0;
    font-size: 16px;
}

.swcss-summary-row strong {
    text-align: right;
}


/*
|--------------------------------------------------------------------------
| Notes
|--------------------------------------------------------------------------
*/

.swcss-invoice-notes {
    margin-top: 24px;
    padding: 14px 16px;
    border: 1px solid #dddddd;
    border-radius: 5px;
    background: #fafafa;
    line-height: 1.5;
}


/*
|--------------------------------------------------------------------------
| Footer
|--------------------------------------------------------------------------
*/

.swcss-invoice-footer {
    margin-top: 38px;
    padding-top: 18px;
    border-top: 1px solid #dddddd;
    text-align: center;
    font-size: 13px;
    color: #555555;
    line-height: 1.5;
}

.swcss-invoice-footer p {
    margin: 0;
}


/*
|--------------------------------------------------------------------------
| Responsive Screen
|--------------------------------------------------------------------------
*/

@media screen and (max-width: 700px) {

    .swcss-buyer-invoice {
        padding: 20px;
    }

    .swcss-invoice-meta {
        display: block;
    }

    .swcss-invoice-meta > div + div {
        margin-top: 8px;
    }

    .swcss-invoice-table {
        font-size: 12px;
    }

    .swcss-invoice-table th,
    .swcss-invoice-table td {
        padding: 8px 6px;
    }

    .swcss-invoice-summary {
        max-width: none;
    }

}


/*
|--------------------------------------------------------------------------
| 80mm Thermal Receipt Printing
|--------------------------------------------------------------------------
|
| This print mode targets common 80mm thermal receipt printers.
| The printable content width is 72mm, leaving a small hardware-safe margin.
|
|--------------------------------------------------------------------------
*/

@media print {

    @page {
        size: 80mm auto;
        margin: 2mm 4mm;
    }

    html,
    body {
        width: 80mm !important;
        min-width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    #swcss-printable-invoice {
        position: relative !important;
        left: auto !important;
        top: auto !important;

        width: 72mm !important;
        max-width: 72mm !important;
        min-width: 72mm !important;

        margin: 0 !important;
        padding: 0 !important;

        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;

        background: #ffffff !important;
        color: #000000 !important;
        overflow: visible !important;

        font-family:
            Arial,
            Helvetica,
            sans-serif !important;

        font-size: 10px !important;
        line-height: 1.25 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Header
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-header {
        margin: 0 0 2mm 0 !important;
        padding: 0 0 2mm 0 !important;
        border-bottom: 1px dashed #000000 !important;
        text-align: center !important;
    }

    .swcss-business-name {
        margin: 0 0 1mm 0 !important;
        font-size: 16px !important;
        line-height: 1.1 !important;
        font-weight: 700 !important;
    }

    .swcss-business-address,
    .swcss-business-phone {
        margin: 0.5mm 0 !important;
        padding: 0 !important;
        font-size: 9px !important;
        line-height: 1.2 !important;
        color: #000000 !important;
    }

    .swcss-invoice-header h1 {
        margin: 1.5mm 0 0 0 !important;
        font-size: 12px !important;
        letter-spacing: 0 !important;
        line-height: 1.1 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Invoice Meta
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-meta {
        display: block !important;

        margin: 0 0 2mm 0 !important;
        padding: 0 0 2mm 0 !important;

        border: none !important;
        border-bottom: 1px dashed #000000 !important;
        border-radius: 0 !important;

        background: #ffffff !important;
        font-size: 9px !important;
    }

    .swcss-invoice-meta > div {
        margin: 0.5mm 0 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Buyer Details
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-section {
        margin: 0 0 2mm 0 !important;
        padding: 0 !important;
    }

    .swcss-invoice-section h3 {
        margin: 0 0 1mm 0 !important;
        padding: 0 !important;
        font-size: 10px !important;
        line-height: 1.1 !important;
    }

    .swcss-buyer-details {
        margin: 0 !important;
        padding: 0 0 2mm 0 !important;

        border: none !important;
        border-bottom: 1px dashed #000000 !important;
        border-radius: 0 !important;

        background: #ffffff !important;
        font-size: 9px !important;
    }

    .swcss-buyer-details p {
        margin: 0.5mm 0 !important;
        padding: 0 !important;
        line-height: 1.2 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Receipt Table
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-table {
        width: 100% !important;
        table-layout: fixed !important;

        margin: 0 !important;
        border-collapse: collapse !important;

        font-size: 8px !important;
        line-height: 1.15 !important;
    }

    .swcss-invoice-table th,
    .swcss-invoice-table td {
        padding: 1mm 0.5mm !important;
        border: none !important;
        border-bottom: 1px dotted #777777 !important;
        background: #ffffff !important;
        color: #000000 !important;
        overflow: visible !important;
        vertical-align: top !important;

        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }

    .swcss-invoice-table th {
        font-weight: 700 !important;
    }

    .swcss-invoice-table th:nth-child(1),
    .swcss-invoice-table td:nth-child(1) {
        width: 22% !important;
    }

    .swcss-invoice-table th:nth-child(2),
    .swcss-invoice-table td:nth-child(2) {
        width: 11% !important;
    }

    .swcss-invoice-table th:nth-child(3),
    .swcss-invoice-table td:nth-child(3) {
        width: 13% !important;
    }

    .swcss-invoice-table th:nth-child(4),
    .swcss-invoice-table td:nth-child(4) {
        width: 18% !important;
    }

    .swcss-invoice-table th:nth-child(5),
    .swcss-invoice-table td:nth-child(5) {
        width: 22% !important;
    }

    .swcss-invoice-table th:nth-child(6),
    .swcss-invoice-table td:nth-child(6) {
        width: 14% !important;
    }

    .swcss-invoice-table .swcss-number {
        text-align: right !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Financial Summary
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-summary {
        width: 100% !important;
        max-width: none !important;

        margin: 2mm 0 0 0 !important;
        padding: 1mm 0 !important;

        border: none !important;
        border-top: 1px dashed #000000 !important;
        border-bottom: 1px dashed #000000 !important;
        border-radius: 0 !important;

        background: #ffffff !important;
    }

    .swcss-summary-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;

        gap: 2mm !important;
        padding: 0.8mm 0 !important;

        border: none !important;

        font-size: 9px !important;
        line-height: 1.15 !important;
    }

    .swcss-summary-row:first-child {
        padding-top: 0.8mm !important;
        font-size: 11px !important;
        font-weight: 700 !important;
    }

    .swcss-summary-row span {
        flex: 1 1 auto !important;
        text-align: left !important;
    }

    .swcss-summary-row strong {
        flex: 0 0 auto !important;
        text-align: right !important;
        white-space: nowrap !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Notes
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-notes {
        margin: 2mm 0 0 0 !important;
        padding: 1.5mm 0 !important;

        border: none !important;
        border-bottom: 1px dashed #000000 !important;
        border-radius: 0 !important;

        background: #ffffff !important;

        font-size: 9px !important;
        line-height: 1.2 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Footer
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-footer {
        margin: 2mm 0 0 0 !important;
        padding: 1.5mm 0 4mm 0 !important;

        border-top: 1px dashed #000000 !important;

        text-align: center !important;

        font-size: 9px !important;
        line-height: 1.2 !important;
        color: #000000 !important;
    }

    .swcss-invoice-footer p {
        margin: 0 !important;
        padding: 0 !important;
    }


    /*
    |--------------------------------------------------------------------------
    | Avoid Awkward Breaks
    |--------------------------------------------------------------------------
    */

    .swcss-invoice-table tr,
    .swcss-invoice-summary,
    .swcss-invoice-notes,
    .swcss-invoice-footer {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

}
