/* The Fourth Chair - reflective companion widget for The Sector Debrief */
/* Editorial, calm, brand-matched. Scoped under #fc-root to avoid collisions. */

#fc-root {
  --fc-cream: #FAF6EA;
  --fc-paper: #FFFDF7;
  --fc-ink: #1A1614;
  --fc-ink-soft: #4a423b;
  --fc-line: rgba(26, 22, 20, 0.14);
  --fc-mustard: #E8B82C;
  --fc-cobalt: #2C5BAA;
  --fc-crimson: #B83A2A;
  --fc-forest: #2A4530;
  --fc-shadow: 0 18px 50px -18px rgba(26, 22, 20, 0.45);
  --fc-serif: Fraunces, "Playfair Display", Georgia, serif;
  --fc-sans: Inter, system-ui, -apple-system, sans-serif;
  position: fixed;
  z-index: 2147483000;
  bottom: 0; right: 0;
  font-family: var(--fc-sans);
}

#fc-root *, #fc-root *::before, #fc-root *::after { box-sizing: border-box; }

/* ---- Floating button ---- */
.fc-fab {
  position: fixed;
  bottom: 22px; right: 22px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 8px 18px 8px 10px;
  background: var(--fc-paper);
  border: 1.5px solid var(--fc-ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--fc-shadow);
  transition: transform .35s cubic-bezier(.22,.61,.36,1), box-shadow .35s;
  animation: fc-rise .6s cubic-bezier(.22,.61,.36,1) both;
}
.fc-fab:hover { transform: translateY(-3px); }
.fc-fab:focus-visible { outline: 3px solid var(--fc-cobalt); outline-offset: 3px; }
.fc-fab-avatars { display: inline-flex; }
.fc-fab-avatars img {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  border: 2px solid var(--fc-paper);
  margin-left: -12px; background: var(--fc-cream);
}
.fc-fab-avatars img:first-child { margin-left: 0; }
.fc-fab-avatars img:last-child { border-color: var(--fc-mustard); }
.fc-fab-label { font-size: 14px; font-weight: 600; color: var(--fc-ink); letter-spacing: .01em; white-space: nowrap; }
.fc-fab-label small { display: block; font-weight: 400; font-size: 11px; color: var(--fc-ink-soft); letter-spacing: .04em; text-transform: uppercase; }

/* ---- Panel ---- */
.fc-panel {
  position: fixed;
  bottom: 22px; right: 22px;
  width: 388px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 44px);
  display: none; flex-direction: column;
  background: var(--fc-cream);
  border: 1.5px solid var(--fc-ink);
  border-radius: 18px;
  box-shadow: var(--fc-shadow);
  overflow: hidden;
}
.fc-panel.fc-open { display: flex; animation: fc-panel-in .4s cubic-bezier(.22,.61,.36,1) both; }

.fc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--fc-line);
  background: var(--fc-paper);
}
.fc-head-avatars { display: inline-flex; flex: 0 0 auto; }
.fc-head-avatars img {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  border: 2px solid var(--fc-paper); margin-left: -10px; background: var(--fc-cream);
}
.fc-head-avatars img:first-child { margin-left: 0; }
.fc-head-avatars img:last-child { border-color: var(--fc-mustard); }
.fc-head-title { flex: 1 1 auto; min-width: 0; }
.fc-head-title b { font-family: var(--fc-serif); font-weight: 600; font-size: 17px; color: var(--fc-ink); display: block; line-height: 1.1; }
.fc-head-title span { font-size: 11.5px; color: var(--fc-ink-soft); letter-spacing: .02em; }
.fc-close {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--fc-line); background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--fc-ink-soft);
  display: grid; place-items: center; transition: background .2s;
}
.fc-close:hover { background: rgba(26,22,20,.06); }
.fc-close:focus-visible { outline: 2px solid var(--fc-cobalt); outline-offset: 2px; }

/* ---- Log ---- */
.fc-log { flex: 1 1 auto; overflow-y: auto; padding: 18px 16px 6px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.fc-msg { max-width: 86%; font-size: 15px; line-height: 1.5; }
.fc-bot { align-self: flex-start; }
.fc-bot .fc-bubble {
  font-family: var(--fc-serif); font-size: 17px; line-height: 1.45; color: var(--fc-ink);
  background: transparent; padding: 2px 2px 2px 14px;
  border-left: 2px solid var(--fc-mustard);
}
.fc-user { align-self: flex-end; }
.fc-user .fc-bubble {
  background: var(--fc-ink); color: var(--fc-cream);
  padding: 10px 14px; border-radius: 14px 14px 4px 14px;
}
.fc-note { align-self: flex-start; font-size: 12px; color: var(--fc-ink-soft); font-style: italic; padding-left: 14px; }

/* pause / thinking */
.fc-sitting { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; color: var(--fc-ink-soft); font-size: 13px; font-style: italic; padding-left: 14px; }
.fc-sitting .fc-dots { display: inline-flex; gap: 3px; }
.fc-sitting .fc-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--fc-mustard); animation: fc-blink 1.3s infinite both; }
.fc-sitting .fc-dots i:nth-child(2){ animation-delay: .18s; }
.fc-sitting .fc-dots i:nth-child(3){ animation-delay: .36s; }

/* ---- Chips ---- */
.fc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; }
.fc-chip {
  font-family: var(--fc-sans); font-size: 12.5px; color: var(--fc-ink);
  background: var(--fc-paper); border: 1px solid var(--fc-line); border-radius: 999px;
  padding: 7px 13px; cursor: pointer; transition: border-color .2s, transform .2s;
}
.fc-chip:hover { border-color: var(--fc-ink); transform: translateY(-1px); }
.fc-chip:focus-visible { outline: 2px solid var(--fc-cobalt); outline-offset: 2px; }

/* ---- Input ---- */
.fc-input-wrap { border-top: 1px solid var(--fc-line); background: var(--fc-paper); padding: 12px 14px 8px; }
.fc-input-row { display: flex; align-items: flex-end; gap: 8px; }
.fc-input {
  flex: 1 1 auto; resize: none; border: 1px solid var(--fc-line); border-radius: 12px;
  padding: 10px 12px; font-family: var(--fc-sans); font-size: 15px; color: var(--fc-ink);
  background: var(--fc-cream); max-height: 120px; line-height: 1.4;
}
.fc-input:focus { outline: none; border-color: var(--fc-cobalt); }
.fc-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--fc-mustard); color: var(--fc-ink); font-size: 18px; display: grid; place-items: center;
  transition: transform .2s, opacity .2s;
}
.fc-send:hover { transform: translateY(-1px); }
.fc-send:disabled { opacity: .45; cursor: default; transform: none; }
.fc-send:focus-visible { outline: 2px solid var(--fc-cobalt); outline-offset: 2px; }
.fc-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px 2px; }
.fc-foot span { font-size: 10.5px; color: var(--fc-ink-soft); letter-spacing: .02em; }
.fc-forget { background: none; border: none; cursor: pointer; font-size: 11px; color: var(--fc-ink-soft); text-decoration: underline; font-family: var(--fc-sans); padding: 0; }
.fc-forget:hover { color: var(--fc-crimson); }

/* ---- Mobile: full sheet ---- */
@media (max-width: 640px) {
  .fc-fab { bottom: 16px; right: 16px; padding: 7px 15px 7px 9px; }
  .fc-fab-label small { display: none; }
  .fc-panel {
    bottom: 0; right: 0; left: 0; width: 100%; max-width: 100%;
    height: 92vh; max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: none;
  }
}

/* ---- Motion prefs ---- */
@keyframes fc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fc-panel-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fc-blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #fc-root *, #fc-root *::before, #fc-root *::after {
    animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
