/*
 * TipTap editor styles
 */

/* ── Barre d'outils ─────────────────────────────────────────── */

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background-color: #e5e7eb;
  color: #111827;
}

.toolbar-btn.is-active {
  background-color: #111827;
  color: #ffffff;
}

.toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 1.5rem;
  background-color: #d1d5db;
  margin: 0 0.25rem;
  vertical-align: middle;
}

/* ── Dark mode toolbar ──────────────────────────────────────── */

.dark .toolbar-btn {
  color: #d1d5db;
}

.dark .toolbar-btn:hover {
  background-color: #374151;
  color: #f9fafb;
}

.dark .toolbar-btn.is-active {
  background-color: #e5e7eb;
  color: #111827;
}

.dark .toolbar-sep {
  background-color: #4b5563;
}

/* ── Zone d'édition TipTap ──────────────────────────────────── */

.tiptap {
  outline: none;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: #111827;
  min-height: 20rem;
}

.dark .tiptap {
  color: #f3f4f6;
}

.tiptap p {
  margin-bottom: 1rem;
}

.tiptap h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
}

.tiptap h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.tiptap h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.tiptap ul {
  list-style-type: disc;
  margin: 0.75rem 0 0.75rem 1.5rem;
}

.tiptap ol {
  list-style-type: decimal;
  margin: 0.75rem 0 0.75rem 1.5rem;
}

.tiptap li {
  margin-bottom: 0.25rem;
}

.tiptap blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  font-style: italic;
  color: #4b5563;
  margin: 1.25rem 0;
}

.dark .tiptap blockquote {
  border-left-color: #4b5563;
  color: #9ca3af;
}

.tiptap hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2rem 0;
}

.dark .tiptap hr {
  border-top-color: #374151;
}

.tiptap img {
  max-width: 100%;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Alignement des images dans l'éditeur */
.tiptap img[style*="text-align: center"],
.tiptap p[style*="text-align: center"] img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.tiptap p[style*="text-align: right"] img {
  display: block;
  margin-left: auto;
}

.tiptap iframe {
  width: 100%;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

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

/* ── Rendu article (.tiptap-content) ────────────────────────── */

.tiptap-content {
  font-family: "Space Grotesk", sans-serif;
}

.tiptap-content p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
}

.tiptap-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: #111827;
}

.tiptap-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
  color: #111827;
}

.tiptap-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: #111827;
}

.dark .tiptap-content h2,
.dark .tiptap-content h3,
.dark .tiptap-content h4 {
  color: #f3f4f6;
}

.tiptap-content ul {
  list-style-type: disc;
  margin: 1rem 0 1rem 1.5rem;
}

.tiptap-content ol {
  list-style-type: decimal;
  margin: 1rem 0 1rem 1.5rem;
}

.tiptap-content li {
  margin-bottom: 0.25rem;
  line-height: 1.6;
}

.tiptap-content blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1.25rem;
  font-style: italic;
  color: #4b5563;
  margin: 1.5rem 0;
}

.dark .tiptap-content blockquote {
  border-left-color: #4b5563;
  color: #9ca3af;
}

.tiptap-content hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2rem 0;
}

.dark .tiptap-content hr {
  border-top-color: #374151;
}

.tiptap-content img {
  max-width: 100%;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  display: block;
}

/* Alignement des images (text-align appliqué directement sur <img> par TipTap) */
.tiptap-content img[style*="text-align: center"],
.tiptap-content img[style*="text-align:center"] {
  margin-left: auto;
  margin-right: auto;
}

.tiptap-content img[style*="text-align: right"],
.tiptap-content img[style*="text-align:right"] {
  margin-left: auto;
  margin-right: 0;
}

.tiptap-content img[style*="text-align: left"],
.tiptap-content img[style*="text-align:left"] {
  margin-left: 0;
  margin-right: auto;
}

.tiptap-content iframe {
  width: 100%;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.tiptap-content strong {
  font-weight: 700;
}

.tiptap-content em {
  font-style: italic;
}

.tiptap-content s {
  text-decoration: line-through;
}
