/* =========================================================
   TRACKBHAI - FLOATING LIVE CHAT WIDGET STYLING
   ========================================================= */

.trackbhai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  font-family: 'Plus Jakarta Sans', 'Hind Siliguri', sans-serif;
}

/* Floating Launcher Button */
.chat-launcher-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.6);
}

.chat-badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f43f5e;
  border: 2px solid #070a13;
}

.chat-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.5);
  animation: chatPulse 2s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

@keyframes chatPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* Chat Popup Window */
.chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 540px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(16, 185, 129, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Window Header */
.chat-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-avatar-frame {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
}

.agent-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #047857;
}

.chat-agent-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.chat-agent-sub {
  font-size: 11px;
  opacity: 0.9;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}

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

/* Chat Messages Body */
.chat-body {
  flex-grow: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #090e1a;
}

.msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-bubble.bot {
  align-self: flex-start;
  background: #1e293b;
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.msg-bubble.visitor {
  align-self: flex-end;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bubble.admin {
  align-self: flex-start;
  background: #1e293b;
  color: #f8fafc;
  border-left: 3px solid #10b981;
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
  text-align: right;
}

/* Quick Response Suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.suggestion-chip {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  background: #10b981;
  color: #fff;
}

/* Chat Footer / Input */
.chat-footer {
  padding: 14px 16px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex-grow: 1;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.chat-input:focus {
  border-color: #10b981;
}

.chat-send-btn {
  background: #10b981;
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.2s, background 0.2s;
}

.chat-send-btn:hover {
  background: #059669;
  transform: scale(1.05);
}

@media (max-width: 480px) {
  .chat-window {
    width: calc(100vw - 32px);
    height: 480px;
    right: -8px;
    bottom: 70px;
  }
}

/* Sender Tag Badges */
.msg-sender-tag {
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.msg-sender-tag.admin {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

/* Typing Indicator Animation */
.typing-bubble {
  padding: 12px 16px;
  min-width: 80px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 14px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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