/* ════════════════════════════════════════════════════════════════════
   THE JUNGLE STAFF — chassis styles (feat/staff-chassis 2026-06-02)

   Layout:
     1024+   chat panel | workspace panel  (side-by-side)
     <768    chat XOR workspace via tab switcher

   Edge-glow on the chat container reflects the active persona's color.
   Persona color tokens live as CSS variables on the chat container.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* Per-persona colors. Mirror staff/specs/staff-room-architecture.md.
     The chassis sets --staff-active to one of these at runtime. */
  --staff-leaf-green:  #4CD964;
  --staff-warm-amber:  #f5a623;
  --staff-cyan:        #00C8FF;
  --staff-pink:        #FF4DA6;
  --staff-yellow:      #FFE600;
  --staff-mint:        #B2FCE4;
  --staff-purple:      #B07CFF;
  --staff-gold:        #E8C75E;   /* Michael — golden tickets */
  /* Default until a persona is picked. */
  --staff-active:      #FFE600;
}

.staff-shell {
  /* Full-bleed below the site header. */
  min-height: calc(100vh - 64px);
  background: #0a0a0a;
  color: #e8eef4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 1024px) {
  .staff-shell { grid-template-columns: minmax(360px, 1fr) minmax(0, 1.4fr); }
}

/* ── Tab switcher (mobile only) ─────────────────────────────────── */
.staff-tabs {
  display: flex;
  gap: 0;
  background: #11141a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 2;
}
.staff-tab {
  flex: 1;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(232, 238, 244, 0.5);
  padding: 14px 12px;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
}
.staff-tab.active { color: var(--staff-active); border-bottom-color: var(--staff-active); }
@media (min-width: 1024px) { .staff-tabs { display: none; } }

/* ── Chat panel — aurora glow per persona (2026-06-03) ──────────── */
.staff-chat {
  display: flex;
  flex-direction: column;
  background: #0e1116;
  position: relative;
  /* The chat needs its own stacking context so the aurora pseudo-
     element layers correctly. */
  isolation: isolate;
}
/* Aurora glow — a multi-layer animated halo that breathes around the
   chat container in the active persona's color. Three layers:
   1. Outer drop-glow (large blur, low opacity, persona color)
   2. Inner edge ring (sharp, persona color)
   3. Inset radial sweep that animates in a slow spin */
.staff-chat::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  pointer-events: none;
  z-index: -1;
  box-shadow:
    0 0 0   2px var(--staff-active),
    0 0 28px 4px color-mix(in srgb, var(--staff-active) 65%, transparent),
    0 0 80px 12px color-mix(in srgb, var(--staff-active) 35%, transparent),
    0 0 160px 24px color-mix(in srgb, var(--staff-active) 15%, transparent);
  animation: staff-aurora-breath 4.2s ease-in-out infinite;
  transition: box-shadow 420ms ease;
}
.staff-chat::after {
  /* Subtle inner radial wash so the chat reads as a glowing surface,
     not just a bordered card. */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(circle at 50% 0%,
    color-mix(in srgb, var(--staff-active) 18%, transparent) 0%,
    transparent 60%);
  opacity: 0.6;
  transition: background 420ms ease;
}
@keyframes staff-aurora-breath {
  0%, 100% {
    filter: brightness(1) saturate(1);
    opacity: 1;
  }
  50% {
    filter: brightness(1.15) saturate(1.25);
    opacity: 0.92;
  }
}
@media (prefers-reduced-motion: reduce) {
  .staff-chat::before { animation: none; }
}
@media (min-width: 1024px) {
  .staff-chat { border-right: 1px solid rgba(255, 255, 255, 0.06); }
}

.staff-chat-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.staff-chat-head-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
/* Big persona name banner — operator always knows who they're talking
   to. The name is the dominant visual element of the header. */
.staff-chat-badge {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 4px 0;
  background: transparent;
  border: 0;
  color: var(--staff-active);
  font-family: var(--font-display, 'Fredoka One', cursive);
  font-size: 1.5rem;
  letter-spacing: 0.5px;
  line-height: 1;
  text-shadow:
    0 0 8px  color-mix(in srgb, var(--staff-active) 60%, transparent),
    0 0 22px color-mix(in srgb, var(--staff-active) 30%, transparent);
}
.staff-chat-badge .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--staff-active);
  box-shadow: 0 0 10px var(--staff-active),
              0 0 22px color-mix(in srgb, var(--staff-active) 50%, transparent);
  flex-shrink: 0;
}
.staff-chat-badge .talking-to {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: rgba(232, 238, 244, 0.45);
  text-transform: uppercase;
  text-shadow: none;
  font-family: inherit;
  margin-right: 4px;
}
/* Pill switcher (2026-06-03) — was tiny color dots which were unreadable.
   Each pill = dot + name. Hover/active swap to a filled persona-colored
   chip so the operator can ID who they're switching to at a glance. */
.staff-chat-switcher {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}
.staff-switcher-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--dot, #888) 55%, transparent);
  background: color-mix(in srgb, var(--dot, #888) 10%, transparent);
  color: color-mix(in srgb, var(--dot, #888) 85%, #fff);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  min-height: 30px;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 100ms ease;
  /* iOS tap polish */
  -webkit-tap-highlight-color: transparent;
}
.staff-switcher-pill .pill-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--dot, #888);
  box-shadow: 0 0 6px var(--dot, #888);
  flex-shrink: 0;
}
.staff-switcher-pill:hover {
  background: color-mix(in srgb, var(--dot, #888) 22%, transparent);
  border-color: var(--dot, #888);
  color: #fff;
}
.staff-switcher-pill.active {
  background: var(--dot, #888);
  color: #0a0a0a;
  border-color: var(--dot, #888);
  /* Subtle scale + glow tells you exactly who's on right now. */
  transform: translateY(-1px);
  box-shadow: 0 0 18px -4px var(--dot, #888);
}
.staff-switcher-pill.active .pill-dot {
  background: #0a0a0a;
  box-shadow: none;
}
.staff-switcher-pill:focus-visible {
  outline: 2px solid var(--dot, #888);
  outline-offset: 2px;
}

.staff-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  /* Limit chat log height on desktop so it scrolls instead of pushing
     the input out of view. */
  min-height: 360px;
}

.staff-msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.94rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.staff-msg-user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.staff-msg-assistant {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid color-mix(in srgb, var(--staff-active) 35%, transparent);
}
.staff-msg-system {
  align-self: center;
  background: transparent;
  color: rgba(232, 238, 244, 0.45);
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
}
.staff-msg-error {
  align-self: stretch;
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.45);
  color: #ffb3b3;
}

/* Streaming caret on the latest in-progress assistant message. */
.staff-msg-assistant.staff-streaming::after {
  content: '▊';
  display: inline-block;
  margin-left: 2px;
  color: var(--staff-active);
  animation: staff-caret 0.9s steps(2, end) infinite;
}
@keyframes staff-caret { 50% { opacity: 0; } }

/* Approval card — the chassis's safety spine. Persona-colored, true gate. */
.staff-approval {
  align-self: stretch;
  margin: 4px 0;
  padding: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid var(--staff-active);
  border-radius: 14px;
  box-shadow: 0 0 18px -6px var(--staff-active);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.staff-approval-title {
  font-family: var(--font-display, 'Fredoka One', cursive);
  font-size: 0.92rem;
  color: var(--staff-active);
  letter-spacing: 0.3px;
}
.staff-approval-body { font-size: 0.92rem; line-height: 1.5; }
.staff-approval-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  flex-wrap: wrap;
}
.staff-approval-btn {
  background: var(--staff-active);
  color: #0a0a0a;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: 0.84rem;
  letter-spacing: 0.3px;
  cursor: pointer;
  min-height: 42px;
}
.staff-approval-btn-cancel {
  background: transparent;
  color: rgba(232, 238, 244, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.staff-approval-btn:hover { filter: brightness(1.1); }

.staff-chat-input-row {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}
.staff-chat-input {
  flex: 1;
  background: #0a0d12;
  color: #e8eef4;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.96rem;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  line-height: 1.4;
}
.staff-chat-input:focus { outline: 2px solid var(--staff-active); border-color: var(--staff-active); }
.staff-chat-send, .staff-chat-mic {
  background: var(--staff-active);
  color: #0a0a0a;
  border: 0;
  border-radius: 10px;
  min-width: 44px; min-height: 44px;
  font-size: 1.1rem; font-weight: 800;
  cursor: pointer;
}
.staff-chat-mic {
  background: transparent;
  color: var(--staff-active);
  border: 1px solid var(--staff-active);
}
.staff-chat-mic.recording { background: var(--staff-active); color: #0a0a0a; }
.staff-chat-send:disabled, .staff-chat-mic:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Workspace panel ────────────────────────────────────────────── */
.staff-workspace {
  background: #0a0d12;
  padding: 16px;
  overflow-y: auto;
  min-height: 300px;
}
.staff-workspace-empty {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  height: 100%; min-height: 240px;
  color: rgba(232, 238, 244, 0.4);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 24px;
  letter-spacing: 0.3px;
}
.staff-workspace-empty .em-icon { font-size: 2.4rem; opacity: 0.7; margin-bottom: 10px; display: block; }

/* Mobile tab visibility — only one of chat/workspace shown at a time. */
@media (max-width: 1023px) {
  .staff-shell.show-chat .staff-workspace { display: none; }
  .staff-shell.show-workspace .staff-chat { display: none; }
}
