/**
 * EmailComposer Styles
 * Tiptap-specific styles and overrides
 */

/* Editor placeholder */
.tiptap .is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
  height: 0;
}

/* Editor focus state */
.tiptap:focus {
  outline: none;
}

/* Mention chip styling */
.tiptap .mention {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  background-color: hsl(270 80% 95%);
  color: hsl(270 70% 40%);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  white-space: nowrap;
  -webkit-user-select: all;
     -moz-user-select: all;
          user-select: all;
}

.tiptap .mention::before {
  content: '';
}

/* Dark mode mention styling */
.dark .tiptap .mention {
  background-color: hsl(270 50% 25%);
  color: hsl(270 80% 80%);
}

/* Link styling in editor */
.tiptap a {
  color: hsl(var(--primary));
  text-decoration: underline;
  cursor: pointer;
}

.tiptap a:hover {
  text-decoration-thickness: 2px;
}

/* Blockquote styling */
.tiptap blockquote {
  border-left: 3px solid hsl(var(--border));
  padding-left: 1rem;
  margin-left: 0;
  color: hsl(var(--muted-foreground));
}

/* Horizontal rule */
.tiptap hr {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 1rem 0;
}

/* List styling */
.tiptap ul,
.tiptap ol {
  padding-left: 1.5rem;
}

.tiptap ul {
  list-style-type: disc;
}

.tiptap ol {
  list-style-type: decimal;
}

.tiptap li {
  margin: 0.25rem 0;
}

/* Code styling */
.tiptap code {
  background-color: hsl(var(--muted));
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
}

/* Selection styling */
.tiptap ::-moz-selection {
  background-color: hsl(var(--primary) / 0.2);
}
.tiptap ::selection {
  background-color: hsl(var(--primary) / 0.2);
}

/* Tippy.js dropdown styling for mentions */
.tippy-box[data-theme~='mention'] {
  background-color: transparent;
  padding: 0;
}

.tippy-box[data-theme~='mention'] > .tippy-content {
  padding: 0;
}

/* Highlight colors */
.tiptap mark {
  border-radius: 0.125rem;
  padding: 0.0625rem 0;
}

/* Subscript/Superscript */
.tiptap sub {
  font-size: 0.75em;
  vertical-align: sub;
}

.tiptap sup {
  font-size: 0.75em;
  vertical-align: super;
}

/* Text alignment */
.tiptap p[style*="text-align: center"],
.tiptap p.text-center {
  text-align: center;
}

.tiptap p[style*="text-align: right"],
.tiptap p.text-right {
  text-align: right;
}

.tiptap p[style*="text-align: justify"],
.tiptap p.text-justify {
  text-align: justify;
}

/* Drag and drop overlay animation */
@keyframes pulse-border {
  0%, 100% {
    border-color: hsl(var(--primary));
  }
  50% {
    border-color: hsl(var(--primary) / 0.5);
  }
}

.drag-overlay {
  animation: pulse-border 1s ease-in-out infinite;
}
