/*
 * Lexxy rich text editor styles for Action Text
 * https://github.com/basecamp/lexxy
 */

/* Basic Lexxy editor styles */
.lexxy-editor {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 12px;
  min-height: 120px;
  font-size: 14px;
  line-height: 1.5;
  background-color: #fff;
  color: #374151;
}

.lexxy-editor:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Content styles */
.lexxy-content p {
  margin: 0 0 1em 0;
}

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

.lexxy-content h1,
.lexxy-content h2,
.lexxy-content h3,
.lexxy-content h4,
.lexxy-content h5,
.lexxy-content h6 {
  margin: 1.5em 0 0.5em 0;
  font-weight: 600;
  line-height: 1.25;
}

.lexxy-content h1:first-child,
.lexxy-content h2:first-child,
.lexxy-content h3:first-child,
.lexxy-content h4:first-child,
.lexxy-content h5:first-child,
.lexxy-content h6:first-child {
  margin-top: 0;
}

.lexxy-content ul,
.lexxy-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.lexxy-content li {
  margin: 0.25em 0;
}

.lexxy-content blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 4px solid #e5e7eb;
  color: #6b7280;
}

.lexxy-content pre {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1em;
  margin: 1em 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Inconsolata, "Roboto Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.lexxy-content code {
  background-color: #f3f4f6;
  border-radius: 3px;
  padding: 0.1em 0.3em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Inconsolata, "Roboto Mono", monospace;
  font-size: 0.9em;
}

.lexxy-content pre code {
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

.lexxy-content a {
  color: #3b82f6;
  text-decoration: underline;
}

.lexxy-content a:hover {
  color: #1d4ed8;
}

/* Attachment styles */
.lexxy-content .attachment {
  margin: 1em 0;
}

.lexxy-content .attachment__caption {
  text-align: center;
  font-size: 0.9em;
  color: #6b7280;
  margin-top: 0.5em;
}

.lexxy-content .attachment--preview {
  text-align: center;
}

.lexxy-content .attachment img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.lexxy-content .attachment--file {
  display: inline-block;
  padding: 0.5em 1em;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  text-decoration: none;
  color: #374151;
}

.lexxy-content .attachment--file:hover {
  background-color: #e5e7eb;
}

/* Toolbar styles (if using custom toolbar) */
.lexxy-toolbar {
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  background-color: #f9fafb;
  padding: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lexxy-toolbar button {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background-color: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.lexxy-toolbar button:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.lexxy-toolbar button.active {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.lexxy-toolbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .lexxy-editor {
    background-color: #1f2937;
    color: #f3f4f6;
    border-color: #4b5563;
  }

  .lexxy-editor:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
  }

  .lexxy-content pre {
    background-color: #111827;
    border-color: #4b5563;
  }

  .lexxy-content code {
    background-color: #111827;
  }

  .lexxy-content blockquote {
    border-left-color: #4b5563;
    color: #9ca3af;
  }

  .lexxy-content .attachment--file {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  .lexxy-content .attachment--file:hover {
    background-color: #4b5563;
  }
}
