/* ============================================================
   Chat widget — same monochrome rules as the rest of the site.
   0px corners on the panel and bubbles, full pill on the launcher,
   hairline borders instead of shadows.
   ============================================================ */

#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--font-sans);
}

/* Labelled pill rather than an emoji bubble — it reads as an invitation
   to try the product, which is the whole point of it being here. */
.chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: var(--pill);
  background: var(--iris-deep);
  color: #fff;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 1s var(--ease), color 1s var(--ease),
    transform 1s var(--ease);
  will-change: transform;
}

.chat-launcher:hover {
  background: var(--iris-diagonal);
  border-color: transparent;
  color: #000;
  transform: translate3d(0, -2px, 0);
}

/* Live dot, gently pulsing in the colourway. */
.chat-launcher .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--iris-green);
  flex: none;
  animation: dot-pulse 2.4s var(--ease) infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.82); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-launcher .dot {
    animation: none;
  }
}

.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: rgba(15, 16, 18, 0.94);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--hairline-strong);
  border-radius: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* Fades and rises in rather than snapping open. */
.chat-panel.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.chat-header {
  position: relative;
  background: var(--iris-deep);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Gradient edge along the bottom of the header. */
.chat-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--iris);
}

.chat-header .title {
  font-size: 15px;
  font-weight: 400;
}

.chat-header .subtitle {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

.chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-bubble.bot {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--text);
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--iris-deep);
  color: var(--paper);
  align-self: flex-end;
}

.chat-bubble.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 16px 14px;
}

.chat-bubble.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chat-typing 1.2s infinite ease-in-out;
}

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

@keyframes chat-typing {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-quick-actions {
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-quick-actions button {
  font-family: inherit;
  font-size: 12px;
  padding: 7px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.9s var(--ease), border-color 0.9s var(--ease),
    color 0.9s var(--ease);
}

.chat-quick-actions button:hover {
  border-color: transparent;
  background: var(--iris-deep);
  color: #fff;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
}

.chat-input-row input {
  flex: 1;
  border: none;
  border-radius: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 0;
  color: var(--text);
}

.chat-input-row input::placeholder {
  color: var(--text-faint);
}

.chat-input-row input:focus {
  outline: none;
}

.chat-input-row button {
  background: none;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--iris-amber);
  cursor: pointer;
  padding: 4px 0;
  transition: opacity 0.7s var(--ease);
}

.chat-input-row button:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 480px) {
  #chat-widget {
    bottom: 16px;
    right: 16px;
  }
  .chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 84px;
  }
}
