/* ════════════════════════════════════════════════
   CHATBOT CSS — Voice + Mobile Fullscreen
════════════════════════════════════════════════ */

/* ── Floating Button ─────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  transition: all 0.3s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fabPulse 2.5s infinite;
}
.chat-fab:hover {
  transform: scale(1.1);
  animation: none;
}

/* FAB sirf open karta hai — koi X nahi */
.chat-fab-icon { pointer-events: none; }

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 8px 25px rgba(0,0,0,0.25); }
  50%       { box-shadow: 0 8px 40px rgba(108,99,255,0.5); }
}

/* ── Chat Window — Desktop ───────────────────── */
.chat-window {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  width: 370px;
  height: 560px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ──────────────────────────────────── */
.chat-header {
  background: linear-gradient(135deg, var(--dark), #1e3a5f);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 0.75rem; }
.chat-header-actions { display: flex; align-items: center; gap: 0.5rem; }

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.chat-name   { color: white; font-weight: 700; font-size: 0.9rem; margin: 0; }
.chat-status { color: #aaa;  font-size: 0.72rem; margin: 0; }

.chat-close, .voice-toggle-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #ccc;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  transition: all 0.2s;
}
.chat-close:hover, .voice-toggle-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}
.voice-toggle-btn.muted { opacity: 0.4; }

/* ── Messages ────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.chat-msg { display: flex; }
.chat-msg.bot  { justify-content: flex-start; }
.chat-msg.user { justify-content: flex-end; }

.msg-bubble {
  max-width: 82%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.65;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot .msg-bubble {
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.chat-msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-bubble {
  background: white;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
}
.typing-bubble span {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%       { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick Replies ────────────────────────────── */
.quick-replies {
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  background: white;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.quick-replies button {
  white-space: nowrap;
  background: #f1f5f9;
  color: var(--primary);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.quick-replies button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ── Input Area ──────────────────────────────── */
.chat-input-area {
  padding: 0.75rem;
  background: white;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}
.chat-input-area input {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 25px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  min-width: 0;
}
.chat-input-area input:focus { border-color: var(--primary); }

.send-btn, .mic-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.send-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}
.send-btn:hover { transform: scale(1.1); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.mic-btn {
  background: #f1f5f9;
  color: var(--primary);
  border: 2px solid #e2e8f0;
}
.mic-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.mic-btn.listening {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
  animation: micPulse 1s infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* ── Voice Status Bar ─────────────────────────── */
.voice-status {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 0.6rem 1rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.voice-status.active { display: flex; }
.voice-status p { color: white; font-size: 0.8rem; margin: 0; flex: 1; }
.voice-status button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.75rem;
}

.voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
}
.voice-waves span {
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
  animation: wave 1s infinite ease-in-out;
}
.voice-waves span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.voice-waves span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.voice-waves span:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.voice-waves span:nth-child(4) { height: 14px; animation-delay: 0.3s; }
.voice-waves span:nth-child(5) { height: 8px;  animation-delay: 0.4s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

/* ════════════════════════════════════════════════
   MOBILE — Full Screen
════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .chat-window {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .chat-fab {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 56px;
    height: 56px;
  }

  /* Chat open hone par FAB hide karo */
  .chat-fab-hidden {
    display: none !important;
  }
}
