.tiptap-editor-container {
  border: 1px solid #495057;
  border-radius: 0.375rem;
  background-color: #212529;
  margin-bottom: 1rem;
}

.tiptap-toolbar {
  border-bottom: 1px solid #495057;
  padding: 0.5rem;
  background-color: #2f3133;
  border-radius: 0.375rem 0.375rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tiptap-toolbar .btn {
  border-color: #495057;
  color: #adb5bd;
  background-color: transparent;
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
}

.tiptap-toolbar .btn:hover {
  background-color: #495057;
  color: #fff;
  border-color: #6c757d;
}

.tiptap-toolbar .btn.active {
  background-color: #5C94FE;
  border-color: #5C94FE;
  color: #fff;
}

.tiptap-toolbar .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tiptap-editor-content {
  min-height: 200px;
  color: #adb5bd;
  background-color: #212529;
  border-radius: 0 0 0.375rem 0.375rem;
}

.tiptap-editor-content .ProseMirror {
  outline: none;
  min-height: 200px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: inherit;
  padding: 1rem 1rem 1rem 2.5rem; /* Extra left padding for drag handles */
}

/* ==========================================================================
   Base ProseMirror Styles
   ========================================================================== */

/* Base editor styling */
.ProseMirror {
  /* Form control styling */
  background-color: transparent !important;
  border: 0 !important;
  color: #adb5bd !important;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  
  /* Remove default outline */
  outline: none !important;
  
  /* Ensure proper sizing */
  width: 100%;
  min-height: inherit;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
}

/* Focus states */
.ProseMirror:focus,
.ProseMirror:focus-within {
  border-color: #5C94FE !important;
  box-shadow: 0 0 0 0.2rem rgba(92, 148, 254, 0.25) !important;
}

/* Content editable states */
.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

/* Gap cursor for empty blocks */
.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}

/* Hide selection */
.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

/* Placeholder styles */
.ProseMirror .is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
  color: #adb5bd;
  margin-bottom: 0;
}

.tiptap-editor-content .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #6c757d;
  pointer-events: none;
  height: 0;
}

/* ==========================================================================
   Specific Editor Types
   ========================================================================== */

/* Title Editor */
.title-editor .ProseMirror {
  color: #fff !important;
  font-size: 1.25rem;
  font-weight: 500;
  min-height: 60px;
  display: flex;
  align-items: center;
  position: relative;
}

.title-editor .ProseMirror p {
  margin: 0 !important;
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  margin-bottom: 0px !important;
}

/* Body Editor */
.body-editor .ProseMirror {
  color: #adb5bd !important;
  min-height: 200px;
}

/* Permlink Editor */
.permlink-editor .ProseMirror {
  color: #6c757d !important;
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* Collaborative status */
.row-collaborative .ProseMirror {
  border-left: 4px solid #5C94FE;
}

.row-local .ProseMirror {
  border-left: 4px solid #6c757d;
}

/* ==========================================================================
   Typography and Content Styles
   ========================================================================== */

/* Headings */
.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4,
.ProseMirror h5,
.ProseMirror h6,
.tiptap-editor-content .ProseMirror h1,
.tiptap-editor-content .ProseMirror h2,
.tiptap-editor-content .ProseMirror h3,
.tiptap-editor-content .ProseMirror h4,
.tiptap-editor-content .ProseMirror h5,
.tiptap-editor-content .ProseMirror h6 {
  color: #fff !important;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
}

.ProseMirror h1,
.tiptap-editor-content .ProseMirror h1 {
  font-size: 2rem;
}

.ProseMirror h2,
.tiptap-editor-content .ProseMirror h2 {
  font-size: 1.5rem;
}

.ProseMirror h3,
.tiptap-editor-content .ProseMirror h3 {
  font-size: 1.25rem;
}

/* Paragraphs */
.ProseMirror p,
.tiptap-editor-content .ProseMirror p {
  margin: 0.5rem 0;
}

/* Lists */
.ProseMirror ul,
.ProseMirror ol,
.tiptap-editor-content .ProseMirror ul,
.tiptap-editor-content .ProseMirror ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.ProseMirror li,
.tiptap-editor-content .ProseMirror li {
  margin: 0.25rem 0;
}

/* Blockquotes */
.ProseMirror blockquote,
.tiptap-editor-content .ProseMirror blockquote {
  border-left: 4px solid #5C94FE;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #ced4da;
  /* font-style: italic; removed to match markdown export */
}

/* Code */
.ProseMirror code,
.tiptap-editor-content .ProseMirror code {
  background-color: #495057;
  color: #f8f9fa;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
}

.ProseMirror pre,
.tiptap-editor-content .ProseMirror pre {
  background-color: #343a40;
  color: #f8f9fa;
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.ProseMirror pre code,
.tiptap-editor-content .ProseMirror pre code {
  background-color: transparent;
  padding: 0;
}

/* Horizontal Rule Wrapper */
.ProseMirror .hr-wrapper,
.tiptap-editor-content .ProseMirror .hr-wrapper {
  min-height: 20px;
  display: flex;
  align-items: center;
  margin: 1rem 0;
  cursor: move;
}

/* Horizontal Rule */
.ProseMirror .hr-wrapper hr,
.tiptap-editor-content .ProseMirror .hr-wrapper hr {
  border: none;
  border-top: 2px solid #495057;
  margin: 0;
  width: 100%;
  display: block;
  box-sizing: content-box;
}

/* Text Formatting */
.ProseMirror strong,
.tiptap-editor-content .ProseMirror strong {
  font-weight: 600;
  color: #fff;
}

.ProseMirror em,
.tiptap-editor-content .ProseMirror em {
  font-style: italic;
}

.ProseMirror s,
.tiptap-editor-content .ProseMirror s {
  text-decoration: line-through;
}

/* Links */
.ProseMirror a {
  color: #5C94FE;
  text-decoration: underline;
}

.ProseMirror a:hover {
  color: #4a7cfe;
}

/* Focus styles */
.tiptap-editor-container:focus-within {
  border-color: #5C94FE;
  box-shadow: 0 0 0 0.2rem rgba(92, 148, 254, 0.25);
}

/* Collaboration header */
.tiptap-collab-header {
  border-radius: 0.375rem 0.375rem 0 0;
}

.collab-cursor {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Collaboration caret indicators in editor (TipTap v3) */
.ProseMirror .collaboration-carets__caret {
  border-left-width: 2px !important;
  border-left-style: solid !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  position: relative;
  word-break: normal;
  display: inline-block;
  height: 1.2em;
}

.ProseMirror .collaboration-carets__label {
  border-radius: 3px 3px 3px 0;
  color: white !important;
  font-size: 12px !important;
  font-style: normal !important;
  font-weight: 600 !important;
  left: -2px;
  line-height: 1.2 !important;
  padding: 0.1rem 0.3rem !important;
  position: absolute;
  top: -1.4em;
  user-select: none;
  white-space: nowrap;
  z-index: 10;
  display: block !important;
  width: auto !important;
  height: auto !important;
}

/* Legacy collaboration cursor support */
.tiptap-editor-content .ProseMirror .collaboration-cursor__caret,
.ProseMirror .collaboration-cursor__caret {
  border-left: 1px solid #0d0d0d;
  border-right: 1px solid #0d0d0d;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  position: relative;
  word-break: normal;
}

.tiptap-editor-content .ProseMirror .collaboration-cursor__label,
.ProseMirror .collaboration-cursor__label {
  background-color: var(--caret-color);
  border-radius: 3px 3px 3px 0;
  color: #0d0d0d;
  font-size: 12px !important;
  font-style: normal;
  font-weight: 600;
  left: -1px;
  line-height: normal !important;
  padding: 0.1rem 0.3rem;
  position: absolute;
  top: -1.4em;
  user-select: none;
  white-space: nowrap;
  z-index: 10;
}

/* ==========================================================================
   State-based Styles
   ========================================================================== */

/* Read-only editor */
.ProseMirror[contenteditable="false"] {
  background-color: rgba(108, 117, 125, 0.1) !important;
  cursor: default !important;
  opacity: 0.8;
}

.ProseMirror[contenteditable="false"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Read-only toolbar */
.editor-toolbar[style*="pointer-events: none"] {
  user-select: none;
}

/* Editor fullscreen mode */
.editor-toolbar.fullscreen {
  z-index: 1100 !important;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 576px) {
  .ProseMirror {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
  
  .title-editor .ProseMirror {
    font-size: 1.125rem;
  }
  
  .tiptap-toolbar {
    padding: 0.25rem;
  }
  
  .tiptap-toolbar .btn {
    padding: 0.1875rem 0.375rem;
    font-size: 0.8125rem;
  }
  
  .tiptap-editor-content {
    padding: 0.75rem;
  }
  
  .collab-cursor {
    width: 20px;
    height: 20px;
    font-size: 0.625rem;
  }
}

/* Save Status Fade Transitions */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

/* Save Indicator Styles */
.save-indicator {
  position: relative;
}

.save-popover {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 10px;
  min-width: 250px;
  z-index: 1000;
}

/* Document Table Column Widths */
.documents-table {
  table-layout: fixed;
}

.documents-table .col-name {
  width: 30%;
}

.documents-table .col-type {
  width: 10%;
}

.documents-table .col-owner {
  width: 15%;
}

.documents-table .col-access {
  width: 15%;
}

.documents-table .col-modified {
  width: 15%;
}

.documents-table .col-actions {
  width: 15%;
}

/* Bubble Menu Styles */
.bubble-menu {
  background: var(--bs-dark, #212529);
  border: 1px solid var(--bs-secondary, #6c757d);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  padding: 0.25rem;
  z-index: 1000;
  position: absolute;
  
  /* Flexbox for button group wrapping */
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: 200px;
  
  /* Let TipTap control visibility through positioning */
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* When TipTap shows the bubble menu */
.bubble-menu[data-show],
.bubble-menu.is-active,
.bubble-menu[style*="visibility: visible"] {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.bubble-menu .btn-group {
  background: transparent;
}

.bubble-menu .btn {
  border-color: var(--bs-secondary, #6c757d);
  color: var(--bs-light, #f8f9fa);
  background-color: transparent;
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border-width: 1px;
}

.bubble-menu .btn:hover {
  background-color: var(--bs-secondary, #6c757d);
  color: #fff;
  border-color: var(--bs-light, #f8f9fa);
}

.bubble-menu .btn.active {
  background-color: #5C94FE;
  border-color: #5C94FE;
  color: #fff;
}

.bubble-menu .btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(92, 148, 254, 0.25);
}

/* Ensure bubble menu appears above other elements */
.bubble-menu {
  position: absolute !important;
}

/* Tippy.js Dark Theme for DLUX */
.tippy-box[data-theme~='dlux-dark'] {
  background-color: var(--bs-dark, #212529);
  color: var(--bs-light, #f8f9fa);
  border: 1px solid var(--bs-gray-700, #495057);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.tippy-box[data-theme~='dlux-dark'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--bs-dark, #212529);
}

.tippy-box[data-theme~='dlux-dark'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--bs-dark, #212529);
}

.tippy-box[data-theme~='dlux-dark'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--bs-dark, #212529);
}

.tippy-box[data-theme~='dlux-dark'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--bs-dark, #212529);
}

/* Mention Dropdown Styles */
.tippy-box[data-theme~='mention-popup'] {
  background-color: var(--bs-dark, #212529);
  padding: 0;
  max-width: 320px;
}

.mention-dropdown {
  max-height: 300px;
  overflow-y: auto;
  background-color: var(--bs-dark, #212529);
  border-radius: 0.375rem;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--bs-light, #f8f9fa);
  width: 100%;
  text-align: left;
  transition: background-color 0.1s ease;
}

.mention-item:hover,
.mention-item.is-selected {
  background-color: var(--bs-gray-800, #343a40);
  color: #fff;
}

.mention-item.is-selected {
  background-color: var(--bs-primary, #5C94FE);
}

.mention-item.mention-empty {
  color: var(--bs-gray-600, #6c757d);
  justify-content: center;
  cursor: default;
}

.mention-item.mention-empty:hover {
  background-color: transparent;
}

.mention-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bs-gray-700, #495057);
  flex-shrink: 0;
}

.mention-username {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mention tags in the editor */
.ProseMirror .mention {
  color: var(--bs-info, #0dcaf0);
  text-decoration: none;
  cursor: pointer;
  padding: 0 0.125rem;
  border-radius: 0.25rem;
  transition: background-color 0.1s ease;
}

.ProseMirror .mention:hover {
  background-color: rgba(13, 202, 240, 0.1);
  text-decoration: none;
}

/* Loading state for mentions */
.mention-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--bs-gray-600, #6c757d);
}

.mention-loading::after {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.5rem;
  border: 2px solid var(--bs-gray-600, #6c757d);
  border-top-color: transparent;
  border-radius: 50%;
  animation: mention-spin 0.6s linear infinite;
}

@keyframes mention-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Floating Menu - for block insertion */
.floating-menu {
  /* Remove styling - let Bootstrap dropdown handle it */
  padding: 0;
  /* Initially hidden until editor receives focus */
  display: none;
}

/* Show floating menu when TipTap activates it after focus */
.floating-menu[style*="visibility: visible"] {
  display: flex;
}

/* Style the dropdown toggle button */
.floating-menu .dropdown-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
}

/* Ensure dropdown menu items work properly */
.floating-menu .dropdown-menu {
  max-height: 400px;
  overflow-y: auto;
}

/* Dropdown submenu implementation */
.dropdown-menu li {
  position: relative;
}

/* Horizontal submenu for headings */
.dropdown-submenu-horizontal {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  padding: 0.25rem;
  background: var(--bs-dark);
  border: 1px solid var(--bs-gray-700);
  border-radius: 0.375rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* Show submenu on hover */
.dropdown-menu > li:hover > .dropdown-submenu-horizontal {
  display: block;
}

/* Style the heading buttons */
.dropdown-submenu-horizontal .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-weight: bold;
  min-width: auto;
}

/* Remove overflow on parent when submenu is visible */
.floating-menu .dropdown-menu:has(li:hover > .dropdown-submenu-horizontal) {
  overflow: visible;
}

/* Table Toolbar - positioned above tables */
.table-toolbar {
  position: fixed;
  background: var(--bs-dark);
  border: 1px solid var(--bs-gray-700);
  border-radius: 0.5rem;
  padding: 0.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

/* Show toolbar when table is active */
.table-toolbar-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.table-toolbar .btn-group {
  display: flex;
  align-items: center;
}

.table-toolbar .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  margin: 0 0.125rem;
}

.table-toolbar .btn i {
  font-size: 0.75rem;
}

/* Button group divider */
.btn-group-divider {
  width: 1px;
  height: 1.5rem;
  background-color: var(--bs-gray-700);
  margin: 0 0.25rem;
}

/* Table styles for markdown compatibility */
.ProseMirror table {
  border-collapse: collapse;
  table-layout: auto;
  width: 100%;
  margin: 1rem 0;
  overflow: hidden;
}

/* Striped table rows */
.ProseMirror tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.03);
}

.ProseMirror tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.ProseMirror td,
.ProseMirror th {
  min-width: 1em;
  border: 1px solid var(--bs-gray-700);
  padding: 0.5rem;
  vertical-align: top;
  box-sizing: border-box;
  position: relative;
}

.ProseMirror th {
  font-weight: bold;
  text-align: left;
  background-color: var(--bs-gray-800);
}

.ProseMirror .selectedCell:after {
  z-index: 2;
  position: absolute;
  content: "";
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(200, 200, 255, 0.4);
  pointer-events: none;
}

.ProseMirror .column-resize-handle {
  display: none; /* Hide resize handles for markdown compatibility */
}

/* ==========================================================================
   Editor Container Styles
   ========================================================================== */

/* Editor field containers */
.editor-field {
  min-height: 60px;
  border: 1px solid #495057;
  background-color: transparent;
}

.editor-field:focus-within {
  border-color: #5C94FE;
  box-shadow: 0 0 0 0.2rem rgba(92, 148, 254, 0.25);
}

.editor-field-body {
  position: relative;
}

.title-editor {
  min-height: 60px;
}

.permlink-editor {
  min-height: 40px;
}

/* File menu bar */
.file-menu-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  border-radius: 0.375rem 0.375rem 0 0;
}

.file-menu-bar .dropdown-menu {
  font-size: 0.875rem;
}

.dropdown-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Editor status indicators */
.row-collaborative {
  border-left: 8px solid #5C94FE !important;
}

.row-local {
  border-left: 8px solid #6c757d !important;
}

.no-caret::after {
  display: none;
}

/* Drag Handle Styles - Dark Theme (Tippy-positioned) */
.ProseMirror-drag-handle {
  width: 20px;
  height: 20px;
  cursor: grab;
  background: var(--bs-gray-700);
  border: 1px solid var(--bs-gray-600);
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease;
  transform: translateX(-10px); 
}

.ProseMirror-drag-handle:hover {
  background: var(--bs-gray-600);
  border-color: var(--bs-gray-500);
}

.ProseMirror-drag-handle:active {
  cursor: grabbing;
}

/* Drag handle icon */
.ProseMirror-drag-handle::before {
  content: '⋮⋮';
  color: var(--bs-gray-400);
  font-size: 10px;
  line-height: 1;
  display: block;
  transform: rotate(90deg);
  user-select: none;
}

.ProseMirror-drag-handle:hover::before {
  color: var(--bs-light);
}

/* Drag handle horizontal positioning */

/* Dragging state */
.ProseMirror .dragging {
  opacity: 0.5;
}

.ProseMirror .drag-preview {
  opacity: 0.8;
  background: var(--bs-primary);
  border-radius: 0.25rem;
}

/* Smooth transition for dropcursor visibility changes */
.custom-dropcursor {
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Drag handle visibility with CSS hover approach */
/* Hide by default without !important so it can be overridden */
.ProseMirror-drag-handle {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Show on editor hover - multiple selectors for reliability */
.ProseMirror:hover .ProseMirror-drag-handle,
.tiptap-editor-content:hover .ProseMirror-drag-handle,
.editor-field-body:hover .ProseMirror-drag-handle,
.ProseMirror:focus-within .ProseMirror-drag-handle {
  opacity: 1;
  visibility: visible;
}

/* Also show parent wrapper on hover if it exists */
.ProseMirror:hover div[style*="pointer-events: none"][style*="position: absolute"] > .ProseMirror-drag-handle,
.tiptap-editor-content:hover div[style*="pointer-events: none"][style*="position: absolute"] > .ProseMirror-drag-handle {
  opacity: 1;
  visibility: visible;
}

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

/* ==========================================================================
   Media Elements
   ========================================================================== */

/* Images */
.ProseMirror img {
  max-width: 100%;
  height: auto;
  display: block;
  cursor: move;
  margin: 0 auto;
}

/* Visual feedback when dragging images */
.ProseMirror img:active {
  opacity: 0.7;
}

.ProseMirror img.content-image {
  border-radius: 0.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Image figures and captions */
.ProseMirror figure.image-figure {
  margin: 1rem 0;
  text-align: center;
}

.ProseMirror figcaption.image-caption {
  color: #6c757d;
  font-size: 0.875rem;
  font-style: italic;
  margin-top: 0.5rem;
  padding: 0 1rem;
  line-height: 1.4;
}


/* Ensure videos are responsive and visible */
.ProseMirror video {
  display: block;
  max-width: 100%;
  height: auto;
  background-color: #000; /* Black background while loading */
  margin: 0 auto;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ProseMirror video[width="100%"] {
  width: 100%;
}

/* Ensure video controls are visible */
.ProseMirror video[controls] {
  cursor: pointer;
}

/* ==========================================================================
   Additional UI Elements
   ========================================================================== */

/* Cursor pointer utility */
.cursor-pointer {
  cursor: pointer;
  transition: opacity 0.2s, background-color 0.2s ease, transform 0.1s ease;
}

.cursor-pointer:hover {
  opacity: 0.8;
  background-color: rgba(255, 255, 255, 0.05);
}

/* Collaboration status */
.collaboration-status {
  transition: all 0.3s ease;
  border-left-width: 4px !important;
}

/* Rotation animation */
.fa-rotate-180 {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

/* Alert info animation */
.alert-info {
  animation: subtle-pulse 2s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
}

