/* Rich text + voicenote styling for message/comment/DM/note bodies.
   Mirrors the established .news-feed-rendered (news_feed.css) and
   .message-content (ask_ai.css) typography so authored markdown reads
   consistently across the app. Loaded globally via the layout. */

/* ── Rendered markdown bodies (.rich-body) ──────────────────────────────── */
.rich-body > :first-child { margin-top: 0; }
.rich-body > :last-child { margin-bottom: 0; }

.rich-body p { margin-bottom: 0.5rem; }

.rich-body h1, .rich-body h2, .rich-body h3,
.rich-body h4, .rich-body h5, .rich-body h6 {
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
  line-height: 1.3;
}
.rich-body h1 { font-size: 1.35rem; }
.rich-body h2 { font-size: 1.2rem; }
.rich-body h3 { font-size: 1.08rem; }
.rich-body h4, .rich-body h5, .rich-body h6 { font-size: 1rem; }

.rich-body ul, .rich-body ol { padding-left: 1.4rem; margin-bottom: 0.5rem; }
.rich-body li { margin-bottom: 0.15rem; }

.rich-body a { color: #0066cc; text-decoration: underline; }

/* Inline code + fenced blocks (GitHub-ish, matches news_feed.css) */
.rich-body code {
  background: #f6f8fa;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: 'Monaco', 'Consolas', 'SFMono-Regular', monospace;
}
.rich-body pre {
  background: #f6f8fa;
  padding: 0.7rem 0.85rem;
  border-radius: 0.4rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}
.rich-body pre code { background: transparent; padding: 0; font-size: 0.85em; }

.rich-body blockquote {
  border-left: 3px solid #d0d7de;
  padding-left: 0.75rem;
  color: #57606a;
  margin: 0.5rem 0;
}

/* Tables — render_workspace_body adds .table.table-sm; ensure consistent
   borders/spacing even if those classes change. */
.rich-body table { margin: 0.5rem 0; font-size: 0.9rem; }
.rich-body th, .rich-body td {
  border: 1px solid #d0d7de;
  padding: 0.35rem 0.6rem;
}
.rich-body th { background: #f6f8fa; font-weight: 600; }

/* Dark theme */
:root[data-theme="dark"] .rich-body code,
:root[data-theme="dark"] .rich-body pre { background: rgba(255, 255, 255, 0.07); }
:root[data-theme="dark"] .rich-body pre code { background: transparent; }
:root[data-theme="dark"] .rich-body blockquote { border-left-color: rgba(255, 255, 255, 0.2); color: #adb5bd; }
:root[data-theme="dark"] .rich-body th { background: rgba(255, 255, 255, 0.07); }
:root[data-theme="dark"] .rich-body th,
:root[data-theme="dark"] .rich-body td { border-color: rgba(255, 255, 255, 0.15); }
:root[data-theme="dark"] .rich-body a { color: #6ea8fe; }

/* ── Voicenote player pill (.voicenote) ─────────────────────────────────── */
/* A themed container around the native <audio> so it reads as an app element
   rather than a raw browser control. */
.voicenote {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 320px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  background: #f8f9fa;
}
.voicenote__row { display: flex; align-items: center; gap: 0.5rem; }
.voicenote__icon {
  flex: 0 0 auto;
  width: 1.6rem; height: 1.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  font-size: 0.75rem;
}
.voicenote audio { height: 32px; max-width: 220px; }
.voicenote__caption { line-height: 1.35; }

/* On a dark message bubble (mine) the pill inverts. */
.voicenote--on-dark {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

:root[data-theme="dark"] .voicenote {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}
