/* ==========================================================================
   rich-editor.css — Lightweight WYSIWYG editor styles
   UI/UX Pro Max — Notion/Linear-level rich text editing
   ========================================================================== */

.rich-editor {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  background: var(--surface, #fff);
}

/* ---------- Toolbar ---------- */
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 8px;
  background: #F9FAFB;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
}

.rich-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: none;
  border-radius: var(--radius, 6px);
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 150ms ease;
  line-height: 1;
}

.rich-toolbar button:hover {
  background: var(--gray-200, #e2e8f0);
  color: var(--text, #1e293b);
}

.rich-toolbar button:focus-visible {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.rich-toolbar button:active {
  background: #EEF2FF;
  color: #6366F1;
  transform: scale(0.95);
}

.rich-toolbar button.active {
  background: #EEF2FF;
  color: #6366F1;
}

.rich-toolbar .toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border-light, #f1f5f9);
  margin: 6px 4px;
  flex-shrink: 0;
}

/* ---------- Content Area ---------- */
.rich-content {
  min-height: 180px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text, #1e293b);
  outline: none;
  word-break: break-word;
}

.rich-content:focus {
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.rich-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted, #64748b);
  pointer-events: none;
}

/* Formatting inside rich-content */
.rich-content h2 {
  font-size: 1.25em;
  font-weight: 700;
  margin: 0.8em 0 0.4em;
  letter-spacing: -0.01em;
}

.rich-content h3 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0.6em 0 0.3em;
  letter-spacing: -0.01em;
}

.rich-content ul, .rich-content ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
}

.rich-content li {
  margin: 0.2em 0;
  line-height: 1.6;
}

.rich-content li::marker {
  color: #6366F1;
}

.rich-content blockquote {
  margin: 0.5em 0;
  padding: 0.4em 0.8em;
  border-left: 3px solid #6366F1;
  background: rgba(99, 102, 241, 0.03);
  color: var(--text-muted, #64748b);
  border-radius: 0 4px 4px 0;
}

.rich-content code {
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 0.88em;
  padding: 2px 5px;
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary-600, #4f46e5);
  border-radius: 4px;
}

.rich-content pre {
  background: #1E293B;
  color: #CDD6F4;
  border-radius: var(--radius, 6px);
  padding: 0.8em 1em;
  overflow-x: auto;
  margin: 0.5em 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.rich-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.rich-content a {
  color: #6366F1;
  text-decoration: underline;
  text-decoration-color: rgba(99, 102, 241, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 150ms ease;
}

.rich-content a:hover {
  text-decoration-color: #6366F1;
}

.rich-content hr {
  border: none;
  border-top: 1px solid var(--border-light, #f1f5f9);
  margin: 0.8em 0;
}

.rich-content p {
  margin: 0.3em 0;
}

.rich-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0;
}

.rich-content th, .rich-content td {
  border: 1px solid var(--border, #e2e8f0);
  padding: 6px 10px;
  font-size: 13px;
}

.rich-content th {
  background: #F9FAFB;
  font-weight: 600;
}

/* Selection styling */
.rich-content ::selection {
  background: rgba(99, 102, 241, 0.15);
}
