/* Estilos específicos do editor Tiptap/ProseMirror */

.ProseMirror {
  outline: none;
}

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

.ProseMirror img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  border-radius: 0.5rem;
}

.ProseMirror img.ProseMirror-selectednode {
  outline: 3px solid #68cef8;
}

/* ─── Tabelas ─── */

.ProseMirror table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  table-layout: fixed;
  overflow: hidden;
}

.ProseMirror table td,
.ProseMirror table th {
  min-width: 2rem;
  border: 1px solid #d1d5db; /* zinc-300 */
  padding: 0.5rem 0.75rem;
  vertical-align: top;
  position: relative;
  box-sizing: border-box;
}

.dark .ProseMirror table td,
.dark .ProseMirror table th {
  border-color: #3f3f46; /* zinc-700 */
}

.ProseMirror table th {
  background-color: #f4f4f5; /* zinc-100 */
  font-weight: 600;
  text-align: left;
}

.dark .ProseMirror table th {
  background-color: #27272a; /* zinc-800 */
}

/* Célula selecionada */
.ProseMirror table .selectedCell::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: rgba(59, 130, 246, 0.15); /* blue-500/15 */
  pointer-events: none;
}

/* Handle de resize */
.ProseMirror table .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #3b82f6; /* blue-500 */
  cursor: col-resize;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

.ProseMirror table td:hover .column-resize-handle,
.ProseMirror table th:hover .column-resize-handle {
  opacity: 1;
}

.ProseMirror.resize-cursor {
  cursor: col-resize;
}

/* ─── Tabelas no conteúdo renderizado (posts, ebooks) ─── */

.rich-text-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  table-layout: auto;
}

.rich-text-content table td,
.rich-text-content table th {
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.75rem;
  vertical-align: top;
}

.dark .rich-text-content table td,
.dark .rich-text-content table th {
  border-color: #3f3f46;
}

.rich-text-content table th {
  background-color: #f4f4f5;
  font-weight: 600;
  text-align: left;
}

.dark .rich-text-content table th {
  background-color: #27272a;
}

.rich-text-content table tr:nth-child(even) td {
  background-color: #fafafa;
}

.dark .rich-text-content table tr:nth-child(even) td {
  background-color: #18181b; /* zinc-900 */
}
