/* Floating Nexo support helper (Prof. Dino). Uses the app tokens from
   styles.css (:root) and inherits the high-contrast filter on body. */
.support-chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  width: 104px;
  height: 128px;
  padding: 0 0 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.support-chat-fab img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transform-origin: 50% 85%;
  filter: drop-shadow(0 6px 5px rgb(25 61 55 / 0.18));
  transition: transform 160ms ease-out;
}
.support-chat-fab.is-dragging {
  cursor: grabbing;
}
.support-chat-fab:hover {
  background: transparent;
}
.support-chat-fab.is-compact {
  width: 64px;
  height: 44px;
  padding: 0;
}
.support-chat-fab.is-compact img {
  display: none;
}
.support-chat-fab.is-compact .support-companion-tag {
  inset: 0;
  display: grid;
  place-items: center;
  transform: none;
}
.support-chat-fab.is-dragging img {
  transition: none;
}
.support-companion-tag {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  pointer-events: none;
}
.support-chat-fab[data-pose="comemorando"] img {
  animation: support-companion-cheer 420ms ease-out 2;
}
@keyframes support-companion-cheer {
  50% {
    transform: translateY(-7px) rotate(-3deg);
  }
}
.support-chat-avatar-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
}
.support-chat-avatar-choice select {
  width: auto;
  max-width: 65%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.support-chat-avatar-choice label {
  margin: 0;
}
.support-chat-compact {
  padding: 6px;
  background: transparent;
  color: var(--green);
  font-size: 12px;
}
.support-chat-compact:hover {
  background: var(--white);
}
.support-chat-fab:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.support-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 156px;
  z-index: 901;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  height: min(520px, calc(100dvh - 150px));
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 20px 45px rgb(25 61 55 / 0.4);
  overflow: hidden;
}
.support-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--green);
  color: white;
}
.support-chat-avatar {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid rgb(255 255 255 / 0.5);
  flex: none;
}
.support-chat-titles {
  flex: 1;
  min-width: 0;
}
.support-chat-titles h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.support-chat-titles p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.3;
}
.support-chat-close {
  padding: 4px 10px;
  background: transparent;
  color: white;
  font-size: 22px;
  line-height: 1;
  flex: none;
}
.support-chat-close:hover {
  background: rgb(255 255 255 / 0.15);
}
.support-chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--paper);
  overflow-y: auto;
}
.support-chat-bubble {
  margin: 0;
  padding: 8px 12px;
  max-width: 88%;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  border: 1px solid var(--line);
}
.support-chat-bot {
  align-self: flex-start;
  background: var(--white);
}
.support-chat-user {
  align-self: flex-end;
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.support-chat-thinking {
  color: var(--muted);
  font-style: italic;
}
.support-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.support-chat-chip {
  padding: 6px 10px;
  background: var(--white);
  color: var(--green);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.support-chat-chip:hover {
  background: var(--lime);
}
.support-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--white);
}
.support-chat-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.support-chat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  font: inherit;
  font-size: 14px;
  background: var(--white);
  color: var(--ink);
}
.support-chat-form input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}
.support-chat-send {
  width: 42px;
  height: 42px;
  padding: 0;
  flex: none;
  font-size: 20px;
  line-height: 1;
  background: var(--green);
  color: white;
}
body.high-contrast .support-chat-panel {
  border: 2px solid #000;
}
body.high-contrast .support-chat-bubble {
  border-width: 2px;
}
/* Phones: an OpenMAIC lesson keeps its own controls where the helper floats
   (public/openmaic-step.js marks the body while the step is mounted). */
@media (max-width: 640px) {
  body.has-openmaic-step .support-chat-fab {
    display: none;
  }
}
@media (max-width: 480px) {
  .support-chat-fab {
    right: 12px;
    bottom: 12px;
    width: 72px;
    height: 88px;
  }
  .support-chat-panel {
    right: 8px;
    bottom: 112px;
    width: calc(100vw - 16px);
    height: min(70dvh, calc(100dvh - 130px), 480px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .support-chat-fab,
  .support-chat-fab img,
  .support-chat-fab[data-pose] img,
  .support-chat-panel {
    transition: none;
    animation: none;
  }
}
/* Embed mode (/support-widget.html): panel fills the page for the Moodle
   floating-help iframe; the launcher and close button do not exist there. */
body.support-chat-embed-page {
  margin: 0;
  height: 100%;
}
.support-chat-panel.support-chat-embed {
  position: static;
  width: 100%;
  height: 100vh;
  border: 0;
  box-shadow: none;
  z-index: auto;
}
body.high-contrast .support-chat-panel.support-chat-embed {
  border: 0;
}
@media (max-width: 480px) {
  .support-chat-panel.support-chat-embed {
    width: 100%;
    height: 100vh;
  }
}
