/* ===========================
   Code Editor
   =========================== */

.editor-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.editor-toolbar-left,
.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-toolbar .file-name {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
}

.editor-toolbar .file-lang {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
}

.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-gutter {
  min-width: 50px;
  background: #0d0f14;
  padding: 16px 0;
  text-align: right;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}

.editor-gutter .line-num {
  display: block;
  padding: 0 12px 0 8px;
}

.editor-gutter .line-num.active {
  color: var(--text);
  background: rgba(108, 92, 231, 0.1);
}

.editor-textarea {
  flex: 1;
  background: #0a0c10;
  padding: 16px;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  min-height: 300px;
}

.editor-textarea::placeholder {
  color: var(--text3);
}

/* --- Unsaved Indicator --- */

.editor-unsaved {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 500;
}

.editor-unsaved::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

/* --- Saved Flash --- */

.editor-saved {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  animation: savedFlash 1.5s ease forwards;
}

.editor-saved::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

@keyframes savedFlash {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Diff Viewer --- */

.diff-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.diff-body {
  background: #0a0c10;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  max-height: 500px;
}

.diff-line {
  padding: 0 16px;
  white-space: pre;
}

.diff-line.added {
  background: rgba(0, 184, 148, 0.1);
  color: var(--green);
}

.diff-line.removed {
  background: rgba(225, 112, 85, 0.1);
  color: var(--red);
}

.diff-line.context {
  color: var(--text3);
}

.diff-line .line-number {
  display: inline-block;
  min-width: 3ch;
  color: var(--text3);
  user-select: none;
  margin-right: 12px;
  text-align: right;
}
