/* Trix Editor Styles */

/* Fix missing Trix icons - use text labels instead */
trix-toolbar .trix-button--icon-bold::before { content: "B"; font-weight: bold; }
trix-toolbar .trix-button--icon-italic::before { content: "I"; font-style: italic; }
trix-toolbar .trix-button--icon-strike::before { content: "S"; text-decoration: line-through; }
trix-toolbar .trix-button--icon-link::before { content: "🔗"; }
trix-toolbar .trix-button--icon-heading-1::before { content: "H1"; font-weight: bold; }
trix-toolbar .trix-button--icon-quote::before { content: '"'; font-size: 1.2em; }
trix-toolbar .trix-button--icon-code::before { content: "<>"; font-family: monospace; }
trix-toolbar .trix-button--icon-bullet-list::before { content: "• ≡"; }
trix-toolbar .trix-button--icon-number-list::before { content: "1. ≡"; }
trix-toolbar .trix-button--icon-decrease-nesting-level::before { content: "←"; }
trix-toolbar .trix-button--icon-increase-nesting-level::before { content: "→"; }
trix-toolbar .trix-button--icon-attach::before { content: "📎"; }
trix-toolbar .trix-button--icon-undo::before { content: "↶"; }
trix-toolbar .trix-button--icon-redo::before { content: "↷"; }

/* Extension buttons */
trix-toolbar .trix-button--icon-emoji { font-size: 18px; }
trix-toolbar .trix-button--icon-checkbox { font-size: 18px; }

trix-toolbar .trix-button--icon::before {
  display: inline-block;
  font-size: 0.8em;
  line-height: 1;
}

/* Toolbar tooltips - custom tooltips positioned on top */
trix-toolbar .trix-button {
  position: relative;
  min-width: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Tooltip element created by JavaScript */
.trix-tooltip-top {
  position: absolute;
  bottom: 100% !important;
  top: auto !important;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  font-weight: normal;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 10000 !important;
  line-height: 1.4;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  margin-bottom: 5px;
}

/* Show tooltip on button hover */
trix-toolbar .trix-button:hover .trix-tooltip-top {
  opacity: 1 !important;
}

/* Trix toolbar container */
trix-toolbar {
  overflow-x: auto;
  overflow-y: visible;
  flex-wrap: nowrap;
}

trix-toolbar .trix-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* Editor container height - fixed height with scroll */
trix-editor {
  height: 600px !important;
  max-height: 600px !important;
  overflow-y: auto !important;
  padding: 1rem !important;
}

/* Basic editor styling */
.trix-content {
  outline: none;
  line-height: 1.75;
  color: #1f2937;
}

/* Paragraphs */
.trix-content p {
  margin-bottom: 1rem;
}

.trix-content p:last-child {
  margin-bottom: 0;
}

/* Lists */
.trix-content ul,
.trix-content ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.trix-content ul {
  list-style-type: disc;
}

.trix-content ol {
  list-style-type: decimal;
}

.trix-content ul li,
.trix-content ol li {
  margin: 0.25rem 0;
}

/* Headings */
.trix-content h1,
.trix-content h2,
.trix-content h3,
.trix-content h4,
.trix-content h5,
.trix-content h6 {
  line-height: 1.25;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.trix-content h1 {
  font-size: 2.25rem;
  color: #4c1d95; /* violet-900 - très foncé */
}

.trix-content h2 {
  font-size: 1.875rem;
  color: #7c3aed; /* violet-600 - moyen */
}

.trix-content h3 {
  font-size: 1.5rem;
  color: #a78bfa; /* violet-400 - clair */
}

.trix-content h4 {
  font-size: 1.25rem;
  color: #c4b5fd; /* violet-300 */
}

.trix-content h5 {
  font-size: 1.125rem;
  color: #c4b5fd; /* violet-300 */
}

.trix-content h6 {
  font-size: 1rem;
  color: #c4b5fd; /* violet-300 */
}

/* Links */
.trix-content a {
  color: #3b82f6;
  text-decoration: underline;
  cursor: pointer;
}

.trix-content a:hover {
  color: #1e40af;
}

/* Blockquote styling */
.trix-content blockquote {
  padding-left: 1rem;
  border-left: 3px solid #d1d5db;
  margin: 1rem 0;
  color: #6b7280;
  font-style: italic;
}

/* Code styling */
.trix-content code {
  background-color: #e2e8f0;
  color: #1e293b;
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-family: monospace;
  font-size: 0.875em;
}

.trix-content pre {
  background: #1e293b;
  color: #e2e8f0;
  font-family: monospace;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1rem 0;
}

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

/* Horizontal rule */
.trix-content hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 2rem 0;
}

/* Strong/Bold */
.trix-content strong {
  font-weight: 700;
}

/* Italic */
.trix-content em {
  font-style: italic;
}

/* Strikethrough */
.trix-content del {
  text-decoration: line-through;
}

/* Focus styles */
.trix-content:focus {
  outline: none;
}

/* Selection */
.trix-content ::selection {
  background-color: #bfdbfe;
}

/* Interactive checkboxes */
.trix-content .checkbox-unchecked,
.trix-content .checkbox-checked {
  cursor: pointer;
  user-select: none;
  font-size: 1.1em;
}

.trix-content .checkbox-unchecked:hover,
.trix-content .checkbox-checked:hover {
  opacity: 0.7;
}

/* ==================== DARK MODE ==================== */

/* Dark mode for trix-toolbar - use !important to override CDN styles */
.dark trix-toolbar {
  background-color: #374151 !important; /* gray-700 */
  border-color: #4b5563 !important; /* gray-600 */
}

.dark trix-toolbar .trix-button-row {
  background-color: #374151 !important;
}

.dark trix-toolbar .trix-button-group {
  background-color: #374151 !important;
  border-color: #4b5563 !important;
}

.dark trix-toolbar .trix-button-group--block-tools,
.dark trix-toolbar .trix-button-group--text-tools,
.dark trix-toolbar .trix-button-group--history-tools,
.dark trix-toolbar .trix-button-group--file-tools {
  background-color: #374151 !important;
}

.dark trix-toolbar .trix-button {
  background-color: #4b5563 !important;
  border-color: #6b7280 !important;
  color: #e5e7eb !important; /* gray-200 */
}

.dark trix-toolbar .trix-button:not(:disabled) {
  background-color: #4b5563 !important;
}

.dark trix-toolbar .trix-button:hover:not(:disabled) {
  background-color: #6b7280 !important;
}

.dark trix-toolbar .trix-button.trix-active {
  background-color: #6366f1 !important; /* indigo-500 */
  color: white !important;
}

.dark trix-toolbar .trix-button--icon::before {
  color: #e5e7eb !important;
}

/* Dark mode for editor content */
.dark .trix-content {
  color: #e5e7eb; /* gray-200 */
}

.dark .trix-content h1 {
  color: #c4b5fd; /* violet-300 */
}

.dark .trix-content h2 {
  color: #a78bfa; /* violet-400 */
}

.dark .trix-content h3 {
  color: #8b5cf6; /* violet-500 */
}

.dark .trix-content a {
  color: #60a5fa; /* blue-400 */
}

.dark .trix-content a:hover {
  color: #93c5fd; /* blue-300 */
}

.dark .trix-content blockquote {
  border-left-color: #6b7280;
  color: #9ca3af; /* gray-400 */
}

.dark .trix-content code {
  background-color: #374151;
  color: #f9fafb;
}

.dark .trix-content pre {
  background-color: #1f2937;
  color: #f3f4f6;
}

.dark .trix-content hr {
  border-top-color: #4b5563;
}

.dark .trix-content ::selection {
  background-color: #4338ca; /* indigo-700 */
}

/* Dark mode dialogs */
.dark trix-toolbar .trix-dialog {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark trix-toolbar .trix-dialog input[type="text"],
.dark trix-toolbar .trix-dialog input[type="url"] {
  background-color: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark trix-toolbar .trix-dialog .trix-button-group .trix-button {
  background-color: #4b5563;
  color: #e5e7eb;
}
