/* ============================================================
   LumoPlans, Lumo Assistant (FAQ chatbot widget)
   A self-mounting, front-end-only FAQ widget: a floating launcher
   bottom-right, opening a small panel with canned answers.
   Midnight Current. Loads after tokens.css + base.css.
   ============================================================ */

.lumobot {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 300;
  font-family: var(--font-body);
}

/* Nudge above the course chapter FAB on small screens so they don't overlap */
@media (max-width: 56.24rem) {
  .lumobot { bottom: 4.75rem; }
}

/* ---------- Launcher ---------- */

.lumobot-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  border: 0;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform var(--speed-fast) var(--ease-out), box-shadow var(--speed-fast) var(--ease-out);
}

.lumobot-launcher:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lumobot-launcher:active { transform: translateY(0); }
.lumobot-launcher:focus-visible { outline: 2px solid var(--lumo); outline-offset: 3px; }

.lumobot-launcher svg { width: 1.5rem; height: 1.5rem; }

.lumobot[data-open="true"] .lumobot-launcher { display: none; }

/* ---------- Panel ---------- */

.lumobot-panel {
  display: none;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2rem));
  height: min(34rem, calc(100vh - 2rem));
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity var(--speed-base) var(--ease-out), transform var(--speed-base) var(--ease-out);
}

.lumobot[data-open="true"] .lumobot-panel {
  display: flex;
  opacity: 1;
  transform: none;
}

/* ---------- Header ---------- */

.lumobot-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: var(--space-4) var(--space-5);
  background: var(--night);
  color: var(--ink-on-night);
}

.lumobot-head-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-pill);
  background: rgba(79, 141, 255, 0.16);
  color: var(--lumo-bright);
  flex: none;
}

.lumobot-head-text { min-width: 0; flex: 1; }

.lumobot-head-title {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: var(--text-base);
  line-height: 1.2;
}

.lumobot-head-sub {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted-on-night);
  margin-top: 0.1rem;
}

.lumobot-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--line-on-night);
  color: var(--ink-on-night);
  cursor: pointer;
}

.lumobot-close:hover { background: rgba(255, 255, 255, 0.08); }
.lumobot-close:focus-visible { outline: 2px solid var(--lumo-bright); outline-offset: 2px; }

/* ---------- Message log ---------- */

.lumobot-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--paper);
}

.lumobot-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.lumobot-msg-bot {
  align-self: flex-start;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-bottom-left-radius: var(--r-sm);
}

.lumobot-msg-user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: var(--r-sm);
}

.lumobot-msg a { font-weight: 600; }
.lumobot-msg-bot a { color: var(--lumo-deep); }
.lumobot-msg p { margin: 0; max-width: none; }
.lumobot-msg p + p { margin-top: 0.5rem; }

/* ---------- Suggested question chips ---------- */

.lumobot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 var(--space-4) var(--space-3);
  background: var(--paper);
}

.lumobot-chip {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--lumo-deep);
  background: var(--lumo-soft);
  border: 1px solid rgba(79, 141, 255, 0.22);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background-color var(--speed-fast) ease, transform var(--speed-fast) var(--ease-out);
}

.lumobot-chip:hover { transform: translateY(-1px); background: rgba(79, 141, 255, 0.22); }
.lumobot-chip:focus-visible { outline: 2px solid var(--lumo); outline-offset: 2px; }

/* ---------- Composer ---------- */

.lumobot-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--paper-raised);
}

.lumobot-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.6rem 0.8rem;
  min-height: 2.75rem;
  resize: none;
  line-height: 1.4;
  max-height: 6rem;
}

.lumobot-input::placeholder { color: var(--muted); }
.lumobot-input:focus {
  outline: none;
  border-color: var(--lumo);
  box-shadow: 0 0 0 3px var(--lumo-glow);
}

.lumobot-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  border: 0;
  cursor: pointer;
  transition: background-color var(--speed-fast) ease, transform var(--speed-fast) var(--ease-out);
}

.lumobot-send:hover { background: var(--night); transform: translateY(-1px); }
.lumobot-send:active { transform: translateY(0); }
.lumobot-send:focus-visible { outline: 2px solid var(--lumo); outline-offset: 2px; }
.lumobot-send svg { width: 1.15rem; height: 1.15rem; }

/* ---------- Footnote ---------- */

.lumobot-foot {
  padding: 0.5rem var(--space-4) 0.7rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  background: var(--paper-raised);
}

.lumobot-foot a { color: var(--lumo-deep); }

@media (prefers-reduced-motion: reduce) {
  .lumobot-launcher,
  .lumobot-panel,
  .lumobot-chip,
  .lumobot-send { transition: none; }
}
