body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    background-color: #f0f2f5;
    color: #333;
}
.main-container {
    display: flex;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}

h1, h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-weight: 500;
}
.controls {
    margin-bottom: 10px;
}
.controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 14px;
    margin-right: 5px;
}
.controls button:hover {
    background-color: #0056b3;
}
.controls button:disabled {
    background-color: #a0c7e4;
    cursor: not-allowed;
}
#editor-container {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#terminal {
    background-color: #282c34;
    color: #abb2bf;
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    border-radius: 4px;
}
.terminal-line {
    white-space: pre-wrap;
}
.terminal-input {
    display: flex;
}
.terminal-input span {
    margin-right: 5px;
}
.terminal-input input {
    flex-grow: 1;
    background: none;
    border: none;
    color: #98c379;
    font-family: inherit;
}
.terminal-input input:focus {
    outline: none;
}
#memory-table {
    width: 100%;
    border-collapse: collapse;
    flex-grow: 1;
}
#memory-table th, #memory-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
#memory-table th {
    background-color: #f9f9f9;
}
/* Add these styles to your style.css file */
#stop-btn {
    background-color: #dc3545;
}
#stop-btn:hover {
    background-color: #c82333;
}
#stop-btn:disabled {
    background-color: #f5c6cb;
}

.current-line-highlight {
    background-color: #3a3f4b; /* A subtle dark highlight */
    display: block;
}

h1 {
    display: flex;
    align-items: center;
}

h1 a {
    vertical-align: middle;
    margin-left: auto;
}

h1 a > img {
    height: 24px;
}


/* Style for the expandable array view */

#memory-table details {
    padding: 2px;
}

#memory-table summary {
    cursor: pointer;
    font-weight: bold;
    user-select: none;
}

#memory-table details[open] summary {
    margin-bottom: 5px;
}

#memory-table ul {
    list-style-type: none;
    padding-left: 20px;
    margin: 0;
}

#memory-table li {
    padding: 2px 0;
}

#memory-table .array-index {
    color: #888;
}

/* This new wrapper will handle the scrolling */
.table-wrapper {
  flex-grow: 1; /* Allows the wrapper to fill the available space */
  overflow-y: auto; /* Adds a vertical scrollbar only when needed */
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* This makes the table header stick to the top during scroll */
#memory-table th {
  position: sticky;
  top: 0;
  background: #f9f9f9; /* Ensures scrolling content doesn't show through the header */
}

/* A generic panel style for all 3 columns */
.panel {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 50px; /* Prevent columns from collapsing completely */
    overflow: hidden; /* Important for child elements with scroll */
}

/* Initial sizing for the panels */
.editor-panel {
    flex: 2 1 50%; /* grow=2, shrink=1, basis=50% */
}
.terminal-panel {
    flex: 1 1 25%; /* grow=1, shrink=1, basis=25% */
}
.memory-panel {
    flex: 1 1 25%; /* grow=1, shrink=1, basis=25% */
}

/* Styling for the draggable handles */
.resizer {
    flex: 0 0 4px; /* Resizers have a fixed width */
    background: #e0e0e0;
    cursor: col-resize;
    transition: background-color 0.2s ease;
}

.resizer:hover {
    background: #007bff; /* Highlight on hover */
}

/* Ensure the terminal and memory views fill their parent panel */
#terminal, .table-wrapper {
    flex-grow: 1;
}

/* --- Styles for Help Sidebar --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.main-container {
    flex-grow: 1; /* Main content takes up the remaining space */
    display: flex;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}

#help-sidebar {
    flex-shrink: 0;
    width: 320px;
    height: 100vh;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    transition: width 0.3s ease-in-out;
    position: relative;
    box-sizing: border-box;


}

#help-sidebar ol, #help-sidebar ul {
    white-space: normal;
}

#help-sidebar .img-wrapper {
    /* margin: 0.2cm 0; */
    background: #1F1F1F;
}

#help-sidebar samp {
    background: #ddd;
    box-shadow: 0 0 2px #000;
    display: inline-block;
    padding: 0 1px;
    margin: 0 1px;
}

#help-sidebar.collapsed {
    width: 0;
    padding: 0;
}

#sidebar-toggle-btn {
    position: absolute;
    left: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50% 0 0 50%;
    border: 1px solid #dee2e6;
    border-right: none;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
    z-index: 10;
}

.sidebar-content {
    padding: 10px;
    height: 100%;
    width: calc(100% - 40px);
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    white-space: nowrap; /* Prevent content from wrapping during collapse */
}

/* Styles for the help cards */
#help-cards-container details {
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
}

#help-cards-container summary {
    padding: 10px;
    cursor: pointer;
    font-weight: bold;
    background-color: #f1f3f5;
}

#help-cards-container .card-content {
    padding: 10px;
    border-top: 1px solid #e9ecef;
}

#help-cards-container .card-content h4 {
    margin: 16px 0 8px 0;
}

#help-cards-container .card-content ul {
    padding-left: 20px;
    margin: 0;
}

/* --- Styles for File Sidebar --- */

#file-sidebar {
    flex-shrink: 0;
    width: 200px;
    height: 100vh;
    background: #e9ecef;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    height: 52px;
    border-bottom: 1px solid #dee2e6;
}

.sidebar-header h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin: 0;
}

#add-file-btn {
    font-size: 24px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    color: #007bff;
    padding: 0 10px;
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#file-list li {
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 42px;
    cursor: pointer;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    user-select: none;
}

#file-list li:hover {
    background-color: #dee2e6;
}

#file-list li.active {
    background-color: #007bff;
    color: white;
}

.file-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #dc3545;
    font-size: 16px;
    margin-left: auto;
    display: none; /* Hide by default */
}

#file-list li:hover .delete-btn {
    display: block; /* Show on hover */
}

#file-list li.active .delete-btn {
    color: white; /* Make it visible on active background */
}
