/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Sortable.js styles */
.sortable-ghost {
  opacity: 1 !important;
  background: transparent !important;
  position: relative;
  min-height: 100px; /* Ensure ghost has minimum height */
}

/* Hide all content in ghost placeholder */
.sortable-ghost > * {
  visibility: hidden !important;
}

/* Show empty bordered box as placeholder */
.sortable-ghost::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px dashed #3b82f6;
  background: #eff6ff;
  border-radius: 0.75rem;
  visibility: visible !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 10;
}

.sortable-drag {
  opacity: 1;
  cursor: grabbing !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* Hide hover controls during drag */
.sortable-drag .group-hover\/array-item\:opacity-100 {
  opacity: 0 !important;
}

/* Hide form content during drag - only show header (for inspector) */
.sortable-ghost [data-inspector-array-card-target="content"],
.sortable-drag [data-inspector-array-card-target="content"] {
  display: none !important;
}

/* Tiptap Editor Styles - Notion-like appearance */
.tiptap-editor {
  display: block;
  outline: none;
}

/* Empty paragraph with placeholder */
.tiptap-editor p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  pointer-events: none;
  float: left;
  height: 0;
}


/* Inline code */
.tiptap-editor code {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  background-color: #f1f5f9; /* slate-100 */
  color: #7c3aed; /* purple-600 */
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

/* Code blocks */
.tiptap-editor pre {
  background-color: #0f172a; /* slate-900 */
  color: #f1f5f9; /* slate-100 */
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.tiptap-editor pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

/* Blockquotes */
.tiptap-editor blockquote {
  border-left: 4px solid #3b82f6; /* blue-500 */
  background-color: #eff6ff; /* blue-50 */
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #475569; /* slate-600 */
}

/* Links */
.tiptap-editor a {
  color: #2563eb; /* blue-600 */
  text-decoration: none;
  cursor: pointer;
}

.tiptap-editor a:hover {
  text-decoration: underline;
}

/* Horizontal rule */
.tiptap-editor hr {
  border: none;
  border-top: 1px solid #e2e8f0; /* slate-200 */
  margin: 3rem 0;
}

/* Selection styling */
.tiptap-editor ::selection {
  background-color: #dbeafe; /* blue-100 */
  color: #1e293b; /* slate-800 */
}

/* Hard break */
.tiptap-editor br {
  display: block;
  content: "";
  margin-top: 0.5rem;
}

/* Disabled button styling for AI toolbar */
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tiptap images with resize functionality */
.tiptap-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.tiptap-editor img:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Resizable image wrapper */
.tiptap-editor .image-resizer {
  display: inline-block;
  position: relative;
  margin: 1.5rem 0;
}

.tiptap-editor .image-resizer img {
  margin: 0;
  display: block;
}

/* Resize handles */
.tiptap-editor .image-resizer .resize-trigger {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #3b82f6;
  border: 2px solid white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.tiptap-editor .image-resizer:hover .resize-trigger,
.tiptap-editor .image-resizer.is-resizing .resize-trigger {
  opacity: 1;
}

/* Position resize handles at corners */
.tiptap-editor .image-resizer .resize-trigger.top-left {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.tiptap-editor .image-resizer .resize-trigger.top-right {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.tiptap-editor .image-resizer .resize-trigger.bottom-left {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

.tiptap-editor .image-resizer .resize-trigger.bottom-right {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}

/* Selected state for resizable images */
.tiptap-editor .image-resizer.ProseMirror-selectednode {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 0.5rem;
}

.tiptap-editor .image-resizer.ProseMirror-selectednode .resize-trigger {
  opacity: 1;
}

/* Slash Commands Dropdown - Notion-like styling */
.slash-commands-dropdown {
  background: white;
  border: 1px solid #e2e8f0; /* slate-200 */
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  min-width: 280px;
  z-index: 1000;
}

.slash-command-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.slash-command-item:hover {
  background-color: #f1f5f9; /* slate-100 */
}

.slash-command-item.is-selected {
  background-color: #e0e7ff; /* blue-100 */
}

.slash-command-icon {
  font-size: 1.25rem;
  font-weight: 600;
  color: #475569; /* slate-600 */
  min-width: 2rem;
  text-align: center;
}

.slash-command-content {
  flex: 1;
  min-width: 0;
}

.slash-command-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b; /* slate-800 */
  line-height: 1.25;
}

.slash-command-description {
  font-size: 0.75rem;
  color: #64748b; /* slate-500 */
  line-height: 1.25;
  margin-top: 0.125rem;
}

.slash-command-empty {
  padding: 0.75rem;
  text-align: center;
  color: #94a3b8; /* slate-400 */
  font-size: 0.875rem;
}

/* Tippy.js tooltip styling for slash commands */
.tippy-box {
  background: transparent !important;
  border: none;
  box-shadow: none;
}

.tippy-arrow {
  display: none !important;
}

.tippy-content {
  padding: 0;
}

/* Analytics Progress Bar Shimmer Animation */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-shimmer {
  animation: shimmer 3s infinite;
}

/* Chat Widget Custom Animations */
@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.animate-gradientShift {
  animation: gradientShift 4s ease infinite;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeInUp {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease-out;
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slideInFromRight {
  animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
