body {
    font-family: sans-serif;
    margin: 0; /* Remove default margin */
    background-color: #f4f4f4;
    display: flex; /* Prepare for appContainer to take full height */
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    flex-direction: column;
}

#appContainer {
    display: flex;
    flex-grow: 1; /* Allows appContainer to fill body height */
    width: 100%;
}

#leftPanel {
    width: 280px; /* Fixed width for the left panel */
    padding: 20px;
    background-color: #e9ecef;
    border-right: 1px solid #ccc;
    box-sizing: border-box;
    overflow-y: auto; /* Allow scrolling if content overflows */
}

#rightPanel {
    flex-grow: 1; /* Right panel takes remaining width */
    padding: 20px;
    box-sizing: border-box;
    overflow: auto; /* Important: allows scrolling for PDF content */
    background-color: #f8f9fa;
}

#pdfContainer {
    margin: 0 auto; /* Center PDF pages if rightPanel is wider */
}

.pageContainer {
    position: relative;
    margin: 0 auto 10px auto; /* Center page and add margin bottom */
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
    background-color: white; /* Ensure canvas background appears white */
}

.pageContainer canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* User's requested debugging style for all overlays */
.pdf-input-overlay {
    position: absolute;
    background-color: rgba(255, 0, 0, 0.5) !important; /* Bright red, semi-transparent */
    border: 2px solid black !important; /* Thick black border */
    box-sizing: border-box;
    font-family: Helvetica, Arial, sans-serif;
    z-index: 1000 !important; /* Ensure it's on top */
    /* Font size for non-comb elements will be set by JS */
    /* For comb containers, this highlights the whole area */
}

/* Ensure focus style is still somewhat visible on the new background */
.pdf-input-overlay:focus,
.pdf-input-overlay:focus-within {
    outline: 2px solid yellow !important; /* Example focus outline */
}

/* Specific styling for checkbox base if needed, though parent gets debugging style */
.pdf-input-overlay[type="checkbox"] {
    /* The red background from .pdf-input-overlay will apply. */
}

/* Styles for Comb Fields */
.comb-input-container { /* This already has .pdf-input-overlay, so it gets the red/black style */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    overflow: hidden;
}

.comb-input-cell {
    flex-grow: 1;
    width: 20px; /* Fallback, mostly overridden by JS distribution */
    height: 100%; /* Fill container height */
    border: 1px solid #333; /* Darker border for cells to be visible on red */
    text-align: center;
    font-family: monospace;
    font-size: inherit;
    padding: 0;
    margin: 0 1px; /* Small margin between cells */
    box-sizing: border-box;
    background-color: transparent; /* MODIFIED: Makes cell transparent to container's red */
    color: black; /* Ensure text is visible; might need adjustment for readability on red */
    -moz-appearance: textfield;
}
.comb-input-cell::-webkit-outer-spin-button,
.comb-input-cell::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.comb-input-cell:first-child {
    margin-left: 0;
}
.comb-input-cell:last-child {
    margin-right: 0;
}
.comb-input-cell:focus {
    border-color: #0056b3; /* Darker blue border on cell focus */
    outline: 1px solid #0056b3; /* Cell-specific focus */
    background-color: rgba(255, 255, 255, 0.2); /* Slight highlight on focus if cell is transparent */
}


h1, h2 {
    margin-top: 0;
    color: #333;
}

.control-group {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}
.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="file"],
button {
    margin-bottom: 5px;
}

button {
    background-color: #007bff;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 5px;
}
button:hover {
    background-color: #0056b3;
}
#viewControls button {
    background-color: #6c757d;
}
#viewControls button:hover {
    background-color: #5a6268;
}

#scaleInput {
    width: 40px;
    text-align: center;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 5px;
}