/**
 * TipTap Editor Styles for Nigerian Blog Platform
 */

/* Editor toolbar buttons */
.editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.375rem;
  background-color: transparent;
  color: #4b5563;
  transition: all 0.2s;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.editor-btn:hover {
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

.editor-btn:active,
.editor-btn.is-active {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

.dark .editor-btn {
  color: #9ca3af;
}

.dark .editor-btn:hover {
  background-color: #374151;
  border-color: #4b5563;
}

.dark .editor-btn:active,
.dark .editor-btn.is-active {
  background-color: #059669;
  color: white;
  border-color: #059669;
}

/* Editor content styles */
.ProseMirror {
  outline: none;
  min-height: 500px;
  padding: 1rem;
}

.ProseMirror:focus {
  outline: none;
}

.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #adb5bd;
  pointer-events: none;
  height: 0;
}

/* Prose styles for dark mode */
.dark .prose {
  color: #e5e7eb;
}

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4,
.dark .prose h5,
.dark .prose h6 {
  color: #f9fafb;
}

.dark .prose strong {
  color: #f9fafb;
  font-weight: 700;
}

.dark .prose a {
  color: #34d399;
}

.dark .prose code {
  color: #fca5a5;
  background-color: #374151;
}

.dark .prose pre {
  background-color: #1f2937;
  color: #e5e7eb;
}

.dark .prose blockquote {
  color: #9ca3af;
  border-left-color: #4b5563;
}

.dark .prose hr {
  border-color: #374151;
}

/* Headings */
.ProseMirror h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.2;
  color: #111827;
}

.dark .ProseMirror h1 {
  color: #f9fafb;
}

.ProseMirror h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.875rem;
  line-height: 1.3;
  color: #111827;
}

.dark .ProseMirror h2 {
  color: #f9fafb;
}

.ProseMirror h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  color: #111827;
}

.dark .ProseMirror h3 {
  color: #f9fafb;
}

/* Paragraphs */
.ProseMirror p {
  margin-bottom: 1rem;
  line-height: 1.75;
  color: #374151;
}

.dark .ProseMirror p {
  color: #e5e7eb;
}

/* Code blocks */
.ProseMirror pre {
  background: #1f2937;
  color: #e5e7eb;
  font-family: "JetBrainsMono", "Courier New", "Courier", monospace;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.ProseMirror pre code {
  background: none;
  color: inherit;
  font-size: 0.875rem;
  padding: 0;
  border-radius: 0;
}

.ProseMirror code {
  background-color: #f3f4f6;
  color: #ef4444;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: "Courier New", Courier, monospace;
}

.dark .ProseMirror code {
  background-color: #374151;
  color: #fca5a5;
}

/* Blockquote */
.ProseMirror blockquote {
  border-left: 4px solid #10b981;
  padding-left: 1rem;
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  color: #6b7280;
  margin: 1.5rem 0;
}

.dark .ProseMirror blockquote {
  border-left-color: #059669;
  color: #9ca3af;
}

/* Horizontal rule */
.ProseMirror hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2rem 0;
}

.dark .ProseMirror hr {
  border-top-color: #374151;
}

/* Lists */
.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.ProseMirror ul {
  list-style-type: disc;
}

.ProseMirror ol {
  list-style-type: decimal;
}

.ProseMirror li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
  color: #374151;
}

.dark .ProseMirror li {
  color: #e5e7eb;
}

.ProseMirror ul ul,
.ProseMirror ol ul {
  list-style-type: circle;
}

.ProseMirror ul ul ul,
.ProseMirror ol ul ul,
.ProseMirror ol ol ul {
  list-style-type: square;
}

/* Links */
.ProseMirror a {
  color: #10b981;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s;
}

.ProseMirror a:hover {
  color: #059669;
}

.dark .ProseMirror a {
  color: #34d399;
}

.dark .ProseMirror a:hover {
  color: #10b981;
}

/* Selection */
.ProseMirror ::selection {
  background-color: rgba(16, 185, 129, 0.3);
}

.dark .ProseMirror ::selection {
  background-color: rgba(52, 211, 153, 0.3);
}

/* Images */
.ProseMirror img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  display: block;
}

/* Tables */
.ProseMirror table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  margin: 1.5rem 0;
  overflow: hidden;
}

.ProseMirror table td,
.ProseMirror table th {
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  vertical-align: top;
  box-sizing: border-box;
  position: relative;
  min-width: 1em;
}

.dark .ProseMirror table td,
.dark .ProseMirror table th {
  border-color: #374151;
}

.ProseMirror table th {
  font-weight: 600;
  text-align: left;
  background-color: #f9fafb;
  color: #111827;
}

.dark .ProseMirror table th {
  background-color: #1f2937;
  color: #f9fafb;
}

/* Empty node placeholder */
.ProseMirror .is-empty::before {
  content: attr(data-placeholder);
  float: left;
  color: #9ca3af;
  pointer-events: none;
  height: 0;
}

/* Focus styles */
.ProseMirror-focused {
  outline: none;
}

/* Loading spinner for image uploads */
.image-uploading {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}

.image-uploading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid #f3f4f6;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Toolbar container */
.editor-toolbar {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  background-color: #ffffff;
}

.dark .editor-toolbar {
  border-bottom-color: #374151;
  background-color: #1f2937;
}

/* Editor container */
.editor-container {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #ffffff;
}

.dark .editor-container {
  border-color: #374151;
  background-color: #1f2937;
}

/* Print styles */
@media print {
  .editor-toolbar,
  .editor-btn {
    display: none !important;
  }

  .ProseMirror {
    border: none !important;
    padding: 0 !important;
  }
}
