/*
 * ActionText + Trix Editor – shadcn-inspired Premium Styling
 */

/* ──────────────────────────────────
   TOOLBAR
   ────────────────────────────────── */
trix-toolbar {
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-radius: 1rem 1rem 0 0;
  background: #f9fafb;
  padding: 0.5rem 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

trix-toolbar .trix-button-group {
  border: none;
  margin: 0;
  display: flex;
  gap: 1px;
  padding: 2px;
  background: transparent;
}

trix-toolbar .trix-button-group + .trix-button-group {
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid #e5e7eb;
}

trix-toolbar .trix-button {
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #4b5563;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

trix-toolbar .trix-button:hover {
  background: #e5e7eb;
  color: #111827;
}

trix-toolbar .trix-button.trix-active {
  background: #111827;
  color: white;
}

trix-toolbar .trix-button--icon {
  width: 34px;
  padding: 0;
}

/* Dialogs */
trix-toolbar .trix-dialog {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05);
  padding: 1rem;
  background: white;
  margin-top: 0.5rem;
}

trix-toolbar .trix-dialog input[type="url"],
trix-toolbar .trix-dialog input[type="text"] {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

trix-toolbar .trix-dialog input:focus {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17,24,39,0.1);
}

trix-toolbar .trix-dialog .trix-button-group {
  margin-top: 0.5rem;
}

trix-toolbar .trix-dialog .trix-button-group .trix-button {
  width: auto;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
}

trix-toolbar .trix-dialog .trix-button-group .trix-button:first-child {
  background: #111827;
  color: white;
}

/* ──────────────────────────────────
   EDITOR AREA
   ────────────────────────────────── */
trix-editor {
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 1rem 1rem;
  padding: 1.5rem;
  min-height: 400px;
  background: white;
  font-size: 1rem;
  line-height: 1.75;
  color: #1f2937;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

trix-editor:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

trix-editor:empty:not(:focus)::before {
  color: #9ca3af;
}

/* Typography inside editor */
trix-editor h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: #111827;
}

trix-editor h2,
trix-editor h3 {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #111827;
}

trix-editor strong {
  font-weight: 700;
  color: #111827;
}

trix-editor blockquote {
  border-left: 3px solid #e5e7eb;
  padding-left: 1rem;
  color: #6b7280;
  font-style: italic;
  margin: 1rem 0;
}

trix-editor pre {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  overflow-x: auto;
  margin: 1rem 0;
}

trix-editor ul,
trix-editor ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

trix-editor li {
  margin-bottom: 0.25rem;
}

trix-editor a {
  color: #6366f1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

trix-editor a:hover {
  color: #4f46e5;
}

/* ──────────────────────────────────
   ATTACHMENT (image/file upload)
   ────────────────────────────────── */
trix-editor .attachment {
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}

trix-editor .attachment__caption {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
  padding: 0.5rem;
}

trix-editor .attachment--preview {
  border-radius: 0.75rem;
}

/* Gallery overrides */
.trix-content .attachment-gallery > action-text-attachment,
.trix-content .attachment-gallery > .attachment {
  flex: 1 0 33%;
  padding: 0 0.5em;
  max-width: 33%;
}

.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
  flex-basis: 50%;
  max-width: 50%;
}

.trix-content action-text-attachment .attachment {
  padding: 0 !important;
  max-width: 100% !important;
}

/* ──────────────────────────────────
   CONTENT DISPLAY (read mode)
   ────────────────────────────────── */
.trix-content {
  font-size: 1rem;
  line-height: 1.85;
  color: #374151;
}

.trix-content h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #111827;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.trix-content blockquote {
  border-left: 3px solid #e5e7eb;
  padding-left: 1rem;
  color: #6b7280;
  margin: 1.5rem 0;
}

.trix-content pre {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  font-size: 0.875rem;
  overflow-x: auto;
}

.trix-content a {
  color: #6366f1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.trix-content ul, .trix-content ol {
  padding-left: 1.5rem;
}

.trix-content img {
  border-radius: 0.75rem;
  margin: 1rem 0;
}

/* ──────────────────────────────────
   WRITING TIPS HELPER
   ────────────────────────────────── */
.writing-tips {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 1rem;
  padding: 1.25rem;
}

.writing-tips h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.writing-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.writing-tips li {
  font-size: 0.75rem;
  color: #15803d;
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.writing-tips li::before {
  content: "✓";
  position: absolute;
  left: 0;
  font-weight: 700;
}

