/* Print Styles - Optimized for Professional Printing */

@media print {
    /* Reset page margins and colors */
    @page {
        margin: 1.5cm;
        size: A4 portrait;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body {
        background-color: white;
        font-size: 11pt;
        line-height: 1.4;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    /* Header - Simplified */
    .app-header {
        background-color: white !important;
        color: black !important;
        padding: 1rem 0;
        border-bottom: 2px solid #333;
        page-break-after: avoid;
    }

    .app-header h1 {
        color: #1e3a8a;
        font-size: 18pt;
        margin-bottom: 0.5rem;
    }

    .header-inputs {
        display: flex;
        gap: 2rem;
        margin-top: 0.5rem;
    }

    .input-group {
        display: flex;
        gap: 0.5rem;
    }

    .input-group label {
        font-weight: 600;
        color: #333;
    }

    /* Hide input fields, show values only */
    .input-group input {
        border: none;
        background: none;
        padding: 0;
        font-weight: normal;
        color: #333;
    }

    /* Main Layout - Single Column */
    .calculator-wrapper {
        display: block;
        margin-top: 1rem;
    }

    .calculator-body {
        margin-bottom: 1rem;
    }

    /* Category Sections */
    .category-section {
        page-break-inside: avoid;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        box-shadow: none;
    }

    .category-header {
        background-color: #f0f0f0 !important;
        color: #333 !important;
        border-bottom: 2px solid #333 !important;
        padding: 0.5rem 1rem;
    }

    .category-header h2 {
        color: #333 !important;
        font-size: 13pt;
    }

    /* Hide toggle buttons */
    .toggle-btn {
        display: none !important;
    }

    /* Show all content (no collapsed sections) */
    .category-content {
        display: flex !important;
        padding: 0.75rem 1rem;
    }

    /* Line Items */
    .line-item {
        display: grid;
        grid-template-columns: 3fr 1fr 1fr 1.5fr;
        gap: 0.5rem;
        padding: 0.4rem 0;
        border-bottom: 1px solid #e0e0e0;
        font-size: 10pt;
    }

    .line-item:last-child {
        border-bottom: none;
    }

    .line-item label {
        color: #333;
        font-weight: 500;
    }

    /* Hide inputs, show read-only values */
    .quantity-input,
    .unit-cost {
        border: none;
        background: none;
        padding: 0;
        text-align: right;
        color: #333;
    }

    .line-total {
        font-weight: 700;
        color: #000;
        text-align: right;
    }

    /* Category Subtotals */
    .category-subtotal {
        background-color: #f5f5f5 !important;
        border-top: 2px solid #333 !important;
        padding: 0.5rem 1rem;
        font-weight: 700;
        color: #000 !important;
        font-size: 11pt;
    }

    /* Summary Panel */
    .summary-panel {
        position: static;
        page-break-before: avoid;
        margin-top: 1.5rem;
        padding: 1rem;
        border: 2px solid #333;
        box-shadow: none;
    }

    .summary-panel h3 {
        color: #1e3a8a !important;
        font-size: 14pt;
        margin-bottom: 0.75rem;
        border-bottom: 2px solid #333;
        padding-bottom: 0.5rem;
    }

    .summary-breakdown {
        margin-bottom: 1rem;
        gap: 0.5rem;
    }

    .summary-line {
        font-size: 10pt;
        color: #333;
    }

    .summary-line span:first-child {
        color: #666;
    }

    .summary-line span:last-child {
        font-weight: 700;
        color: #000;
    }

    /* Grand Total */
    .grand-total {
        background-color: #1e3a8a !important;
        color: white !important;
        padding: 0.75rem 1rem;
        border-radius: 4px;
        font-size: 14pt;
        font-weight: 700;
        margin-bottom: 1rem;
    }

    /* Hide Action Buttons */
    .action-buttons {
        display: none !important;
    }

    /* Hide elements not needed in print */
    .btn,
    button,
    input[type="button"],
    input[type="submit"] {
        display: none !important;
    }

    /* Page Breaks */
    .category-section {
        page-break-inside: avoid;
    }

    .summary-panel {
        page-break-before: auto;
    }

    /* Footer with page numbers (optional) */
    @page {
        @bottom-right {
            content: "Page " counter(page) " of " counter(pages);
            font-size: 9pt;
            color: #666;
        }
    }

    /* Prevent orphaned headers */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    /* Links */
    a {
        text-decoration: none;
        color: #000;
    }

    a[href]:after {
        content: none !important;
    }

    /* Remove shadows and unnecessary visual effects */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Ensure backgrounds print */
    .category-header,
    .category-subtotal,
    .grand-total {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
