/* static/print.css */

/* This block applies only when the page is being printed */
@media print {

    /* --- General Print Rules --- */
    body {
        font-size: 12pt; /* Set a smaller base font size */
        margin: 0;
        padding: 0;
    }

    body * {
        visibility: hidden; /* Hide all elements by default */
    }

    .printable-area, .printable-area * {
        visibility: visible; /* Make only the main content area visible */
    }

    .printable-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px; /* Add some padding to the page edge */
        box-sizing: border-box; /* Ensure padding is included in width */
    }
    .no-print {
        display: none !important;
    }

    /* --- Elements to Hide When Printing --- */
    .btn, form, a[href] {
        display: none !important;
    }
    
    /* --- Table-Specific Print Rules --- */
    table {
        width: 100%;
        border-collapse: collapse; /* Make borders neat */
        margin-top: 20px;
    }

    thead {
        display: table-header-group; /* Ensures header repeats on each page */
    }

    th, td {
        border: 1px solid #ccc; /* Add a light border to cells */
        padding: 8px;
        text-align: left;
    }
    
    /* Ensure the main page title is still visible */
    h1, h2 {
        visibility: visible;
    }

    .container > h1 {
        display: none !important; /* Hide the main "My Recipe Book" title */
    }
    h2, h3 {
        visibility: visible; /* Ensure page titles like "Your Grocery List" are still shown */
        color: black !important;
        font-size: 1.2em !important;
    }
}