/* ============================================================
   FLOATING CHAT WIDGET
   ============================================================ */
.chat-widget-root {
  position: fixed;
  bottom: 58px; /* Above the WhatsApp button */
  right: 50px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.chat-widget-button:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.chat-widget-button.open {
  transform: rotate(180deg);
  background: var(--gray-800);
}

.button-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff3b30;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.chat-window-container {
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.155);
  transform-origin: bottom right;
}

@keyframes slideUp {
  from { opacity: 0; transform: scale(0.8) translateY(40px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-window-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.header-text h3 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
  line-height:1.2;
}

.header-text p {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.9;
}

.header-status {
   font-size: 0.7rem;
   background: rgba(255, 255, 255, 0.15);
   padding: 4px 10px;
   border-radius: 50px;
   display: flex;
   align-items: center;
   gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 5px #4ade80;
}

.chat-messages-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

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

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

.message-bubble {
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 0.88rem;
  position: relative;
  line-height: 1.4;
}

.bot .message-bubble {
  background: white;
  color: var(--gray-800);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user .message-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.message-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
}

.user .message-time {
  text-align: right;
  color: rgba(255,255,255,0.8);
}

.chat-input-area {
  padding: 15px;
  background: white;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  border: 1px solid var(--gray-200);
  padding: 10px 15px;
  border-radius: 50px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-input-area button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.chat-input-area button:hover:not(:disabled) {
  transform: scale(1.1);
  background: var(--primary-dark);
}

.chat-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing Animation */
.typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px !important;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #cbd5e1;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Mobile Responsive */
@media (max-width: 576px) {
  .chat-widget-root {
    bottom: 90px;
    right: 20px;
  }
  .chat-window-container {
    width: calc(100vw - 40px);
    height: 70vh;
    bottom: 80px;
    right: 0;
  }
}

/* Suggested Questions Styling */
.chat-suggestions-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 5px 0;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.suggestion-pill {
  background: white;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  text-align: left;
}

.suggestion-pill:hover {
  background: var(--primary);
  color: white;
  transform: translateX(5px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

/* Highly Highlighted Chat WhatsApp Button */
.chat-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #25d366;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
  animation: pulse-whatsapp-btn 2s infinite;
  border: 2px solid transparent;
  width: 100%;
}

.chat-whatsapp-btn:hover {
  background-color: #20ba59;
  color: white;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.5);
}

.chat-whatsapp-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.chat-whatsapp-btn i {
  font-size: 1.4rem;
}

@keyframes pulse-whatsapp-btn {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
