/**
 * Print Styling and Function for Michigan Sentencing Calculator
 * Creates professional, printable output of calculation results
 * WITHOUT PRV and OV sections (results only)
 */

/* ========================================
   PRINT-SPECIFIC CSS STYLES
   Add this to your styles.css or <style> tag
   ======================================== */

@media print {
    /* TITLE PAGE - Show and format */
    .print-title-page {
        display: block !important;
        page-break-after: always;
        position: relative;
    }
    
    .print-title-page h1 {
        font-size: 42pt !important;
        font-weight: bold !important;
        color: #1a365d !important;
        text-transform: uppercase;
        letter-spacing: 3px;
        line-height: 1.3;
        margin-bottom: 60px !important;
    }
    
    .print-title-page img {
        max-width: 600px !important;
        width: 90% !important;
        height: auto !important;
    }
    
    /* Hide unnecessary elements when printing */
    .main-header,
    .header-top,
    .header-main,
    nav,
    .hero-section,
    .panel:not(#results),
    #offenseSearch,
    #searchResults,
    #selectedOffense,
    .calculate-section,
    #calculateBtn,
    .legal-notice,
    footer,
    .search-results,
    .copyright-notice:not(.print-copyright),
    button,
    .no-print,
    #contact,
    section#contact,
    #prvContainer,
    #ovContainer {
        display: none !important;
    }
    
    /* Hide everything after the results section */
    #results ~ *:not(.panel) {
        display: none !important;
    }
    
    /* Show only results */
    body {
        background: white !important;
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    #results {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .results-container {
        border: 2px solid #000 !important;
        background: white !important;
        padding: 20px !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    
    /* Print header */
    .print-header {
        display: block !important;
    }
    
    /* Title page styling */
    .print-header > div:first-child {
        text-align: center;
        page-break-after: always;
        padding-top: 150px;
    }
    
    .print-header h1 {
        font-size: 36pt;
        font-weight: bold;
        margin: 0 0 50px 0;
        color: #1a365d;
        text-transform: uppercase;
        letter-spacing: 2px;
        line-height: 1.2;
    }
    
    .print-header img {
        max-width: 500px;
        width: 100%;
        height: auto;
        display: block;
        margin: 50px auto;
    }
    
    /* Subsequent page header */
    .print-header > div:nth-child(2) {
        border-bottom: 2px solid #1a365d;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .print-header h2 {
        font-size: 14pt;
        margin: 0;
        color: #1a365d;
    }
    
    .print-header p {
        font-size: 10pt;
        margin: 5px 0 0 0;
        color: #666;
    }
    
    /* Result sections */
    .result-section {
        page-break-inside: avoid;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        padding: 10px;
    }
    
    .result-section h4 {
        font-size: 12pt;
        color: #1a365d;
        margin-bottom: 8px;
        border-bottom: 1px solid #ddd;
        padding-bottom: 5px;
    }
    
    .result-section p {
        font-size: 11pt;
        margin: 5px 0;
        line-height: 1.4;
    }
    
    /* Grid table */
    table {
        page-break-inside: avoid;
        border-collapse: collapse;
        width: 100%;
        font-size: 9pt;
        margin: 10px 0;
    }
    
    table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        padding: 5px;
        font-weight: bold;
    }
    
    table td {
        border: 1px solid #666 !important;
        padding: 5px;
        text-align: center;
    }
    
    /* Highlight current cell in print */
    table td[style*="background-color: rgb(254, 240, 138)"],
    table td[style*="background-color: #fef08a"] {
        background-color: #ffff99 !important;
        border: 2px solid #000 !important;
        font-weight: bold !important;
    }
    
    /* Print footer */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        border-top: 1px solid #666;
        padding-top: 10px;
        margin-top: 20px;
    }
    
    /* Copyright notice for print */
    .print-copyright {
        display: block !important;
        font-size: 9pt;
        text-align: center;
        border: 1px solid #000;
        padding: 10px;
        margin: 15px 0;
        background: #f9f9f9 !important;
    }
    
    /* Page breaks */
    .page-break-before {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    /* No page breaks inside these */
    .result-section,
    table,
    .print-header,
    .print-footer {
        page-break-inside: avoid;
    }
    
    /* Links should show URL */
    a[href]:after {
        content: none; /* Don't show URLs in print */
    }
    
    /* Remove box shadows and backgrounds for print */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Print button styling (not printed) */
.print-button {
    background: linear-gradient(135deg, #1a365d, #2d74da);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    margin: 20px auto;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26, 54, 93, 0.3);
}

.print-button:hover {
    background: linear-gradient(135deg, #2d74da, #1a365d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 54, 93, 0.4);
}

.print-button i {
    margin-right: 8px;
}

@media print {
    .print-button {
        display: none !important;
    }
}
