/* =========================================================
   AI CHAT WIDGET — floating bubble + chat panel
   Sits bottom-left so it doesn't collide with the WhatsApp
   button (bottom-right).
   ========================================================= */

.ai-chat-toggle {
  position: fixed;
  bottom: 26px;
  left: 26px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--gold-light);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.3);
  z-index: 200;
  font-size: 26px;
  transition: transform 0.15s ease;
}
.ai-chat-toggle:hover { transform: scale(1.08); }

/* Pulsing glow rings to catch the eye — stop once the chat has been opened */
.ai-chat-toggle::before,
.ai-chat-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0;
  animation: ai-pulse-ring 2.6s ease-out infinite;
}
.ai-chat-toggle::after { animation-delay: 1.3s; }
.ai-chat-toggle.pulse-stopped::before,
.ai-chat-toggle.pulse-stopped::after { animation: none; opacity: 0; }

@keyframes ai-pulse-ring {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* "AI" badge — differentiates this from a generic chat bubble */
.ai-chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gold);
  color: var(--navy-deep);
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 3px 6px;
  border-radius: 10px;
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  animation: ai-badge-bounce 2.4s ease-in-out infinite;
}
@keyframes ai-badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Proactive greeting bubble — appears on its own shortly after page load */
.ai-greeting-bubble {
  position: fixed;
  bottom: 100px;
  left: 26px;
  max-width: 240px;
  background: var(--white);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 14px 34px rgba(11,37,69,0.22);
  padding: 14px 16px;
  z-index: 199;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  cursor: pointer;
}
.ai-greeting-bubble.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.ai-greeting-bubble p { font-size: 13px; color: var(--ink); line-height: 1.4; margin: 0; padding-right: 14px; }
.ai-greeting-bubble .greeting-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
}
.ai-greeting-bubble .greeting-close:hover { color: var(--red); }
.ai-greeting-bubble .greeting-label {
  font-family: var(--font-label); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; display: block; margin-bottom: 4px;
}

.ai-chat-panel {
  position: fixed;
  bottom: 96px;
  left: 26px;
  width: min(360px, calc(100vw - 40px));
  height: min(520px, calc(100vh - 140px));
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(11,37,69,0.25);
  display: flex;
  flex-direction: column;
  z-index: 201;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.ai-chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.ai-chat-head {
  background: var(--navy);
  color: var(--white);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ai-chat-head-brand { display: flex; align-items: center; gap: 10px; }
.ai-chat-head-brand img { width: 30px; height: 30px; border-radius: 50%; }
.ai-chat-head-brand strong { font-family: var(--font-display); font-size: 15px; display: block; }
.ai-chat-head-brand span { font-family: var(--font-label); font-size: 9.5px; color: var(--gold-light); letter-spacing: 0.06em; }
.ai-chat-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 16px; cursor: pointer; }
.ai-chat-close:hover { color: var(--white); }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
}
.ai-msg { max-width: 85%; padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-line; }
.ai-msg.user { align-self: flex-end; background: var(--gold); color: var(--navy-deep); border-bottom-right-radius: 3px; }
.ai-msg.assistant { align-self: flex-start; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.ai-msg.system-note { align-self: center; font-family: var(--font-label); font-size: 11px; color: var(--slate); text-align: center; max-width: 95%; }
.ai-msg.typing { align-self: flex-start; background: var(--white); border: 1px solid var(--line); color: var(--slate); font-style: italic; }

.ai-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--white);
}
.ai-chat-input-row input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  outline: none;
}
.ai-chat-input-row input:focus { border-color: var(--gold); }
.ai-chat-send-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}
.ai-chat-send-btn:hover { background: var(--navy-deep); }
.ai-chat-send-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 720px) {
  .ai-chat-toggle { left: 20px; bottom: 20px; }
  .ai-chat-panel { left: 12px; bottom: 88px; }
  .ai-greeting-bubble { left: 20px; bottom: 92px; max-width: 200px; }
}
