/* "Ask about Nikhil" chat widget — uses the site's tokens from style.css */

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  font-family: var(--ff-poppins);
}

.chat-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--bg-gradient-jet);
  border: 1px solid var(--jet);
  color: var(--orange-yellow-crayola);
  font-size: var(--fs-6);
  font-weight: var(--fw-500);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: var(--transition-1);
}

.chat-launcher:hover { border-color: var(--orange-yellow-crayola); }
.chat-launcher ion-icon { font-size: 20px; }
.chat-launcher-label { color: var(--white-2); }
.chat-icon-close { display: none; }
.chat-widget.is-open .chat-icon-open,
.chat-widget.is-open .chat-launcher-label { display: none; }
.chat-widget.is-open .chat-icon-close { display: block; }
.chat-widget.is-open .chat-launcher { padding: 12px; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--eerie-black-2);
  border: 1px solid var(--jet);
  border-radius: 20px;
  box-shadow: var(--shadow-5);
  overflow: hidden;
}

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

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--jet);
  background: var(--eerie-black-1);
}

.chat-header img { border-radius: 50%; }
.chat-header > div { flex: 1; min-width: 0; }
.chat-title { color: var(--white-2); font-size: var(--fs-6); font-weight: var(--fw-500); }
.chat-subtitle { color: var(--light-gray-70); font-size: var(--fs-8); font-weight: var(--fw-300); }

.chat-close {
  color: var(--light-gray);
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chat-close:hover { color: var(--orange-yellow-crayola); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

.chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: var(--fs-6);
  font-weight: var(--fw-300);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chat-msg-assistant {
  align-self: flex-start;
  background: var(--onyx);
  color: var(--light-gray);
  border-bottom-left-radius: 4px;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--orange-yellow-crayola);
  color: var(--smoky-black);
  font-weight: var(--fw-400);
  border-bottom-right-radius: 4px;
}

.chat-msg a { color: var(--orange-yellow-crayola); text-decoration: underline; }
.chat-msg strong { color: var(--white-2); font-weight: var(--fw-500); }
.chat-bullet { display: block; padding-left: 14px; position: relative; }
.chat-bullet::before { content: "•"; position: absolute; left: 2px; color: var(--orange-yellow-crayola); }
.chat-error { border: 1px solid var(--bittersweet-shimmer); }

.chat-typing { display: flex; gap: 4px; padding: 14px; }
.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--light-gray-70);
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

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

.chat-suggestions[hidden] { display: none; }

.chat-chip {
  padding: 6px 12px;
  border: 1px solid var(--jet);
  border-radius: 999px;
  color: var(--light-gray);
  font-size: var(--fs-8);
  cursor: pointer;
  transition: var(--transition-1);
}

.chat-chip:hover { border-color: var(--orange-yellow-crayola); color: var(--orange-yellow-crayola); }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--jet);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--jet);
  border-radius: 999px;
  background: var(--eerie-black-1);
  color: var(--white-2);
  font-size: var(--fs-6);
  outline: none;
}

.chat-input:focus { border-color: var(--orange-yellow-crayola); }

.chat-send {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--orange-yellow-crayola);
  color: var(--smoky-black);
  font-size: 18px;
  cursor: pointer;
}

.chat-send:disabled { opacity: 0.5; cursor: wait; }

/* below 1024px the site's navbar is pinned to the bottom, so sit above it */
@media (max-width: 1023px) {
  .chat-widget { bottom: 90px; }
  .chat-panel { height: min(520px, calc(100vh - 190px)); }
}

@media (max-width: 580px) {
  .chat-widget { right: 16px; bottom: 84px; }
  .chat-launcher-label { display: none; }
  .chat-launcher { padding: 13px; }
}
