/* ============================================
   JivaSiddhi Biopharma - AI Chat Widget Styles
   ============================================ */

/* ---------- Chat Toggle Button ---------- */
.chat-toggle-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 4rem;
  height: 4rem;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: white;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 10px 30px rgba(13, 148, 136, 0.5);
  z-index: 999;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  animation: chatPulse 2s infinite;
}

.chat-toggle-btn:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 15px 40px rgba(13, 148, 136, 0.7);
}

.chat-toggle-btn.active {
  animation: none;
  transform: rotate(90deg);
}

.chat-toggle-btn.active:hover {
  transform: rotate(90deg) scale(1.1);
}

@keyframes chatPulse {
  0%, 100% {
    box-shadow: 0 10px 30px rgba(13, 148, 136, 0.5), 0 0 0 0 rgba(13, 148, 136, 0.7);
  }
  50% {
    box-shadow: 0 10px 30px rgba(13, 148, 136, 0.5), 0 0 0 15px rgba(13, 148, 136, 0);
  }
}

/* Notification badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: badgeBounce 1s infinite;
}

@keyframes badgeBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ---------- Chat Window ---------- */
.chat-window {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 3rem);
  height: 560px;
  max-height: calc(100vh - 8rem);
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
  z-index: 998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  border: 1px solid #e2e8f0;
}

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

/* ---------- Chat Header ---------- */
.chat-header {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  position: relative;
}

.chat-header-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 9999px;
  border: 2px solid #0f766e;
}

.chat-header-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.chat-header-info p {
  font-size: 0.7rem;
  margin: 0;
  opacity: 0.85;
}

.chat-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* ---------- Chat Body ---------- */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ---------- Chat Messages ---------- */
.chat-message {
  display: flex;
  gap: 0.5rem;
  max-width: 85%;
  animation: messageSlide 0.3s ease-out;
}

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

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

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-message.bot .chat-message-avatar {
  background: #ccfbf1;
  color: #0f766e;
}

.chat-message.user .chat-message-avatar {
  background: #0d9488;
  color: white;
}

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.bot .chat-bubble {
  background: white;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 0.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: white;
  border-top-right-radius: 0.25rem;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

/* ---------- Typing Indicator ---------- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 1rem;
  border-top-left-radius: 0.25rem;
  border: 1px solid #e2e8f0;
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 9999px;
  animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Quick Reply Buttons ---------- */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.quick-reply-btn {
  background: white;
  border: 1.5px solid #0d9488;
  color: #0d9488;
  padding: 0.5rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.quick-reply-btn:hover {
  background: #0d9488;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}

/* ---------- Chat Input Area ---------- */
.chat-input-area {
  padding: 0.75rem 1rem;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-input-area input,
.chat-input-area textarea {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  resize: none;
  max-height: 80px;
}

.chat-input-area input:focus,
.chat-input-area textarea:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.chat-send-btn {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: white;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.5);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Progress Bar ---------- */
.chat-progress {
  height: 3px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #22c55e);
  width: 0%;
  transition: width 0.5s ease;
}

/* ---------- Success Message ---------- */
.chat-success {
  text-align: center;
  padding: 1.5rem 1rem;
  animation: messageSlide 0.4s ease-out;
}

.chat-success-icon {
  width: 4rem;
  height: 4rem;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
  animation: successPop 0.5s ease-out;
}

@keyframes successPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.chat-success h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.chat-success p {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chat-toggle-btn {
    bottom: 1rem;
    right: 1rem;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.4rem;
  }
}

/* ---------- Remove WhatsApp float (replaced by chat) ---------- */
.whatsapp-float {
  display: none !important;
}