/* ==========================================================================
   Chatbot Widget Styles
   ========================================================================== */

/* The floating widget button */
.chatbot-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(78,122,92,.35);
  cursor: pointer;
  z-index: 9999;
  transition: var(--transition);
  animation: pulse-bot 2s infinite;
}

.chatbot-widget:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(78,122,92,.45);
}

@keyframes pulse-bot {
  0% { box-shadow: 0 0 0 0 rgba(78,122,92,.35); }
  70% { box-shadow: 0 0 0 15px rgba(78,122,92,0); }
  100% { box-shadow: 0 0 0 0 rgba(78,122,92,0); }
}

/* Chatbot Window Container */
.chatbot-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: min(380px, calc(100vw - 12px));
  height: 520px;
  background-color: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
  background-color: var(--bg-dark);
  color: var(--bg-white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chatbot-bot-avatar {
  width: 36px;
  height: 36px;
  background-color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.chatbot-header-text h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--bg-white);
}

.chatbot-header-text p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chatbot-close {
  background: none;
  border: none;
  color: var(--bg-white);
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chatbot-close:hover {
  opacity: 1;
}

/* Messages Area */
.chatbot-messages {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: var(--bg-light);
}

.chatbot-message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.chatbot-message-wrapper.bot {
  align-self: flex-start;
}

.chatbot-message-wrapper.user {
  align-self: flex-end;
}

.chatbot-message-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chatbot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
}

.chatbot-message {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chatbot-message.bot {
  background-color: var(--bg-white);
  color: var(--text-primary);
  border-radius: 12px 12px 12px 2px;
}

.chatbot-message.user {
  background-color: var(--primary);
  color: var(--bg-white);
  border-radius: 12px 12px 2px 12px;
}

.chatbot-timestamp {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  margin-bottom: 0;
}

.bot .chatbot-timestamp {
  align-self: flex-start;
  margin-left: 36px;
}

.user .chatbot-timestamp {
  align-self: flex-end;
}

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

.chatbot-typing span {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: bounce-typing 1.4s infinite ease-in-out both;
}

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

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

/* Suggestions / Chips */
.chatbot-suggestions {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-white);
  border-top: 1px solid var(--border);
}

.chatbot-suggestions::-webkit-scrollbar {
  height: 4px;
}

.suggestion-chip {
  background-color: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 0.4rem 0.8rem;
  border-radius: 16px;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.suggestion-chip:hover {
  background-color: var(--primary-light);
  color: var(--bg-white);
  border-color: var(--primary-light);
}

/* Input Area */
.chatbot-input {
  display: flex;
  align-items: center;
  padding: 1rem;
  background-color: var(--bg-white);
  border-top: 1px solid var(--border);
  gap: 0.5rem;
}

.chatbot-input input {
  flex-grow: 1;
  border: none;
  background-color: var(--bg-light);
  padding: 0.75rem 1rem;
  border-radius: 20px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
}

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

.chatbot-btn-action {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.chatbot-btn-action:hover {
  background-color: var(--bg-light);
  color: var(--primary);
}

.chatbot-btn-send {
  background-color: var(--primary);
  color: var(--bg-white);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.chatbot-btn-send:hover {
  background-color: var(--primary-dark);
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
  .chatbot-window {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
    transform: translateY(100%);
  }
  
  .chatbot-window.active {
    transform: translateY(0);
  }
  
  .chatbot-widget {
    bottom: 1rem;
    right: 1rem;
  }
}
