/* Boundaryless Outline customizations */

:root { color-scheme: light !important; }

/* ── Sidebar */
[data-boundaryless-sidebar],
[data-boundaryless-sidebar] * {
  color: #ffffff !important;
}
[data-boundaryless-sidebar] svg { fill: currentColor !important; }

.boundaryless-sidebar-logo {
  display: block;
  margin: 16px auto 12px;
  padding: 10px 14px;
  max-width: 180px;
  width: 78%;
  height: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ── Doc-header buttons */
main button, main [role="button"],
[data-toolbar] button,
button[aria-haspopup],
button[data-state] {
  color: #1b2026 !important;
}
main button svg,
main [role="button"] svg { fill: currentColor !important; }

main button:not([style*="background: rgb(239"]):not([style*="background-color: rgb(239"]) {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12) !important;
  background: #ffffff !important;
}
main button:not([style*="background: rgb(239"]):hover {
  background: #f4f7fb !important;
}

[data-boundaryless-sidebar] button,
[data-boundaryless-sidebar] [role="button"] {
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* ── Editor floating toolbar (dark bar that appears when image/text is selected).
 *    Radix UI wraps it with role="toolbar". Force high-contrast white on all
 *    children so icons + input placeholder are readable on the dark background.
 *    Also OVERRIDE the doc-header button rules above so toolbar buttons do not
 *    get a white box background. */
[role="toolbar"] {
  color: #ffffff !important;
}
[role="toolbar"] *,
[role="toolbar"] button,
[role="toolbar"] [role="button"] {
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
}
[role="toolbar"] svg {
  fill: currentColor !important;
  color: #ffffff !important;
  opacity: 1 !important;
}
[role="toolbar"] button:hover,
[role="toolbar"] [role="button"]:hover {
  background: rgba(255,255,255,0.12) !important;
}
[role="toolbar"] input,
[role="toolbar"] input::placeholder {
  color: #ffffff !important;
  background: transparent !important;
  border-color: rgba(255,255,255,0.25) !important;
  opacity: 1 !important;
}
[role="toolbar"] input::placeholder {
  color: rgba(255,255,255,0.6) !important;
}

/* Preserve the orange accent for active (aria-pressed) toolbar buttons */
[role="toolbar"] button[aria-pressed="true"] svg,
[role="toolbar"] [data-state="on"] svg {
  color: #EF7D00 !important;
  fill: #EF7D00 !important;
}

/* ── Link editor floating popup ("Paste a link…" / "Search or paste a link…").
 *    Same dark-bar style as the image toolbar. Some renderings do not wrap
 *    it in role=toolbar so target by input placeholder as a fallback. */
input[placeholder*="Paste a link" i],
input[placeholder*="Search or paste" i],
input[placeholder*="link" i] {
  color: #ffffff !important;
  background: transparent !important;
  border-color: rgba(255,255,255,0.25) !important;
  opacity: 1 !important;
}
input[placeholder*="Paste a link" i]::placeholder,
input[placeholder*="Search or paste" i]::placeholder,
input[placeholder*="link" i]::placeholder {
  color: rgba(255,255,255,0.6) !important;
}

/* If the link editor is siblings of the input (not inside role=toolbar),
 * find its parent element and style all siblings' buttons/icons white. */
input[placeholder*="link" i] ~ button,
input[placeholder*="link" i] ~ * button {
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
}
input[placeholder*="link" i] ~ button svg,
input[placeholder*="link" i] ~ * svg {
  fill: #ffffff !important;
  color: #ffffff !important;
  opacity: 1 !important;
}
input[placeholder*="link" i] ~ button:hover,
input[placeholder*="link" i] ~ * button:hover {
  background: rgba(255,255,255,0.12) !important;
}

/* Extra safety: any floating popup with the dark menu background */
[data-radix-popper-content-wrapper] [role],
[data-radix-popper-content-wrapper] input {
  /* placeholder — Radix popups usually inherit theme correctly, we don't
     want to break dropdown menus that are correctly light-themed. */
}

/* ── Dark floating popups (SelectionToolbar, LinkEditor, ImageToolbar, etc.)
 *    Runtime tagger adds data-boundaryless-dark-popup to any element with
 *    a near-black background that is small enough to be a popup (not the body).
 *    Force white text and icons on ALL descendants. */
[data-boundaryless-dark-popup],
[data-boundaryless-dark-popup] * {
  color: #ffffff !important;
}
[data-boundaryless-dark-popup] svg {
  fill: currentColor !important;
  color: #ffffff !important;
  opacity: 1 !important;
}
[data-boundaryless-dark-popup] button,
[data-boundaryless-dark-popup] [role="button"] {
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
}
[data-boundaryless-dark-popup] button:hover,
[data-boundaryless-dark-popup] [role="button"]:hover {
  background: rgba(255,255,255,0.12) !important;
}
[data-boundaryless-dark-popup] input {
  color: #ffffff !important;
  background: transparent !important;
  border-color: rgba(255,255,255,0.25) !important;
}
[data-boundaryless-dark-popup] input::placeholder {
  color: rgba(255,255,255,0.6) !important;
  opacity: 1 !important;
}
/* Preserve active-state icons */
[data-boundaryless-dark-popup] button[aria-pressed="true"] svg,
[data-boundaryless-dark-popup] [data-state="on"] svg,
[data-boundaryless-dark-popup] .active svg {
  color: #EF7D00 !important;
  fill: #EF7D00 !important;
}

/* ── Radix dropdown menus (document "..." overflow, right-click menus, etc.)
 *    Outline renders these with a dark theme regardless of app theme. Force
 *    high-contrast white on all menu items so labels + icons + shortcuts read. */
[role="menu"] {
  color: #ffffff !important;
}
[role="menu"] *,
[role="menuitem"],
[role="menuitemcheckbox"],
[role="menuitemradio"] {
  color: #ffffff !important;
}
[role="menu"] svg,
[role="menuitem"] svg {
  fill: currentColor !important;
  color: #ffffff !important;
  opacity: 1 !important;
}
[role="menuitem"]:hover,
[role="menuitem"][data-highlighted],
[role="menuitem"][aria-selected="true"] {
  background: rgba(255,255,255,0.10) !important;
}
/* Shortcut hint text (Ctrl+Shift+I etc.) is usually dimmer — keep it dim but readable */
[role="menu"] kbd,
[role="menu"] [class*="shortcut" i],
[role="menu"] [class*="Shortcut"] {
  color: rgba(255,255,255,0.65) !important;
}

/* ── Link editor inputs — force white unconditionally regardless of placeholder */
[data-boundaryless-dark-popup] input,
[data-boundaryless-dark-popup] input[type="text"],
[data-boundaryless-dark-popup] input[type="url"] {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: transparent !important;
  caret-color: #ffffff !important;
}
