/* Print Styles */
@media print {

    /* Hide Non-Print Elements */
    .sidebar,
    .sidebar-overlay,
    .topbar,
    .bottom-nav,
    .chat-window,
    .chat-tbt,
    .fab-container,
    .modal-close,
    .btn-no-print,
    #corporateSummary {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        margin: 0;
        padding: 0;
        overflow: visible !important;
    }

    #mainApp {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Target the Invoice Modal specifically */
    #invoiceDetailModal {
        display: block !important;
        position: static !important;
        background: white !important;
        width: 100% !important;
        height: auto !important;
        z-index: 9999 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    #invoiceDetailModal .modal-content {
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        background: transparent !important;
        animation: none !important;
    }

    /* Hiding anything that is NOT the invoice modal if it's active */
    body> :not(#invoiceDetailModal) {
        display: none !important;
    }

    /* A4 Paper Layout Improvements */
    .invoice-container {
        width: 100%;
        max-width: 210mm;
        /* A4 Width */
        margin: 0 auto;
        padding: 20px;
        border: 1px solid #ddd;
    }

    .invoice-header,
    .invoice-items,
    .invoice-footer {
        width: 100%;
        margin-bottom: 20px;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    th,
    td {
        border: 1px solid #eee;
        padding: 8px;
        text-align: left;
    }

    .text-right {
        text-align: right;
    }

    .text-center {
        text-align: center;
    }

    .bold {
        font-weight: bold;
    }
}

/* Screen Styles for Invoice Modal */
.invoice-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    color: #333;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.invoice-from,
.invoice-to {
    width: 45%;
}

.invoice-meta {
    text-align: right;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.invoice-table th {
    background: #f8fafc;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
}

.invoice-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.invoice-summary {
    display: flex;
    justify-content: flex-end;
}

.invoice-summary table {
    width: 300px;
}

.invoice-summary td {
    padding: 5px;
    text-align: right;
}

.invoice-actions {
    margin-top: 30px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive adjustments for screen */
@media screen and (max-width: 768px) {
    .invoice-header {
        flex-direction: column;
        gap: 20px;
    }

    .invoice-from,
    .invoice-to {
        width: 100%;
    }
}