/* ==================== PRINT STYLES FOR MEDICAL RECORDS ==================== */

/* Hide non-printable elements */
@media print {
    /* Hide UI elements */
    .global-search-bar,
    .filter-sidebar,
    .unified-record-list,
    .record-quick-actions,
    .bulk-actions-panel,
    .export-modal,
    .quick-view-modal,
    .tag-manager-modal,
    nav,
    .sidebar,
    .diagnosis-header,
    .loading-overlay,
    .material-icons.action-icon,
    button:not(.print-keep),
    .no-print {
        display: none !important;
    }

    /* Show only detail view */
    .record-detail-view {
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 20px !important;
    }

    .unified-content {
        display: block !important;
        height: auto !important;
    }

    .unified-medical-records-container {
        height: auto !important;
    }

    /* Page setup */
    @page {
        size: A4;
        margin: 2cm 1.5cm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
        background: white;
    }

    /* Print header */
    .print-header {
        display: block !important;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #333;
    }

    .print-header h1 {
        font-size: 24pt;
        margin: 0 0 5px 0;
        color: #333;
    }

    .print-header .print-subtitle {
        font-size: 10pt;
        color: #666;
    }

    .print-metadata {
        display: block !important;
        margin-top: 10px;
        font-size: 9pt;
        color: #666;
    }

    /* Record details */
    .detail-header h2 {
        font-size: 18pt;
        margin: 0 0 10px 0;
        color: #333;
        page-break-after: avoid;
    }

    .detail-metadata {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .meta-item {
        font-size: 10pt;
    }

    .meta-label {
        font-weight: bold;
        color: #333;
    }

    .meta-value {
        color: #666;
    }

    /* Status badges */
    .status-badge {
        border: 1px solid #333 !important;
        padding: 2px 8px;
        border-radius: 3px;
        font-size: 9pt;
        font-weight: bold;
    }

    /* Content sections */
    .detail-section {
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .section-title {
        font-size: 14pt;
        font-weight: bold;
        margin: 15px 0 10px 0;
        color: #333;
        border-bottom: 1px solid #ccc;
        padding-bottom: 5px;
        page-break-after: avoid;
    }

    .detail-content {
        font-size: 11pt;
        line-height: 1.8;
        color: #333;
    }

    /* Tables */
    table {
        width: 100%;
        border-collapse: collapse;
        margin: 10px 0;
        page-break-inside: avoid;
    }

    table th {
        background: #f0f0f0 !important;
        border: 1px solid #333;
        padding: 8px;
        font-weight: bold;
        text-align: left;
        font-size: 10pt;
    }

    table td {
        border: 1px solid #ccc;
        padding: 6px 8px;
        font-size: 10pt;
    }

    /* Lab results */
    .lab-results-table {
        margin: 15px 0;
    }

    .lab-result-row {
        page-break-inside: avoid;
    }

    /* Attachments */
    .attachments-list {
        list-style: none;
        padding: 0;
    }

    .attachment-item {
        margin: 8px 0;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        page-break-inside: avoid;
    }

    .attachment-name {
        font-weight: bold;
        color: #333;
    }

    .attachment-meta {
        font-size: 9pt;
        color: #666;
    }

    /* Activity timeline */
    .activity-timeline {
        margin: 15px 0;
    }

    .activity-item {
        margin: 10px 0;
        padding-left: 20px;
        border-left: 2px solid #333;
        page-break-inside: avoid;
    }

    .activity-date {
        font-weight: bold;
        color: #333;
    }

    .activity-description {
        color: #666;
        font-size: 10pt;
    }

    /* Page breaks */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    .page-break-before {
        page-break-before: always;
    }

    .page-break-after {
        page-break-after: always;
    }

    .no-page-break {
        page-break-inside: avoid;
    }

    /* Print footer */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px 0;
        border-top: 1px solid #ccc;
        font-size: 8pt;
        color: #666;
        text-align: center;
    }

    .print-footer .page-number::after {
        content: counter(page);
    }

    /* Medical-specific elements */
    .diagnosis-code {
        font-family: 'Courier New', monospace;
        background: #f5f5f5 !important;
        padding: 2px 4px;
        border-radius: 3px;
    }

    .medication-name {
        font-weight: bold;
        color: #333;
    }

    .dosage-info {
        color: #666;
        font-style: italic;
    }

    .vital-sign {
        display: inline-block;
        margin: 5px 10px 5px 0;
        padding: 5px 10px;
        background: #f9f9f9 !important;
        border: 1px solid #ddd;
        border-radius: 4px;
    }

    .vital-label {
        font-weight: bold;
        color: #333;
    }

    .vital-value {
        color: #000;
        margin-left: 5px;
    }

    /* Signature section */
    .signature-section {
        margin-top: 40px;
        page-break-inside: avoid;
    }

    .signature-line {
        border-bottom: 1px solid #333;
        width: 300px;
        margin: 30px 0 5px 0;
    }

    .signature-label {
        font-size: 9pt;
        color: #666;
    }

    /* Watermark */
    .print-watermark {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-45deg);
        font-size: 80pt;
        color: rgba(200, 200, 200, 0.3);
        z-index: -1;
        pointer-events: none;
    }

    /* QR Code or Barcode */
    .print-barcode {
        display: block !important;
        margin: 10px 0;
        text-align: right;
    }

    .print-barcode img {
        max-width: 150px;
        height: auto;
    }

    /* Confidentiality notice */
    .confidentiality-notice {
        display: block !important;
        margin-top: 30px;
        padding: 10px;
        border: 1px solid #ccc;
        background: #f9f9f9 !important;
        font-size: 8pt;
        color: #666;
        page-break-inside: avoid;
    }

    /* Multi-page record support */
    .record-page {
        page-break-after: always;
    }

    .record-page:last-child {
        page-break-after: auto;
    }
}

/* Print preview mode (for browser print preview) */
@media screen {
    .print-only {
        display: none;
    }
}

@media print {
    .print-only {
        display: block !important;
    }
}
