@media print {
    @page {
        margin: 0.5cm;
        size: auto;
    }

    body {
        background-color: white;
        color: black;
        margin: 0;
        padding: 0;
        zoom: 0.9; /* Scale down slightly to ensure fit */
        -webkit-print-color-adjust: exact;
    }

    .site-header, 
    .ad-container, 
    .faq-bubble, 
    .actions-area, 
    .modal,
    .info-icon,
    button,
    #currency-dropdown,
    #language-dropdown,
    .footer-ad {
        display: none !important;
    }

    .main-container {
        display: block;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    .calculator-wrapper {
        width: 100%;
        margin: 0;
    }

    .calculator-container {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .calc-table {
        width: 100%;
        font-size: 12px; /* Reduce font size for print */
        border-collapse: collapse;
    }

    .calc-table th, .calc-table td {
        padding: 4px 8px; /* Reduce padding */
        border-bottom: 1px solid #ccc;
    }

    .section-header td {
        padding-top: 10px;
        padding-bottom: 5px;
        font-weight: bold;
        background-color: #f0f0f0 !important; /* Ensure section headers are visible */
    }

    .qty-input {
        border: none;
        background: none;
        padding: 0;
        text-align: right;
        width: 100%;
    }

    /* Print Header Injection */
    #print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    #print-header h1 {
        font-size: 18px;
        margin-bottom: 5px;
    }
    
    #print-header p {
        font-size: 12px;
        margin: 2px 0;
    }

    /* Ensure Grand Total is visible and prominent at the bottom */
    #grand-total-print {
        display: block !important;
        text-align: right;
        font-size: 16px;
        font-weight: bold;
        margin-top: 1rem;
        padding-top: 0.5rem;
        border-top: 2px solid #000;
    }
}
