/* --- Global Resets & Split Layout --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #121212;
  color: #e0e0e0;
  height: 100vh;
  padding: 16px;
  overflow: scroll;
}

h1 {
  margin-bottom: 1rem;
}

/* Split Pane Wrapper */
.ide-container {
  display: flex;
  flex-direction: row;
  gap: 16px;
  width: 100%;
  height: calc(100vh - 32px);
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #1d1f21; /* Prism Tomorrow Dark Base */
  border: 1px solid #333333;
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #252526;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #cccccc;
  border-bottom: 1px solid #333333;
}

/* --- Left Pane: Dual-Layer Prism Editor --- */
.code-editor {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
}

/* Line Numbers Sidebar */
#line-numbers {
  padding: 10px 8px;
  text-align: left;
  background-color: #252526;
  color: #858585;
  user-select: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5rem;
  min-width: 35px;
  box-sizing: border-box;
}

#line-numbers span {
  display: block;
}

/* Override Prism's defaults & lock both overlay layers to match exactly */
#editing-area, 
#highlighting-area {
  margin: 0 !important;
  padding: 12px 33px !important;
  border: 0 !important;
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;
  font-size: 14px !important;
  line-height: 1.5rem !important;
  tab-size: 2 !important;
  white-space: pre !important;
  word-wrap: normal !important;
  overflow: auto !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

/* Layer 1 (Bottom): Prism syntax highlights */
#highlighting-area {
  z-index: 1;
  pointer-events: none;
  background: transparent !important; /* Let container background show through */
}

#highlighting-content {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  padding: 0 !important;
  background: transparent !important;
}

/* Layer 2 (Top): User input layer */
#editing-area {
  z-index: 2;
  color: transparent !important; /* Hide black text so Prism colors show through */
  caret-color: #ffffff !important; /* Keep typing cursor visible */
  background: transparent !important;
  resize: none;
  outline: none;
}

/* Ensure scrollbars match between layers */
#editing-area::-webkit-scrollbar,
#highlighting-area::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#editing-area::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 4px;
}

#highlighting-area::-webkit-scrollbar-thumb {
  background: transparent;
}

/* --- Right Pane: Terminal Output --- */
.terminal {
  flex: 1;
  background-color: #181818;
  padding: 14px;
  font-family: 'Fira Code', Consolas, Monaco, monospace;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#terminal-output {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
  color: #1cbc00;
  line-height: 1.4;
  font-size: 1rem;
  overflow-y: auto;
}

#input-tray {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background-color: #222222;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #333333;
}

.prompt-symbol {
  color: #569cd6;
  font-weight: bold;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: inherit;
}
#title {
  float: left;
}

/* --- Buttons --- */
#run-btn {
  background-color: #1cbc00;
  color: #ffffff;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  float: right;
}

#run-btn:hover {
  background-color: #106a00;
}

#run-btn:disabled {
  background-color: #444444;
  cursor: not-allowed;
  color: #8f8f8f
}

#clear-btn {
  background: transparent;
  color: #888888;
  border: 1px solid #444444;
 padding: 0.5rem 1rem;
  font-size: 0.8rem;
  border-radius: 3px;
  cursor: pointer;
}

#clear-btn:hover {
  color: #ffffff;
  border-color: #666666;
}

/* Responsive Fallback */
@media (max-width: 768px) {
  .ide-container {
    flex-direction: column;
  }
}