/* "Ask about Amit" chatbot widget. Uses the site's colour tokens from dark.css. */
.chatbot-toggle {
  position: fixed;
  right: 20px;
  bottom: 70px;
  z-index: 1000;
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #18d26e);
  color: #0a0a0a;
  font-size: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, background 0.2s;
}

.chatbot-toggle:hover {
  background: var(--accent-hover, #35e888);
}

/* ---- Animated robot face ---- */
.chatbot-toggle {
  animation: cb-bob 3s ease-in-out infinite;
}

.chatbot-toggle::after {
  /* soft pulsing ring to draw the eye */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent, #18d26e);
  animation: cb-ring 2.4s ease-out infinite;
  pointer-events: none;
}

.chatbot-toggle.open,
.chatbot-toggle.open::after {
  animation: none;
}

.chatbot-toggle.open::after { opacity: 0; }

.chatbot-robot {
  width: 40px;
  height: 40px;
  overflow: visible;
  transition: transform 0.3s;
}

.chatbot-toggle:hover .chatbot-robot {
  animation: cb-wiggle 0.6s ease-in-out;
}

.cb-head { fill: #0a0a0a; }
.cb-ear { fill: #0a0a0a; }
.cb-antenna { stroke: #0a0a0a; stroke-width: 3; stroke-linecap: round; }
.cb-bulb { fill: #ff5c8a; animation: cb-glow 1.6s ease-in-out infinite; }
.cb-eyes circle { fill: var(--accent, #18d26e); }
.cb-eyes { transform-origin: 32px 31px; animation: cb-blink 4s infinite; }
.cb-cheek { fill: #ff5c8a; opacity: 0.55; }
.cb-mouth { fill: none; stroke: var(--accent, #18d26e); stroke-width: 3; stroke-linecap: round; }

/* happy squint on hover */
.chatbot-toggle:hover .cb-eyes { animation: none; transform: scaleY(0.35); }

.chatbot-x {
  display: none;
  font-size: 28px;
}

.chatbot-toggle.open .chatbot-robot { display: none; }
.chatbot-toggle.open .chatbot-x { display: block; }

@keyframes cb-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes cb-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes cb-blink {
  0%, 44%, 50%, 92%, 100% { transform: scaleY(1); }
  47%, 95% { transform: scaleY(0.1); }
}

@keyframes cb-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes cb-wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}

/* ---- Cursor-following eyes ---- */
.cb-look { transition: transform 0.15s ease-out; }

/* ---- Sleepy mode ---- */
.cb-sleep-eyes {
  display: none;
  fill: none;
  stroke: var(--accent, #18d26e);
  stroke-width: 3;
  stroke-linecap: round;
}

.cb-o { display: none; fill: var(--accent, #18d26e); }

.cb-zzz { display: none; }

.cb-zzz text {
  fill: #fff;
  font: 700 11px "Poppins", sans-serif;
  opacity: 0;
  animation: cb-float 3s ease-in infinite;
}

.cb-zzz text:nth-child(2) { animation-delay: 1s; }
.cb-zzz text:nth-child(3) { animation-delay: 2s; font-size: 14px; }

.chatbot-toggle.sleepy { animation: cb-bob 6s ease-in-out infinite; }
.chatbot-toggle.sleepy::after { animation: none; opacity: 0; }
.chatbot-toggle.sleepy .cb-look { display: none; }
.chatbot-toggle.sleepy .cb-sleep-eyes,
.chatbot-toggle.sleepy .cb-zzz { display: inline; }
.chatbot-toggle.sleepy .cb-bulb { animation: none; opacity: 0.25; }
.chatbot-toggle.sleepy .cb-cheek { opacity: 0.25; }

@keyframes cb-float {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(14px, -22px) scale(1.1); }
}

/* ---- Surprised (just woke up) ---- */
.chatbot-toggle.surprised { animation: cb-jump 0.5s ease-out; }
.chatbot-toggle.surprised .cb-eyes { animation: none; transform: scale(1.3); }
.chatbot-toggle.surprised .cb-mouth { display: none; }
.chatbot-toggle.surprised .cb-o { display: inline; }

@keyframes cb-jump {
  0% { transform: translateY(0); }
  35% { transform: translateY(-14px) rotate(-6deg); }
  70% { transform: translateY(0) rotate(4deg); }
  100% { transform: translateY(0); }
}

/* ---- Speech bubble ---- */
.chatbot-bubble {
  position: fixed;
  right: 86px;
  bottom: 80px;
  z-index: 1000;
  background: #fff;
  color: #0a0a0a;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px) scale(0.8);
  transform-origin: right bottom;
  transition: opacity 0.25s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.25s;
}

.chatbot-bubble.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle, .chatbot-toggle::after, .cb-eyes, .cb-bulb,
  .chatbot-toggle:hover .chatbot-robot,
  .chatbot-toggle.sleepy, .chatbot-toggle.surprised, .cb-zzz text { animation: none; }
  .cb-zzz text { opacity: 1; }
  .cb-look { transition: none; }
}

.chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 136px;
  z-index: 1000;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  background: var(--card, #161616);
  color: var(--text, #d6d6d6);
  border: 1px solid var(--border, #262626);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  font-family: "Open Sans", sans-serif;
}

.chatbot-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #262626);
}

.chatbot-header strong {
  display: block;
  color: var(--heading, #fff);
  font-family: "Poppins", sans-serif;
  font-size: 15px;
}

.chatbot-header span {
  font-size: 12px;
  color: var(--muted, #9a9a9a);
}

.chatbot-close {
  background: none;
  border: none;
  color: var(--muted, #9a9a9a);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.chatbot-close:hover {
  color: var(--heading, #fff);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-msg {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chatbot-msg ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.chatbot-msg a {
  color: var(--accent, #18d26e);
  text-decoration: underline;
}

.chatbot-bot {
  align-self: flex-start;
  background: var(--bg, #0a0a0a);
  border: 1px solid var(--border, #262626);
  border-bottom-left-radius: 4px;
}

.chatbot-user {
  align-self: flex-end;
  background: var(--accent, #18d26e);
  color: #0a0a0a;
  border-bottom-right-radius: 4px;
}

.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted, #9a9a9a);
  animation: chatbot-blink 1.2s infinite;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.chatbot-suggestions button {
  background: transparent;
  border: 1px solid var(--border, #262626);
  color: var(--text, #d6d6d6);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
}

.chatbot-suggestions button:hover {
  border-color: var(--accent, #18d26e);
  color: var(--accent, #18d26e);
}

.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border, #262626);
}

.chatbot-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg, #0a0a0a);
  border: 1px solid var(--border, #262626);
  color: var(--text, #d6d6d6);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.chatbot-form input:focus {
  border-color: var(--accent, #18d26e);
}

.chatbot-form button {
  background: var(--accent, #18d26e);
  border: none;
  color: #0a0a0a;
  border-radius: 8px;
  width: 40px;
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .chatbot-toggle { right: 16px; bottom: 64px; }
  .chatbot-bubble { right: 80px; bottom: 74px; }
  .chatbot-panel { left: 16px; right: 16px; width: auto; bottom: 128px; }
}

/* ---- Biker style (ICON_STYLE = 'biker' in chatbot.js) ---- */
.chatbot-clip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Only clip while riding, so the Zzz can float outside the button */
.chatbot-toggle.riding .chatbot-clip { overflow: hidden; }

.chatbot-toggle.open .chatbot-clip { display: none; }

.cb-bike,
.cb-helmet { display: none; }

.chatbot-toggle.biker .cb-helmet { display: inline; }
.chatbot-toggle.biker .cb-antenna,
.chatbot-toggle.biker .cb-bulb { display: none; }

.cb-shell { fill: #ff3b3b; }
.cb-stripe { fill: #fff; opacity: 0.9; }
.cb-visor { fill: #1f1f1f; }

.cb-rider {
  transform-origin: 32px 0;
  transition: transform 0.3s ease;
}

.cb-wheel circle,
.cb-wheel line,
.cb-frame {
  fill: none;
  stroke: #0a0a0a;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cb-wheel line { stroke-width: 1.5; }
.cb-tank { fill: #ff3b3b; }
.cb-speed { stroke: #fff; stroke-width: 2; stroke-linecap: round; opacity: 0.8; }

.cb-wheel {
  transform-box: fill-box;
  transform-origin: center;
}

/* Riding: shrink the robot onto the bike, then zoom out right and back in from the left */
.chatbot-toggle.riding .cb-bike { display: inline; }
.chatbot-toggle.riding .cb-rider { transform: scale(0.68); }
.chatbot-toggle.riding .cb-wheel { animation: cb-spin 0.3s linear infinite; }
.chatbot-toggle.riding .chatbot-robot { animation: cb-ride 2.6s ease-in-out; }
.chatbot-toggle.riding { animation: none; }
.chatbot-toggle.riding .cb-eyes { animation: none; transform: scaleY(0.6); }

@keyframes cb-spin {
  to { transform: rotate(360deg); }
}

@keyframes cb-ride {
  0%   { transform: translateX(0); }
  12%  { transform: translateX(-5px) rotate(-8deg); }   /* wheelie wind-up */
  40%  { transform: translateX(64px) rotate(-4deg); }   /* zoom off to the right */
  41%  { transform: translateX(-64px); }                /* reappear on the left */
  75%  { transform: translateX(3px) rotate(2deg); }
  88%  { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle.riding .chatbot-robot,
  .chatbot-toggle.riding .cb-wheel { animation: none; }
}

/* ---- Avatar style (ICON_STYLE = 'avatar' in chatbot.js) ---- */
.av-skin { fill: #b47a55; }
.av-hair { fill: #151515; }
.av-stubble { fill: #3a2418; opacity: 0.22; }
.av-brow { fill: none; stroke: #151515; stroke-width: 2.2; stroke-linecap: round; }
.av-nose { fill: none; stroke: #7a4a30; stroke-width: 1.4; stroke-linecap: round; }
.av-shirt { fill: #ece6d8; }
.av-collar { fill: #d6cfbf; }

.chatbot-toggle.avatar .cb-eyes circle { fill: #151515; }
.chatbot-toggle.avatar .cb-eyes { transform-origin: 32px 30px; }
.chatbot-toggle.avatar .cb-mouth,
.chatbot-toggle.avatar .cb-sleep-eyes { stroke: #4a2616; stroke-width: 2; }
.chatbot-toggle.avatar .cb-o { fill: #4a2616; }

/* Helmet goes on only for the ride */
.chatbot-toggle.avatar .cb-helmet { display: none; }
.chatbot-toggle.avatar.riding .cb-helmet { display: inline; }

.av-hand {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.chatbot-toggle.avatar.waving .av-hand,
.chatbot-toggle.avatar:hover .av-hand { animation: av-wave 0.8s ease-in-out 2; }

.chatbot-toggle.avatar:hover .chatbot-robot { animation: none; }  /* wave instead of wiggle */
.chatbot-toggle.avatar.riding .av-hand,
.chatbot-toggle.avatar.sleepy .av-hand { display: none; }

@keyframes av-wave {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-18deg); }
  40% { transform: rotate(14deg); }
  60% { transform: rotate(-14deg); }
  80% { transform: rotate(10deg); }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle.avatar.waving .av-hand,
  .chatbot-toggle.avatar:hover .av-hand { animation: none; }
}
