/* ===========================================
   Print Styles
   HIPAA: Structured print templates
   =========================================== */

/* Hide app UI when printing */
@media print {
    body * {
        visibility: hidden;
    }
    
    body.printing-patient *,
    body.printing-chart * {
        visibility: hidden;
    }
    
    #printRoot,
    #printRoot * {
        visibility: visible;
    }
    
    #printRoot {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    /* Hide non-print elements */
    .no-print,
    .signature-actions,
    .summary-actions,
    button,
    .nav-controls,
    .pres-header {
        display: none !important;
    }
}

/* Print document container */
.print-document {
    max-width: 8.5in;
    margin: 0 auto;
    padding: 0.5in;
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
}

/* Print header */
.print-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #0D9488;
}

.print-logo svg {
    flex-shrink: 0;
}

.print-header-text h1 {
    margin: 0;
    font-size: 18pt;
    font-weight: 700;
    color: #0D9488;
}

.print-date {
    margin: 0.25rem 0 0 0;
    font-size: 10pt;
    color: #666;
}

/* Patient info */
.print-patient-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.print-info-field {
    display: flex;
    gap: 0.5rem;
}

.print-info-field label {
    font-weight: 600;
    color: #333;
}

.print-info-field span {
    color: #000;
}

/* Treatment section */
.print-treatment-section {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
}

.print-treatment-section h2 {
    margin: 0 0 1rem 0;
    font-size: 14pt;
    font-weight: 600;
    color: #0D9488;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.print-treatment-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.print-treatment-table th {
    background: #0D9488;
    color: #fff;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 10pt;
}

.print-treatment-table th.text-right {
    text-align: right;
}

.print-treatment-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 10pt;
}

.print-treatment-table td.text-right {
    text-align: right;
}

.print-treatment-table tfoot {
    border-top: 2px solid #0D9488;
}

.print-total-row {
    font-weight: 700;
    background: #f8f9fa;
}

.print-total-row td {
    padding: 0.75rem 0.5rem;
}

/* Chart copy table (wider) */
.print-chart-table {
    font-size: 9pt;
}

.print-chart-table th,
.print-chart-table td {
    padding: 0.4rem;
}

/* Consents section */
.print-consents-section {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
}

.print-consents-section h2 {
    margin: 0 0 1rem 0;
    font-size: 14pt;
    font-weight: 600;
    color: #0D9488;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.print-consent-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f8f9fa;
}

.print-consent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.print-consent-header strong {
    font-size: 11pt;
    color: #0D9488;
}

.print-consent-version {
    font-size: 9pt;
    color: #666;
}

.print-consent-details {
    font-size: 10pt;
}

.print-consent-initials {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.print-consent-acknowledgment {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #d1fae5;
    border-left: 3px solid #0D9488;
    font-size: 9pt;
}

.print-no-consents {
    color: #666;
    font-style: italic;
    padding: 1rem;
}

/* Consent audit table */
.print-consents-audit {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
}

.print-consents-audit h2 {
    margin: 0 0 1rem 0;
    font-size: 14pt;
    font-weight: 600;
    color: #0D9488;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.print-audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
}

.print-audit-table th {
    background: #0D9488;
    color: #fff;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
}

.print-audit-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.print-audit-table .text-center {
    text-align: center;
}

/* Signature section */
.print-signature-section {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
}

.print-signature-section h2 {
    margin: 0 0 1rem 0;
    font-size: 14pt;
    font-weight: 600;
    color: #0D9488;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.print-signature-display {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    text-align: center;
}

.print-signature-image {
    max-width: 100%;
    height: auto;
    max-height: 3in;
}

.print-signature-meta {
    margin-top: 0.5rem;
    font-size: 10pt;
    color: #666;
    text-align: center;
}

/* Footer */
.print-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-size: 9pt;
    color: #666;
    text-align: center;
}

.print-hipaa-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 4px;
}

.print-hipaa-notice svg {
    flex-shrink: 0;
}

.print-timestamp {
    margin: 0.25rem 0;
}

.print-audit-note {
    margin-top: 0.5rem;
    font-style: italic;
    color: #999;
}

/* Page breaks */
.print-document > * {
    page-break-inside: avoid;
}

.print-treatment-section,
.print-consents-section,
.print-signature-section {
    page-break-inside: avoid;
}

/* Screen styles (hidden container) */
#printRoot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
}

#printRoot.hidden {
    display: none;
}

