/* ============================================
   PRINT STYLES - MORTGAGE CALCULATOR
   Optimized for printing results
   ============================================ */

@media print {
    /* ===== HIDE NON-ESSENTIAL ELEMENTS ===== */
    .header,
    .main-nav,
    .menu-toggle,
    .sidebar,
    .ad-container,
    .btn,
    .form-group,
    .calculator-form,
    .related-calculators,
    .footer,
    .no-print {
        display: none !important;
    }
    
    /* ===== RESET LAYOUT FOR PRINT ===== */
    body {
        background: white;
        color: black;
        font-size: 12pt;
        line-height: 1.5;
        margin: 0;
        padding: 0;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .layout-grid {
        display: block;
    }
    
    .main-content {
        width: 100%;
    }
    
    /* ===== CARD STYLES ===== */
    .card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .card-header {
        border-bottom: 2px solid #000;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    /* ===== HEADINGS ===== */
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }
    
    h1 {
        font-size: 24pt;
        margin-bottom: 10px;
    }
    
    h2 {
        font-size: 18pt;
        margin-top: 15px;
        margin-bottom: 10px;
    }
    
    h3 {
        font-size: 14pt;
        margin-top: 12px;
        margin-bottom: 8px;
    }
    
    /* ===== RESULTS SECTION ===== */
    .results-section {
        display: block !important;
    }
    
    .results-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        page-break-inside: avoid;
    }
    
    .result-item {
        border: 2px solid #000;
        padding: 10px;
        background: #f0f0f0 !important;
        page-break-inside: avoid;
    }
    
    .result-label {
        font-size: 10pt;
        font-weight: bold;
        margin-bottom: 5px;
    }
    
    .result-value {
        font-size: 16pt;
        font-weight: bold;
    }
    
    /* ===== BREAKDOWN LIST ===== */
    .breakdown-list {
        border: 1px solid #000;
        padding: 10px;
        background: #f9f9f9 !important;
        page-break-inside: avoid;
    }
    
    .breakdown-list li {
        border-bottom: 1px solid #ccc;
        padding: 5px 0;
    }
    
    .breakdown-list li:last-child {
        border-bottom: 2px solid #000;
        font-weight: bold;
        margin-top: 5px;
        padding-top: 10px;
    }
    
    /* ===== TABLE STYLES ===== */
    .table-container {
        page-break-inside: avoid;
    }
    
    .data-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9pt;
    }
    
    .data-table thead {
        background: #e0e0e0 !important;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #000;
        padding: 5px;
        text-align: left;
    }
    
    .data-table th {
        font-weight: bold;
    }
    
    .data-table tbody tr:nth-child(even) {
        background: #f5f5f5 !important;
    }
    
    /* ===== CHART CONTAINER ===== */
    .chart-container {
        page-break-inside: avoid;
        border: 1px solid #000;
        padding: 10px;
        max-height: 400px;
    }
    
    .chart-container canvas {
        max-width: 100%;
        height: auto !important;
    }
    
    /* ===== CONTENT SECTIONS ===== */
    .content-section {
        page-break-inside: avoid;
        border: 1px solid #ccc;
        padding: 15px;
        margin: 15px 0;
    }
    
    .content-section h2 {
        border-bottom: 2px solid #000;
        padding-bottom: 5px;
    }
    
    /* ===== LINKS ===== */
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }
    
    /* Don't show link URLs for internal anchors */
    a[href^="#"]:after {
        content: "";
    }
    
    /* ===== PAGE BREAKS ===== */
    .page-break {
        page-break-after: always;
    }
    
    .page-break-avoid {
        page-break-inside: avoid;
    }
    
    /* ===== PRINT HEADER ===== */
    .print-header {
        display: block;
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #000;
    }
    
    .print-date {
        display: block;
        font-size: 10pt;
        color: #666;
        margin-top: 5px;
    }
    
    /* ===== PRINT FOOTER ===== */
    @page {
        margin: 2cm;
        
        @bottom-right {
            content: "Page " counter(page) " of " counter(pages);
            font-size: 9pt;
        }
    }
    
    /* ===== UTILITY CLASSES ===== */
    .print-only {
        display: block !important;
    }
    
    .no-page-break {
        page-break-inside: avoid;
    }
    
    /* ===== FORCE BACKGROUNDS (for better readability) ===== */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
