/*
 * Action Text + Trix Editor Styles
 * Styles for rendered rich text content (.trix-content)
 * and editor enhancements.
 */

/* Editor styling */
trix-editor {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  min-height: 200px;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.6;
}

trix-editor:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Toolbar styling */
trix-toolbar {
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-bottom: none;
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 0.375rem;
}

trix-toolbar + trix-editor {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

trix-toolbar .trix-button-group {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin-right: 0.375rem;
  overflow: hidden;
}

trix-toolbar .trix-button {
  border: none;
  border-bottom: none;
  padding: 0.375rem 0.625rem;
  background: white;
}

trix-toolbar .trix-button:hover {
  background: #eff6ff;
}

trix-toolbar .trix-button.trix-active {
  background: #dbeafe;
  color: #1d4ed8;
}

trix-toolbar .trix-button--icon {
  width: 2.25rem;
  height: 2.25rem;
}

/* Dialog styling (link, attachment) */
trix-toolbar .trix-dialogs {
  position: relative;
}

trix-toolbar .trix-dialog {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding: 0.75rem;
  margin-top: 0.375rem;
}

trix-toolbar .trix-dialog input[type="url"],
trix-toolbar .trix-dialog input[type="text"] {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.875rem;
  outline: none;
}

trix-toolbar .trix-dialog input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

trix-toolbar .trix-dialog .trix-button-group {
  margin: 0;
}

/* Rendered rich text content */
.trix-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #1f2937;
}

.trix-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.25rem 0 0.625rem;
  line-height: 1.3;
}

.trix-content a {
  color: #2563eb;
  text-decoration: underline;
}

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

.trix-content ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 0.625rem 0;
}

.trix-content ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin: 0.625rem 0;
}

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

.trix-content blockquote {
  border-left: 4px solid #d1d5db;
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  color: #6b7280;
  font-style: italic;
}

.trix-content pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.trix-content strong {
  font-weight: 700;
}

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

.trix-content p {
  margin: 0.5rem 0;
}

/* Attachment / image styling */
.trix-content .attachment {
  display: inline-block;
  position: relative;
  max-width: 100%;
  margin: 0.625rem 0;
}

.trix-content .attachment__caption {
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  padding: 0.25rem 0;
}

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

.trix-content .attachment--preview img,
.trix-content .attachment img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.trix-content .attachment--file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: #f3f4f6;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  margin: 0.5rem 0;
}

/* Image gallery within editor */
.trix-content .attachment-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.trix-content .attachment-gallery .attachment {
  flex: 1 0 calc(33.333% - 0.625rem);
  max-width: calc(33.333% - 0.625rem);
}

/* Editor attachment preview */
trix-editor .attachment {
  max-width: 100%;
}

trix-editor .attachment img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* Progress bar for uploads */
.trix-content .attachment__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.trix-content .attachment__progress .attachment__progress__bar {
  height: 100%;
  background: #3b82f6;
  transition: width 0.2s ease;
}
