/* Print stylesheet for Dental Chart Application (v12.0.0) */

@page {
    size: A4;
    margin: 10mm;
}

body {
    font-family: 'Arial', sans-serif;
    color: #333;
    line-height: 1.4;
    background-color: white;
    font-size: 12px; /* Increase base font size */
}

/* Hide non-printable elements */
button, 
.no-print,
.modal,
.btn-group,
.version-info {
    display: none !important;
}

/* General print styles */
.container {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

/* PDF container */
.pdf-container {
    padding: 5px;
    max-width: 100%;
}

/* Header styles for print */
.header {
    text-align: center;
    margin-bottom: 5px;
    padding-bottom: 3px;
    border-bottom: 1px solid #0078b6;
    background-color: #f0f8ff;
    padding: 5px;
    border-radius: 5px;
}

.logo-container {
    text-align: center;
    margin-bottom: 3px;
}

.logo-container img {
    max-width: 100px;
    height: auto;
    margin: 0 auto;
}

.clinic-name {
    font-size: 16px;
    font-weight: bold;
    color: #0078b6;
    margin: 0;
}

.clinic-contact {
    font-size: 10px;
    margin: 2px 0;
}

.document-title {
    font-size: 18px;
    margin: 5px 0;
    text-align: center;
    color: #0078b6;
}

/* Patient information section */
.patient-info {
    background-color: #f0f8ff;
    padding: 4px 6px;
    border-radius: 5px;
    margin-bottom: 5px;
    border-left: 4px solid #0078b6;
}

.patient-info p {
    margin: 2px 0;
    font-size: 11px;
}

/* Section titles */
.section-title {
    font-size: 14px;
    margin: 5px 0 3px 0;
    color: #0078b6;
    border-bottom: 1px solid #0078b6;
    padding-bottom: 2px;
}

/* Dental chart for PDF */
.dental-chart-pdf {
    margin: 5px 0;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    page-break-inside: avoid;
}

/* Table-based dental chart layout */
.dental-chart-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    table-layout: fixed;
}

.dental-chart-table td {
    border: none;
    text-align: center;
    padding: 1px 0;
    width: 6.25%;
    vertical-align: middle;
}

.dental-chart-table td .tooth {
    display: inline-block;
    width: auto !important;
    margin: 0 auto;
}

.jaw-container {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.jaw {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 3px 0;
    flex-wrap: nowrap !important; /* Prevent wrapping of teeth */
}

/* Add styles for dental arch quadrants */
.jaw-quadrant {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap !important; /* Prevent teeth from wrapping to next line */
    white-space: nowrap; /* Prevent line breaks */
}

.upper-right, .lower-right {
    flex-direction: row-reverse;
    flex-shrink: 0; /* Prevent shrinking */
}

.upper-left, .lower-left {
    flex-direction: row;
    flex-shrink: 0; /* Prevent shrinking */
}

.jaw-separator {
    height: 1px;
    background-color: #ddd;
    margin: 2px 0;
    width: 90%;
}

.tooth {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 1px;
    padding: 1px;
    border-radius: 3px;
    width: auto !important; /* Auto width to fit content */
    height: auto !important; /* Auto height to fit content */
    position: relative;
    border: 1px solid transparent;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent shrinking */
}

.tooth.selected {
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tooth img {
    width: 18px !important; /* Slightly smaller images */
    height: auto;
    max-height: 18px;
    object-fit: contain;
}

.tooth-number {
    font-size: 8px;
    margin: 0;
}

.upper-jaw .tooth {
    flex-direction: column-reverse;
}

.lower-jaw .tooth {
    flex-direction: column;
}

.upper-jaw, .lower-jaw {
    display: flex;
    justify-content: center;
    width: 100%;
    flex-wrap: nowrap !important; /* Prevent wrapping */
}

/* Chart legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 3px;
    font-size: 8px;
    max-width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 1px 3px;
    white-space: nowrap;
}

.legend-color {
    width: 6px;
    height: 6px;
    margin-right: 2px;
    border-radius: 2px;
    border: 0.5px solid #999;
}

/* Treatment table */
.treatment-table {
    width: 100%;
    border-collapse: collapse;
    margin: 5px 0;
    font-size: 10px; /* Increased font size */
}

.treatment-table th {
    background-color: #0078b6;
    color: white;
    text-align: left;
    padding: 3px 4px;
    border: 1px solid #ddd;
    font-size: 11px;
}

.treatment-table td {
    padding: 3px 4px;
    border: 1px solid #ddd;
}

.treatment-table tr:nth-child(even) {
    background-color: #e6f7ff;
}

.treatment-table .price-column {
    text-align: right;
}

.treatment-total-row {
    font-weight: bold;
    background-color: #f0f8ff !important;
    color: #0078b6;
    font-size: 11px;
}

/* Strikethrough for discounted prices */
.original-price {
    text-decoration: line-through;
    color: #999;
    display: block;
    font-size: 10px;
    margin-bottom: 1px;
}

.discounted-price {
    color: #e53935;
    font-weight: bold;
    display: block;
    font-size: 12px;
}

.discount-percentage {
    color: #e53935;
    font-style: italic;
    font-size: 10px;
    margin-left: 2px;
    font-weight: bold;
}

/* Hotel info and summary tables */
.info-table, .summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 3px 0;
    font-size: 10px;
}

.info-table th, .summary-table th {
    background-color: #0078b6;
    color: white;
    text-align: left;
    padding: 3px 4px;
    border: 1px solid #ddd;
    width: 30%;
    font-size: 11px;
}

.info-table td, .summary-table td {
    padding: 3px 4px;
    border: 1px solid #ddd;
}

.hotel-info-pdf, .summary-pdf {
    margin: 3px 0;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

/* For vertical layout in v12 */
.forms-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Second visit dental chart for print */
#secondVisitDentalChartSection {
    page-break-before: always;
}

/* Section spacing for print */
.section {
    margin-bottom: 5px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

/* Ensure page breaks properly */
.section {
    page-break-inside: avoid;
}

/* Optimize images for print */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Avoid page breaks inside important elements */
tr, td, th, p, h2, h3 {
    page-break-inside: avoid;
}

/* Avoid page breaks after headers */
h1, h2, h3, h4, h5 {
    page-break-after: avoid;
}

/* Colorful styling */
.treatment-table th, .info-table th, .summary-table th {
    background-color: #0078b6 !important;
}

.treatment-table tr:nth-child(even), .info-table tr:nth-child(even) {
    background-color: #f2f2f2 !important;
}

.treatment-total-row, .total-row {
    background-color: #e6f4ff !important;
}

/* Layout containers */
.hotel-info-pdf, .summary-pdf {
    page-break-inside: avoid;
}