/* ============================================================
   EDITOR.CSS — Code Editor page specific styles
   ============================================================ */

/* Editor area wrapper (replaces notebook-area) */
.editor-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
  background-color: var(--surface-base);
  position: relative;
  overflow: hidden;
}

/* Editor header bar */
.editor-header {
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border-ghost);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-low);
  backdrop-filter: blur(10px);
  z-index: 5;
  flex-shrink: 0;
}

/* File name input */
#editorFileName {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 1px dashed rgba(255,255,255,0.12);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  margin: 0;
  font-weight: 600;
  outline: none;
  width: auto;
  min-width: 180px;
  max-width: 400px;
}
#editorFileName:hover { border-color: rgba(0,209,255,0.3); background: rgba(0,209,255,0.04); }
#editorFileName:focus { border-color: var(--primary); background: rgba(0,209,255,0.08); box-shadow: 0 0 0 2px rgba(0,209,255,0.12); }

/* CodeMirror container */
.cm-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#cmEditorTarget {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#cmEditorTarget .cm-editor {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#cmEditorTarget .cm-scroller {
  flex: 1;
  overflow: auto;
}

/* Output panel */
#outputPanel {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border-ghost);
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
  height: 200px;
  min-height: 80px;
  max-height: 80vh;
  overflow: hidden;
}

/* Output drag handler */
#outputDragHandler {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 1.5rem;
  border-bottom: 1px solid var(--border-ghost);
  background: rgba(0,0,0,0.2);
  cursor: row-resize;
  user-select: none;
  z-index: 10;
}
#outputContent {
  margin: 0;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow: auto;
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Copilot toggle button */
#btnToggleCopilot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  background: rgba(139,92,246,0.2) !important;
  border-color: rgba(139,92,246,0.5) !important;
  color: #a78bfa !important;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
}

/* Copilot panel */
#copilotPanel {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  height: 520px;
  background: var(--surface-high);
  border: 1px solid var(--border-ghost);
  z-index: 40;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border-radius: 14px;
}

/* DataFrame output table (from editor.html) */
#outputContent { white-space: normal; }
#outputContent pre,
#outputContent .plain-text { white-space: pre; overflow-x: auto; font-family: var(--font-mono); }
#outputContent .dataframe-wrapper {
  overflow-x: auto;
  margin: 0.5rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,209,255,0.12);
}
#outputContent table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.25);
}
#outputContent table thead tr { background: rgba(0,209,255,0.08); position: sticky; top: 0; }
#outputContent table th {
  padding: 5px 12px;
  text-align: left;
  color: var(--primary-container, #00d1ff);
  border-bottom: 1px solid rgba(0,209,255,0.2);
  font-weight: 600;
  white-space: nowrap;
}
#outputContent table td {
  padding: 4px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
  white-space: nowrap;
}
#outputContent table tbody tr:hover { background: rgba(255,255,255,0.03); }
#outputContent table tbody tr:nth-child(even) { background: rgba(255,255,255,0.01); }
#outputContent table th:first-child,
#outputContent table td:first-child { color: var(--text-secondary); opacity: 0.6; font-size: 0.72rem; }