/* ============================================================
   CHATBOT STYLES
   ============================================================ */

/* Floating Action Button */
.chatbot-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-white);
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(239, 68, 107, 0.4);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  border: none;
  outline: none;
}

.chatbot-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 30px rgba(239, 68, 107, 0.5);
}

.chatbot-fab svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.3s ease;
}

/* Toggle state for icon (chat -> X) */
.chatbot-fab.is-open .icon-chat { display: none; }
.chatbot-fab.is-open .icon-close { display: block; }
.chatbot-fab:not(.is-open) .icon-chat { display: block; }
.chatbot-fab:not(.is-open) .icon-close { display: none; }

/* Chat Window Container */
.chatbot-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 600px;
  max-height: calc(100vh - 8rem);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden by default, animated by GSAP */
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
}

.chatbot-window.is-active {
  pointer-events: auto;
}

/* Chat Header */
.chatbot-header {
  padding: 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chatbot-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-header__avatar svg {
  width: 20px;
  height: 20px;
  color: var(--clr-white);
}

.chatbot-header__info h3 {
  font-size: var(--fs-base);
  font-family: var(--font-body);
  font-weight: 600;
  margin: 0 0 0.1rem 0;
}

.chatbot-header__info span {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chatbot-header__info span::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981; /* Green status dot */
}

/* Chat Body (Messages) */
.chatbot-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Body */
.chatbot-body::-webkit-scrollbar { width: 4px; }
.chatbot-body::-webkit-scrollbar-track { background: transparent; }
.chatbot-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Messages */
.chat-message {
  max-width: 85%;
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: messageSlideIn 0.3s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes messageSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
  color: var(--clr-text);
}

.chat-message.user {
  align-self: flex-end;
  background: var(--grad-primary);
  color: var(--clr-white);
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0.5rem;
  align-items: center;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--clr-text-muted);
  animation: typingBounce 1.4s infinite both;
}

.chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Input Area */
.chatbot-footer {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
}

.chatbot-input-group {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
  padding: 0.25rem 0.25rem 0.25rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-input-group:focus-within {
  border-color: var(--clr-coral);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.18);
}

.chatbot-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--clr-white);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  padding: 0.5rem 0;
}

.chatbot-input::placeholder {
  color: var(--clr-text-muted);
}

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send:hover {
  transform: scale(1.05);
}

.chatbot-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  margin-left: -2px; /* optical center correction for send icon */
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 2rem);
    height: 70vh;
    right: 1rem;
    bottom: 5.5rem;
  }
  
  .chatbot-fab {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
  }
  
  .chatbot-fab svg {
    width: 24px;
    height: 24px;
  }
}
