/* ============================================================================
 * CHATBOT DE FEEDBACK — bulle flottante + panneau, charte Swiss
 * ========================================================================= */

.fbk {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9700;
  font-family: var(--font-sans);
}

/* — Bulle déclencheur — */
.fbk__toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -6px rgba(11, 92, 171, 0.55);
  transition:
    transform 200ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    background-color 160ms ease;
}
.fbk__toggle:hover {
  transform: translateY(-2px) scale(1.04);
  background: #003d78;
}
.fbk__toggle svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}
.fbk__toggle .fbk__close-icon {
  display: none;
}
.fbk.is-open .fbk__toggle .fbk__chat-icon {
  display: none;
}
.fbk.is-open .fbk__toggle .fbk__close-icon {
  display: block;
}

/* — Panneau de chat — */
.fbk__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 110px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition:
    opacity 240ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 240ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    visibility 0s linear 240ms;
}
.fbk.is-open .fbk__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 240ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 240ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    visibility 0s;
}

.fbk__head {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.fbk__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.fbk__title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

/* — Fil de messages — */
.fbk__log {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.fbk__msg {
  max-width: 85%;
  padding: 10px 13px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.fbk__msg--bot {
  align-self: flex-start;
  background: var(--paper-2);
  color: var(--ink);
}
.fbk__msg--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
}
.fbk__typing {
  align-self: flex-start;
  color: var(--ink-3);
  font-size: 0.85rem;
  font-style: italic;
}

/* — Récap feedback prêt — */
.fbk__recap {
  align-self: stretch;
  border: 1px solid var(--accent);
  padding: var(--s-3);
  background: rgba(11, 92, 171, 0.04);
}
.fbk__recap-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.fbk__recap-line {
  font-size: 0.85rem;
  line-height: 1.5;
}
.fbk__recap-line b {
  font-weight: 600;
}
.fbk__send {
  margin-top: var(--s-2);
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.fbk__send:hover {
  background: #003d78;
}
.fbk__send:disabled {
  opacity: 0.6;
  cursor: default;
}

/* — Zone de saisie — */
.fbk__form {
  display: flex;
  gap: 8px;
  padding: var(--s-3);
  border-top: 1px solid var(--line);
}
.fbk__input {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  border: 1px solid var(--line);
  padding: 10px 12px;
  resize: none;
  max-height: 90px;
  min-height: 42px;
}
.fbk__input:focus {
  outline: none;
  border-color: var(--ink);
}
.fbk__submit {
  flex: 0 0 auto;
  width: 42px;
  background: var(--ink);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fbk__submit:hover {
  background: var(--accent);
}
.fbk__submit svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}
.fbk__submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.fbk__unavailable {
  padding: var(--s-4);
  text-align: center;
  color: var(--ink-3);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .fbk__panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    right: -2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fbk__toggle,
  .fbk__panel {
    transition: none !important;
  }
}
