/* TipTap Editor Styles */
.tiptap-wrapper {
  width: 100%;
}

.tiptap-editor {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.25rem;
  background-color: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
  outline: none;
  transition: border-color 0.2s;

  height: 100%;
}

.tiptap-editor:focus {
  /* border-color: var(--ring); */
}

.tiptap-editor[contenteditable='false'] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Caret color styling */
.tiptap-editor.caret-accent {
  caret-color: var(--terminal-accent);
}

.tiptap-editor.caret-error {
  caret-color: var(--terminal-error);
}

/* Placeholder (https://tiptap.dev/docs/editor/extensions/functionality/placeholder) */
.tiptap p.is-editor-empty:first-child::before {
  color: var(--terminal-fg-dim);
  padding-left: 0.25rem;
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

/* Basic typography */
.tiptap-editor p {
  margin: 0;
}

.tiptap-editor p + p {
  margin-top: 0.5em;
}

/* Markdown syntax highlighting styles */
.markdown-syntax {
  opacity: 0.5;
  color: var(--muted-foreground);
}

.markdown-syntax-bold {
  color: var(--terminal-accent);
}

.markdown-syntax-italic {
  color: var(--terminal-accent-alt);
}

.markdown-syntax-strike {
  color: var(--terminal-error);
}

.markdown-syntax-code {
  color: var(--terminal-success);
}

/* Heading syntax markers */
.markdown-syntax-heading-1,
.markdown-syntax-heading-2,
.markdown-syntax-heading-3,
.markdown-syntax-heading-4,
.markdown-syntax-heading-5,
.markdown-syntax-heading-6 {
  color: var(--terminal-accent);
  opacity: 0.5;
}

/* List syntax markers */
.markdown-syntax-list {
  color: var(--terminal-accent-alt);
  opacity: 0.5;
}

/* Code block markers */
.markdown-syntax-codeblock {
  color: var(--terminal-success);
  opacity: 0.5;
}

.markdown-codeblock-lang {
  color: var(--terminal-accent);
  opacity: 0.7;
}

.markdown-codeblock-content {
  font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* Markdown content styles */
.markdown-bold {
  color: var(--terminal-accent);
  font-weight: 700;
}

.markdown-italic {
  font-style: italic;
  color: var(--terminal-accent-alt);
}

.markdown-strike {
  text-decoration: line-through;
}

.markdown-code {
  font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', Consolas, 'Courier New', monospace;
  color: var(--terminal-success);
  background-color: var(--muted);
  border-radius: 0.25rem;
}

/* Heading content styles */
.markdown-heading-1 {
  font-weight: 700;
}

.markdown-heading-2 {
  font-weight: 700;
}

.markdown-heading-3 {
  font-weight: 600;
}

.markdown-heading-4 {
  font-weight: 600;
}

.markdown-heading-5 {
  font-weight: 600;
}

.markdown-heading-6 {
  font-weight: 600;
}

/* Code block styles */
.tiptap-editor pre {
  background-color: var(--terminal-background, #000000);
  color: var(--terminal-foreground, #ffffff);
  font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.tiptap-editor pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Syntax highlighting theme - Terminal colors */
.hljs-comment,
.hljs-quote {
  color: var(--terminal-fg-dim);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
  color: var(--terminal-warning);
}

.hljs-number,
.hljs-string,
.hljs-meta .hljs-string,
.hljs-literal,
.hljs-doctag,
.hljs-regexp {
  color: var(--terminal-success);
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
  color: var(--terminal-accent);
}

.hljs-attribute,
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-class .hljs-title,
.hljs-type {
  color: var(--terminal-warning);
}

.hljs-symbol,
.hljs-bullet,
.hljs-subst,
.hljs-meta,
.hljs-link {
  color: var(--terminal-accent-alt);
}

.hljs-built_in {
  color: var(--terminal-accent-alt);
}

.hljs-deletion {
  color: var(--terminal-error);
  text-decoration: line-through;
}

.hljs-insertion,
.hljs-addition {
  color: var(--terminal-success);
  text-decoration: underline;
}

.hljs-function {
  color: var(--terminal-accent-alt);
}

.hljs-punctuation {
  color: var(--terminal-fg);
}

.hljs-operator,
.hljs-entity,
.hljs-url {
  color: var(--terminal-accent-alt);
}

.hljs-property,
.hljs-tag,
.hljs-boolean,
.hljs-constant {
  color: var(--terminal-accent);
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

/* Mention styles */
.tiptap-editor .mention {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  margin: 0 0.125rem;
  /* background-color: var(--terminal-bg-alt); */
  color: var(--terminal-accent);
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid var(--terminal-accent);
  user-select: none;
}

.tiptap-editor .mention:hover {
  background-color: var(--terminal-accent);
  color: var(--terminal-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tiptap-editor .mention:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* React NodeView wrapper alignment fix */
.tiptap-editor .react-renderer {
  display: inline-flex;
  vertical-align: middle;
}
