/*
 * Bea — the site's chat assistant widget.
 *
 * One fixed-position island, bottom-right, on every page. Two children:
 * .bea-launcher (always in the DOM) and .bea-panel (toggled by bea.js via
 * [hidden], never by removing it — removing and re-adding on every open
 * would replay the Google Fonts/layout cost each time for no reason).
 *
 * Colours and type match the rest of the site exactly — no separate theme.
 * The quick-reply cards' "illustration" is styles.css's own .dot-scale /
 * .dot components (defined site-wide, not here) — this file only adds the
 * card chrome around them, so Bea never needs its own icon set.
 */

.bea-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  font-family: Figtree, 'Helvetica Neue', sans-serif;
}

/* ---------------------------------------------------------- launcher -- */

.bea-launcher-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.bea-ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #1657CE;
  pointer-events: none;
  animation: bea-pulse 2.4s ease-out infinite;
}

.bea-launcher {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: none;
  background: #1657CE;
  box-shadow: 0 10px 24px rgba(22, 87, 206, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  animation: bea-pop 320ms cubic-bezier(.34, 1.56, .64, 1) both;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.bea-launcher:hover,
.bea-launcher:focus-visible {
  transform: scale(1.06);
}

.bea-launcher svg {
  display: block;
}

/* hidden by bea.js while the panel is open */
.bea-root.is-open .bea-launcher-wrap {
  display: none;
}

/* ------------------------------------------------------------ nudge -- */
/* The small teaser bubble above the launcher. Lives inside
   .bea-launcher-wrap (position: relative, above), so the "hidden while the
   panel is open" rule above already covers it too — no separate rule
   needed for that case. Shown/hidden by toggling .is-visible rather than
   [hidden], so the opacity/transform transition actually plays. */

.bea-nudge {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 220px;
  max-width: calc(100vw - 64px);
  box-sizing: border-box;
  background: #FFFFFF;
  border: 1px solid #E1E7F2;
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(15, 26, 60, 0.16);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.bea-nudge.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* The little speech-bubble tail, pointing down toward the launcher. */
.bea-nudge::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 22px;
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  border-right: 1px solid #E1E7F2;
  border-bottom: 1px solid #E1E7F2;
  transform: rotate(45deg);
}

.bea-nudge__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #9AA6C4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.bea-nudge__close:hover,
.bea-nudge__close:focus-visible {
  background: #F0F3FA;
  color: #566080;
}

.bea-nudge__body {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 22px 12px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.bea-nudge__body:focus-visible {
  outline: 2px solid #2E90E0;
  outline-offset: -2px;
  border-radius: 14px;
}

.bea-nudge__avatar {
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: linear-gradient(135deg, #16337A, #1FB6C9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: Sora, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
}

.bea-nudge__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.bea-nudge__summary {
  font-size: 12.5px;
  line-height: 1.4;
  color: #0F1A3C;
}

.bea-nudge__cta {
  font-size: 11.5px;
  font-weight: 700;
  color: #1657CE;
}

/* ------------------------------------------------------------- panel -- */

.bea-panel {
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  box-sizing: border-box;
  border-radius: 20px;
  background: #FFFFFF;
  border: 1px solid #E1E7F2;
  box-shadow: 0 24px 48px rgba(15, 26, 60, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: bea-pop 220ms cubic-bezier(.34, 1.56, .64, 1) both;
}

.bea-panel[hidden] {
  display: none;
}

.bea-head {
  flex-shrink: 0;
  height: 64px;
  box-sizing: border-box;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0F1A3C;
}

.bea-head-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bea-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #16337A, #1FB6C9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: Sora, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.bea-head-text {
  display: flex;
  flex-direction: column;
}

.bea-head-name {
  font-family: Sora, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
}

.bea-head-sub {
  font-size: 12px;
  color: #9FB0D6;
}

.bea-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

/* -------------------------------------------------------- messages -- */

.bea-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #F9FBFE;
}

.bea-row {
  display: flex;
  animation: bea-msg-in 220ms ease both;
}

.bea-row.is-user {
  justify-content: flex-end;
}

.bea-row.is-bea {
  justify-content: flex-start;
}

.bea-bubble {
  max-width: 78%;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.bea-bubble.is-user {
  background: #1657CE;
  color: #FFFFFF;
}

.bea-bubble.is-bea {
  background: #EDF3FE;
  color: #0F1A3C;
}

/* ---------------------------------------------- Tips result carousel -- */
/* Same scroll-snap-strip pattern as /tips' own .carousel, sized to fit the
   360px chat panel instead of the full page width. */

.bea-tips-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: bea-msg-in 220ms ease both;
  /* Lets the track's cards bleed to the panel's inner edge rather than
     being squeezed by .bea-body's own 18px padding on both sides. */
  margin: 0 -18px;
}

.bea-tips-lead {
  font-size: 14px;
  line-height: 1.5;
  color: #0F1A3C;
  padding: 0 18px;
}

.bea-tips-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 2px 18px 6px;
}

.bea-tips-track:focus-visible {
  outline: 2px solid #2E90E0;
  outline-offset: 2px;
  border-radius: 10px;
}

.bea-tips-track::-webkit-scrollbar { height: 6px; }
.bea-tips-track::-webkit-scrollbar-track { background: transparent; }
.bea-tips-track::-webkit-scrollbar-thumb { background: #C9D6EC; border-radius: 999px; }

.bea-tip-card {
  flex: 0 0 180px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #EDF3FE;
  text-decoration: none;
  transition: background 120ms ease, transform 120ms ease;
}

.bea-tip-card:hover,
.bea-tip-card:focus-visible {
  background: #DCE8FC;
  transform: translateY(-1px);
}

/* The category + media badges a tip card carries — the same classification
   /tips shows, just small enough for a 180px card. */
.bea-tip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1px;
}

.bea-tip-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 17px;
  padding: 0 7px;
  border-radius: 999px;
  background: #FFFFFF;
  color: #16337A;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bea-tip-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--royal, #1657CE);
  flex-shrink: 0;
}

.bea-tip-tag[data-dot="azure"]::before { background: var(--azure, #2E90E0); }
.bea-tip-tag[data-dot="cyan"]::before { background: var(--cyan, #1FB6C9); }
.bea-tip-tag[data-dot="navy"]::before { background: var(--navy, #131C46); }
.bea-tip-tag[data-dot="royal"]::before { background: var(--royal, #1657CE); }

.bea-tip-tag--media {
  color: #566080;
}

.bea-tip-tag--media::before {
  display: none;
}

.bea-tip-title {
  display: block;
  font-family: Sora, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #0F1A3C;
}

.bea-tip-snippet {
  display: block;
  font-size: 12.5px;
  line-height: 1.4;
  color: #566080;
}

.bea-tips-empty {
  font-size: 13px;
  color: #6B7593;
  padding: 0 18px;
}

/* -------------------------------------------------------- composer -- */

.bea-foot {
  flex-shrink: 0;
  padding: 12px 0 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #E1E7F2;
  background: #FFFFFF;
}

/* ------------------------------------------- quick-reply carousel -- */
/* Each quick reply is an illustrated card, not a chip: the site's own
   .dot-scale mark (styles.css) plus a title and a one-line description,
   laid out in the same scroll-snap strip as the Tips result above — one
   consistent "swipe sideways, tap a card" interaction throughout. Empty
   until bea.js populates it (hidden via :empty so the foot doesn't show an
   empty bar while the get-to-know-you step is still in progress). */

.bea-quick:empty {
  display: none;
}

.bea-quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 2px 14px 6px 0;
}

.bea-quick:focus-visible {
  outline: 2px solid #2E90E0;
  outline-offset: 2px;
  border-radius: 10px;
}

.bea-quick::-webkit-scrollbar { height: 6px; }
.bea-quick::-webkit-scrollbar-track { background: transparent; }
.bea-quick::-webkit-scrollbar-thumb { background: #C9D6EC; border-radius: 999px; }

.bea-quick-card {
  flex: 0 0 136px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  box-sizing: border-box;
  padding: 10px 12px 11px;
  border-radius: 14px;
  border: 1.5px solid #C9D6EC;
  background: #FFFFFF;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.bea-quick-card:hover,
.bea-quick-card:focus-visible {
  background: #EDF3FE;
  border-color: #1657CE;
}

.bea-quick-card:disabled {
  opacity: 0.5;
  cursor: default;
}

/* .dot-scale / .dot come from styles.css; this only sizes the mark down a
   touch so three cards' worth of dots don't crowd a 136px-wide card. */
.bea-quick-card .dot-scale {
  gap: 4px;
}

.bea-quick-card__title {
  font-size: 13px;
  font-weight: 600;
  color: #16337A;
  white-space: nowrap;
}

.bea-quick-card__desc {
  font-size: 11px;
  line-height: 1.3;
  color: #6B7593;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.bea-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 14px 0 14px;
}

.bea-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #E1E7F2;
  font-size: 14px;
  font-family: inherit;
  color: #0F1A3C;
  background: #F5F8FD;
}

.bea-input:focus-visible {
  outline: 2px solid #1657CE;
  outline-offset: 1px;
}

.bea-send {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: #1657CE;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

.bea-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* --------------------------------------------------------- motion -- */

@keyframes bea-pop {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bea-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bea-pulse {
  0% { transform: scale(1); opacity: 0.45; }
  100% { transform: scale(1.9); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bea-launcher,
  .bea-panel,
  .bea-row,
  .bea-tips-block,
  .bea-ring,
  .bea-tip-card,
  .bea-quick-card,
  .bea-nudge {
    animation: none;
    transition: none;
  }
}

@media (max-width: 420px) {
  .bea-root {
    right: 16px;
    bottom: 16px;
  }
}
