/**
 * Print Styles
 * Professional printing for medical reports and invoices
 */

@media print {

    /* Hide UI elements */
    .sidebar,
    .app-header,
    .mobile-nav,
    .page-actions,
    .btn,
    button,
    .no-print {
        display: none !important;
    }

    /* Reset layout for printing */
    body {
        background: white;
        color: black;
    }

    .main-content {
        margin: 0;
    }

    .page-content {
        padding: 0;
    }

    /* Page breaks */
    .page-break {
        page-break-after: always;
    }

    .avoid-break {
        page-break-inside: avoid;
    }

    /* Medical Report Styles */
    .medical-report {
        width: 210mm;
        min-height: 297mm;
        padding: 20mm;
        margin: 0 auto;
        background: white;
        box-shadow: none;
        border: none;
    }

    .report-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding-bottom: 20px;
        border-bottom: 3px solid #14B8A6;
        margin-bottom: 30px;
    }

    .clinic-logo {
        width: 80px;
        height: 80px;
    }

    .clinic-info {
        text-align: right;
    }

    .clinic-info h1 {
        font-size: 24pt;
        margin: 0 0 10px 0;
        color: #14B8A6;
    }

    .clinic-info p {
        margin: 5px 0;
        font-size: 10pt;
    }

    .report-title {
        text-align: center;
        font-size: 20pt;
        font-weight: bold;
        margin: 20px 0;
        color: #333;
    }

    .report-section {
        margin: 20px 0;
        page-break-inside: avoid;
    }

    .report-section h3 {
        font-size: 14pt;
        font-weight: bold;
        color: #14B8A6;
        border-bottom: 2px solid #e5e7eb;
        padding-bottom: 5px;
        margin-bottom: 10px;
    }

    .report-field {
        margin: 10px 0;
        display: flex;
        gap: 10px;
    }

    .report-label {
        font-weight: bold;
        min-width: 150px;
    }

    .report-value {
        flex: 1;
    }

    .report-footer {
        margin-top: 50px;
        padding-top: 20px;
        border-top: 1px solid #e5e7eb;
    }

    .signature-line {
        width: 200px;
        border-top: 1px solid #333;
        margin-top: 50px;
        padding-top: 5px;
        text-align: center;
    }

    /* Invoice Styles */
    .invoice-print {
        width: 210mm;
        min-height: 297mm;
        padding: 15mm;
        margin: 0 auto;
        background: white;
        page-break-after: always;
    }

    .invoice-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 25mm;
        padding-bottom: 10mm;
        border-bottom: 3px solid #14B8A6;
    }

    .invoice-title {
        font-size: 32pt;
        font-weight: bold;
        color: #14B8A6;
        margin: 0;
    }

    .invoice-number {
        font-size: 16pt;
        color: #666;
        margin-top: 5mm;
    }

    .invoice-table {
        width: 100%;
        border-collapse: collapse;
        margin: 15mm 0;
        font-size: 11pt;
    }

    .invoice-table th,
    .invoice-table td {
        border: 1px solid #ddd;
        padding: 3mm 2mm;
        text-align: left;
    }

    .invoice-table th {
        background: #f3f4f6;
        font-weight: bold;
        font-size: 12pt;
    }

    .invoice-total {
        margin-top: 15mm;
        page-break-inside: avoid;
    }

    .invoice-total-row {
        display: flex;
        justify-content: flex-end;
        gap: 40mm;
        margin: 3mm 0;
        font-size: 12pt;
    }

    .invoice-total-label {
        font-weight: bold;
        min-width: 30mm;
        text-align: right;
    }

    .invoice-total-row:last-child {
        border-top: 2px solid #333;
        padding-top: 3mm;
        margin-top: 5mm;
        font-size: 14pt;
        font-weight: bold;
    }

    /* Report Tables */
    .report-table {
        width: 100%;
        border-collapse: collapse;
        margin: 15px 0;
    }

    .report-table th,
    .report-table td {
        border: 1px solid #ddd;
        padding: 8px;
        font-size: 10pt;
    }

    .report-table th {
        background: #f3f4f6;
        font-weight: bold;
    }

    /* Typography for print */
    @page {
        size: A4;
        margin: 15mm;
    }

    h1,
    h2,
    h3,
    h4 {
        color: #333;
    }

    /* Ensure colors print */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Screen-only styles for print preview */
@media screen {

    .medical-report,
    .invoice-print {
        max-width: 210mm;
        margin: 20px auto;
        background: white;
        padding: 20mm;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    .print-preview-only {
        display: none;
    }
}

/* RTL Support for Arabic reports */
.report-rtl {
    direction: rtl;
    text-align: right;
}

.report-rtl .report-header {
    flex-direction: row-reverse;
}

.report-rtl .clinic-info {
    text-align: left;
}

.report-rtl .invoice-table {
    direction: rtl;
}