/*
 * Lexxy editor styles for Action Text
*/

/* Main Lexxy editor container */
lexxy-editor {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Action Text Editor Styling */
.content-editor-container {
  /* Remove default styling to create seamless editing experience */
}

.lexxy-editor-wrapper {
  /* Wrapper for the rich text editor */
}

.lexxy-editor-wrapper trix-editor {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  font-size: 1rem;
  line-height: 1.6;
  color: #374151;
}

.lexxy-editor-wrapper trix-editor:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Remove any default form styling */
.lexxy-editor-wrapper trix-editor .trix-content {
  padding: 0 !important;
  margin: 0 !important;
}

/* Lexxy Toolbar Container Wrapper - positioned above the content block with sticky behavior */
.lexxy-toolbar-container-wrapper {
  /* Sticky positioning with smooth transitions */
  transition: all 0.2s ease-in-out;
}

/* Lexxy Toolbar Container - enhanced styling with modern design */
.lexxy-toolbar-container {
  /* Enhanced container with better shadows and transitions */
  transition: box-shadow 0.2s ease-in-out, transform 0.1s ease-in-out;
  backdrop-filter: blur(8px);
}

.lexxy-toolbar-container:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1), 0 2px 6px -1px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

/* Toolbar content area within the container */
.lexxy-toolbar-container .toolbar-content {
  /* Enhanced toolbar content styling */
  min-height: 44px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Toolbar buttons styling */
.lexxy-toolbar-container .toolbar-content button,
.lexxy-toolbar-container .toolbar-content .ql-toolbar button {
  border-radius: 6px;
  padding: 6px 8px;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  background: white;
  color: #374151;
}

.lexxy-toolbar-container .toolbar-content button:hover,
.lexxy-toolbar-container .toolbar-content .ql-toolbar button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.lexxy-toolbar-container .toolbar-content button.ql-active,
.lexxy-toolbar-container .toolbar-content .ql-toolbar button.ql-active {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

/* Toolbar separators */
.lexxy-toolbar-container .toolbar-content .ql-toolbar .ql-formats {
  margin-right: 12px;
  padding-right: 12px;
  border-right: 1px solid #e5e7eb;
}

.lexxy-toolbar-container .toolbar-content .ql-toolbar .ql-formats:last-child {
  border-right: none;
  margin-right: 0;
  padding-right: 0;
}

/* Lexxy toolbar styling - updated for sidebar positioning */
.lexxy-toolbar-container lexxy-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}

/* Lexxy toolbar buttons */
lexxy-toolbar .lexxy-editor__toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  font-size: 0;
  width: 2.5rem;
  height: 2.5rem;
}

lexxy-toolbar .lexxy-editor__toolbar-button:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

lexxy-toolbar .lexxy-editor__toolbar-button[aria-pressed="true"] {
  background-color: #eef2ff;
  border-color: #6366f1;
  color: #6366f1;
}

/* Lexxy toolbar button SVGs */
lexxy-toolbar .lexxy-editor__toolbar-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

/* Lexxy toolbar overflow menu */
lexxy-toolbar .lexxy-editor__toolbar-overflow {
  position: relative;
}

lexxy-toolbar .lexxy-editor__toolbar-overflow-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Lexxy link dialog styling */
lexxy-link-dialog dialog {
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
}

lexxy-link-dialog input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

lexxy-link-dialog .lexxy-dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

lexxy-link-dialog .btn {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s ease-in-out;
}

lexxy-link-dialog .btn:hover {
  background-color: #f9fafb;
  border-color: #6366f1;
}

/* Lexxy editor content styling */
.lexxy-editor__content,
.trix-content,
.prose {
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #374151; }
  .lexxy-editor__content *,
  .trix-content *,
  .prose * {
    box-sizing: border-box; }
  
  /* Typography improvements */
  .lexxy-editor__content h1,
  .trix-content h1,
  .prose h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    color: #111827;
    margin: 1.5rem 0 1rem 0; }
  
  .lexxy-editor__content h2,
  .trix-content h2,
  .prose h2 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
    margin: 1.25rem 0 0.75rem 0; }
  
  .lexxy-editor__content h3,
  .trix-content h3,
  .prose h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
    margin: 1rem 0 0.5rem 0; }
  
  .lexxy-editor__content h4,
  .trix-content h4,
  .prose h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
    margin: 0.875rem 0 0.5rem 0; }
  
  .lexxy-editor__content h5,
  .trix-content h5,
  .prose h5 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
    margin: 0.75rem 0 0.5rem 0; }
  
  .lexxy-editor__content h6,
  .trix-content h6,
  .prose h6 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: #374151;
    margin: 0.75rem 0 0.5rem 0; }
  
  .lexxy-editor__content p,
  .trix-content p,
  .prose p {
    margin: 0.75rem 0;
    line-height: 1.6;
    color: #374151; }
  
  .lexxy-editor__content strong,
  .trix-content strong,
  .prose strong {
    font-weight: 600;
    color: #111827; }
  
  .lexxy-editor__content em,
  .trix-content em,
  .prose em {
    font-style: italic; }
  
  .lexxy-editor__content a,
  .trix-content a,
  .prose a {
    color: #6366f1;
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.4);
    text-underline-offset: 2px;
    transition: all 0.15s ease-in-out; }
  
  .lexxy-editor__content a:hover,
  .trix-content a:hover,
  .prose a:hover {
    color: #4f46e5;
    text-decoration-color: #4f46e5; }
  
  .lexxy-editor__content code,
  .trix-content code,
  .prose code {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    color: #e11d48;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875em;
    padding: 0.125rem 0.375rem; }
  
  .lexxy-editor__content hr,
  .trix-content hr,
  .prose hr {
  border: none;
    height: 1px;
    background-color: #e5e7eb;
    margin: 2rem 0; }
  .lexxy-editor__content blockquote,
  .trix-content blockquote,
  .prose blockquote {
    border: 0 solid #d1d5db;
    border-left-width: 0.25rem;
    margin: 1.25rem 0;
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    font-style: italic;
    color: #6b7280;
    border-radius: 0.375rem; }
  .lexxy-editor__content [dir=rtl] blockquote,
  .lexxy-editor__content blockquote[dir=rtl],
  .trix-content [dir=rtl] blockquote,
  .trix-content blockquote[dir=rtl],
  .prose [dir=rtl] blockquote,
  .prose blockquote[dir=rtl] {
    border-width: 0;
    border-right-width: 0.25rem;
    margin-right: 0;
    padding-right: 1.5rem;
    padding-left: 1rem; }
  
  .lexxy-editor__content ul,
  .trix-content ul,
  .prose ul {
    margin: 1rem 0;
    padding-left: 1.5rem; }
  
  .lexxy-editor__content ol,
  .trix-content ol,
  .prose ol {
    margin: 1rem 0;
    padding-left: 1.5rem; }
  
  .lexxy-editor__content li,
  .trix-content li,
  .prose li {
    margin: 0.375rem 0;
    line-height: 1.6;
    color: #374151; }
  .lexxy-editor__content [dir=rtl] li,
  .trix-content [dir=rtl] li,
  .prose [dir=rtl] li {
    margin-right: 1em; }
  
  .lexxy-editor__content ul > li,
  .trix-content ul > li,
  .prose ul > li {
    list-style-type: disc; }
  
  .lexxy-editor__content ol > li,
  .trix-content ol > li,
  .prose ol > li {
    list-style-type: decimal; }
  
  .lexxy-editor__content ul ul,
  .lexxy-editor__content ol ul,
  .trix-content ul ul,
  .trix-content ol ul,
  .prose ul ul,
  .prose ol ul {
    margin: 0.5rem 0; }
  
  .lexxy-editor__content ul ol,
  .lexxy-editor__content ol ol,
  .trix-content ul ol,
  .trix-content ol ol,
  .prose ul ol,
  .prose ol ol {
    margin: 0.5rem 0; }
  .lexxy-editor__content pre,
  .trix-content pre,
  .prose pre {
    display: block;
    width: 100%;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    white-space: pre;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow-x: auto;
    color: #374151; }
  .lexxy-editor__content img,
  .trix-content img,
  .prose img {
    max-width: 100%;
    height: auto; }
  .trix-content .attachment {
    display: inline-block;
    position: relative;
    max-width: 100%; }
    .trix-content .attachment a {
      color: inherit;
      text-decoration: none; }
      .trix-content .attachment a:hover, .trix-content .attachment a:visited:hover {
        color: inherit; }
  .trix-content .attachment__caption {
    text-align: center; }
    .trix-content .attachment__caption .attachment__name + .attachment__size::before {
      content: ' \2022 '; }
  .trix-content .attachment--preview {
    width: 100%;
    text-align: center; }
    .trix-content .attachment--preview .attachment__caption {
      color: #666;
      font-size: 0.9em;
      line-height: 1.2; }
  .trix-content .attachment--file {
    color: #333;
    line-height: 1;
    margin: 0 2px 2px 2px;
    padding: 0.4em 1em;
    border: 1px solid #bbb;
    border-radius: 5px; }
  .trix-content .attachment-gallery {
    display: flex;
    flex-wrap: wrap;
    position: relative; }
    .trix-content .attachment-gallery .attachment {
      flex: 1 0 33%;
      padding: 0 0.5em;
      max-width: 33%; }
    .trix-content .attachment-gallery.attachment-gallery--2 .attachment, .trix-content .attachment-gallery.attachment-gallery--4 .attachment {
      flex-basis: 50%;
      max-width: 50%; }

/*
 * We need to override trix.css’s image gallery styles to accommodate the
 * <action-text-attachment> element we wrap around attachments. Otherwise,
 * images in galleries will be squished by the max-width: 33%; rule.
*/
.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;
}
