/* ══════════════════════════════════════
   ADMIN EDITOR — footer toggle link
══════════════════════════════════════ */
.admin-toggle-link {
  display: inline-block;
  margin-top: 0.75rem;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--ff-body);
  font-size: 0.7rem;
  color: rgba(107, 117, 160, 0.35);
  cursor: pointer;
  transition: color 0.2s;
}
.admin-toggle-link:hover { color: rgba(107, 117, 160, 0.7); }
.admin-toggle-link.admin-active { color: var(--highlight); }

/* ══════════════════════════════════════
   ADMIN EDITOR — login modal
══════════════════════════════════════ */
.admin-login-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 11, 24, 0.75);
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.admin-login-overlay.open { display: flex; }
.admin-login-box {
  width: 100%; max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.admin-login-box h3 {
  font-family: var(--ff-head); font-size: 1.3rem; font-weight: 500;
  color: var(--text); margin-bottom: 1.25rem;
}
.admin-login-box input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}
.admin-login-box button {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.admin-login-box button:hover { background: var(--highlight); }
.admin-login-error {
  color: #e07070;
  font-size: 0.82rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ══════════════════════════════════════
   ADMIN EDITOR — in-context edit mode
══════════════════════════════════════ */
body.admin-mode [data-edit] {
  outline: 1px dashed transparent;
  outline-offset: 3px;
  cursor: text;
  transition: outline-color 0.15s;
}
body.admin-mode [data-edit]:hover {
  outline-color: rgba(84, 92, 172, 0.55);
}
body.admin-mode [data-edit].admin-editing {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
body.admin-mode img[data-edit] { cursor: pointer; }

.admin-image-upload-btn {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(10, 11, 24, 0.75);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  /* Every prior caller wraps a small, tightly-sized element with nothing
     else nearby, so stacking order was never an issue. The hero section's
     upload button is the first to share space with content that has its
     own z-index (.hero-inner, which expands to cover the full section on
     mobile) -- without this it renders fine but is unclickable underneath. */
  z-index: 50;
}

body.admin-mode [data-block-id] {
  position: relative;
  outline: 1px dashed transparent;
  outline-offset: 6px;
  transition: outline-color 0.15s;
}
body.admin-mode [data-block-id]:hover {
  outline-color: rgba(84, 92, 172, 0.35);
}
/* Hides for real visitors on the published site. Scoped separately from
   admin-mode (below) so a hidden section is actually hidden once published,
   not just visually distinguished in the editor. */
[data-block-id][data-hidden="true"] {
  display: none;
}
/* While editing, keep hidden blocks visible (dimmed) so their controls
   stay reachable -- otherwise there'd be no way to un-hide a section. */
body.admin-mode [data-block-id][data-hidden="true"] {
  display: block;
  opacity: 0.4;
}
body.admin-mode [data-block-id].admin-block-dragging {
  opacity: 0.4;
}

.admin-block-controls {
  position: absolute;
  top: 6px; left: 6px;
  display: flex;
  gap: 6px;
  z-index: 50;
}
.admin-drag-handle,
.admin-hide-toggle {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(10, 11, 24, 0.8);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-drag-handle { cursor: grab; }
.admin-drag-handle:active { cursor: grabbing; }

/* ══════════════════════════════════════
   ADMIN EDITOR — staged-changes bar
══════════════════════════════════════ */
.admin-publish-bar {
  display: none;
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 800;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  padding: 0.6rem 0.6rem 0.6rem 1.25rem;
  align-items: center; gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.admin-publish-bar.visible { display: flex; }
.admin-publish-bar button {
  border: none;
  border-radius: var(--r-pill);
  padding: 0.5rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.admin-publish-btn { background: var(--accent); color: var(--text); }
.admin-publish-btn:hover { background: var(--highlight); }
.admin-publish-btn:disabled { opacity: 0.6; cursor: default; }
.admin-discard-btn { background: transparent; color: var(--text-dim); }
.admin-discard-btn:hover { color: var(--text); }

/* ══════════════════════════════════════
   ADMIN EDITOR — add-post form (Sleep News page)
══════════════════════════════════════ */
.admin-add-post-btn {
  display: none;
  margin-bottom: 1.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
body.admin-mode .admin-add-post-btn { display: inline-block; }
.admin-add-post-btn:hover { background: var(--highlight); }

.admin-add-post-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 11, 24, 0.75);
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.admin-add-post-overlay.open { display: flex; }
.admin-add-post-box {
  width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.admin-add-post-box h3 {
  font-family: var(--ff-head); font-size: 1.4rem; font-weight: 500;
  color: var(--text); margin-bottom: 1.25rem;
}
.admin-add-post-box label {
  display: block;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 0.4rem; margin-top: 1rem;
}
.admin-add-post-box input,
.admin-add-post-box textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 0.9rem;
}
.admin-add-post-box textarea { min-height: 80px; resize: vertical; }
.admin-add-post-box .admin-body-paragraph { margin-bottom: 0.5rem; }
.admin-add-post-box button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

/* ══════════════════════════════════════
   ADMIN EDITOR — collection items (add/remove)
══════════════════════════════════════ */
.admin-item-add {
  display: block;
  margin-top: 0.75rem;
  padding: 0.55rem 1.1rem;
  background: transparent;
  color: var(--highlight);
  border: 1px dashed rgba(84, 92, 172, 0.5);
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.admin-item-add:hover { background: rgba(84, 92, 172, 0.12); }

.admin-item-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(10, 11, 24, 0.8);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  z-index: 10;
}
.admin-item-remove:hover { background: #b04040; }
.admin-item-remove:disabled { opacity: 0.3; cursor: not-allowed; }

.admin-pub-attach-btn {
  position: absolute;
  bottom: 6px; right: 6px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(10, 11, 24, 0.8);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  z-index: 10;
}
.admin-pub-attach-btn:hover { background: var(--highlight); }
