/* ============================================================= *
 *  admin.css — the ＋/✎ tree affordances, create + edit/archive
 *  container modals, card editor, revision history, toast.
 *  Loads LAST (its rules override .login-card etc.).
 * ============================================================= */

/* hover "＋" on subject/area/solo rows — creates a child inside that row */
.row-plus {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: none;                 /* revealed on row hover */
  align-items: center;
  justify-content: center;
  padding: 0;
}
.row:hover .row-plus { display: inline-flex; }
.row-plus:hover { color: var(--ink); background: var(--hover); border-color: var(--line-strong); }

/* ✎ rename/archive affordance — mirrors .row-plus, revealed on row hover */
.row-edit {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.row:hover .row-edit { display: inline-flex; }
.row-edit:hover { color: var(--ink); background: var(--hover); border-color: var(--line-strong); }

/* edit-container modal: archive button (left), spacer, and the confirm step */
.edit-actions-spacer { flex: 1 1 auto; }
.edit-archive-btn {              /* solid red fill — same destructive look as the confirm button */
  flex: 0 0 auto;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--shit, #e5484d);
  border-radius: 10px;
  background: var(--shit, #e5484d);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.edit-archive-btn:hover:not(:disabled) { filter: brightness(0.93); }
.edit-archive-btn:disabled { opacity: 0.5; cursor: default; }
.edit-archive-confirm { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.edit-archive-warn { font-size: 13px; line-height: 1.5; color: var(--ink); margin-bottom: 12px; }
.edit-archive-go {               /* the destructive confirm — solid red, same height as Save */
  flex: 0 0 auto;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--shit, #e5484d);
  border-radius: 10px;
  background: var(--shit, #e5484d);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.edit-archive-go:hover:not(:disabled) { filter: brightness(0.93); }
.edit-archive-go:disabled { opacity: 0.6; cursor: default; }

/* muted "＋ Add …" child row inside an empty subject/area, and the top
   "＋ New subject" row */
.row.ghost { color: var(--faint); }
.row.ghost .label { color: var(--faint); font-style: italic; }
.row.ghost .ghost-plus { color: var(--faint); font-size: 14px; font-style: normal; }
.row.ghost:hover .label,
.row.ghost:hover .ghost-plus { color: var(--muted); }

/* empty-deck placeholder inside the deck view */
.deck-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  padding: 56px 30px;
  text-align: center;
  color: var(--faint);
}
.deck-empty .empty-title { font-size: 17px; color: var(--muted); margin-bottom: 8px; }
.deck-empty code {
  background: var(--hover);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}

/* modal — reuses .login-card for the panel + fields */
.create-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
}
.create-card { width: 360px; }
.create-head { font-weight: 700; font-size: 16px; }
.create-err { color: var(--shit); font-size: 13px; min-height: 16px; }
.create-actions { display: flex; gap: 10px; justify-content: flex-end; }
.create-cancel {
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.create-cancel:hover { color: var(--ink); background: var(--hover); }
.create-go { flex: 0 0 auto; padding: 0 22px; margin-top: 0; }

/* transient toast, bottom center */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(8px);
  z-index: 70;
  max-width: min(560px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 14px;
  padding: 12px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================= *
 *  Card editor + admin actions (A-29 … A-34)
 *  Reuses the dark tool palette; radii/spacing from the A-26 tokens.
 * ============================================================= */

/* action bar under the deck controls: Edit / New / Revisions / Archive */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
  align-items: center;
}
.card-act {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.card-act:hover { color: var(--ink); background: var(--hover); border-color: var(--line-strong); }
.card-act:disabled { opacity: .4; cursor: default; }
.card-act--primary { color: var(--ink); border-color: rgba(111,140,255,.5); }
.card-act--primary:hover { background: rgba(111,140,255,.14); }
.card-act--danger:hover { color: #fff; background: var(--shit); border-color: var(--shit); }
/* Note action: highlighted while the composer is expanded */
.card-act--on { color: var(--ink); background: var(--hover); border-color: var(--line-strong); }
/* Note action carries the notebook glyph (same as the Notes tree's All notes) */
#act-note { display: inline-flex; align-items: center; gap: 6px; }
#act-note .card-act-ic { flex: 0 0 auto; }
.deck-empty .card-act { margin-top: var(--sp-5); }

/* editor modal — reuses .create-overlay + .login-card; wider + scrolls if tall */
.editor-card {
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  gap: var(--sp-3);
}
.editor-head { display: flex; flex-direction: column; gap: 2px; }
.editor-context { font-size: 12px; color: var(--faint); }
.editor-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
}
.editor-card textarea:focus { outline: 2px solid #6f8cff; outline-offset: 1px; }
.editor-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.editor-check input { width: 16px; height: 16px; accent-color: #6f8cff; cursor: pointer; }

/* "More options" collapsible — hides note / bidirectional / ύλη year / source */
.editor-more {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 0;
}
.editor-more:hover { color: var(--ink); }
.editor-more-caret { font-size: 11px; color: var(--faint); transition: transform .12s ease; }
.editor-more[aria-expanded="true"] .editor-more-caret { transform: rotate(90deg); }
.editor-more-dot { color: #6f8cff; font-size: 18px; line-height: 0; }
.editor-more-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-1);
  border-top: 1px solid var(--line);
}

/* revision history modal */
.history-card {
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  gap: var(--sp-3);
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 2px;
}
.history-empty { color: var(--faint); font-size: 14px; text-align: center; padding: 18px 0; }
.history-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.history-item.current { border-color: rgba(45,189,110,.5); }
.hist-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-ver { font-weight: 700; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hist-action {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--active-ink);
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.hist-a-create { background: rgba(45,189,110,.18); }
.hist-a-edit { background: rgba(111,140,255,.18); }
.hist-a-approve { background: rgba(45,189,110,.30); }
.hist-a-restore { background: rgba(199,125,51,.20); }
.hist-a-archive, .hist-a-flag { background: rgba(229,72,77,.18); }
.hist-time, .hist-actor { font-size: 12px; color: var(--faint); }
.hist-cur-tag { font-size: 11px; color: var(--approve); font-weight: 600; }
.hist-restore {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hist-restore:hover { color: var(--ink); background: var(--hover); }
.hist-preview { font-size: 13px; color: var(--muted); line-height: 1.4; }
.hist-preview b { color: var(--faint); font-weight: 700; }
