/* ==========================================================================
   AI Assistant chat widget
   ========================================================================== */
.chat-launcher {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 150;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px -10px rgba(30, 58, 138, 0.55);
  cursor: pointer;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease);
}
.chat-launcher:hover { transform: translateY(-3px); background: #17296b; }
.chat-launcher svg { width: 26px; height: 26px; }
.chat-launcher .icon-close { display: none; }
body.chat-open .chat-launcher .icon-chat { display: none; }
body.chat-open .chat-launcher .icon-close { display: block; }

.chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 6rem;
  z-index: 150;
  width: min(380px, calc(100vw - 2.5rem));
  height: min(560px, calc(100vh - 8rem));
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
body.chat-open .chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-panel-header {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.chat-panel-header .chat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-panel-header .chat-avatar svg { width: 18px; height: 18px; }
.chat-panel-header h3 { font-family: var(--font-body); font-size: 0.9375rem; font-weight: 700; margin: 0; }
.chat-panel-header p { font-size: 0.75rem; color: rgba(255,255,255,0.75); margin: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--color-muted-bg);
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.chat-bubble.from-assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--color-fg);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(30,58,138,0.08);
}
.chat-bubble.from-user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.is-typing { display: flex; gap: 4px; align-items: center; padding: 0.75rem 0.9rem; }
.chat-bubble.is-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-muted-fg);
  animation: chat-typing 1.1s infinite ease-in-out;
}
.chat-bubble.is-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble.is-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chat-booking-cta {
  align-self: flex-start;
  max-width: 90%;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0.85rem;
  box-shadow: 0 2px 8px rgba(30,58,138,0.08);
}
.chat-booking-cta p {
  font-size: 0.8125rem;
  color: var(--color-muted-fg);
  margin: 0 0 0.6rem;
}
.chat-booking-cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #25D366;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  transition: transform 0.2s var(--ease);
}
.chat-booking-cta a:hover { transform: translateY(-1px); }
.chat-booking-cta a svg { width: 16px; height: 16px; }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #fff;
  border-top: 1px solid var(--color-border);
}
.chat-form input {
  flex: 1;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-fg);
}
.chat-form input:focus-visible { outline: 2px solid var(--color-accent-light); outline-offset: 1px; }
.chat-form button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s var(--ease);
}
.chat-form button:hover { background: #17296b; }
.chat-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-form button svg { width: 17px; height: 17px; }

@media (max-width: 480px) {
  .chat-panel { right: 0.75rem; bottom: 5.25rem; }
  .chat-launcher { right: 1rem; bottom: 1rem; }
}
