/* =========================================
   KDS Printing Logic
   ========================================= */

/* Hide print area by default on screen */
/* Hide print area by default on screen */
#printArea,
#printArea * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    z-index: -9999 !important;
    clip-path: inset(100%);
}

/* Print Media Query */
@media print {

    /* Hide everything else */
    body>*:not(#printArea) {
        display: none !important;
    }

    /* Show only the print area */
    /* Show only the print area */
    #printArea,
    #printArea * {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        /* Static is safer for print flow */
        width: auto !important;
        height: auto !important;
        opacity: 1 !important;
        overflow: visible !important;
        z-index: auto !important;
        clip-path: none !important;
    }

    #printArea {
        position: absolute !important;
        /* Container needs to be absolute to replace body */
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }

    /* Child specific rewrites if needed */
    #printArea .tp-item {
        display: flex !important;
        /* Restore flex for items */
    }

    /* Reset potential global styles that might interfere */
    body,
    html {
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Specific Ticket Styling */
    .ticket-print {
        width: 80mm;
        /* Standard receipt width */
        font-family: 'Courier New', monospace;
        /* Classic thermal printer font */
        font-size: 14px;
        font-weight: bold;
        line-height: 1.2;
        padding: 5px;
    }

    .tp-header {
        text-align: center;
        margin-bottom: 10px;
        border-bottom: 1px dashed #000;
        padding-bottom: 5px;
    }

    .tp-logo {
        font-size: 18px;
        font-weight: bold;
        display: block;
        text-transform: uppercase;
    }

    .tp-meta {
        font-size: 12px;
        margin-top: 5px;
    }

    .tp-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 5px;
    }

    .tp-qty {
        width: 25px;
        font-weight: bold;
    }

    .tp-name {
        flex: 1;
    }

    .tp-extras {
        font-size: 12px;
        padding-left: 10px;
        color: #333;
    }

    .tp-total {
        margin-top: 10px;
        border-top: 2px solid #000;
        padding-top: 5px;
        text-align: right;
        font-size: 18px;
        font-weight: bold;
    }

    .tp-notes {
        margin-top: 10px;
        border: 1px solid #000;
        padding: 5px;
        font-weight: bold;
    }
}