/* Cubbie — polished frosted glass overlay (Bees & Cubs). Does not change school layout. */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,500;9..40,600;9..40,700&family=Literata:opsz,wght@7..72,600;7..72,700&display=swap");

#bnc-chatbot-root {
  --accent: #e86b1f;
  --accent-soft: #fff1e8;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --frost: rgba(255, 255, 255, 0.78);
  --frost-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(30, 41, 59, 0.08);
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.12);
  --pill-top: 84%;
  --pill-clear: max(18px, env(safe-area-inset-bottom, 0px));
  --kb-inset: 0px;
  --rail: min(540px, calc(100vw - 32px));
  --radius: 20px;
  --panel-gap: 36px; /* visual space above pill (~12px clear of pill top) */
  --nav-clear: 88px; /* keep panel below site header / nav */
  --pill-h: 52px;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  z-index: 2147483000;
  position: relative;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#bnc-chatbot-root.is-busy .bnc-pill-send {
  opacity: 0.55;
  pointer-events: none;
}

#bnc-chatbot-root.is-busy .bnc-chip {
  pointer-events: none;
  opacity: 0.7;
}

#bnc-chatbot-root.is-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Hide while landing posts / fancybox / video overlays are open */
#bnc-chatbot-root.is-ready.is-obscured {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Critical: children with pointer-events:auto would still steal taps over Bootstrap posts */
#bnc-chatbot-root.is-ready.is-obscured,
#bnc-chatbot-root.is-ready.is-obscured * {
  pointer-events: none !important;
}

/* Pill/panel stay invisible while bee is flying */
#bnc-chatbot-root.is-introing .bnc-pill,
#bnc-chatbot-root.is-introing .bnc-panel,
#bnc-chatbot-root.is-introing .bnc-toast,
#bnc-chatbot-root.is-ready.is-introing .bnc-pill,
#bnc-chatbot-root.is-ready.is-introing .bnc-panel,
#bnc-chatbot-root.is-ready.is-introing .bnc-toast {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#bnc-chatbot-root.is-introing .bnc-pill {
  transition: none !important;
  transform: translateX(-50%) scale(0.86);
}

/* Bee on document.body — large & clear */
.bnc-bee-flight {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483646;
  width: 88px;
  height: 88px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7ed 0%, #fdba74 45%, #f46917 100%);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.95),
    0 14px 36px rgba(15, 23, 42, 0.35),
    0 0 40px rgba(244, 105, 23, 0.45);
  pointer-events: none;
  display: grid;
  place-items: center;
  font-size: 48px;
  line-height: 1;
  will-change: transform, opacity;
  animation: bnc-bee-fly 2.15s cubic-bezier(0.4, 0.05, 0.2, 1) forwards;
}

.bnc-bee-flight span {
  display: block;
  animation: bnc-bee-wiggle 0.22s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

@keyframes bnc-bee-fly {
  0% {
    opacity: 0;
    transform: translate3d(-12vw, 16vh, 0) rotate(-22deg) scale(0.45);
  }
  6% {
    opacity: 1;
  }
  28% {
    transform: translate3d(18vw, 30vh, 0) rotate(16deg) scale(1.15);
  }
  50% {
    transform: translate3d(72vw, 42vh, 0) rotate(-12deg) scale(1.05);
  }
  72% {
    transform: translate3d(38vw, 66vh, 0) rotate(10deg) scale(1);
  }
  88% {
    opacity: 1;
    transform: translate3d(calc(50vw - 44px), calc(84vh - 44px), 0) rotate(0deg) scale(0.85);
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(50vw - 44px), calc(84vh - 44px), 0) rotate(0deg) scale(0.2);
  }
}

@keyframes bnc-bee-wiggle {
  from { transform: translateY(-4px) rotate(-10deg) scale(1.05); }
  to { transform: translateY(4px) rotate(10deg) scale(1.05); }
}

#bnc-chatbot-root.is-pill-pop .bnc-pill {
  animation: bnc-pill-pop 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes bnc-pill-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.72);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bnc-bee-flight,
  #bnc-chatbot-root.is-pill-pop .bnc-pill {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .bnc-bee-flight {
    width: 64px;
    height: 64px;
    font-size: 34px;
  }
  @keyframes bnc-bee-fly {
    0% {
      opacity: 0;
      transform: translate3d(-8vw, 20vh, 0) rotate(-18deg) scale(0.5);
    }
    8% { opacity: 1; }
    35% {
      transform: translate3d(55vw, 38vh, 0) rotate(12deg) scale(1.05);
    }
    70% {
      transform: translate3d(28vw, 62vh, 0) rotate(-8deg) scale(0.95);
    }
    100% {
      opacity: 0;
      transform: translate3d(calc(50vw - 32px), calc(100dvh - 96px), 0) scale(0.2);
    }
  }
}

#bnc-chatbot-root *,
#bnc-chatbot-root *::before,
#bnc-chatbot-root *::after {
  box-sizing: border-box;
}

#bnc-chatbot-root button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

#bnc-chatbot-root button:focus-visible,
#bnc-chatbot-root input:focus-visible {
  outline: 2px solid rgba(232, 107, 31, 0.45);
  outline-offset: 2px;
}

/* ——— Thin modern scrollbar (no OS arrow buttons) ——— */
#bnc-chatbot-root .bnc-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 41, 59, 0.28) transparent;
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar {
  width: 5px;
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar-thumb {
  background: rgba(30, 41, 59, 0.22);
  border-radius: 999px;
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 41, 59, 0.38);
}

#bnc-chatbot-root .bnc-messages::-webkit-scrollbar-corner {
  background: transparent;
}

/* ——— Cookie ——— */
#bnc-chatbot-root .bnc-cookie {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  width: min(460px, calc(100vw - 28px));
  z-index: 2147483010;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--frost-strong);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#bnc-chatbot-root.is-cookie .bnc-cookie {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

#bnc-chatbot-root.is-cookie .bnc-toast,
#bnc-chatbot-root.is-cookie .bnc-panel,
#bnc-chatbot-root.is-cookie .bnc-pill {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

#bnc-chatbot-root .bnc-cookie h3 {
  margin: 0 0 6px;
  font-family: "Literata", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

#bnc-chatbot-root .bnc-cookie p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 500;
}

#bnc-chatbot-root .bnc-cookie-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#bnc-chatbot-root .bnc-cookie-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

#bnc-chatbot-root .bnc-cookie-btn:hover { transform: translateY(-1px); }

#bnc-chatbot-root .bnc-cookie-btn.accept {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(232, 107, 31, 0.28);
  width: 100%;
}

#bnc-chatbot-root .bnc-cookie-btn.essential {
  display: none !important;
}

/* Intro toast — disabled (pill + panel only) */
#bnc-chatbot-root .bnc-toast {
  display: none !important;
}

/* ——— Conversation panel (sits fully above the pill) ——— */
#bnc-chatbot-root .bnc-panel {
  position: fixed;
  left: 50%;
  top: auto;
  bottom: calc(var(--pill-clear) + var(--kb-inset) + var(--pill-h) + var(--panel-gap));
  transform: translateX(-50%) translateY(10px);
  width: var(--rail);
  height: min(520px, calc(100dvh - var(--pill-clear) - var(--kb-inset) - var(--pill-h) - var(--panel-gap) - var(--nav-clear)));
  max-height: calc(100dvh - var(--pill-clear) - var(--kb-inset) - var(--pill-h) - var(--panel-gap) - var(--nav-clear));
  z-index: 2147483004;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: var(--frost);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.25);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease, bottom 0.2s ease;
}

#bnc-chatbot-root.is-open .bnc-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

#bnc-chatbot-root .bnc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

#bnc-chatbot-root .bnc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#bnc-chatbot-root .bnc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 16px;
  border: 1px solid rgba(232, 107, 31, 0.12);
  flex-shrink: 0;
}

#bnc-chatbot-root .bnc-header h2 {
  margin: 0;
  font-family: "Literata", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

#bnc-chatbot-root .bnc-header p {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

#bnc-chatbot-root .bnc-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.06);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  line-height: 0;
}

#bnc-chatbot-root .bnc-close svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  display: block;
}

#bnc-chatbot-root .bnc-close:hover {
  background: rgba(30, 41, 59, 0.1);
  color: var(--ink);
}

#bnc-chatbot-root .bnc-messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 12px 14px 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

#bnc-chatbot-root .bnc-msg {
  display: flex;
  margin-bottom: 10px;
  animation: bnc-in 0.25s ease;
}

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

#bnc-chatbot-root .bnc-msg.bot { justify-content: flex-start; }
#bnc-chatbot-root .bnc-msg.user { justify-content: flex-end; }

#bnc-chatbot-root .bnc-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
}

#bnc-chatbot-root .bnc-msg.bot .bnc-bubble {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

#bnc-chatbot-root .bnc-msg.user .bnc-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(232, 107, 31, 0.2);
}

#bnc-chatbot-root .bnc-bubble a {
  color: var(--accent);
  font-weight: 700;
}

#bnc-chatbot-root .bnc-msg.user .bnc-bubble a { color: #fff; }

#bnc-chatbot-root .bnc-voice-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

#bnc-chatbot-root .bnc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 12px;
}

#bnc-chatbot-root .bnc-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#bnc-chatbot-root .bnc-chip:hover {
  border-color: rgba(232, 107, 31, 0.35);
  color: var(--accent);
  background: var(--accent-soft);
}

#bnc-chatbot-root .bnc-chip.accent {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

#bnc-chatbot-root .bnc-typing {
  display: inline-flex;
  gap: 4px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  border: 1px solid var(--line);
}

#bnc-chatbot-root .bnc-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: bnc-dot 1.1s infinite ease-in-out;
}

#bnc-chatbot-root .bnc-typing span:nth-child(2) { animation-delay: 0.15s; }
#bnc-chatbot-root .bnc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bnc-dot {
  0%, 80%, 100% { opacity: 0.35; transform: none; }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ——— Input pill ——— */
#bnc-chatbot-root .bnc-pill {
  position: fixed;
  left: 50%;
  top: auto;
  bottom: calc(var(--pill-clear) + var(--kb-inset));
  transform: translateX(-50%);
  z-index: 2147483005;
  width: var(--rail);
  min-height: var(--pill-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: var(--frost-strong);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, bottom 0.2s ease;
}

#bnc-chatbot-root .bnc-pill.is-listening {
  border-color: rgba(232, 107, 31, 0.4);
  box-shadow: 0 0 0 3px rgba(232, 107, 31, 0.12), var(--shadow-soft);
}

#bnc-chatbot-root .bnc-pill.is-continue-mode {
  cursor: pointer;
  border-color: rgba(232, 107, 31, 0.2);
}

#bnc-chatbot-root .bnc-pill.is-continue-mode input {
  cursor: pointer;
  caret-color: transparent;
}

#bnc-chatbot-root .bnc-pill input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  min-width: 0;
  padding: 8px 0;
  line-height: 1.3;
}

#bnc-chatbot-root .bnc-pill input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

#bnc-chatbot-root .bnc-pill-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

#bnc-chatbot-root .bnc-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7b8798;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

#bnc-chatbot-root .bnc-icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

#bnc-chatbot-root .bnc-icon-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  animation: bnc-pulse 1.2s ease infinite;
}

@keyframes bnc-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#bnc-chatbot-root .bnc-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

#bnc-chatbot-root .bnc-pill-send {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  line-height: 0;
  box-shadow: 0 4px 14px rgba(232, 107, 31, 0.32);
  transition: transform 0.15s ease, filter 0.15s ease;
}

#bnc-chatbot-root .bnc-pill-send:hover {
  transform: scale(1.05);
  filter: brightness(1.05);
}

#bnc-chatbot-root .bnc-pill-send:active {
  transform: scale(0.98);
}

#bnc-chatbot-root .bnc-pill-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
  /* optical center for up-arrow glyph */
  transform: translateY(-0.5px);
}

@media (max-width: 640px) {
  #bnc-chatbot-root {
    --pill-clear: max(12px, env(safe-area-inset-bottom, 0px));
    --rail: calc(100vw - 16px);
    --nav-clear: max(64px, env(safe-area-inset-top, 0px));
    --panel-gap: 14px;
    --pill-h: 54px;
    --radius: 18px;
  }

  #bnc-chatbot-root .bnc-cookie {
    width: calc(100vw - 16px);
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    padding: 16px;
    border-radius: 18px;
  }

  #bnc-chatbot-root .bnc-cookie h3 { font-size: 16px; }
  #bnc-chatbot-root .bnc-cookie p { font-size: 13px; margin-bottom: 12px; }

  #bnc-chatbot-root .bnc-cookie-actions {
    flex-direction: column;
  }

  #bnc-chatbot-root .bnc-cookie-btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
  }

  #bnc-chatbot-root .bnc-panel {
    width: calc(100vw - 16px);
    border-radius: 18px;
    height: min(68dvh, calc(100dvh - var(--pill-clear) - var(--kb-inset) - var(--pill-h) - var(--panel-gap) - var(--nav-clear)));
    max-height: calc(100dvh - var(--pill-clear) - var(--kb-inset) - var(--pill-h) - var(--panel-gap) - var(--nav-clear));
  }

  #bnc-chatbot-root .bnc-header {
    padding: 10px 10px 10px 12px;
  }

  #bnc-chatbot-root .bnc-close {
    width: 40px;
    height: 40px;
  }

  #bnc-chatbot-root .bnc-messages {
    padding: 10px 10px 14px;
  }

  #bnc-chatbot-root .bnc-bubble {
    font-size: 14px;
    max-width: 92%;
  }

  #bnc-chatbot-root .bnc-chips {
    gap: 6px;
  }

  #bnc-chatbot-root .bnc-chip {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 12.5px;
  }

  #bnc-chatbot-root .bnc-pill {
    width: calc(100vw - 16px);
    padding: 5px 5px 5px 14px;
    /* Sit above typical floating side widgets on phones */
    bottom: calc(var(--pill-clear) + var(--kb-inset) + 8px);
  }

  #bnc-chatbot-root .bnc-panel {
    bottom: calc(var(--pill-clear) + var(--kb-inset) + var(--pill-h) + var(--panel-gap) + 8px);
  }

  /* 16px prevents iOS auto-zoom on focus */
  #bnc-chatbot-root .bnc-pill input {
    font-size: 16px;
    padding: 10px 0;
  }

  #bnc-chatbot-root .bnc-icon-btn,
  #bnc-chatbot-root .bnc-pill-send {
    width: 42px;
    height: 42px;
  }

  #bnc-chatbot-root .bnc-icon-btn svg {
    width: 19px;
    height: 19px;
  }

  #bnc-chatbot-root .bnc-pill-send svg {
    width: 17px;
    height: 17px;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  #bnc-chatbot-root .bnc-header p {
    display: none;
  }
}

