/* Material Design 3 Interactive Markdown WYSIWYG Editor Styles */

.editor-view-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  flex: 1;
  background-color: var(--md-sys-color-surface);
  position: relative;
  overflow: hidden;
}

/* Editor Header & Control Bar */
.editor-top-nav {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--md-sys-color-surface-container-high);
  background-color: var(--md-sys-color-surface);
  flex-shrink: 0;
  gap: 16px;
}

.editor-nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-folder-select {
  padding: 6px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.editor-save-indicator {
  font-size: 12.5px;
  color: var(--md-sys-color-outline);
  display: flex;
  align-items: center;
  gap: 6px;
}
.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--md-sys-color-outline);
}
.save-dot.saved {
  background-color: #4caf50;
}
.save-dot.saving {
  background-color: #ff9800;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.editor-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Fixed Quick Formatting Toolbar (Optional Helper) */
.editor-action-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 24px;
  background-color: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-surface-container-high);
  flex-wrap: wrap;
}
.toolbar-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--md-sys-shape-corner-small);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toolbar-btn:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}
.toolbar-btn.active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.toolbar-sep {
  width: 1px;
  height: 20px;
  background-color: var(--md-sys-color-outline-variant);
  margin: 0 4px;
}

/* Main Editor Workspace & Canvas Layout */
.editor-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  height: calc(100% - 102px);
}

.editor-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px 56px 65vh 56px;
  display: flex;
  justify-content: flex-start;
  transition: padding 0.25s cubic-bezier(0.2, 0, 1);
  scroll-behavior: smooth;
}

.editor-paper {
  width: 100%;
  max-width: 980px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

/* Note Title Input */
.editor-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--md-sys-color-on-surface);
  outline: none;
  font-family: inherit;
}
.editor-title-input::placeholder {
  color: var(--md-sys-color-outline-variant);
}

/* Tags Chip Bar */
.editor-tags-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--md-sys-color-surface-container-high);
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
}
.tag-chip-remove {
  cursor: pointer;
  opacity: 0.6;
}
.tag-chip-remove:hover {
  opacity: 1;
}
.tag-input-inline {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  font-family: inherit;
  color: var(--md-sys-color-on-surface);
  min-width: 80px;
}

/* The Core Interactive WYSIWYG Content Area */
.editor-interactive-content {
  min-height: 480px;
  outline: none;
  font-size: 16px;
  line-height: 1.7;
  color: var(--md-sys-color-on-surface);
  word-break: break-word;
}

.editor-interactive-content:empty::before {
  content: '输入内容，或输入 / 快速唤起插入菜单...';
  color: var(--md-sys-color-outline-variant);
  pointer-events: none;
}

/* Typography styles inside editor */
.editor-interactive-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}
.editor-interactive-content h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-top: 20px;
  margin-bottom: 10px;
  line-height: 1.35;
}
.editor-interactive-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-top: 16px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.editor-interactive-content p {
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.7;
  font-size: 16px;
}

/* Interactive Checkboxes / Task Lists */
.editor-interactive-content ul.task-list {
  list-style: none;
  padding-left: 0;
  margin-top: 0;
  margin-bottom: 8px;
}
.editor-interactive-content li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
  line-height: 1.7;
  font-size: 16px;
  min-height: calc(16px * 1.7);
}
.editor-interactive-content li.task-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--md-sys-color-outline);
  cursor: pointer;
  margin-top: 4.5px;
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s ease;
  background-color: var(--md-sys-color-surface);
}
.editor-interactive-content li.task-item input[type="checkbox"]:checked {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}
.editor-interactive-content li.task-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}
.editor-interactive-content li.task-item span {
  flex: 1;
  min-width: 20px;
  min-height: 1.7em;
  line-height: 1.7;
  font-size: 16px;
  outline: none;
  cursor: text;
  display: inline-block;
  margin: 0;
  padding: 0;
}
.editor-interactive-content li.task-item.completed span {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Blockquotes */
.editor-interactive-content blockquote {
  border-left: 4px solid var(--md-sys-color-primary);
  padding: 10px 18px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0;
  margin: 16px 0;
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
  font-size: 16px;
  line-height: 1.7;
}

.editor-interactive-content blockquote p {
  margin: 0;
  min-height: calc(16px * 1.7);
}

.editor-interactive-content blockquote p + p {
  margin-top: 6px;
}

/* Neutralize browser-synthesized white backgrounds inside blockquotes and paragraphs */
.editor-interactive-content blockquote span:not(.text-highlight),
.editor-interactive-content blockquote font {
  background-color: transparent !important;
}

.editor-interactive-content span[style*="background-color: rgb(255, 255, 255)"]:not(.text-highlight),
.editor-interactive-content span[style*="background-color: #ffffff"]:not(.text-highlight),
.editor-interactive-content span[style*="background-color: #fff"]:not(.text-highlight),
.editor-interactive-content span[style*="background-color: transparent"]:not(.text-highlight) {
  background-color: transparent !important;
}

/* Standard Lists */
.editor-interactive-content ul:not(.task-list),
.editor-interactive-content ol {
  padding-left: 24px;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.7;
}
.editor-interactive-content ul:not(.task-list) li,
.editor-interactive-content ol li {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.7;
  min-height: calc(16px * 1.7);
}

/* Ensure <div> blocks (Chrome contenteditable default) match <p> spacing */
.editor-interactive-content > div:not(.code-block-header):not(.code-block-actions):not(.code-block-lang-wrapper) {
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.7;
  font-size: 16px;
}

/* Normalize margins between adjacent list-type elements */
.editor-interactive-content ul + ul,
.editor-interactive-content ol + ol,
.editor-interactive-content ul + ol,
.editor-interactive-content ol + ul,
.editor-interactive-content ul.task-list + ul.task-list {
  margin-top: 0;
}

/* Code Blocks */
.editor-interactive-content pre.code-block {
  background-color: #1e1e24;
  color: #e0e0e0;
  padding: 0;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 20px 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-1);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background-color: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
  font-family: inherit;
}

.code-block-lang-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-lang-icon {
  font-size: 16px !important;
  color: var(--md-sys-color-primary);
  opacity: 0.9;
}

.code-lang-select {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  padding: 3px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-lang-select:hover {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.code-lang-select option {
  background-color: #24242e;
  color: #e0e0e0;
}

.code-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d1d5db;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.code-copy-btn.copied {
  background: rgba(76, 175, 80, 0.25);
  color: #81c784;
  border-color: rgba(76, 175, 80, 0.4);
}

.editor-interactive-content pre.code-block code {
  display: block;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 2;
  color: #e6edf3;
  outline: none;
  white-space: pre;
  word-break: normal;
}

/* Syntax Highlighting Colors (Prism / Built-in token support) */
.editor-interactive-content pre code .token.comment,
.editor-interactive-content pre code .token.prolog,
.editor-interactive-content pre code .token.doctype,
.editor-interactive-content pre code .token.cdata {
  color: #8b949e;
  font-style: italic;
}
.editor-interactive-content pre code .token.punctuation {
  color: #c9d1d9;
}
.editor-interactive-content pre code .token.property,
.editor-interactive-content pre code .token.tag,
.editor-interactive-content pre code .token.boolean,
.editor-interactive-content pre code .token.number,
.editor-interactive-content pre code .token.constant,
.editor-interactive-content pre code .token.symbol {
  color: #79c0ff;
}
.editor-interactive-content pre code .token.selector,
.editor-interactive-content pre code .token.attr-name,
.editor-interactive-content pre code .token.string,
.editor-interactive-content pre code .token.char,
.editor-interactive-content pre code .token.builtin {
  color: #7ee787;
}
.editor-interactive-content pre code .token.operator,
.editor-interactive-content pre code .token.entity,
.editor-interactive-content pre code .token.url {
  color: #ff7b72;
}
.editor-interactive-content pre code .token.atrule,
.editor-interactive-content pre code .token.attr-value,
.editor-interactive-content pre code .token.keyword {
  color: #ff7b72;
  font-weight: 500;
}
.editor-interactive-content pre code .token.function,
.editor-interactive-content pre code .token.class-name {
  color: #d2a8ff;
}
.editor-interactive-content pre code .token.macro,
.editor-interactive-content pre code .token.directive {
  color: #ff7b72;
  font-weight: 500;
}
.editor-interactive-content pre code .token.decorator {
  color: #ffa657;
}
.editor-interactive-content pre code .token.regex,
.editor-interactive-content pre code .token.important,
.editor-interactive-content pre code .token.variable {
  color: #ffa657;
}

/* Inline Code */
.editor-interactive-content code:not(pre code) {
  font-family: 'JetBrains Mono', Consolas, monospace;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Highlight text / Mark */
.editor-interactive-content mark,
.editor-interactive-content mark.text-highlight {
  background-color: #ffe082;
  color: #1a1a1a;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}
[data-theme="dark"] .editor-interactive-content mark,
[data-theme="dark"] .editor-interactive-content mark.text-highlight {
  background-color: #ffd54f;
  color: #000000;
}

/* Tables styling handled in dedicated table section below */

/* Horizontal Rule */
.editor-interactive-content hr {
  border: none;
  height: 1px;
  background-color: var(--md-sys-color-surface-container-highest);
  margin: 24px 0;
}

/* Floating Formatting Bubble Menu (Triggers on text selection - Fixed to viewport to prevent clipping) */
.floating-bubble-menu {
  position: fixed;
  z-index: 10000;
  background-color: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-4);
  display: none;
  align-items: center;
  padding: 4px 6px;
  gap: 2px;
  animation: bubblePop 0.15s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: auto;
  user-select: none;
}
.floating-bubble-menu.show {
  display: flex;
}

@keyframes bubblePop {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble-btn {
  color: var(--md-sys-color-inverse-on-surface);
  width: 32px;
  height: 32px;
  border-radius: var(--md-sys-shape-corner-small);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.bubble-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.bubble-btn.active {
  background-color: var(--md-sys-color-primary) !important;
  color: #ffffff !important;
}

/* Right Sidebar Outline & Stats Panel */
.editor-outline-panel {
  width: 240px;
  min-width: 240px;
  flex-shrink: 0;
  border-left: 1px solid var(--md-sys-color-surface-container-high);
  background-color: var(--md-sys-color-surface);
  overflow-y: auto;
  padding: 20px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: width 0.25s cubic-bezier(0.2, 0, 0, 1), min-width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
}

.editor-outline-panel.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  border-left: none;
}

.outline-card {
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.outline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.outline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.outline-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.outline-tree {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.outline-empty {
  font-size: 12px;
  color: var(--md-sys-color-outline);
  line-height: 1.5;
  padding: 8px 0;
}

.outline-link {
  display: block;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--md-sys-shape-corner-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1.4;
}

.outline-link:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.outline-link.level-1 {
  font-weight: 600;
  padding-left: 8px;
  color: var(--md-sys-color-on-surface);
}

.outline-link.level-2 {
  padding-left: 18px;
  font-size: 12.5px;
}

.outline-link.level-3 {
  padding-left: 28px;
  font-size: 12px;
  opacity: 0.85;
}

.outline-link.active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 600;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stat-item {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 8px 6px;
  text-align: center;
  border: 1px solid var(--md-sys-color-surface-container-high);
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 10.5px;
  color: var(--md-sys-color-outline);
  margin-top: 3px;
}

/* Modern Dynamic Tables (Adaptive width based on content) */
.editor-table-wrapper {
  margin: 20px 0;
  position: relative;
  display: block;
  clear: both;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px 28px 24px 14px;
  user-select: auto;
}

.editor-interactive-content table,
.editor-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  table-layout: auto;
  margin: 0;
  border-radius: 4px;
  background-color: var(--md-sys-color-surface);
}

.editor-interactive-content th,
.editor-interactive-content td {
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 8px 14px;
  text-align: left;
  min-width: 72px;
  max-width: 480px;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
  vertical-align: top;
  position: relative;
  line-height: 1.5;
}

.editor-interactive-content th {
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-weight: 600;
}

.editor-interactive-content td {
  color: var(--md-sys-color-on-surface);
  background-color: transparent;
}

.editor-interactive-content tr:hover td {
  background-color: rgba(0, 99, 155, 0.04);
}
[data-theme="dark"] .editor-interactive-content tr:hover td {
  background-color: rgba(255, 255, 255, 0.04);
}

/* Table Hover Line Inserters (+ indicator on hover) */
.table-line-inserter {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.table-line-inserter.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Horizontal Row Inserter Line */
.table-row-inserter {
  height: 3px;
  background-color: var(--md-sys-color-primary);
  transform: translateY(-50%);
  cursor: pointer;
  border-radius: 2px;
}

.table-row-inserter::before {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  right: 0;
}

.table-row-inserter .table-inserter-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--md-sys-color-surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.table-row-inserter:hover .table-inserter-btn,
.table-row-inserter .table-inserter-btn:hover {
  transform: translate(-50%, -50%) scale(1.18);
  filter: brightness(1.1);
}

.table-row-inserter .table-inserter-btn .material-symbols-outlined {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

/* Vertical Column Inserter Line */
.table-col-inserter {
  width: 3px;
  background-color: var(--md-sys-color-primary);
  transform: translateX(-50%);
  cursor: pointer;
  border-radius: 2px;
}

.table-col-inserter::before {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  top: 0;
  bottom: 0;
}

.table-col-inserter .table-inserter-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--md-sys-color-surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.table-col-inserter:hover .table-inserter-btn,
.table-col-inserter .table-inserter-btn:hover {
  transform: translate(-50%, -50%) scale(1.18);
  filter: brightness(1.1);
}

.table-col-inserter .table-inserter-btn .material-symbols-outlined {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}



/* Context Menu for Table Actions */
.table-context-menu {
  position: fixed;
  z-index: 10001;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-3);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  font-size: 13px;
  animation: bubblePop 0.12s ease;
}

.table-context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--md-sys-shape-corner-small);
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 12.5px;
  white-space: nowrap;
}

.table-context-menu-item:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

.table-context-menu-item.danger {
  color: var(--md-sys-color-error);
}
.table-context-menu-item.danger:hover {
  background-color: var(--md-sys-color-error-container);
}

.table-context-menu-item .material-symbols-outlined {
  font-size: 16px;
}

.table-context-menu-sep {
  height: 1px;
  background-color: var(--md-sys-color-surface-container-highest);
  margin: 3px 0;
}

/* Inline Images */
.editor-interactive-content img,
.editor-inline-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--md-sys-shape-corner-medium);
  margin: 12px 0;
  display: block;
  box-shadow: var(--md-sys-elevation-1);
}

/* Link Action Popover (MD3 style) */
.link-action-popover {
  position: fixed;
  z-index: 120;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-3);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 13px;
  pointer-events: auto;
}

.link-popover-icon {
  font-size: 16px;
  color: var(--md-sys-color-primary);
  margin-left: 2px;
}

.link-popover-url {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 4px;
}

.link-popover-url:hover {
  text-decoration: underline;
  background-color: var(--md-sys-color-surface-container-highest);
}

.link-popover-divider {
  width: 1px;
  height: 18px;
  background-color: var(--md-sys-color-outline-variant);
  margin: 0 2px;
}

.link-popover-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  padding: 0;
}

.link-popover-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.link-popover-btn span {
  font-size: 16px;
}

.link-popover-btn.delete:hover {
  color: var(--md-sys-color-error);
}

