/* --- Basic Layout --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 20px;
}

h1, h3 {
    color: #222;
}

input[type="file"] {
    margin: 20px 0;
    display: block;
    font-size: 1.1em;
}

#outputContainer {
    /* Remove display:flex and gap. Padding is still good. */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* NEW: Styles for the header row */
.view-header-row {
    display: flex;
    gap: 20px; /* This is the space between Hex and Text */
    border-bottom: 1px solid #ddd;
}
.view-header-hex, .view-header-text {
    flex: 1;
    min-width: 0;
}
.gutter-space {
    /* This adds dummy space to align headers with content */
    margin-left: 45px; 
}

.code-view {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    background-color: #fdfdfd;
    /* Remove border/radius/padding, it's on outputContainer */
    overflow-x: auto;
    min-height: 300px;
    padding-top: 10px; /* Space from header */
}

/* --- Removed old "row" and "attribute" styles --- */

.error {
    color: #d73a49;
    background-color: #ffdce0 !important; /* Use !important to override attribute colors */
    font-weight: bold;
    display: block;
    padding: 5px;
}

/* --- Color-Coding Palette --- */
/* These map to the 'colorMap' object in script.js */
.color-1  { background-color: #ffadad; } /* TableID (red) */
.color-2  { background-color: #ffd6a5; } /* ObjectID (orange) */
.color-3  { background-color: #fdffb6; } /* Length/Type/Props (yellow) */
.color-4  { background-color: #caffbf; } /* Designator (green) */
.color-5  { background-color: #9bf6ff; } /* Version/Value/Scale (cyan) */
.color-6  { background-color: #a0c4ff; } /* ClientName/Parent/Triggers (blue) */
.color-7  { background-color: #bdb2ff; } /* Serial/Label (purple) */
.color-8  { background-color: #ffc6ff; } /* Localization/List (pink) */
.color-9  { background-color: #ffbdb2; } /* SerialString */
.color-10 { background-color: #d4a5ffd6; } /* StructureLabel */
.color-11 { background-color: #a5d6ff; } /* LocalizationLabel */
.color-12 { background-color: #a5ffd6; } /* ExtLength */
.color-13 { background-color: #d6ffa5; } /* ExtLabel */
.color-error { background-color: #ff8a8a; } /* Error/Unknown */

/* Style for hex/text spans */
.hex-byte, .text-char {
    padding: 1px 0;
    border-radius: 3px;
    /* This ensures spans stay in their pre-wrap flow */
    white-space: pre-wrap;
}

/* --- New Line Number Styles --- */

.line {
    display: flex;
    align-items: stretch; /* This is the magic! Makes children same height */
    gap: 20px; /* Space between Hex and Text columns */
}

/* A divider between lines */
.line + .line {
    border-top: 1px solid #f0f0f0;
}

.line-number {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    color: #999;
    padding: 2px 0; /* Give it a little top/bottom padding */
    text-align: right;
    width: 40px; /* Fixed width gutter */
    user-select: none;
    flex-shrink: 0; /* Don't let it shrink */
}

/* NEW: We now have two content panes per line */
.line-hex, .line-text {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    white-space: pre-wrap; /* This keeps the wrapping behavior */
    word-wrap: break-word;
    flex: 1; /* Take remaining space */
    min-width: 0; /* The all-important flex-shrink fix */
    padding: 2px 0; /* Match line-number padding */
}