/* inline-editor.css — Styles for the in-page editing experience.
   Loaded after styles.css so it can override / extend baseline tokens. */

/* ── Admin dashboard add-ons (also used by Drafts tab) ──── */
.admin-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-page-head h2 {
  font-size: 1.4rem;
}
.empty-state {
  padding: 48px 24px;
  text-align: center;
  border-radius: 14px;
}
.empty-state h3 {
  margin-bottom: 4px;
}
.empty-state p {
  max-width: 420px;
  margin: 8px auto 0;
}

/* ── Editable wrapper (text) ─────────────────────────────── */
.iedit {
  position: relative;
  cursor: text;
  outline: 1.5px dashed transparent;
  outline-offset: 4px;
  border-radius: 4px;
  transition: outline-color 0.12s ease, background-color 0.12s ease;
}
.iedit:hover {
  outline-color: rgba(125, 211, 252, 0.45);
  background-color: rgba(125, 211, 252, 0.06);
}
.iedit-on,
.iedit-active {
  outline: 2px solid var(--ice) !important;
  outline-offset: 4px;
  background-color: rgba(125, 211, 252, 0.08);
}
.iedit-on:focus {
  outline: 2px solid var(--ice) !important;
}
.iedit-draft {
  outline-color: rgba(251, 191, 36, 0.55) !important;
  background-color: rgba(251, 191, 36, 0.05);
}
.iedit-pin {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  color: var(--ice);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
  z-index: 5;
}
.iedit:hover .iedit-pin,
.iedit-draft .iedit-pin { opacity: 1; transform: scale(1); }
.iedit-pin-dot {
  width: 6px;
  height: 6px;
  background: #fbbf24;
  border-radius: 50%;
  margin-right: -2px;
  margin-left: -8px;
  position: absolute;
  top: -2px;
  right: -2px;
}

/* Editable image */
.iedit-img {
  position: relative;
  cursor: pointer;
  outline: 1.5px dashed rgba(125, 211, 252, 0.45);
  outline-offset: 4px;
  border-radius: 8px;
  overflow: visible;
}
.iedit-img:hover { outline: 2px solid var(--ice); }
.iedit-img img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.iedit-img.iedit-draft { outline-color: rgba(251, 191, 36, 0.7) !important; }

/* Placeholder for an image that hasn't been set yet (read-only view) */
.edit-img-empty {
  background: repeating-linear-gradient(135deg,
    rgba(255, 255, 255, 0.025) 0 14px,
    rgba(255, 255, 255, 0.06) 14px 28px);
  border: 1px dashed var(--border-2);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  min-height: 120px;
  aspect-ratio: 16 / 9;
}
.edit-img-empty-inner { padding: 16px; text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }

/* ── Edit mode toolbar (top of viewport) ─────────────────── */
.edit-toolbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}
.edit-toolbar-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px 8px 14px;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(125, 211, 252, 0.30);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  border-radius: 999px;
}
.edit-toolbar-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  max-width: 320px;
}
.edit-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.edit-toolbar-actions .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 9px;
  background: rgba(251, 191, 36, 0.20);
  color: #fbbf24;
  font-size: 0.7rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .edit-toolbar-inner { padding: 8px 10px; gap: 8px; }
  .edit-toolbar-hint { display: none; }
}

/* ── Draft tray (bottom-right) ───────────────────────────── */
.draft-tray {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 95;
  border-radius: 14px;
  overflow: hidden;
}
.draft-tray-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.draft-tray-sub { font-size: 0.78rem; color: var(--text-dim); }
.draft-tray-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.draft-tray-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.draft-tray-foot .btn { width: 100%; justify-content: center; }
.draft-empty { padding: 16px 0; text-align: center; }

.draft-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.draft-item.submitted {
  border-color: rgba(125, 211, 252, 0.30);
  background: rgba(125, 211, 252, 0.05);
}
.draft-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.draft-item-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.draft-item-status {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
}
.draft-item.submitted .draft-item-status {
  color: var(--ice);
  background: rgba(125, 211, 252, 0.12);
}
.draft-item-actions {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

/* Diff renderer */
.draft-diff.text {
  font-size: 0.84rem;
  line-height: 1.4;
  display: grid;
  gap: 4px;
}
.draft-diff-prior {
  color: rgba(248, 113, 113, 0.85);
  text-decoration: line-through;
  text-decoration-color: rgba(248, 113, 113, 0.4);
}
.draft-diff-next {
  color: rgba(94, 234, 212, 0.95);
}
.draft-diff.img {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.draft-diff-side { flex: 1; }
.draft-diff-tag {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.draft-diff-side img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.draft-diff-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* ── User pill (top nav) ─────────────────────────────────── */
.user-pill-wrap { position: relative; }
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.user-pill:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--border-2); }
.user-pill-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ice), var(--ice-2));
  color: #03192c;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.user-pill-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.user-pill-name { font-size: 0.84rem; font-weight: 600; }
.user-pill-meta .role-pill {
  margin-top: 3px;
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.role-pill.super_admin { background: rgba(251,113,133,0.15); color: #fda4af; }
.role-pill.admin       { background: rgba(167,139,250,0.18); color: #c4b5fd; }
.role-pill.web_admin   { background: rgba(125,211,252,0.18); color: var(--ice); }
.role-pill.alliance_admin { background: rgba(94,234,212,0.18); color: #5eead4; }
.role-pill.staff       { background: rgba(255,255,255,0.06); color: var(--text-dim); }

@media (max-width: 720px) {
  .user-pill-meta { display: none; }
  .user-pill { padding: 4px; }
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 250px;
  border-radius: 12px;
  padding: 6px;
  z-index: 60;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.user-menu-item:hover { background: rgba(255,255,255,0.06); }
.user-menu-item .count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 700;
}
.user-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 4px;
}

/* ── Approval badge (top-right floater) ──────────────────── */
.approval-badge {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 999px;
  color: #c4b5fd;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: approval-pulse 2.4s ease-in-out infinite;
}
.approval-badge:hover { background: rgba(167, 139, 250, 0.22); }
.approval-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4b5fd;
  box-shadow: 0 0 8px #c4b5fd;
}
@keyframes approval-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(167, 139, 250, 0); }
}

/* ── Approval / History modal — list items ───────────────── */
.seg-toggle {
  display: inline-flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-toggle button {
  padding: 5px 12px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.seg-toggle button.on {
  background: rgba(125, 211, 252, 0.15);
  color: var(--ice);
}

.approval-empty,
.audit-list:empty { padding: 32px 0; text-align: center; }

.approval-list,
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 6px;
}
.approval-item,
.audit-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.approval-item-head,
.audit-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.approval-item-label,
.audit-label { font-weight: 600; }
.approval-item-meta,
.audit-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.approval-item-key,
.audit-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-left: 4px;
}
.approval-status {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.approval-status.pending  { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.approval-status.approved { background: rgba(94, 234, 212, 0.15); color: #5eead4; }
.approval-status.rejected { background: rgba(248, 113, 113, 0.15); color: #fda4af; }
.approval-status.withdrawn{ background: rgba(255,255,255,0.06); color: var(--text-faint); }

.approval-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.approval-item-actions input {
  flex: 1;
  min-width: 180px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.approval-item-actions input:focus {
  outline: none;
  border-color: var(--ice);
}
.approval-note {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(248,113,113,0.08);
  border-left: 2px solid rgba(248,113,113,0.5);
  font-size: 0.82rem;
  color: var(--text-dim);
  border-radius: 0 6px 6px 0;
}
.approval-note.approved {
  background: rgba(94,234,212,0.06);
  border-left-color: rgba(94,234,212,0.5);
}

.audit-action {
  display: inline-block;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 8px;
}
.audit-action.approve  { background: rgba(94, 234, 212, 0.15); color: #5eead4; }
.audit-action.reject   { background: rgba(248, 113, 113, 0.15); color: #fda4af; }
.audit-action.rollback { background: rgba(167, 139, 250, 0.18); color: #c4b5fd; }
.audit-when { font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }
.audit-note {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
}
.audit-actions { margin-top: 10px; }

/* link-style button */
.link-btn {
  background: none;
  border: 0;
  color: var(--ice);
  font: inherit;
  font-size: 0.78rem;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(125, 211, 252, 0.35);
  text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: var(--ice); }

/* ── Image picker modal ──────────────────────────────────── */
.img-picker-canvas {
  position: relative;
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.img-picker-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-picker-crop {
  position: absolute;
  border: 2px solid var(--ice);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  cursor: move;
  border-radius: 2px;
}
.img-picker-crop-grip {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 10px;
  height: 10px;
  background: var(--ice);
  border-radius: 50%;
  border: 2px solid var(--bg-0);
}
.img-picker-hint {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.55);
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
}
.img-picker-empty {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.025) 0 14px,
    rgba(255,255,255,0.05) 14px 28px);
  color: var(--text-faint);
}
.picker-aspect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.picker-aspect input[type=range] {
  accent-color: var(--ice);
  width: 120px;
}

/* When edit mode is on, lift body padding so the toolbar doesn't crash into the nav */
body.is-editing { padding-top: 56px; }
body.is-editing .nav { top: 56px; }

/* Hide the snow + back-to-top while editing so they don't obscure click targets */
body.is-editing .snow,
body.is-editing .back-top { display: none; }

/* In edit mode, the floating CTA is more distracting than helpful */
body.is-editing .fcta-pill,
body.is-editing .fcta-rail,
body.is-editing .fcta-bar { display: none; }
