/* Tale Form - Light Theme */

/* Move upload/attachment button to first position in toolbar */
lexxy-toolbar button[name="upload"] {
  order: -1;
}

/* Override Lexxy editor for tale form */
.tale-form lexxy-editor {
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  background: white;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow: visible;
}

.tale-form .lexxy-editor__content {
  padding: 1rem;
  padding-top: 0.45rem;
  min-block-size: 5.5lh;
  font-size: 0.875rem;
  color: rgb(15 23 42);
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
  position: relative;
}

.tale-form .lexxy-editor__content::-webkit-scrollbar {
  width: 6px;
}

.tale-form .lexxy-editor__content::-webkit-scrollbar-track {
  background: transparent;
}

.tale-form .lexxy-editor__content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 9999px;
}

.tale-form .lexxy-editor__content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

.tale-form .lexxy-editor--empty .lexxy-editor__content::before {
  color: rgb(156 163 175);
  /* gray-400 */
  opacity: 1;
  font-size: 0.875rem;
}

/* Toolbar styling */
.tale-form lexxy-toolbar {
  border: none;
  border-top: 1px solid rgb(229 231 235);
  background: rgb(249 250 251);
  /* gray-50 */
  padding: 0.625rem 0.875rem;
  gap: 0.5rem;
  display: flex;
  align-items: center;
}

.tale-form .lexxy-editor__toolbar-button {
  aspect-ratio: 1;
  block-size: 1.875rem;
  width: 1.875rem;
  border-radius: 0.375rem;
  color: rgb(107 114 128);
  /* gray-500 */
  background: transparent;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tale-form .lexxy-editor__toolbar-button:hover:not([aria-disabled="true"]) {
  background: rgb(229 231 235);
  color: rgb(15 23 42);
}

.tale-form .lexxy-editor__toolbar-button[aria-pressed="true"] {
  background: rgb(29 155 240);
  /* X blue */
  color: white;
}

.tale-form .lexxy-editor__toolbar-button[aria-disabled="true"] {
  opacity: 0.3;
  cursor: not-allowed;
}

.tale-form .lexxy-editor__toolbar-button svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* Toolbar spacer */
.tale-form .lexxy-editor__toolbar-spacer {
  flex: 1;
}

/* Form action buttons */
.tale-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
  gap: 0.75rem;
}

/* Submit button styling */
.tale-form .tale-submit-btn {
  background: rgb(29 155 240);
  /* X blue */
  color: white;
  padding: 0.55rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.tale-form .tale-submit-btn:hover {
  background: rgb(26 140 216);
}

/* Cancel button */
.tale-form .tale-cancel-btn {
  color: rgb(107 114 128);
  /* gray-500 */
  padding: 0.55rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease;
}

.tale-form .tale-cancel-btn:hover {
  color: rgb(15 23 42);
}

/* Link dialog customization */
.tale-form .lexxy-link-dialog dialog {
  background: white;
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.tale-form .lexxy-link-dialog input[type="url"] {
  background: rgb(249 250 251);
  border: 1px solid rgb(229 231 235);
  color: rgb(15 23 42);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
}

.tale-form .lexxy-link-dialog input[type="url"]:focus {
  outline: 2px solid rgb(29 155 240);
  outline-offset: -1px;
  border-color: rgb(29 155 240);
}

.tale-form .lexxy-link-dialog button[type="submit"] {
  background: rgb(29 155 240);
  color: white;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.tale-form .lexxy-link-dialog button:not([type="submit"]) {
  background: transparent;
  color: rgb(107 114 128);
  border: 1px solid rgb(229 231 235);
  border-radius: 9999px;
  padding: 0.5rem 1rem;
}

/* Content area focus */
.tale-form .lexxy-editor__content:focus {
  outline: none;
}

/* Attachment styling */
.tale-form action-text-attachment {
  margin: 1rem 0;
}

/* Mentions inline — override block margin above */
.tale-form action-text-attachment[content-type="application/vnd.actiontext.mention"] {
  margin: 0;
}

/* Gallery images in editor — fill space, reduce gaps */
.tale-form .attachment-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 0;
  margin: 0.5rem 0;
}

.tale-form .attachment-gallery .attachment {
  margin: 0;
  padding: 0;
  display: block;
  inline-size: 100%;
  min-width: 0;
}

.tale-form .attachment-gallery .attachment img {
  width: 100%;
  height: 100%;
  max-block-size: 16rem;
  inline-size: 100%;
  object-fit: cover;
  border-radius: 0.375rem;
}

.tale-form .attachment-gallery .attachment__caption {
  display: none;
}

.tale-form .attachment-gallery .attachment__container {
  padding: 0;
  margin: 0;
}

/* Compact Lexxy editor for comments and short descriptions */
.lexxy-compact lexxy-editor {
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  background: white;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 40vh;
  overflow: visible;
}

.lexxy-compact .lexxy-editor__content {
  padding: 0.5rem 0.75rem;
  min-block-size: 2.5lh;
  font-size: 0.8125rem;
  color: rgb(15 23 42);
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.lexxy-compact .lexxy-editor__content:focus {
  outline: none;
}

.lexxy-compact .lexxy-editor--empty .lexxy-editor__content::before {
  color: rgb(156 163 175);
  opacity: 1;
  font-size: 0.8125rem;
}

.lexxy-compact lexxy-toolbar {
  border: none;
  border-top: 1px solid rgb(229 231 235);
  background: rgb(249 250 251);
  padding: 0.375rem 0.625rem;
  gap: 0.35rem;
  display: flex;
  align-items: center;
}

.lexxy-compact .lexxy-editor__toolbar-button {
  aspect-ratio: 1;
  block-size: 1.5rem;
  width: 1.5rem;
  border-radius: 0.25rem;
  color: rgb(107 114 128);
  background: transparent;
  transition: all 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lexxy-compact .lexxy-editor__toolbar-button:hover:not([aria-disabled="true"]) {
  background: rgb(229 231 235);
  color: rgb(15 23 42);
}

.lexxy-compact .lexxy-editor__toolbar-button[aria-pressed="true"] {
  background: rgb(29 155 240);
  color: white;
}

.lexxy-compact .lexxy-editor__toolbar-button[aria-disabled="true"] {
  opacity: 0.3;
  cursor: not-allowed;
}

.lexxy-compact .lexxy-editor__toolbar-button svg {
  width: 0.75rem;
  height: 0.75rem;
}

.lexxy-compact .lexxy-link-dialog dialog {
  background: white;
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  padding: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.lexxy-compact .lexxy-link-dialog input[type="url"] {
  background: rgb(249 250 251);
  border: 1px solid rgb(229 231 235);
  color: rgb(15 23 42);
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
}

.lexxy-compact .lexxy-link-dialog input[type="url"]:focus {
  outline: 2px solid rgb(29 155 240);
  outline-offset: -1px;
  border-color: rgb(29 155 240);
}

.lexxy-compact action-text-attachment {
  margin: 0.5rem 0;
}

.lexxy-compact action-text-attachment[content-type="application/vnd.actiontext.mention"] {
  margin: 0;
}

/* Gallery images in compact editor */
.lexxy-compact .attachment-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 0;
  margin: 0.35rem 0;
}

.lexxy-compact .attachment-gallery .attachment {
  margin: 0;
  padding: 0;
  display: block;
  inline-size: 100%;
  min-width: 0;
}

.lexxy-compact .attachment-gallery .attachment img {
  width: 100%;
  height: 100%;
  max-block-size: 10rem;
  inline-size: 100%;
  object-fit: cover;
  border-radius: 0.25rem;
}

.lexxy-compact .attachment-gallery .attachment__caption {
  display: none;
}

.lexxy-compact .attachment-gallery .attachment__container {
  padding: 0;
  margin: 0;
}

@media (max-width: 767px) {
  .tale-form lexxy-editor {
    border-radius: 0.65rem;
    max-height: 55vh;
  }

  .tale-form .lexxy-editor__content {
    padding: 0.875rem;
    padding-top: 0.4rem;
    font-size: 15px;
    min-block-size: 5lh;
  }

  .tale-form .lexxy-editor--empty .lexxy-editor__content::before {
    font-size: 15px;
  }

  .tale-form lexxy-toolbar {
    padding: 0.5rem 0.75rem;
    gap: 0.35rem;
  }
}
