/*
 * Rich text en las burbujas del chat de reservas (DPE-699).
 * Solo los admins escriben con formato (Lexxy en el inbox); esto lo pinta en el
 * inbox admin y en el chat web de conductores/anfitriones. Va con selectores
 * de `.chat-rich` para ganarle a trix-content / lexxy-content.
 */
.chat-rich {
  --highlight-1: rgb(136, 118, 38);
  --highlight-2: rgb(185, 94, 6);
  --highlight-3: rgb(207, 0, 0);
  --highlight-4: rgb(216, 28, 170);
  --highlight-5: rgb(144, 19, 254);
  --highlight-6: rgb(5, 98, 185);
  --highlight-7: rgb(17, 138, 15);
  --highlight-8: rgb(148, 82, 22);
  --highlight-9: rgb(102, 102, 102);
  --highlight-bg-1: rgba(229, 223, 6, 0.3);
  --highlight-bg-2: rgba(255, 185, 87, 0.3);
  --highlight-bg-3: rgba(255, 118, 118, 0.3);
  --highlight-bg-4: rgba(248, 137, 216, 0.3);
  --highlight-bg-5: rgba(190, 165, 255, 0.3);
  --highlight-bg-6: rgba(124, 192, 252, 0.3);
  --highlight-bg-7: rgba(140, 255, 129, 0.3);
  --highlight-bg-8: rgba(221, 170, 123, 0.3);
  --highlight-bg-9: rgba(200, 200, 200, 0.3);
  --chat-rich-link: #6d28d9;
  --chat-rich-rule: rgba(17, 24, 39, 0.12);
  --chat-rich-code-bg: rgba(17, 24, 39, 0.06);

  font-size: 14px;
  line-height: 1.6;
}

.chat-rich--dark {
  --chat-rich-link: #ffffff;
  --chat-rich-rule: rgba(255, 255, 255, 0.35);
  --chat-rich-code-bg: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.chat-rich--system {
  --chat-rich-link: #92400e;
  font-size: 12px;
  color: #92400e;
}

/* El texto toma el color de la burbuja aunque el layout pinte `p` u otros por
   su cuenta (en el chat web los párrafos salían oscuros sobre el morado). */
.chat-rich :is(p, li, span, em, i, strong, b, u, s, del, h1, h2, h3, h4, h5, h6, blockquote, figcaption, td, th, pre, code) {
  color: inherit;
}

.chat-rich .trix-content,
.chat-rich .lexxy-content {
  font: inherit;
  color: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
}

.chat-rich p { margin: 0; }
.chat-rich :is(ul, ol, blockquote, pre, table, figure, h1, h2, h3, h4) { margin: 0.35em 0; }
.chat-rich :is(ul, ol, blockquote, pre, table, figure, h1, h2, h3, h4):first-child { margin-top: 0; }
.chat-rich :is(ul, ol, blockquote, pre, table, figure, h1, h2, h3, h4):last-child { margin-bottom: 0; }

.chat-rich :is(h1, h2) { font-size: 1.2em; font-weight: 700; line-height: 1.3; }
.chat-rich :is(h3, h4) { font-size: 1.05em; font-weight: 700; line-height: 1.3; }

.chat-rich :is(strong, b) { font-weight: 700; }
.chat-rich :is(em, i) { font-style: italic; }
.chat-rich :is(s, del) { text-decoration: line-through; }

.chat-rich a {
  color: var(--chat-rich-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.chat-rich ul { list-style: disc; padding-left: 1.25em; }
.chat-rich ol { list-style: decimal; padding-left: 1.25em; }
.chat-rich li { margin: 0.15em 0; }

.chat-rich blockquote {
  border-left: 3px solid var(--chat-rich-rule);
  padding-left: 0.75em;
  opacity: 0.9;
}

.chat-rich code {
  background: var(--chat-rich-code-bg);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.3em;
}

.chat-rich pre {
  background: var(--chat-rich-code-bg);
  border-radius: 8px;
  overflow-x: auto;
  padding: 0.6em 0.8em;
  white-space: pre;
}

.chat-rich pre code { background: none; padding: 0; }

.chat-rich mark { background: var(--highlight-bg-1); color: inherit; border-radius: 2px; padding: 0 0.1em; }

.chat-rich hr { border: 0; border-top: 1px solid var(--chat-rich-rule); margin: 0.75em 0; }

.chat-rich table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
.chat-rich :is(th, td) { border: 1px solid var(--chat-rich-rule); padding: 0.3em 0.5em; text-align: left; }
.chat-rich th { font-weight: 700; }

.chat-rich img { border-radius: 10px; max-height: 240px; max-width: 100%; height: auto; }
.chat-rich figure { margin: 0 0 0.5em; }
.chat-rich figcaption { font-size: 0.85em; opacity: 0.75; margin-top: 0.25em; }

/* Compositor del inbox admin: Lexxy sin su borde (lo pone el contenedor) */
.chat-composer lexxy-editor.chat-composer__editor {
  --lexxy-editor-rows: 3lh;
  border: 0;
  border-radius: 1rem 1rem 0 0;
  background: transparent;
  font-size: 14px;
}

.chat-composer lexxy-editor.chat-composer__editor .lexxy-editor__content {
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  line-height: 1.6;
}

.chat-composer lexxy-editor.chat-composer__editor lexxy-toolbar {
  border-bottom: 1px solid rgb(243, 244, 246);
  padding: 0.25rem 0.5rem;
}
