:root {
    --green     : #4CAF50;
    --green-dark: #45a049;
    --light-grey: #f1f46;
    --grey      : #ccc;
    --grey-dark : #777;
    --success   : #D0FFD0;
    --success-dark: #00CC00;
    --error     : #FFDCDC;
    --error-dark: #FE0100;
}

.line-num {
    display: block;
    cursor: pointer;
    text-align: right;
    line-height: 1.2em;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'Courier New', monospace;
}

.tab {
    border: 1px solid var(--grey);
    background-color: var(--light-grey);
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    width: 100%;
}

.tab button {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
}

.tab button:hover {
    background-color: var(--grey);
}

.tab button.active {
    background-color: var(--grey);
}

.tab_content {
    padding: 6px 12px;
    border: 1px solid var(--grey);
    border-top: none;
    width: 100%;
    min-height: 400px;
    font-family: monospace;
    box-sizing: border-box;
}

textarea.tab_content {
    height: 100%;
    border: none;
    outline: none;
    font-family: monospace;
    padding-left: 5px;
    margin: 0;
}


#computer.output-computer-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    padding: 20px;
    background-color: whitesmoke;
    align-items: start;
}


.tab .output-tab {
    margin-left: auto;
    white-space: nowrap;
    overflow-x: auto;
    width: 100%;
}

.main_btn {
    margin: 10px 0;
    padding: 10px 20px;
    font-size: 16px;
    background-color: var(--green);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.main_btn:disabled {
    background-color: var(--grey) !important;
    color: #666 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.loading {
    color: var(--grey-dark);
    font-style: italic;
}

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#loadingBar {
  width: 80%;
  height: 20px;
  background-color: var(--grey);
  border-radius: 5px;
  overflow: hidden;
}

#loadingProgress {
  height: 100%;
  background-color: var(--green);
  transition: width 0.5s ease-in-out; /* Smooth transition for visual effect */
}

.message-container {
    position: fixed;
    bottom: 20px;
    font-size: 16px;
    border-width: 2px;
    border-style: none;
    white-space: pre-wrap;
    display: none;
    z-index: 1000;
}

.message-container.show {
    display: block;
    opacity: 1;
}

.message-container.success {
    background-color: var(--success);
    border-bottom-color: var(--success-dark);
    color: var(--success-dark);
    border-style: solid;
}

.message-container.error {
    background-color: var(--error);
    border-bottom-color: var(--error-dark);
    color: var(--error-dark);
    border-style: solid;
}

.main-content-layout {
    display: grid;
    /* minmax(0, 1fr) to prevent content from expanding the column */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    width: 100%;
}

#computer.output-computer-panel {
    display: block; /* Changed from grid to block for simpler 50/50 behavior */
    padding: 20px;
    background-color: whitesmoke;
    overflow-x: hidden; /* Prevent the panel itself from scrolling */
}

.main-content-layout.sidebar-hidden {
    grid-template-columns: 1fr; /* Single column */
}


.status-sections-row {
    display: flex;
    padding-left: 1vw;
    padding-right: 1vw;
}
.status-section{
    width: 100%;
}

.status-sections-row, .flags-container {
    flex-wrap: wrap;
    gap: 10px;
}

#pixelCanvas {
    border: 2px solid var(--grey-dark);
    background-color: black;
    image-rendering: crisp-edges;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    height: 75%;
    width: 75%;
    aspect-ratio: 1 / 1;
}

/* The inner content wrapper for the computer display area */
.computer-display-area {
    text-align: center;
    width: 100%; /* Changed from 50% to 100% so it fills its half of the screen */
}


.status-section {
    background-color: white;
    border: 1px solid var(--grey);
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: black;
    border-bottom: 2px solid var(--green);
    padding-bottom: 5px;
}

.flags-container {
    display: flex;
    gap: 10px;
    justify-content: space-around;
}

.flag {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: whitesmoke;
    border-radius: 4px;
    min-width: 60px;
}

.flag-label {
    font-size: 12px;
    color: var(--grey-dark);
    margin-bottom: 5px;
    font-weight: bold;
}

.flag-value {
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.flag-value.active {
    color: var(--green);
}

.flag-value.inactive {
    color: #ccc;
}

.pc-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pc-value {
    font-size: 24px;
    font-weight: bold;
    color: black;
}

.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border: 1px solid var(--grey);
}

.registers-table {
    width: 100%;
    border-collapse: collapse;
}

.registers-table td {
    padding: 6px 8px;
    border: 1px solid var(--grey);
}

.registers-table tr:nth-child(even) {
    background-color: whitesmoke;
}

.registers-table tr:hover {
    background-color: honeydew;
}

@media (max-width: 1200px) {
    #computer.output-computer-panel {
        grid-template-columns: 1fr;
    }

    #pixelCanvas {
        width: 100%;
        height: auto;
        max-width: 512px;
    }
}

.slider {
  -webkit-appearance: none;
  width: 30%;
  background: var(--grey);
  outline: none;
  opacity: 0.7;
  -webkit-transition: .2s;
  transition: opacity .2s;
}

.slider:hover {
  opacity: 1;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 5%;
  height: 25px;
  background: var(--green);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 25px;
  height: 25px;
  background: var(--green);
  cursor: pointer;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    color: darkgray;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}
.message-text{
    padding-right: 10px;
    padding-left: 10px;
}

/* Base styling for all details tags */
details {
  margin-left: 20px; /* This creates the "tabbed" indent */
  padding-left: 10px;
  border-left: 2px solid lightgray; /* Visual guide for nesting */
  transition: all 0.3s ease;
}

/* Style the summary (the clickable part) */
summary {
  cursor: pointer;
  font-weight: 600;
  padding: 3px;
  list-style: none;
}

/* Custom arrow or indicator */
summary::before {
  content: "→";
  display: inline-block;
  width: 20px;
  transition: transform 0.2s;
}

details[open] > summary::before {
  content: "↓";
}

details[open] {
  border-left: 2px solid lightblue;
}

details div {
  color: mediumslateblue;
  font-weight: bold;
}

.LN_wrapper {
    display: none; /* Controlled by JS when a tab is selected */
    flex-direction: row;
    border: 1px solid gainsboro;
    min-height: 400px;
    overflow: hidden;
    background-color: snow;
    padding: 6px 12px;
    border-top: none;
    box-sizing: border-box;
}

.LN_sb {
    background-color: lightgray;
    border-right: 1px solid gainsboro;
    font-family: monospace;
    font-size: 13px;
    padding: 5px 5px;
    text-align: right;
    user-select: none;
    width: 30px;
}

.LN_ta {
    border: none;
    outline: none;
    padding: 5px;
    width: calc(100% - 40px);
    resize: none;
    font-family: monospace;
    font-size: 13px;
    overflow-y: auto;
    background: white;
}

.sticky-nav{
    position: sticky;
    top: 0;
    overflow: hidden;
    background-color: white;
}