/* GSK Productions — Ava virtual receptionist widget (site-wide component).
   Uses the shared brand tokens from css/brand.css — no new colours except
   the WhatsApp-button green (--whatsapp-green), which is brand.css's too.
   See DESIGN-SYSTEM.md and Receptionist-Bot-Implementation-Brief.md. */

.ava-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050; /* above header.site-nav (1000), below the mobile burger-menu drawer (2000) */
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.ava-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s;
  position: relative;
}

.ava-fab:hover {
  transform: scale(1.06);
}

.ava-fab.chat {
  background: var(--cyan);
}

.ava-fab.wa {
  background: var(--whatsapp-green);
}

.ava-fab svg {
  width: 28px;
  height: 28px;
}

.ava-fab .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #fff;
  color: var(--navy);
  font-size: .6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.ava-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 70px -20px rgba(28, 33, 56, .5);
  z-index: 1100; /* above header.site-nav (1000) so the mobile full-screen panel isn't hidden under the sticky site header */
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ava-panel.open {
  display: flex;
}

.ava-panel-head {
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.ava-panel-head .av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--cyan-bright), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: none;
}

.ava-panel-head .who b {
  display: block;
  font-size: 1rem;
}

.ava-panel-head .who span {
  font-size: .72rem;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ava-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--whatsapp-green);
  display: inline-block;
}

.ava-panel-head .ava-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: .8;
  line-height: 1;
  padding: 4px;
}

.ava-panel-head .ava-close:hover {
  opacity: 1;
}

.ava-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--mist);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ava-msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: .9rem;
  line-height: 1.5;
}

.ava-msg.ava {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ava-msg.user {
  background: var(--navy);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ava-msg .ava-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.ava-msg .ava-sources a {
  color: var(--cyan);
  font-weight: 600;
  font-size: .85rem;
  text-decoration: none;
}

.ava-msg .ava-sources a:hover {
  text-decoration: underline;
}

.ava-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  background: var(--mist);
  flex: none;
}

.ava-quick button {
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--cyan);
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: .15s;
}

.ava-quick button:hover {
  background: var(--cyan);
  color: #fff;
}

.ava-quick[hidden] {
  display: none;
}

.ava-typing {
  display: flex;
  gap: 4px;
  padding: 12px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  align-self: flex-start;
  width: fit-content;
}

.ava-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: ava-blink 1.2s infinite;
}

.ava-typing span:nth-child(2) { animation-delay: .2s; }
.ava-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes ava-blink {
  0%, 60%, 100% { opacity: .3; }
  30% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ava-typing span { animation: none; opacity: .8; }
}

.ava-handoff {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
  background: #fff;
  flex: none;
}

.ava-handoff a {
  flex: 1;
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
  transition: .15s;
}

.ava-handoff .wa {
  background: var(--whatsapp-green);
  color: #fff;
}

.ava-handoff .call {
  background: var(--cyan-soft);
  color: #1d7ba6;
}

.ava-composer {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex: none;
}

.ava-composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: .9rem;
  outline: none;
}

.ava-composer input:focus {
  border-color: var(--cyan);
}

.ava-composer .ava-send {
  background: var(--cyan);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.ava-composer .ava-send:focus-visible,
.ava-fab:focus-visible,
.ava-panel-head .ava-close:focus-visible,
.ava-quick button:focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 2px;
}

/* Two FABs stack vertically bottom-right at every width — never side by side,
   so they can't overlap each other or run off-screen on mobile. */
@media (max-width: 480px) {
  .ava-launcher {
    bottom: 16px;
    right: 16px;
  }

  .ava-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
