/* Book Reader Text Color System - Exact Spec */

:root {
  --br-text-primary: #111827;
  --br-text-muted: #5b6472;
  --br-text-soft: rgba(17, 24, 39, 0.95);
  --br-link: #f6416c;
  --br-pdf: #dc2626;
  --br-epub: #9333ea;
  --br-code-label: #374151;
  --br-code-text: #1f2937;
  --br-output-label: #0d9488;
  --br-toast-text: #0f172a;
  --br-inline-code-bg: #f8f3d4;
}

[data-theme="dark"] {
  --br-text-primary: #dde6ed;
  --br-text-muted: #c6d2db;
  --br-text-soft: rgba(221, 230, 237, 0.9);
  --br-link: #ffb33f;
  --br-pdf: #dc2626;
  --br-epub: #9333ea;
  --br-code-label: #e5e7eb;
  --br-code-text: #f1f5f9;
  --br-output-label: #2dd4bf;
  --br-toast-text: #0f172a;
  --br-inline-code-bg: #3a4f66;
}

/* Page-level */
body {
  color: var(--br-text-primary) !important;
}

/* Sidebar */
.sidebar-main-title,
.sidebar-select,
.search-input,
.search-count,
.download-title {
  color: var(--br-text-primary) !important;
}

.sidebar-label,
#searchResults,
.search-summary,
.search-navigation button,
.stat-line,
.toc-item-new.coming-soon {
  color: var(--br-text-muted) !important;
}

.toc-item-new {
  color: var(--br-text-primary) !important;
}

.toc-item-new:hover,
.toc-item-new.active {
  color: var(--br-link) !important;
}

.toc-badge-new {
  color: #111827 !important;
}

[data-theme="dark"] .toc-badge-new {
  color: #dde6ed !important;
}

.download-pdf,
.download-option.pdf-option,
.download-pdf-btn {
  color: var(--br-pdf) !important;
}

.download-epub,
.download-option.epub-option,
.download-epub-btn {
  color: var(--br-epub) !important;
}

/* Toolbar */
.toolbar-now-reading {
  color: var(--br-text-muted) !important;
}

.toolbar-book-title-new {
  color: var(--br-text-primary) !important;
}

.toolbar-icon-btn {
  background-color: transparent !important;
  color: var(--br-text-primary) !important;
}

.toolbar-icon-btn:hover {
  background-color: transparent !important;
  color: var(--br-link) !important;
}

.toolbar-icon-btn.active {
  background-color: #f6416c !important;
  color: #ffffff !important;
}

[data-theme="dark"] .toolbar-icon-btn.active {
  background-color: #ffb33f !important;
  color: #27374d !important;
}

/* Reader prose */
.reader-prose,
.reader-prose p,
.reader-prose li {
  color: var(--br-text-soft) !important;
}

.reader-prose h1,
.reader-prose h2,
.reader-prose h3,
.reader-prose h4,
.reader-prose h5,
.reader-prose h6,
.reader-prose strong,
.reader-prose em,
.reader-prose th,
.reader-prose td,
.reader-prose blockquote,
.reader-prose pre,
.reader-prose pre code {
  color: var(--br-text-primary) !important;
}

.reader-prose a {
  color: var(--br-link) !important;
  text-decoration: underline dotted !important;
}

.reader-prose code {
  color: var(--br-text-primary) !important;
  background-color: var(--br-inline-code-bg) !important;
}

/* Python Code Editor */
.playground-header,
.python-runner-label {
  color: var(--br-code-label) !important;
}

.playground-btn.reset-btn,
.playground-btn.copy-btn,
.python-runner-btn {
  color: #6b7280 !important;
}

.playground-btn.run-btn {
  background-color: #14b8a6 !important;
  border-color: #14b8a6 !important;
  color: #ffffff !important;
}

.playground-code,
.python-runner-code {
  color: var(--br-code-text) !important;
}

[data-theme="dark"] .playground-code {
  background-color: #0f172a !important;
}

.python-output-label {
  color: var(--br-output-label) !important;
}

.playground-output,
.python-output-content {
  color: var(--br-code-text) !important;
}

/* States */
.welcome-message .text-muted,
#markdownContent .mt-2,
.search-summary {
  color: var(--br-text-muted) !important;
}

/* Error state inside reader */
.reader-error,
.reader-error * {
  color: #f6416c !important;
}

[data-theme="dark"] .reader-error,
[data-theme="dark"] .reader-error * {
  color: #f98f8f !important;
}

/* Toast text color spec */
.toolbar-notification,
.book-reader-toast {
  color: var(--br-toast-text) !important;
}
