/* ── SCEditor fixes ── */

/* Starting height comes from min-height (SCEditor's own inline height is tiny); no forced height,
   so the grip in the bottom corner can make the editor taller (the inline height it sets wins) */
.sceditor-container {
  min-height: 250px;
  border: 1px solid var(--glass-border) !important;
  border-radius: .5rem !important;
  background: var(--glass-bg-heavy) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Full editors (new thread, new reply, edit post, PM) get double height; quick reply keeps the default */
form[name="input"][action^="newthread.php"] .sceditor-container,
form[name="input"][action^="newreply.php"] .sceditor-container,
form[name="input"][action^="editpost.php"] .sceditor-container,
form[name="input"][action^="private.php"] .sceditor-container {
  min-height: 500px;
}

/* Dark mode for the editor toolbar and container */
:root[data-bs-theme="dark"] .sceditor-container {
  background: var(--glass-bg-heavy) !important;
  border-color: var(--glass-border) !important;
}

:root[data-bs-theme="dark"] .sceditor-toolbar {
  background: var(--glass-bg) !important;
  border-bottom-color: var(--glass-border) !important;
}

:root[data-bs-theme="dark"] .sceditor-button {
  background: transparent !important;
}

:root[data-bs-theme="dark"] .sceditor-button:hover {
  background: var(--tekbb-accent-subtle) !important;
}

/* Sprite icons only — Bootstrap Icons glyphs (editor-extras) are coloured, inverting them flips the accent */
:root[data-bs-theme="dark"]:not(.ee-bi-icons) .sceditor-button div {
  filter: invert(1);
}

:root[data-bs-theme="dark"] .sceditor-group {
  border-color: var(--glass-border) !important;
  background: transparent !important;
}

/* Dark mode for editor dropdown menus */
:root[data-bs-theme="dark"] .sceditor-dropdown {
  background: var(--glass-bg-heavy) !important;
  border-color: var(--glass-border) !important;
  color: var(--bs-body-color) !important;
}

:root[data-bs-theme="dark"] .sceditor-dropdown label {
  color: var(--bs-body-color) !important;
}

:root[data-bs-theme="dark"] .sceditor-dropdown input,
:root[data-bs-theme="dark"] .sceditor-dropdown textarea {
  background: var(--glass-bg-heavy) !important;
  color: var(--bs-body-color) !important;
  border-color: var(--glass-border) !important;
}

/* Source mode textarea */
:root[data-bs-theme="dark"] .sceditor-container textarea {
  background: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
}

/* Dropdown options (font, size, colour…): SCEditor's own CSS colours them #333 */
:root[data-bs-theme="dark"] .sceditor-dropdown a,
:root[data-bs-theme="dark"] .sceditor-dropdown a font {
  color: var(--bs-body-color) !important;
}

:root[data-bs-theme="dark"] .sceditor-dropdown a:hover {
  background: var(--tekbb-accent-subtle) !important;
}

/* Maximize: fill the window. The auto height above would otherwise win, and the glass
   panels' backdrop-filter makes them the containing block of the fixed editor, so it
   stayed inside its box; drop those effects on the editor's ancestors while maximized. */
.sceditor-container.sceditor-maximize {
  height: 100% !important;
  border-radius: 0 !important;
  z-index: 3000;
}

:has(.sceditor-maximize) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transform: none !important;
  filter: none !important;
}
