/**
 * Print Styles
 * Optimized for printing case reports and Materia Medica
 */

@media print {
    /* Reset margins and backgrounds */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    body {
        background: white;
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
    
    /* Hide non-printable elements */
    .sidebar,
    .top-navbar,
    .btn,
    .no-print,
    .dropdown,
    .modal,
    .alert-dismissible,
    .pagination,
    .action-buttons,
    .print-hide {
        display: none !important;
    }
    
    /* Show printable content */
    .main-content,
    .admin-main,
    .doctor-main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Card styles for print */
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        margin-bottom: 15px;
        page-break-inside: avoid;
    }
    
    .card-header {
        background: #f5f5f5;
        border-bottom: 1px solid #ddd;
        padding: 10px;
        font-weight: bold;
    }
    
    .card-body {
        padding: 10px;
    }
    
    /* Table styles */
    .table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .table th,
    .table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }
    
    .table th {
        background: #f5f5f5;
        font-weight: bold;
    }
    
    /* Typography */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    
    h1 { font-size: 20pt; }
    h2 { font-size: 16pt; }
    h3 { font-size: 14pt; }
    h4 { font-size: 12pt; }
    
    p, ul, ol, dl {
        page-break-inside: avoid;
    }
    
    /* Header and footer */
    @page {
        margin: 2cm;
        @top-center {
            content: "Homoeopathy System - Kent's Repertory";
            font-size: 9pt;
            color: #666;
        }
        @bottom-center {
            content: "Page " counter(page) " of " counter(pages);
            font-size: 9pt;
            color: #666;
        }
    }
    
    /* Print header on first page */
    .print-header {
        display: block;
        text-align: center;
        margin-bottom: 20px;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
    }
    
    .print-header h1 {
        margin-bottom: 5px;
    }
    
    .print-header p {
        color: #666;
        font-size: 10pt;
    }
    
    /* Section headers */
    .section-title {
        background: #f0f0f0;
        padding: 8px;
        margin: 15px 0 10px 0;
        font-weight: bold;
        border-left: 4px solid #2ecc71;
    }
    
    /* Grade styling for print */
    .grade-4 {
        font-weight: bold;
        text-decoration: underline;
    }
    
    .grade-3 {
        font-weight: bold;
        color: #c62828;
    }
    
    .grade-2 {
        font-style: italic;
        color: #1565c0;
    }
    
    .grade-1 {
        font-weight: normal;
    }
    
    /* Remedy list */
    .remedy-list span {
        display: inline-block;
        margin-right: 8px;
    }
    
    /* Links */
    a {
        text-decoration: none;
        color: black;
    }
    
    /* Images */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    /* Prescription section */
    .prescription-box {
        border: 1px dashed #333;
        padding: 10px;
        margin-top: 20px;
    }
    
    /* Follow-up section */
    .followup-item {
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }
    
    /* Avoid page breaks inside certain elements */
    .prescription-card,
    .modality-card,
    .stats-card {
        page-break-inside: avoid;
    }
    
    /* QR Code for verification (optional) */
    .print-qr {
        text-align: center;
        margin-top: 30px;
        font-size: 8pt;
        color: #999;
    }
}

/* Print button styling */
.print-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

@media screen {
    .print-header,
    .print-footer {
        display: none;
    }
}