/* ==========================================================================
   Tiptap / ProseMirror content styling
   Scoped under .tiptap-editor so it never leaks into the rest of the app.
   Uses Tailwind v4 CSS variables (--color-*) where available, with plain
   hex fallbacks so this still works if your tokens differ.
   ========================================================================== */

.tiptap-editor .ProseMirror {
  outline: none;
  min-height: var(--editor-min-height, 200px);
  padding: 0.75rem 1rem;
  color: #18181b;
  font-size: 0.9375rem;
  line-height: 1.65;
  word-wrap: break-word;
}

@media (min-width: 640px) {
  .tiptap-editor .ProseMirror {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
}

.dark .tiptap-editor .ProseMirror {
  color: #f4f4f5;
}

/* Placeholder */
.tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
  color: #a1a1aa;
}

.dark .tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  color: #71717a;
}

/* Headings */
.tiptap-editor .ProseMirror h1,
.tiptap-editor .ProseMirror h2,
.tiptap-editor .ProseMirror h3,
.tiptap-editor .ProseMirror h4 {
  font-weight: 700;
  line-height: 1.25;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  color: inherit;
}

.tiptap-editor .ProseMirror h1:first-child,
.tiptap-editor .ProseMirror h2:first-child,
.tiptap-editor .ProseMirror h3:first-child {
  margin-top: 0;
}

.tiptap-editor .ProseMirror h1 {
  font-size: 1.75rem;
}
.tiptap-editor .ProseMirror h2 {
  font-size: 1.4rem;
}
.tiptap-editor .ProseMirror h3 {
  font-size: 1.15rem;
}
.tiptap-editor .ProseMirror h4 {
  font-size: 1rem;
}

@media (min-width: 640px) {
  .tiptap-editor .ProseMirror h1 {
    font-size: 2.1rem;
  }
  .tiptap-editor .ProseMirror h2 {
    font-size: 1.65rem;
  }
  .tiptap-editor .ProseMirror h3 {
    font-size: 1.3rem;
  }
}

/* Paragraphs */
.tiptap-editor .ProseMirror p {
  margin: 0.6em 0;
}

/* Links */
.tiptap-editor .ProseMirror a {
  color: #6366f1;
  text-decoration: underline;
  text-decoration-color: #c7d2fe;
  cursor: pointer;
}
.dark .tiptap-editor .ProseMirror a {
  color: #a5b4fc;
  text-decoration-color: #4338ca;
}

/* Bold / italic / strike / code */
.tiptap-editor .ProseMirror strong {
  font-weight: 700;
}
.tiptap-editor .ProseMirror em {
  font-style: italic;
}
.tiptap-editor .ProseMirror s {
  text-decoration: line-through;
}

.tiptap-editor .ProseMirror code {
  background-color: #f4f4f5;
  border-radius: 0.25rem;
  padding: 0.15em 0.4em;
  font-size: 0.85em;
  font-family: var(--, ui-monospace, SFMono-Regular, Menlo, monospace);
  color: #be123c;
}
.dark .tiptap-editor .ProseMirror code {
  background-color: #27272a;
  color: #fda4af;
}

/* Code blocks (lowlight) */
.tiptap-editor .ProseMirror pre {
  background-color: #18181b;
  color: #f4f4f5;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.85em 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

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

/* lowlight syntax token colors (hljs-* class names) */
.tiptap-editor .ProseMirror pre .hljs-comment,
.tiptap-editor .ProseMirror pre .hljs-quote {
  color: #71717a;
}
.tiptap-editor .ProseMirror pre .hljs-keyword,
.tiptap-editor .ProseMirror pre .hljs-selector-tag,
.tiptap-editor .ProseMirror pre .hljs-tag {
  color: #c084fc;
}
.tiptap-editor .ProseMirror pre .hljs-string,
.tiptap-editor .ProseMirror pre .hljs-attr,
.tiptap-editor .ProseMirror pre .hljs-template-tag {
  color: #86efac;
}
.tiptap-editor .ProseMirror pre .hljs-number,
.tiptap-editor .ProseMirror pre .hljs-literal {
  color: #fca5a5;
}
.tiptap-editor .ProseMirror pre .hljs-title,
.tiptap-editor .ProseMirror pre .hljs-section,
.tiptap-editor .ProseMirror pre .hljs-name {
  color: #93c5fd;
}

/* Blockquote */
.tiptap-editor .ProseMirror blockquote {
  border-left: 3px solid #d4d4d8;
  padding-left: 1rem;
  margin: 0.85em 0;
  color: #52525b;
  font-style: italic;
}
.dark .tiptap-editor .ProseMirror blockquote {
  border-left-color: #52525b;
  color: #a1a1aa;
}

/* Horizontal rule */
.tiptap-editor .ProseMirror hr {
  border: none;
  border-top: 2px solid #e4e4e7;
  margin: 1.5em 0;
}
.dark .tiptap-editor .ProseMirror hr {
  border-top-color: #3f3f46;
}

/* Lists */
.tiptap-editor .ProseMirror ul,
.tiptap-editor .ProseMirror ol {
  padding-left: 1.4rem;
  margin: 0.6em 0;
}
.tiptap-editor .ProseMirror ul {
  list-style-type: disc;
}
.tiptap-editor .ProseMirror ol {
  list-style-type: decimal;
}
.tiptap-editor .ProseMirror li {
  margin: 0.2em 0;
}
.tiptap-editor .ProseMirror li p {
  margin: 0;
}

/* Task list */
.tiptap-editor .ProseMirror ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0.25rem;
}
.tiptap-editor .ProseMirror ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.tiptap-editor .ProseMirror ul[data-type="taskList"] li > label {
  flex: 0 0 auto;
  margin-top: 0.2em;
  user-select: none;
}
.tiptap-editor .ProseMirror ul[data-type="taskList"] li > div {
  flex: 1 1 auto;
}
.tiptap-editor .ProseMirror ul[data-type="taskList"] input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: #6366f1;
}
.tiptap-editor .ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div {
  color: #a1a1aa;
  text-decoration: line-through;
}

/* Images */
.tiptap-editor .ProseMirror img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.75em 0;
  display: block;
}
.tiptap-editor .ProseMirror img.ProseMirror-selectednode {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Tables */
.tiptap-editor .ProseMirror .tableWrapper {
  overflow-x: auto;
  margin: 1em 0;
}

.tiptap-editor .ProseMirror table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  min-width: 320px;
}

.tiptap-editor .ProseMirror table td,
.tiptap-editor .ProseMirror table th {
  border: 1px solid #e4e4e7;
  padding: 0.45rem 0.6rem;
  vertical-align: top;
  position: relative;
  font-size: 0.875rem;
}
.dark .tiptap-editor .ProseMirror table td,
.dark .tiptap-editor .ProseMirror table th {
  border-color: #3f3f46;
}

.tiptap-editor .ProseMirror table th {
  background-color: #f4f4f5;
  font-weight: 600;
  text-align: left;
}
.dark .tiptap-editor .ProseMirror table th {
  background-color: #27272a;
}

.tiptap-editor .ProseMirror table .selectedCell {
  background-color: rgba(99, 102, 241, 0.12);
}

.tiptap-editor .ProseMirror table .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: -2px;
  width: 4px;
  background-color: #6366f1;
  pointer-events: none;
}

.tiptap-editor .ProseMirror table.resize-cursor {
  cursor: col-resize;
}

/* Subscript / superscript */
.tiptap-editor .ProseMirror sub {
  vertical-align: sub;
  font-size: 0.75em;
}
.tiptap-editor .ProseMirror sup {
  vertical-align: super;
  font-size: 0.75em;
}

/* Selection */
.tiptap-editor .ProseMirror ::selection {
  background-color: rgba(99, 102, 241, 0.25);
}

/* Gapcursor (shown around block-level void nodes like images/tables) */
.tiptap-editor .ProseMirror .ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: relative;
}
.tiptap-editor .ProseMirror .ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid #71717a;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}
.tiptap-editor .ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}
