/* ─────────────────────────────────────────────────────────────────
 * css/board-notes.css
 *
 * Styles for the per-board collaborator notes feature (PILOT-READY,
 * 2026-05-27). Owned by js/builder/board-notes.js. Loads AFTER
 * builder.css so brand tokens (--ink, --ink-muted, etc.) are in scope.
 *
 * Surfaces:
 *   • .board-notes-pill        — the 📝 chip in the MY BOARDS row
 *   • .board-notes-backdrop    — modal backdrop
 *   • .board-notes-panel       — slide-in panel (right side on wide,
 *                                 full-screen on mobile)
 *   • .bn-*                    — sub-elements inside the panel
 *
 * Role badge colors:
 *   parent  → blue
 *   slp     → green
 *   teacher → amber
 *   other   → gray
 * ───────────────────────────────────────────────────────────────── */

/* ─── Pill (replaces .sidebar-item-count) ─────────────────────── */
.board-notes-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  margin: 0 0.25rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
  background: linear-gradient(135deg, #eef2ff 0%, #fdf4ff 100%);
  color: #4338ca;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  line-height: 1;
}
.board-notes-pill:hover {
  background: linear-gradient(135deg, #e0e7ff 0%, #fae8ff 100%);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18);
}
.board-notes-pill:active {
  transform: scale(0.96);
}
.board-notes-pill:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
.board-notes-pill.has-notes {
  border-color: rgba(217, 70, 239, 0.4);
  color: #a21caf;
}
.board-notes-pill .bnp-icon {
  font-size: 0.85rem;
  line-height: 1;
}
.board-notes-pill .bnp-count:empty {
  display: none;
}

/* ─── Backdrop + panel ───────────────────────────────────────── */
.board-notes-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0);
  display: flex;
  justify-content: flex-end;
  z-index: 10000;
  transition: background 200ms ease;
  pointer-events: none;
}
.board-notes-backdrop.open {
  background: rgba(15, 23, 42, 0.45);
  pointer-events: auto;
}

.board-notes-panel {
  width: min(420px, 100vw);
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.25);
  transform: translateX(100%);
  transition: transform 200ms ease;
  font-family: inherit;
}
.board-notes-backdrop.open .board-notes-panel {
  transform: translateX(0);
}

/* Mobile: full-screen */
@media (max-width: 640px) {
  .board-notes-panel {
    width: 100vw;
  }
}

/* ─── Header ─────────────────────────────────────────────────── */
/* 2026-05-28 (Luke caught: "notes need to follow branding guidelines,
   colors are off"). Was a rainbow indigo→magenta→amber gradient that
   matched nothing else in the product. Re-aligned to the platform
   chrome: the dark navy --nav-bg / cream --nav-text pair the top
   nav + sidebar + modal headers use. Single amber accent reserved for
   the post button below. */
.bn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--nav-bg, #1A1A2E);
  color: var(--nav-text, #F5EDE0);
  border-bottom: 1px solid rgba(232, 168, 56, 0.25); /* faint amber accent */
  flex-shrink: 0;
}
.bn-titleblock {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.bn-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.bn-subtitle {
  font-size: 0.8rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease;
  flex-shrink: 0;
}
.bn-close:hover {
  background: rgba(255, 255, 255, 0.32);
}
.bn-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* ─── Sign-in banner ─────────────────────────────────────────── */
.bn-banner {
  padding: 0.65rem 1rem;
  background: #fef3c7;
  color: #78350f;
  font-size: 0.8rem;
  border-bottom: 1px solid #fde68a;
}
.bn-link {
  color: #92400e;
  font-weight: 600;
  text-decoration: underline;
}

/* ─── List ───────────────────────────────────────────────────── */
.bn-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  background: #fafaf9;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.bn-list[aria-busy="true"]::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6366f1, transparent);
  animation: bn-shimmer 1.2s linear infinite;
}
@keyframes bn-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.bn-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #6b7280;
  font-size: 0.9rem;
}
.bn-empty-emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.bn-empty-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}
.bn-empty-sub {
  font-size: 0.825rem;
}

/* ─── Note card ──────────────────────────────────────────────── */
.bn-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.bn-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.bn-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.bn-card-author {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.bn-card-name {
  font-size: 0.825rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-card-when {
  font-size: 0.7rem;
  color: #9ca3af;
  white-space: nowrap;
}
.bn-card-body {
  font-size: 0.875rem;
  color: #1f2937;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bn-card-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}
.bn-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms ease, border-color 100ms ease;
}
.bn-icon-btn:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

/* ─── Edit-in-place ──────────────────────────────────────────── */
.bn-edit-area {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
  resize: vertical;
}
.bn-edit-area:focus {
  outline: 2px solid #6366f1;
  outline-offset: 0;
  border-color: #6366f1;
}
.bn-edit-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.bn-edit-save,
.bn-edit-cancel {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.bn-edit-save {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
.bn-edit-cancel {
  background: white;
  color: #374151;
  border-color: #d1d5db;
}

/* ─── Role badges (color-coded) ──────────────────────────────── */
.bn-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}
.bn-badge-parent {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}
.bn-badge-slp {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}
.bn-badge-teacher {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.bn-badge-other {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

/* ─── Compose area (sticky bottom) ───────────────────────────── */
.bn-compose {
  padding: 0.75rem 1rem 1rem;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}
.bn-compose-row {
  display: flex;
  gap: 0.5rem;
}
.bn-name {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  /* iOS-zoom defense — match the global mobile-tokens.css floor */
  font-size: 16px;
}
.bn-role {
  padding: 0.45rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  background: white;
  cursor: pointer;
}
.bn-name:focus,
.bn-role:focus {
  outline: 2px solid #6366f1;
  outline-offset: 0;
  border-color: #6366f1;
}
.bn-body {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  resize: none;
  overflow-y: auto;
}
.bn-body:focus {
  outline: 2px solid #6366f1;
  outline-offset: 0;
  border-color: #6366f1;
}
.bn-compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.bn-counter {
  font-size: 0.75rem;
  color: #9ca3af;
}
.bn-post {
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 120ms ease;
}
.bn-post:hover {
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}
.bn-post:active {
  transform: scale(0.97);
}
.bn-post:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.bn-post:focus-visible {
  outline: 2px solid #d97706;
  outline-offset: 2px;
}

/* ─── Signed-out compose CTA (Codex r22) ──────────────────────── */
/* When the panel is rendered for an anonymous viewer, the post
   form is replaced by a clear sign-in CTA so writes don't silently
   fall back to localStorage. Reuse the .bn-compose container chrome
   so the panel footer keeps its vertical rhythm. */
.bn-compose.bn-compose-signed-out {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  text-align: center;
}
.bn-signedout-msg {
  font-size: 0.92rem;
  color: #44403c;
  line-height: 1.45;
}
.bn-post.bn-post-link {
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

/* ─── SLP audit trail additions (2026-05-28, Luke spec) ────────── */

/* System-event card — auto-logged "board created" / future opened /
   downloaded / session markers. Distinct from user notes: muted
   surface, neutral border, no actions, mono-ish timestamp. Keeps the
   trail scannable without competing with real observations. */
.bn-card-system {
  background: var(--bg-warm, #F5EDE0);
  border-color: var(--border, #E5DDD0);
}
.bn-card-system .bn-card-name {
  font-weight: 600;
  color: var(--ink-soft, #4A4A5A);
}
.bn-badge-system {
  background: var(--brand-bg-soft, #EFF4FF);
  color: var(--brand-blue, #1976D2);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--brand-blue-light, #BBDEFB);
}
.bn-card-body-meta {
  padding: 0;
}

/* Absolute timestamp line under any card body — SLP billing trail.
   Small, monospaced for date precision, sits beneath the relative
   "3h ago" header. Visible on every card type. */
.bn-card-timestamp {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light, #EDE8E0);
  font-size: 0.72rem;
  color: var(--ink-muted, #8A8A9A);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
