/* =====================================================================
   editor-additions.css
   - Inline edit controls inside content
   - Publish/unpublish cues
   - Nav submenu drag & drop visuals
====================================================================== */

/* Editable region affordances */
.editable-wrap { position: relative; }
.edit-mode #page-body {
  outline: 2px dashed rgba(90,160,255,.6);
  outline-offset: 6px;
}

/* Lexical table parity in display mode:
   saved table cells carry inline white backgrounds, so striped rows
   need an explicit override outside the editor runtime CSS. */
#page-body table.inline-lexical-table[data-lexical-row-striping="true"] tr:nth-child(even) > td {
  background-color: var(--sisd-table-striped-bg, #f7fafc) !important;
}

#page-body table.inline-lexical-table th,
#page-body table.inline-lexical-table td {
  padding: 4px !important;
  min-height: 20px;
}

#page-body table.inline-lexical-table td .inline-lexical-image-frame,
#page-body table.inline-lexical-table th .inline-lexical-image-frame {
  width: 100% !important;
  max-width: 100%;
  margin: 0 !important;
}

/* Pencil button */
.page-edit-actions {
  position: absolute;
  top: 6px;
  right: 10px;
  left: auto;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-edit-status {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--site-bg, #edf5ff) 84%, white 16%);
  border: 1px solid color-mix(in srgb, var(--site-text, #1b2d41) 18%, white 82%);
  font-size: 0.8rem;
  line-height: 1.1;
  font-weight: 700;
  color: color-mix(in srgb, var(--site-text, #1b2d41) 78%, black 22%);
  white-space: nowrap;
}

.page-edit-status.is-unpublished {
  background: color-mix(in srgb, #f59e0b 14%, white 86%);
  border-color: color-mix(in srgb, #f59e0b 40%, white 60%);
  color: color-mix(in srgb, #b45309 82%, black 18%);
}

.page-edit-status.is-home {
  background: color-mix(in srgb, #64748b 14%, white 86%);
  border-color: color-mix(in srgb, #64748b 34%, white 66%);
  color: color-mix(in srgb, #334155 82%, black 18%);
}

.page-edit-status.is-system {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: #475569;
}

.page-edit-publish-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid var(--action-icon-warn-ring);
  background: var(--action-icon-bg);
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--action-icon-warn-fg);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}

.page-edit-publish-btn::before {
  content: "";
  width: 15px;
  height: 15px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-image: url("../icons/ri-eye-off-line.svg");
  -webkit-mask-image: url("../icons/ri-eye-off-line.svg");
}

.page-edit-publish-btn.is-published::before {
  mask-image: url("../icons/ri-eye-line.svg");
  -webkit-mask-image: url("../icons/ri-eye-line.svg");
}

.page-edit-publish-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.page-edit-publish-btn.is-system {
  border-color: #94a3b8;
  color: #64748b;
  background: #f8fafc;
  box-shadow: none;
}

.page-edit-publish-btn.is-system:disabled {
  opacity: 1;
  cursor: not-allowed;
}

.edit-pencil {
  position: static;
  border: 2px solid var(--action-icon-edit-ring);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font: 15px/1 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background: var(--action-icon-bg);
  color: var(--action-icon-edit-fg);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  display: grid;
  place-items: center;
  z-index: 3;
  padding: 0;
  font-size: 0;
}

.edit-pencil::before {
  content: "";
  width: 14px;
  height: 14px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-image: url("../icons/ri-pencil-line.svg");
  -webkit-mask-image: url("../icons/ri-pencil-line.svg");
}

/* Simple toolbar for inline actions */
.edit-toolbar { display: flex; gap: 8px; margin: 8px 0 12px; }
.edit-toolbar button {
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
.edit-save   { background: #37d38a; color: #042; }
.edit-cancel { background: #e2e8f0; color: #123; }

/* Delete (✕) button next to pencil */
.edit-delete {
  position: static;
  width: 28px;
  height: 28px;
  border: 2px solid var(--action-icon-delete-ring);
  border-radius: 50%;
  font: 15px/1 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background: var(--action-icon-bg);
  color: var(--action-icon-delete-fg);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  display: grid;
  place-items: center;
  z-index: 3;
  padding: 0;
  font-size: 0;
}

.edit-delete::before {
  content: "";
  width: 15px;
  height: 15px;
  display: block;
  background-color: currentColor;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-image: url("../icons/ri-delete-bin-line.svg");
  -webkit-mask-image: url("../icons/ri-delete-bin-line.svg");
}
.edit-delete:hover { filter: brightness(1.05); }
.edit-delete:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.edit-delete:disabled {
  opacity: 0.45;
  filter: grayscale(0.6);
  cursor: not-allowed;
  box-shadow: none;
}

.edit-delete.is-system:disabled {
  border-color: #cbd5e1;
  color: #94a3b8;
  background: #f8fafc;
  opacity: 1;
}

/* Unpublished items in nav: subtle visual cue */
.nav-sublink.is-unpublished { opacity: .75; font-style: italic; }

/* === Nav submenu drag & drop (universal for any reorderable submenu) === removed whitelisted submenu-ID blocks */

/* Universal alignment: any reorderable submenu item stays in one flex row */
.nav-subitem[data-reorder-item] {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.nav-subitem[data-reorder-item] .nav-sublink {
  flex: 1 1 auto;
  display: block;
}

.nav-subitem[data-reorder-item] .drag-handle {
  display: inline-block;
  line-height: 1;
  padding: 0 .25rem;
  cursor: grab;
  user-select: none;
  opacity: .75;
}

.nav-subitem[data-reorder-item] .drag-handle:active {
  cursor: grabbing;
  opacity: 1;
}

.nav-subitem[data-reorder-item].is-dragging {
  opacity: .6;
}

.nav-drop-indicator[data-reorder-indicator] {
  list-style: none;
  margin: 4px 0;
  padding: 0;
  height: 0;
  border-top: 2px solid rgba(255,255,255,0.6);
  opacity: .9;
}
