/* ── RichTextBox Inline Toolbar Addon ──
   Bubble menu, link popup, image toolbar, context menu
   ──────────────────────────────────────────────────── */

/* ── Shared button ── */
.rit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px;
  color: #4a4a4a;
  transition: background 0.15s;
}
.rit-btn:hover { background: rgba(0,0,0,0.08); }
.rit-btn svg { width: 16px; height: 16px; }

/* ── Bubble Menu ── */
.rit-bubble-menu {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 6px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100050;
  animation: rit-show 0.12s ease;
  pointer-events: auto;
}
.rit-bubble-menu::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #fff;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
}
@keyframes rit-show {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rit-bubble-menu .rit-btn { width: 26px; height: 26px; }
.rit-bubble-sep { width: 1px; height: 18px; background: #e5e7eb; margin: 0 3px; }

/* ── Link Popup ── */
.rit-link-popup {
  position: fixed;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100050;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: rit-show 0.12s ease;
  max-width: 400px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.rit-link-popup a { color: #4A90D9; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.rit-link-popup a:hover { text-decoration: underline; }
.rit-link-popup .rit-btn { width: 24px; height: 24px; flex-shrink: 0; }
.rit-link-popup .rit-btn svg { width: 14px; height: 14px; }
.rit-link-sep { width: 1px; height: 18px; background: #e5e7eb; }

/* ── Image Toolbar ── */
.rit-image-toolbar {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100050;
  animation: rit-show 0.12s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.rit-image-toolbar .rit-btn { width: 28px; height: 28px; padding: 3px; }
.rit-img-sep { width: 1px; height: 20px; background: #e5e7eb; margin: 0 2px; }
.rit-img-size { font-size: 11px; color: #6b7280; padding: 0 6px; white-space: nowrap; }

/* ── Context Menu ── */
.rit-context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 4px;
  z-index: 110012;
  min-width: 180px;
  animation: rit-show 0.1s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}
.rit-context-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: #1a1a1a;
  gap: 10px;
  transition: background 0.12s;
}
.rit-context-item:hover { background: #f3f4f6; }
.rit-context-item.rit-disabled { opacity: 0.4; pointer-events: none; }
.rit-context-icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-flex; }
.rit-context-icon svg { width: 16px; height: 16px; }
.rit-context-shortcut { margin-left: auto; font-size: 11px; color: #9ca3af; }
.rit-context-separator { height: 1px; background: #e5e7eb; margin: 4px 0; }

/* ── Color Palette ── */
.rit-color-palette {
  position: fixed;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: 100060;
  padding: 10px;
  animation: rit-show 0.12s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.rit-color-palette-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding: 0 2px;
}
.rit-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.rit-color-swatch {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}
.rit-color-swatch:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #4A90D9;
  z-index: 1;
  position: relative;
}
