body {
    font-family: Arial, sans-serif;
    line-height: 1.5;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    -webkit-print-color-adjust: exact; /* For better print results */
}

.input-form-container {
    max-width: 800px;
    margin: 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 50px; /* Space between form and report template */
}

.input-form-container h1 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
}

.form-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.form-section h2 {
    color: #0056b3;
    margin-top: 0;
}

.form-section label {
    display: inline-block;
    width: 150px;
    margin-bottom: 8px;
    font-weight: bold;
    vertical-align: top; /* Align labels to the top of textareas */
}

.form-section input[type="text"],
.form-section input[type="date"],
.form-section select,
.form-section textarea {
    width: calc(100% - 160px);
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit; /* Ensure textarea uses the same font */
}

.test-item-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.test-item-row input[type="checkbox"] {
    margin-right: 10px;
}

.test-item-row label {
    margin-bottom: 0;
    width: 130px;
}

.test-item-row input[type="text"] {
    flex-grow: 1;
    width: auto;
    margin-bottom: 0;
}

.input-form-container button {
    background-color: #28a745;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    margin-right: 10px;
}
.input-form-container button:hover {
    background-color: #218838;
}

/* --- REPORT PAGE STYLES (A4 format) --- */
.report-page {
    width: 210mm;
    min-height: 297mm;
    margin: 20mm auto;
    background: #fff;
    padding: 20mm;
    box-sizing: border-box;
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: none; /* Hide all report templates by default */
}

.report-page.active-report {
    display: block; /* Show only the active report */
}

/* Header Section */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.header-left { text-align: left; flex: 1; }
.clinic-logo { width: 320px; height: auto; margin-bottom: 5px; }
.clinic-logo1 { width: 220px; height: auto; margin-bottom: 5px; }
.reg-no { margin-top: 0px; font-size: 8px;}
.header-right { text-align: right; font-size: 10px; line-height: 1.4; color: #555; flex: 1; }
.company-name { font-weight: bold; color: #333; font-size: 13px; }
.clinic-name { font-size: 23px; font-weight: bold; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right a { color: #007bff; text-decoration: none; }

/* Date and Serial Number */
.date-serial {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 20px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #ccc;
}
.serial-no { font-weight: bold; }

/* Test Type Heading */
.test-type-heading {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    text-decoration: underline;
    margin-top: 25px;
    margin-bottom: 30px;
    color: #000;
}

/* Patient Details */
.patient-details p { margin: 5px 0; font-size: 14px; display: flex; align-items: baseline; }
.patient-detail-label { width: 160px; flex-shrink: 0; }
.patient-detail-colon { margin-right: 8px; }

/* Results Table */
.results-table { width: 100%; border-collapse: collapse; margin-top: 25px; font-size: 14px; }
.results-table th, .results-table td { border: 1px solid #000; padding: 8px 12px; text-align: left; }
.results-table th { background-color: #f0f0f0; font-weight: bold; text-align: center; }
.results-table td:first-child { text-align: center; width: 30px; }
.results-table td:nth-child(3) { text-align: center; width: 120px; }
.results-table td:last-child { text-align: center; width: 100px; }

/* Done and Reported By */
.done-reported { margin-top: 30px; margin-bottom: 20px; font-size: 14px; font-weight: bold; }

/* Signature Block */
.signature-block { display: flex; justify-content: space-between; margin-top: 100px; align-items: flex-end; }
.examiner-info { flex: 1; line-height: 1.3; font-size: 13px; }
.examiner-info p { margin: 0; }
.examiner-name-line { font-weight: bold; text-decoration: underline; }
.clinic-stamp { flex: 1; text-align: right; margin-left: 20px; }
.clinic-stamp-img { width: 150px; height: auto; opacity: 0.7; }

/* Footer Section */
.footer-section { text-align: center; margin-top: 50px; font-weight: bold; font-size: 14px; color: #555; }

/* Print Media Queries */
@media print {
    body { margin: 0; padding: 0; }
    .input-form-container { display: none; }
    .report-page {
        margin: 0; border: none; box-shadow: none; width: 100%; height: 100vh;
        padding: 15mm; box-sizing: border-box; overflow: hidden; display: none !important; /* Hide all by default */
    }
    .report-page.active-report {
        display: block !important; /* Show ONLY the active one for printing */
    }
    body { font-size: 10pt; }
    .header-right, .date-serial, .test-type-heading, .patient-details, .results-table, .done-reported, .examiner-info, .footer-section { font-size: 9pt; }
    .company-name { font-size: 10pt; }
    .test-type-heading { font-size: 12pt; }
    .clinic-logo, .clinic-stamp-img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}