/**
 * Block Editor Styles - Medium-style Design
 * Tiptap editor with Notion-style interactions
 * ⚠️ NO NEOBRUTALISM - Use soft shadows, thin borders, rounded corners
 */

/* ===========================================
 * BLOCK EDITOR BASE
 * =========================================== */

.block-editor {
  position: relative;
  width: 100%;
}

.block-editor__wrapper {
  position: relative;
  min-height: 400px;
  padding-left: 64px; /* Space for drag handle + add button */
}

.block-editor__editor {
  outline: none;
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: 1.4;
  color: var(--text-primary);
}

/* ===========================================
 * BLOCK SELECTION (Notion-style)
 * =========================================== */

/* Highlighted blocks during drag selection (temporary) */
.ProseMirror > .drag-selected,
.ProseMirror > p.drag-selected,
.ProseMirror > h1.drag-selected,
.ProseMirror > h2.drag-selected,
.ProseMirror > h3.drag-selected,
.ProseMirror > h4.drag-selected,
.ProseMirror > h5.drag-selected,
.ProseMirror > h6.drag-selected,
.ProseMirror > ul.drag-selected,
.ProseMirror > ol.drag-selected,
.ProseMirror > blockquote.drag-selected,
.ProseMirror > pre.drag-selected,
.ProseMirror > hr.drag-selected,
.ProseMirror > div.drag-selected {
  background-color: rgba(25, 118, 210, 0.2) !important; /* --color-blue-500 with alpha */
  border-radius: 3px;
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
}

/* Selected blocks (persistent selection) - Notion style */
.ProseMirror > .block-selected,
.ProseMirror > p.block-selected,
.ProseMirror > h1.block-selected,
.ProseMirror > h2.block-selected,
.ProseMirror > h3.block-selected,
.ProseMirror > h4.block-selected,
.ProseMirror > h5.block-selected,
.ProseMirror > h6.block-selected,
.ProseMirror > ul.block-selected,
.ProseMirror > ol.block-selected,
.ProseMirror > blockquote.block-selected,
.ProseMirror > pre.block-selected,
.ProseMirror > hr.block-selected,
.ProseMirror > div.block-selected {
  background-color: rgba(25, 118, 210, 0.2) !important; /* --color-blue-500 with alpha */
  border-radius: 3px;
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
  position: relative;
}

/* Selection indicator container */
.block-selection-indicators {
  pointer-events: none;
  z-index: 5;
}

/* Vertical selection indicator bar (Notion style) */
.block-selection-indicator {
  width: 4px;
  background: var(--color-blue-500);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(25, 118, 210, 0.5);
  transition: height 0.1s ease, top 0.1s ease;
}

/* Selection rectangle (lasso) */
.drag-selection-rect {
  background: rgba(25, 118, 210, 0.1); /* --color-blue-500 with alpha */
  border: 1px solid rgba(25, 118, 210, 0.4);
  border-radius: 2px;
}

/* Prevent text selection ONLY during block drag-to-select from left margin */
.block-editor.is-drag-selecting .block-editor__wrapper {
  user-select: none;
}

/* Note: Native text selection is always enabled - do not disable it */

/* ===========================================
 * SELECTION TOOLBAR (TIPTAP BUBBLE MENU)
 * Uses selection-toolbar styles from components.css
 * These are overrides for Tiptap BubbleMenu integration
 * =========================================== */

/* Hidden by default - Tiptap BubbleMenu extension controls visibility via Tippy.js */
.block-editor .selection-toolbar {
  visibility: hidden;
  opacity: 0;
}

/* Tippy.js shows the selection toolbar by wrapping it */
.tippy-box .selection-toolbar,
.selection-toolbar[data-visible="true"] {
  visibility: visible;
  opacity: 1;
}

/* Color picker active state - appears above */
.selection-toolbar__color-picker.active {
  opacity: 1;
  visibility: visible;
}

.block-editor .selection-toolbar__color-picker {
  top: auto;
  bottom: calc(100% + 8px);
}

/* Clear highlight option */
.selection-toolbar__color-option--clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 2px dashed var(--border-default);
}

/* ===========================================
 * FLOATING MENU (Drag Handle + Add Button)
 * =========================================== */

.floating-menu {
  position: absolute;
  left: 8px;
  top: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease, top 0.1s ease;
  z-index: 10;
}

.floating-menu.visible {
  opacity: 1;
  visibility: visible;
}

/* DEBUG: Uncomment to always show floating menu */
/* .floating-menu { opacity: 1 !important; visibility: visible !important; } */

.floating-menu__drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: grab;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.floating-menu__drag-handle:hover {
  color: var(--text-secondary);
  background-color: var(--color-gray-100);
}

.floating-menu__drag-handle:active {
  cursor: grabbing;
  background-color: var(--color-gray-200);
}

.floating-menu__drag-handle i {
  font-size: 18px;
}

.floating-menu__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.floating-menu__btn:hover {
  color: var(--text-secondary);
  background-color: var(--color-gray-100);
}

.floating-menu__btn:active {
  background-color: var(--color-gray-200);
}

.floating-menu__btn i {
  font-size: 18px;
}

/* Placeholder text */
.block-editor__editor .is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-tertiary);
  pointer-events: none;
  height: 0;
}

.block-editor__editor .is-empty::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-tertiary);
  pointer-events: none;
  height: 0;
}

/* Ensure empty paragraphs have minimum height for hover detection */
.block-editor__editor .ProseMirror > p.is-empty,
.block-editor__editor .ProseMirror > p:empty {
  min-height: 1.4em;
}

/* ===========================================
 * TIPTAP CONTENT STYLES
 * =========================================== */

.block-editor__editor .ProseMirror {
  outline: none;
  min-height: 400px;
  padding: var(--spacing-4) 0;
}

.block-editor__editor .ProseMirror > * {
  margin-bottom: var(--spacing-2);
}

.block-editor__editor .ProseMirror > *:last-child {
  margin-bottom: 0;
}

/* Headings */
.block-editor__editor h1 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-top: var(--spacing-8);
  margin-bottom: var(--spacing-4);
}

.block-editor__editor h2 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-top: var(--spacing-6);
  margin-bottom: var(--spacing-3);
}

.block-editor__editor h3 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-top: var(--spacing-5);
  margin-bottom: var(--spacing-2);
}

/* Paragraphs */
.block-editor__editor p {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: 1.4;
}

/* Bold, Italic, etc */
.block-editor__editor strong {
  font-weight: var(--font-weight-bold);
}

.block-editor__editor em {
  font-style: italic;
}

.block-editor__editor s {
  text-decoration: line-through;
}

.block-editor__editor code {
  background-color: var(--bg-muted);
  border-radius: var(--radius-xs);
  padding: 0.125rem 0.375rem;
  font-family: var(--font-family-mono);
  font-size: 0.9em;
}

/* Links - Neobrutalism Style */
.block-editor__editor a,
.block-editor__editor .editor-link {
  color: var(--color-green-500);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: all 0.15s ease;
}

.block-editor__editor a:hover,
.block-editor__editor .editor-link:hover {
  color: var(--color-green-700);
  text-decoration-color: var(--color-green-700);
}

/* Lists */
.block-editor__editor ul,
.block-editor__editor ol {
  padding-left: var(--spacing-6);
  margin: var(--spacing-4) 0;
}

.block-editor__editor ul {
  list-style-type: disc;
}

.block-editor__editor ol {
  list-style-type: decimal;
}

.block-editor__editor li {
  margin-bottom: var(--spacing-2);
  padding-left: var(--spacing-2);
}

.block-editor__editor li p {
  margin: 0;
}

/* Blockquote - Medium Style */
.block-editor__editor blockquote {
  margin: var(--spacing-6) 0;
  padding: var(--spacing-4) var(--spacing-6);
  background-color: transparent;
  border-left: 3px solid var(--text-primary);
  font-style: italic;
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}

.block-editor__editor blockquote p {
  margin: 0;
}

/* Horizontal Rule - Medium Style */
.block-editor__editor hr {
  border: none;
  height: 1px;
  background-color: var(--border-default);
  margin: var(--spacing-8) 0;
}

/* Code Block - Medium Style */
.block-editor__editor pre {
  margin: var(--spacing-6) 0;
  padding: var(--spacing-4);
  background-color: var(--color-gray-50);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.block-editor__editor pre code {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-primary);
}

/* Code Syntax Highlighting - Light theme */
.block-editor__editor pre .hljs-keyword { color: #d73a49; }
.block-editor__editor pre .hljs-string { color: #22863a; }
.block-editor__editor pre .hljs-number { color: #005cc5; }
.block-editor__editor pre .hljs-comment { color: #6a737d; }
.block-editor__editor pre .hljs-function { color: #6f42c1; }
.block-editor__editor pre .hljs-class { color: #d73a49; }
.block-editor__editor pre .hljs-variable { color: #24292e; }
.block-editor__editor pre .hljs-attr { color: #005cc5; }
.block-editor__editor pre .hljs-tag { color: #22863a; }

/* Image - Medium Style */
.block-editor__editor img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--spacing-6) auto;
  border-radius: var(--radius-sm);
}

.block-editor__editor img.ProseMirror-selectednode {
  outline: 4px solid #58CC02;
  outline-offset: 2px;
}

/* YouTube Embed - Medium Style */
.block-editor__editor iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: var(--radius-sm);
  margin: var(--spacing-6) 0;
}

/* ===========================================
 * SLASH MENU - NOTION STYLE WITH PREVIEW
 * =========================================== */

.slash-menu {
  position: absolute;
  z-index: 1000;
  display: none;
  flex-direction: column;
  width: auto;
  background-color: #fff;
  border: 1px solid rgba(55, 53, 47, 0.1);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(15, 15, 15, 0.05), 0 3px 6px rgba(15, 15, 15, 0.1), 0 9px 24px rgba(15, 15, 15, 0.2);
  overflow: visible;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.slash-menu.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Container for list and preview side by side */
.slash-menu__container {
  display: flex;
  flex-direction: row;
}

/* List section */
.slash-menu__list {
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  flex-shrink: 0;
}

/* Custom scrollbar */
.slash-menu__list::-webkit-scrollbar {
  width: 6px;
}

.slash-menu__list::-webkit-scrollbar-track {
  background: transparent;
}

.slash-menu__list::-webkit-scrollbar-thumb {
  background: #E0E0E0;
  border-radius: 3px;
}

.slash-menu__list::-webkit-scrollbar-thumb:hover {
  background: #BDBDBD;
}

/* Category headers */
.slash-menu__category {
  display: block;
  padding: 8px 12px 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(55, 53, 47, 0.5);
}

.slash-menu__category:not(:first-child) {
  margin-top: 6px;
  border-top: 1px solid rgba(55, 53, 47, 0.09);
  padding-top: 10px;
}

/* Menu items */
.slash-menu__item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  margin-bottom: 1px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.slash-menu__item:hover,
.slash-menu__item.selected {
  background-color: rgba(55, 53, 47, 0.08);
}

.slash-menu__item:focus,
.slash-menu__item:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  background-color: rgba(55, 53, 47, 0.08);
}

.slash-menu__item:active {
  background-color: rgba(55, 53, 47, 0.12);
}

.slash-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: rgba(55, 53, 47, 0.06);
  border-radius: 4px;
  font-size: 16px;
  color: rgba(55, 53, 47, 0.7);
  flex-shrink: 0;
}

.slash-menu__item:hover .slash-menu__icon,
.slash-menu__item.selected .slash-menu__icon {
  background-color: rgba(55, 53, 47, 0.1);
  color: rgba(55, 53, 47, 0.85);
}

.slash-menu__item-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.slash-menu__item-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgb(55, 53, 47);
  line-height: 1.3;
}

.slash-menu__item-desc {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 12px;
  color: rgba(55, 53, 47, 0.5);
  line-height: 1.3;
}

/* Preview panel - appears on hover (Notion style) */
.slash-menu__preview {
  display: none;
  width: 240px;
  padding: 16px;
  background-color: #fafafa;
  border-left: 1px solid rgba(55, 53, 47, 0.1);
  flex-direction: column;
  gap: 12px;
  border-radius: 0 8px 8px 0;
}

.slash-menu__preview.visible {
  display: flex;
}

.slash-menu__preview-content {
  background: white;
  border-radius: 6px;
  padding: 16px;
  min-height: 80px;
  font-size: 14px;
  border: 1px solid rgba(55, 53, 47, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Footer */
.slash-menu__footer {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background-color: rgba(55, 53, 47, 0.04);
  border-top: 1px solid rgba(55, 53, 47, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 12px;
  color: rgba(55, 53, 47, 0.5);
}

.slash-menu__footer-hint {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slash-menu__footer kbd {
  display: inline-block;
  padding: 2px 6px;
  background: white;
  border: 1px solid rgba(55, 53, 47, 0.16);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  color: rgba(55, 53, 47, 0.6);
}

/* Hide header */
.slash-menu__header {
  display: none;
}

/* ===========================================
 * YOUTUBE MODAL - PREMIUM NOTION STYLE
 * =========================================== */

.youtube-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.youtube-modal.active {
  display: flex;
  opacity: 1;
}

.youtube-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 15, 15, 0.6);
  backdrop-filter: blur(4px);
}

.youtube-modal__content {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 16px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(15, 15, 15, 0.05),
    0 3px 6px rgba(15, 15, 15, 0.1),
    0 9px 24px rgba(15, 15, 15, 0.2);
  transform: scale(0.96) translateY(-8px);
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.youtube-modal.active .youtube-modal__content {
  transform: scale(1) translateY(0);
}

/* Header */
.youtube-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
  border-bottom: 1px solid rgba(55, 53, 47, 0.09);
}

.youtube-modal__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.youtube-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  border-radius: 10px;
  color: white;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(255, 0, 0, 0.25);
}

.youtube-modal__title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: rgb(55, 53, 47);
  margin: 0;
  letter-spacing: -0.01em;
}

.youtube-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(55, 53, 47, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 18px;
}

.youtube-modal__close:hover {
  background-color: rgba(55, 53, 47, 0.08);
  color: rgb(55, 53, 47);
}

.youtube-modal__close:active {
  background-color: rgba(55, 53, 47, 0.12);
  transform: scale(0.96);
}

/* Form */
.youtube-modal__form {
  padding: 24px 28px 28px;
}

.youtube-modal__input-group {
  margin-bottom: 24px;
}

.youtube-modal__label {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgb(55, 53, 47);
  margin-bottom: 8px;
}

/* Input wrapper with icon */
.youtube-modal__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.youtube-modal__input-icon {
  position: absolute;
  left: 14px;
  color: rgba(55, 53, 47, 0.4);
  font-size: 18px;
  pointer-events: none;
  transition: color 0.15s ease;
}

.youtube-modal__input-wrapper:focus-within .youtube-modal__input-icon {
  color: rgb(55, 53, 47);
}

.youtube-modal__input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 15px;
  background-color: #fff;
  border: 1px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  transition: all 0.15s ease;
  color: rgb(55, 53, 47);
}

.youtube-modal__input:hover {
  border-color: rgba(55, 53, 47, 0.3);
}

.youtube-modal__input:focus {
  outline: none;
  border-color: rgb(55, 53, 47);
  box-shadow: 0 0 0 3px rgba(55, 53, 47, 0.1);
}

.youtube-modal__input::placeholder {
  color: rgba(55, 53, 47, 0.4);
}

.youtube-modal__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 13px;
  color: rgba(55, 53, 47, 0.5);
  font-weight: 400;
}

.youtube-modal__hint i {
  font-size: 14px;
}

/* Actions */
.youtube-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.youtube-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.youtube-modal__btn--cancel {
  background-color: transparent;
  color: rgba(55, 53, 47, 0.65);
}

.youtube-modal__btn--cancel:hover {
  background-color: rgba(55, 53, 47, 0.08);
  color: rgb(55, 53, 47);
}

.youtube-modal__btn--cancel:active {
  background-color: rgba(55, 53, 47, 0.12);
  transform: scale(0.98);
}

.youtube-modal__btn--submit {
  background: linear-gradient(180deg, rgb(55, 53, 47) 0%, rgb(35, 33, 27) 100%);
  color: white;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.youtube-modal__btn--submit:hover {
  background: linear-gradient(180deg, rgb(75, 73, 67) 0%, rgb(55, 53, 47) 100%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.youtube-modal__btn--submit:active {
  background: linear-gradient(180deg, rgb(35, 33, 27) 0%, rgb(25, 23, 17) 100%);
  transform: scale(0.98);
}

.youtube-modal__btn--submit i {
  font-size: 16px;
}

/* ===========================================
 * UTILITY CLASSES
 * =========================================== */

.hidden {
  display: none !important;
}

/* ===========================================
 * EDITOR PAGE SPECIFIC OVERRIDES
 * =========================================== */

.editor-page .block-editor__editor {
  min-height: 400px;
}

/* Selection highlight */
.block-editor__editor .ProseMirror-gapcursor:after {
  border-top: 2px solid var(--color-black);
}

/* Drop cursor for drag and drop */
.block-editor__editor .ProseMirror-dropcursor {
  border-left: 4px solid #58CC02;
}

/* ===========================================
 * DRAG & DROP STYLES
 * =========================================== */

/* Dragging state for blocks */
.block-editor__editor .ProseMirror .is-dragging {
  opacity: 0.3;
  background: #e5e7eb;
  border-radius: 4px;
  position: relative;
}

.block-editor__editor .ProseMirror .is-dragging::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed #9ca3af;
  border-radius: 4px;
  pointer-events: none;
}

/* Hover highlight for drop target - Notion style */
.block-editor__editor .ProseMirror .drag-hover {
  background: #eff6ff;
  border-radius: 4px;
  margin-left: -8px;
  margin-right: -8px;
  padding-left: 8px;
  padding-right: 8px;
}

/* Drag ghost element - Minimal Medium-style */
.drag-ghost {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: white !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  padding: 12px 16px !important;
}

/* Drop indicator line - Notion style */
.drop-indicator {
  height: 3px !important;
  background: #2563eb !important;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3), 0 2px 8px rgba(37, 99, 235, 0.4);
  transition: top 0.05s ease-out;
}

/* Cursor change on drag handle */
.floating-menu__drag-handle {
  cursor: grab;
}

.floating-menu__drag-handle:active {
  cursor: grabbing;
}

/* Body class when dragging */
body.is-dragging-block {
  cursor: grabbing !important;
  user-select: none;
}

/* ===========================================
 * RESIZABLE IMAGE
 * Clean, minimal Medium-style (no Neobrutalism)
 * =========================================== */

.resizable-image-container {
  position: relative;
  display: inline-block;
  margin: var(--spacing-6) 0;
  cursor: default;
}

/* Alignment */
.resizable-image-container[data-align="left"] {
  display: block;
  text-align: left;
}

.resizable-image-container[data-align="center"] {
  display: block;
  text-align: center;
}

.resizable-image-container[data-align="right"] {
  display: block;
  text-align: right;
}

/* Image wrapper - contains image and handles */
.resizable-image-wrapper {
  position: relative;
  display: inline-block;
}

/* Image inside wrapper - clean style */
.resizable-image-wrapper img {
  display: block;
  max-width: 100%;
  border-radius: 4px;
  border: none !important;
  box-shadow: none !important;
}

/* Selection border - blue outline like reference */
.ProseMirror-selectednode .resizable-image-wrapper,
.resizable-image-container.is-resizing .resizable-image-wrapper {
  outline: 2px solid var(--color-blue-400);
  outline-offset: 3px;
}

/* ===========================================
 * RESIZE HANDLES - 8 handles (4 corners + 4 sides)
 * =========================================== */

/* Base handle styles */
.resize-handle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}

/* Show handles on selection or hover */
.ProseMirror-selectednode .resize-handle,
.resizable-image-container:hover .resize-handle,
.resizable-image-container.is-resizing .resize-handle {
  opacity: 1;
  pointer-events: auto;
}

/* Corner handles - square dots */
.resize-handle--corner {
  width: 10px;
  height: 10px;
  background: white;
  border: 2px solid var(--color-blue-400);
  border-radius: 2px;
}

.resize-handle--corner:hover {
  background: var(--color-blue-400);
}

/* Corner positions */
.resize-handle--nw {
  top: -8px;
  left: -8px;
  cursor: nw-resize;
}

.resize-handle--ne {
  top: -8px;
  right: -8px;
  cursor: ne-resize;
}

.resize-handle--sw {
  bottom: -8px;
  left: -8px;
  cursor: sw-resize;
}

.resize-handle--se {
  bottom: -8px;
  right: -8px;
  cursor: se-resize;
}

/* Side handles - lines */
.resize-handle--side {
  background: var(--color-blue-400);
  border-radius: 2px;
}

/* Top and bottom side handles */
.resize-handle--n,
.resize-handle--s {
  width: 50px;
  height: 4px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.resize-handle--n {
  top: -6px;
}

.resize-handle--s {
  bottom: -6px;
}

/* Left and right side handles */
.resize-handle--e,
.resize-handle--w {
  width: 4px;
  height: 50px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.resize-handle--e {
  right: -6px;
}

.resize-handle--w {
  left: -6px;
}

/* Side handle hover effect */
.resize-handle--side:hover {
  background: var(--color-blue-500);
}

/* Resizing state */
.resizable-image-container.is-resizing {
  user-select: none;
}

/* ===========================================
 * RESIZABLE YOUTUBE
 * =========================================== */

.resizable-youtube-container {
  position: relative;
  display: flex;
  justify-content: center;
  margin: var(--spacing-6) 0;
}

.resizable-youtube-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.resizable-youtube-wrapper iframe {
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Selection state */
.ProseMirror-selectednode .resizable-youtube-wrapper,
.resizable-youtube-container.is-resizing .resizable-youtube-wrapper {
  outline: 2px solid var(--color-blue-400);
  outline-offset: 4px;
  border-radius: 12px;
}

/* YouTube resize handles */
.youtube-resize-handle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.ProseMirror-selectednode .youtube-resize-handle,
.resizable-youtube-container:hover .youtube-resize-handle,
.resizable-youtube-container.is-resizing .youtube-resize-handle {
  opacity: 1;
  pointer-events: auto;
}

/* Side handles (east/west) */
.youtube-resize-handle--e,
.youtube-resize-handle--w {
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 60px;
  background: var(--color-blue-400);
  border-radius: 4px;
  cursor: ew-resize;
}

.youtube-resize-handle--e {
  right: -16px;
}

.youtube-resize-handle--w {
  left: -16px;
}

/* Corner handles */
.youtube-resize-handle--se,
.youtube-resize-handle--sw {
  bottom: -12px;
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid var(--color-blue-400);
  border-radius: 3px;
}

.youtube-resize-handle--se {
  right: -12px;
  cursor: se-resize;
}

.youtube-resize-handle--sw {
  left: -12px;
  cursor: sw-resize;
}

.youtube-resize-handle:hover {
  background: var(--color-blue-500);
}

.youtube-resize-handle--se:hover,
.youtube-resize-handle--sw:hover {
  background: var(--color-blue-400);
}

.resizable-youtube-container.is-resizing {
  user-select: none;
}

/* ===========================================
 * IMAGE TOOLBAR
 * =========================================== */

.image-toolbar {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 20;
}

.ProseMirror-selectednode .image-toolbar,
.resizable-image-container:hover .image-toolbar {
  opacity: 1;
  visibility: visible;
}

.image-toolbar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.image-toolbar__btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.image-toolbar__btn[data-action="delete"]:hover {
  background: #fee2e2;
  color: #dc2626;
}

.image-toolbar__btn i {
  font-size: 18px;
}

.image-toolbar__divider {
  width: 1px;
  height: 24px;
  background: #e5e7eb;
  margin: 0 4px;
}

/* Override default image styles */
.block-editor__editor .resizable-image-container img,
.block-editor__editor .resizable-image-wrapper img {
  margin: 0;
  border: none !important;
  box-shadow: none !important;
}

.block-editor__editor .ProseMirror-selectednode .resizable-image-container img {
  outline: none !important;
}

/* ===========================================
 * FIELD ERROR STATE
 * =========================================== */

.field--error {
  border: 2px solid var(--status-error, #dc2626) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
  animation: field-error-shake 0.4s ease;
}

.field--error:focus {
  border-color: var(--status-error, #dc2626) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
}

@keyframes field-error-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ===========================================
 * WORD COUNT FOOTER
 * =========================================== */

.block-editor__footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--spacing-4) 0;
  margin-top: var(--spacing-4);
  border-top: 1px solid var(--border-light);
}

.block-editor__word-count {
  font-family: var(--font-family-ui);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  user-select: none;
}
