/* Community edit mode — in-page WYSIWYG toolbar + dialog. */

/* --- Visual signal that edit mode is active --- */
/* Outline + subtle box-shadow signal edit mode without overriding the
   site's background/text colors (which would clash with dark mode). */
body.rt-editing .article-body {
  outline: 2px dashed #c9a04a;
  outline-offset: 12px;
  box-shadow: 0 0 0 12px rgba(201, 160, 74, 0.06);
  min-height: 200px;
}

body.rt-editing .article-body:focus {
  outline-color: #d6b25c;
  outline-style: solid;
}

/* Hide nav and footer in edit mode so users focus on the article */
body.rt-editing .site-nav,
body.rt-editing footer {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}

/* --- Floating toolbar (fixed bottom-right) --- */
.rt-edit-toolbar {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  background: #2a2520;
  color: #fff;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  z-index: 9999;
  max-width: 280px;
}

body.rt-editing .rt-edit-toolbar { display: flex; }

.rt-edit-toolbar h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  color: #f0d68a;
}

.rt-edit-toolbar p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #ccc;
}

.rt-edit-toolbar button {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.3rem;
}

.rt-edit-toolbar .rt-submit {
  background: #c9a04a;
  color: #1a1a1a;
}
.rt-edit-toolbar .rt-submit:hover { background: #d6ad55; }

.rt-edit-toolbar .rt-cancel {
  background: #555;
  color: #fff;
}
.rt-edit-toolbar .rt-cancel:hover { background: #666; }

.rt-edit-toolbar .rt-toolbar-status {
  font-size: 0.82rem;
  color: #f0d68a;
  margin-top: 0.4rem;
  min-height: 1em;
  line-height: 1.3;
}
.rt-edit-toolbar .rt-toolbar-status.error {
  color: #ff8a8a;
}

.rt-edit-toolbar .rt-image-hint {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 0.3rem;
  font-style: italic;
}

/* --- Submit dialog --- */
.rt-edit-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.rt-edit-dialog-backdrop.open { display: flex; }

.rt-edit-dialog {
  background: #fff;
  color: #1a1a1a;
  border-radius: 8px;
  padding: 1.5rem 1.7rem;
  max-width: 460px;
  width: 92%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.rt-edit-dialog h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.rt-edit-dialog p.muted {
  margin: 0 0 1rem;
  color: #666;
  font-size: 0.92rem;
}

.rt-edit-dialog label {
  display: block;
  margin: 0.6rem 0 0.2rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.rt-edit-dialog input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
}

.rt-edit-dialog .rt-dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

.rt-edit-dialog button {
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.rt-edit-dialog .rt-dialog-submit {
  background: #c9a04a;
  color: #1a1a1a;
}
.rt-edit-dialog .rt-dialog-cancel {
  background: #ddd;
  color: #333;
}

.rt-edit-dialog .rt-status {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: #666;
  min-height: 1.2em;
}
.rt-edit-dialog .rt-status.error { color: #c33; }
.rt-edit-dialog .rt-status.success { color: #2a8; }

/* --- Trigger link in TOC (matches existing "Suggest an edit" styling) --- */
.toc-suggest-edit {
  display: block;
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid #ddd;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}
.toc-suggest-edit:hover { color: #c9a04a; }
