/* Action Text Editor Styles for Light and Dark Mode */

/* Trix Editor Container */
trix-editor {
  min-height: 200px;
  background-color: white;
  color: rgb(17, 24, 39);
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
}

trix-editor:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
  border-color: rgb(34, 197, 94);
}

.dark trix-editor {
  background-color: rgb(17, 24, 39);
  color: rgb(243, 244, 246);
  border-color: rgb(55, 65, 81);
}

/* Trix Toolbar */
trix-toolbar {
  background-color: rgb(249, 250, 251);
  border-bottom: 1px solid rgb(209, 213, 219);
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  padding: 0.5rem;
}

.dark trix-toolbar {
  background-color: rgb(31, 41, 55);
  border-bottom-color: rgb(55, 65, 81);
}

/* Toolbar Button Groups */
trix-toolbar .trix-button-group {
  border-color: rgb(209, 213, 219);
  margin-right: 0.5rem;
}

.dark trix-toolbar .trix-button-group {
  border-color: rgb(55, 65, 81);
}

/* Toolbar Buttons */
trix-toolbar .trix-button {
  background-color: white;
  color: rgb(55, 65, 81);
  border-color: rgb(209, 213, 219);
}

trix-toolbar .trix-button:hover {
  background-color: rgb(243, 244, 246);
}

.dark trix-toolbar .trix-button {
  background-color: rgb(31, 41, 55);
  color: rgb(209, 213, 219);
  border-color: rgb(55, 65, 81);
}

.dark trix-toolbar .trix-button:hover {
  background-color: rgb(55, 65, 81);
}

/* Active/Selected Toolbar Buttons */
trix-toolbar .trix-button.trix-active {
  background-color: rgb(34, 197, 94);
  color: white;
}

.dark trix-toolbar .trix-button.trix-active {
  background-color: rgb(34, 197, 94);
  color: white;
}

/* Toolbar Dialog */
trix-toolbar .trix-dialog {
  background-color: white;
  border: 1px solid rgb(209, 213, 219);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-radius: 0.375rem;
  padding: 1rem;
}

.dark trix-toolbar .trix-dialog {
  background-color: rgb(31, 41, 55);
  border-color: rgb(55, 65, 81);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

trix-toolbar .trix-dialog__link-fields input[type="url"],
trix-toolbar .trix-dialog input[type="text"] {
  background-color: white;
  color: rgb(17, 24, 39);
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
}

.dark trix-toolbar .trix-dialog__link-fields input[type="url"],
.dark trix-toolbar .trix-dialog input[type="text"] {
  background-color: rgb(17, 24, 39);
  color: rgb(243, 244, 246);
  border-color: rgb(55, 65, 81);
}

trix-toolbar .trix-dialog input[type="button"] {
  background-color: rgb(34, 197, 94);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  border: none;
}

trix-toolbar .trix-dialog input[type="button"]:hover {
  opacity: 0.9;
}

/* Dialog text and labels */
trix-toolbar .trix-dialog {
  color: rgb(17, 24, 39) !important;
}

.dark trix-toolbar .trix-dialog {
  color: rgb(243, 244, 246) !important;
}

/* Dialog labels and text elements */
/* Dialog labels - not buttons */
trix-toolbar .trix-dialog label,
trix-toolbar .trix-dialog span:not(.trix-button__text) {
  color: rgb(17, 24, 39) !important;
}

.dark trix-toolbar .trix-dialog label,
.dark trix-toolbar .trix-dialog span:not(.trix-button__text) {
  color: rgb(243, 244, 246) !important;
}

/* Dialog input fields */
trix-toolbar .trix-dialog .trix-input,
trix-toolbar .trix-dialog input[type="url"],
trix-toolbar .trix-dialog input[type="text"] {
  color: rgb(17, 24, 39) !important;
}

.dark trix-toolbar .trix-dialog .trix-input,
.dark trix-toolbar .trix-dialog input[type="url"],
.dark trix-toolbar .trix-dialog input[type="text"] {
  color: rgb(243, 244, 246) !important;
}

/* Dialog button text - MUST be white for visibility on green background */
trix-toolbar .trix-dialog .trix-button,
trix-toolbar .trix-dialog .trix-button *,
trix-toolbar .trix-dialog input[type="button"],
trix-toolbar .trix-dialog button {
  color: white !important;
}

.dark trix-toolbar .trix-dialog .trix-button,
.dark trix-toolbar .trix-dialog .trix-button *,
.dark trix-toolbar .trix-dialog input[type="button"],
.dark trix-toolbar .trix-dialog button {
  color: white !important;
}

/* Ensure input text is always visible */
.dark trix-toolbar .trix-dialog input[type="url"]::placeholder,
.dark trix-toolbar .trix-dialog input[type="text"]::placeholder {
  color: rgb(107, 114, 128);
}

/* Button text should be white */
trix-toolbar .trix-dialog input[type="button"] {
  color: white !important;
}

/* Ensure dialog is properly positioned and visible */
trix-toolbar .trix-dialog {
  position: relative;
  z-index: 1000;
}

/* Only show dialog when it's actually active (remove forced display: block) */
trix-toolbar .trix-dialog[data-trix-active=""],
trix-toolbar .trix-dialog.trix-active {
  display: block !important;
}

/* Ensure link fields container is visible */
trix-toolbar .trix-dialog__link-fields {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Make sure buttons are visible and styled */
trix-toolbar .trix-dialog .trix-button,
trix-toolbar .trix-dialog button {
  background-color: rgb(34, 197, 94);
  color: white !important;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  border: none;
  font-size: 0.875rem;
}

trix-toolbar .trix-dialog .trix-button:hover,
trix-toolbar .trix-dialog button:hover {
  opacity: 0.9;
}

trix-toolbar .trix-dialog .trix-button--dialog {
  background-color: rgb(34, 197, 94);
  color: white !important;
}

/* Editor Content Styling */
trix-editor h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

trix-editor h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

trix-editor h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

trix-editor p {
  margin-bottom: 0.5rem;
}

trix-editor a {
  color: rgb(34, 197, 94);
  text-decoration: underline;
}

.dark trix-editor a {
  color: rgb(96, 165, 250);
}

trix-editor ul {
  list-style-type: disc;
  list-style-position: inside;
  margin-bottom: 0.5rem;
}

trix-editor ol {
  list-style-type: decimal;
  list-style-position: inside;
  margin-bottom: 0.5rem;
}

trix-editor blockquote {
  border-left: 4px solid rgb(209, 213, 219);
  padding-left: 1rem;
  font-style: italic;
  color: rgb(107, 114, 128);
}

.dark trix-editor blockquote {
  border-left-color: rgb(55, 65, 81);
  color: rgb(156, 163, 175);
}

trix-editor pre {
  background-color: rgb(243, 244, 246);
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.875rem;
}

.dark trix-editor pre {
  background-color: rgb(31, 41, 55);
}

trix-editor code {
  background-color: rgb(243, 244, 246);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  color: rgb(220, 38, 38);
  font-family: monospace;
  font-size: 0.875rem;
}

.dark trix-editor code {
  background-color: rgb(31, 41, 55);
  color: rgb(248, 113, 113);
}

/* File Attachments */
trix-editor .attachment {
  background-color: rgb(249, 250, 251);
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin: 0.5rem 0;
}

.dark trix-editor .attachment {
  background-color: rgb(31, 41, 55);
  border-color: rgb(55, 65, 81);
}

trix-editor .attachment__caption {
  color: rgb(107, 114, 128);
  font-size: 0.875rem;
}

.dark trix-editor .attachment__caption {
  color: rgb(156, 163, 175);
}

trix-editor .attachment__remove {
  color: rgb(220, 38, 38);
}

trix-editor .attachment__remove:hover {
  color: rgb(185, 28, 28);
}

.dark trix-editor .attachment__remove {
  color: rgb(248, 113, 113);
}

.dark trix-editor .attachment__remove:hover {
  color: rgb(252, 165, 165);
}

/* Placeholder Text */
trix-editor[placeholder]:empty::before {
  content: attr(placeholder);
  color: rgb(156, 163, 175);
}

.dark trix-editor[placeholder]:empty::before {
  color: rgb(107, 114, 128);
}

/* Selection Highlight */
trix-editor::selection,
trix-editor *::selection {
  background-color: rgb(191, 219, 254);
}

.dark trix-editor::selection,
.dark trix-editor *::selection {
  background-color: rgb(30, 58, 138);
}

/* Disabled State */
trix-editor[disabled] {
  background-color: rgb(243, 244, 246);
  color: rgb(156, 163, 175);
  cursor: not-allowed;
}

.dark trix-editor[disabled] {
  background-color: rgb(31, 41, 55);
  color: rgb(107, 114, 128);
}

/* Action Text Content Display (non-editor) */
.trix-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content h1 {
  color: rgb(243, 244, 246);
}

.trix-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content h2 {
  color: rgb(243, 244, 246);
}

.trix-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content h3 {
  color: rgb(243, 244, 246);
}

.trix-content p {
  margin-bottom: 0.5rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content p {
  color: rgb(243, 244, 246);
}

.trix-content a {
  color: rgb(34, 197, 94);
  text-decoration: underline;
}

.dark .trix-content a {
  color: rgb(96, 165, 250);
}

.trix-content ul {
  list-style-type: disc;
  list-style-position: inside;
  margin-bottom: 0.5rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content ul {
  color: rgb(243, 244, 246);
}

.trix-content ol {
  list-style-type: decimal;
  list-style-position: inside;
  margin-bottom: 0.5rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content ol {
  color: rgb(243, 244, 246);
}

.trix-content blockquote {
  border-left: 4px solid rgb(209, 213, 219);
  padding-left: 1rem;
  font-style: italic;
  color: rgb(107, 114, 128);
}

.dark .trix-content blockquote {
  border-left-color: rgb(55, 65, 81);
  color: rgb(156, 163, 175);
}

.trix-content pre {
  background-color: rgb(243, 244, 246);
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.875rem;
  color: rgb(17, 24, 39);
}

.dark .trix-content pre {
  background-color: rgb(31, 41, 55);
  color: rgb(243, 244, 246);
}

.trix-content code {
  background-color: rgb(243, 244, 246);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  color: rgb(220, 38, 38);
  font-family: monospace;
  font-size: 0.875rem;
}

.dark .trix-content code {
  background-color: rgb(31, 41, 55);
  color: rgb(248, 113, 113);
}

.trix-content .attachment {
  background-color: rgb(249, 250, 251);
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin: 0.5rem 0;
}

.dark .trix-content .attachment {
  background-color: rgb(31, 41, 55);
  border-color: rgb(55, 65, 81);
}

/* ===== TRIX DIALOG LINK BUTTON FIX ===== */

/* Override the hidden button text for dialog buttons only - all possible selectors */
trix-toolbar .trix-dialog .trix-button .trix-button__text,
trix-toolbar .trix-dialog .trix-button--dialog .trix-button__text,
trix-toolbar .trix-dialog button .trix-button__text,
trix-toolbar .trix-dialog input[type="button"] .trix-button__text {
  display: inline !important;
  visibility: visible !important;
  font-size: 0.875rem !important;
  width: auto !important;
  height: auto !important;
  color: white !important;
}

/* Style dialog buttons */
trix-toolbar .trix-dialog input[type="button"],
trix-toolbar .trix-dialog .trix-button--dialog {
  background-color: rgb(34, 197, 94) !important;
  color: white !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.375rem !important;
  border: none !important;
  cursor: pointer !important;
}

trix-toolbar .trix-dialog input[type="button"]:hover,
trix-toolbar .trix-dialog .trix-button--dialog:hover {
  opacity: 0.9 !important;
}

/* Ensure input button values are visible */
trix-toolbar .trix-dialog input[type="button"] {
  font-size: 0.875rem !important;
  text-indent: 0 !important;
  overflow: visible !important;
}

/* Show all text content in dialog buttons */
trix-toolbar .trix-dialog .trix-button *,
trix-toolbar .trix-dialog button *,
trix-toolbar .trix-dialog input[type="button"] * {
  display: inline !important;
  visibility: visible !important;
  font-size: 0.875rem !important;
  color: white !important;
  width: auto !important;
  height: auto !important;
}

/* Add visible text labels to dialog buttons using pseudo-elements */
trix-toolbar .trix-dialog__link-fields input[type="button"][data-trix-method="setAttribute"]::after {
  content: "Link";
  display: inline-block !important;
  color: white !important;
  font-size: 0.875rem !important;
}

trix-toolbar .trix-dialog__link-fields input[type="button"][data-trix-method="removeAttribute"]::after {
  content: "Unlink";
  display: inline-block !important;
  color: white !important;
  font-size: 0.875rem !important;
}

/* Fallback: add text to all dialog buttons if they don't have specific data attributes */
trix-toolbar .trix-dialog input[type="button"]:first-of-type:not([data-trix-method])::after {
  content: "Link";
  display: inline-block !important;
  color: white !important;
  font-size: 0.875rem !important;
}

trix-toolbar .trix-dialog input[type="button"]:last-of-type:not([data-trix-method])::after {
  content: "Unlink";
  display: inline-block !important;
  color: white !important;
  font-size: 0.875rem !important;
}
