/* ==========================================================================
   CHAT: floating WhatsApp button and the chat assistant
   ========================================================================== */

/* ---------- floating WhatsApp button ---------- */
.whatsapp-btn {
  position: fixed;
  right: 22px;
  bottom: 94px;
  z-index: 60;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #25d366;
  box-shadow: 0 12px 30px -8px rgba(37, 211, 102, .7);
  transition: .25s;
}

.whatsapp-btn:hover {
  transform: scale(1.08);
}

.whatsapp-btn svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

/* ---------- launcher button ---------- */
.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 61;
  height: 58px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--gradient);
  color: #fff;
  font: 600 15px Inter, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 14px 34px -10px rgba(51, 85, 255, .8);
  transition: .25s;
}

.chat-launcher:hover {
  transform: translateY(-2px);
}

.chat-launcher i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3dff9e;
  box-shadow: 0 0 0 4px rgba(61, 255, 158, .25);
}

.chat-launcher.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---------- panel ---------- */
.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 62;
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: #0d1426;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
  transform: translateY(20px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: .28s;
}

.chat-panel.is-open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: linear-gradient(120deg, rgba(56, 214, 255, .16), rgba(51, 85, 255, .2), rgba(139, 92, 246, .14));
  border-bottom: 1px solid var(--line);
}

.chat-header b {
  display: block;
  font-size: 15px;
}

.chat-header small {
  color: var(--muted);
  font-size: 12px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--navy);
  border: 1px solid rgba(51, 85, 255, .45);
}

.chat-avatar img {
  width: 28px;
  height: 28px;
}

.chat-close {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.chat-close:hover {
  background: var(--card);
  color: var(--text);
}

/* ---------- messages ---------- */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  animation: chatIn .25s ease;
}

.chat-msg--bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.chat-msg--user {
  align-self: flex-end;
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.chat-msg b {
  color: var(--cyan);
}

.chat-msg--user b {
  color: #fff;
}

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

/* ---------- typing dots ---------- */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 14px;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingDot 1s infinite;
}

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

@keyframes typingDot {
  0%, 100% { opacity: .3; transform: none; }
  50%      { opacity: 1; transform: translateY(-3px); }
}

/* ---------- quick-reply chips ---------- */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  max-width: 100%;
}

.chat-chips button {
  border: 1px solid rgba(51, 85, 255, .5);
  background: rgba(51, 85, 255, .1);
  color: var(--text);
  border-radius: 20px;
  padding: 6px 12px;
  font: 500 13px Inter, system-ui, sans-serif;
  cursor: pointer;
}

.chat-chips button:hover {
  background: rgba(51, 85, 255, .28);
}

.chat-chips button.chat-chip--link {
  border-color: rgba(56, 214, 255, .6);
  background: rgba(56, 214, 255, .12);
}

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

.chat-form input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--text);
  font: 16px Inter, system-ui, sans-serif;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--purple);
}

.chat-form button {
  width: 46px;
  border: 0;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.chat-note {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 0 12px 9px;
}
