/* Code Editor & Interactive Terminal Workspace - VS Code Dark Theme */

.editor-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  gap: 8px;
}

/* 1. Main Code Editor Container */
.editor-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 180px;
  background: #1e1e1e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-sizing: border-box;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 10px;
  background: #252526;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-code);
  font-size: 12px;
  color: #9cdcfe;
}

.editor-badge {
  font-family: var(--font-code);
  font-size: 11px;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: #2d2d2d;
  border: 1px solid #3c3c3c;
  color: #cccccc;
  font-weight: 500;
}

.editor-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #858585;
}

.editor-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  background: #1e1e1e;
  overflow: hidden;
}

.line-numbers {
  width: 40px;
  padding: 10px 6px;
  text-align: right;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  color: #858585;
  user-select: none;
  background: #1e1e1e;
  border-right: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
}

.code-textarea {
  flex: 1;
  height: 100%;
  padding: 10px 12px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  font-feature-settings: "liga" 0;
  color: #d4d4d4;
  caret-color: #ffffff;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  white-space: pre;
  tab-size: 2;
  overflow-y: auto;
  box-sizing: border-box;
}

/* 2. Interactive Terminal / Test Output Container */
.terminal-container {
  display: flex;
  flex-direction: column;
  height: 180px;
  min-height: 120px;
  max-height: 240px;
  background: #181818;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 10px;
  background: #252526;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.terminal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #cccccc;
  text-transform: uppercase;
}

.terminal-status-pill {
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: #2d2d2d;
  border: 1px solid #3c3c3c;
  color: #cccccc;
}

.terminal-status-pill.idle {
  color: #858585;
}

.terminal-status-pill.running {
  color: #3794ff;
  border-color: #007acc;
}

.terminal-status-pill.pass {
  color: #89d185;
  border-color: #2d4530;
}

.terminal-status-pill.fail {
  color: #f14c4c;
  border-color: #5a1d1d;
}

/* Terminal Controls & Buttons (Test, Submit, Clear) */
.terminal-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-terminal-action {
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 500;
  color: #cccccc;
  background: #2d2d2d;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #3c3c3c;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}

.btn-terminal-action:hover:not(:disabled) {
  color: #ffffff;
  background: #37373d;
  border-color: #4c4c4c;
}

.btn-terminal-action:active:not(:disabled) {
  background: #222225;
}

.btn-terminal-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.terminal-body {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
  color: #d4d4d4;
  background: #181818;
  box-sizing: border-box;
}

.terminal-line {
  margin-bottom: 2px;
  word-break: break-word;
}

.terminal-line.cmd {
  color: #3794ff;
  font-weight: 600;
}

.terminal-line.pass {
  color: #89d185;
}

.terminal-line.fail {
  color: #f14c4c;
}

.terminal-line.stdout {
  color: #cccccc;
  padding-left: 8px;
  border-left: 2px solid #3c3c3c;
}

.terminal-line.summary-pass {
  color: #89d185;
  font-weight: 600;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #2d2d2d;
}

.terminal-line.summary-fail {
  color: #f14c4c;
  font-weight: 600;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #2d2d2d;
}

.terminal-line.hint {
  color: #858585;
  font-size: 11px;
  margin-top: 3px;
}

/* ------------------------------------------------------------- */
/* MOBILE RESPONSIVE ADAPTATIONS                                 */
/* ------------------------------------------------------------- */
.arena-mobile-action-bar {
  display: none;
}

.btn-editor-format {
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 500;
  color: #cccccc;
  background: #2d2d2d;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid #3c3c3c;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-editor-format:hover {
  color: #ffffff;
  background: #37373d;
  border-color: #4c4c4c;
}

@media (max-width: 768px) {
  .editor-workspace {
    gap: 6px;
    height: 100%;
    min-height: 0;
  }

  .editor-container {
    min-height: 0;
    flex: 1;
    border-radius: var(--radius-sm);
  }

  .editor-header {
    height: 34px;
    padding: 0 8px;
  }

  .editor-title {
    font-size: 11px;
  }

  .line-numbers {
    width: 32px;
    padding: 8px 4px;
    font-size: 12px;
    line-height: 1.5;
  }

  .code-textarea {
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .terminal-container {
    min-height: 0;
    flex: 1;
    max-height: 100%;
    height: 100%;
  }

  .terminal-header {
    height: 34px;
    padding: 0 8px;
  }

  .btn-terminal-action {
    padding: 4px 10px;
    font-size: 12px;
  }

  .terminal-body {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Mobile Action Bar */
  .arena-mobile-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #1f1f1f;
    border-top: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    flex-shrink: 0;
  }

  .btn-mobile-action {
    flex: 1;
    padding: 8px 6px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid #3c3c3c;
    background: #2d2d2d;
    color: #cccccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 36px;
    transition: all 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-mobile-action:active {
    transform: scale(0.98);
  }

  .btn-mobile-action.btn-mobile-test {
    background: #0e639c;
    border-color: #1177bb;
    color: #ffffff;
  }

  .btn-mobile-action.btn-mobile-submit {
    background: #2d4530;
    border-color: #3e6342;
    color: #89d185;
  }

  .btn-mobile-action.btn-mobile-format {
    flex: 0 0 auto;
    padding: 8px 12px;
    background: #252526;
    color: #9cdcfe;
  }
}

