/* ========================================
   REAL-TIME UI STYLES
   WebSockets, Live Ticker, 120 FPS Chat Widget
   ======================================== */

/* ===== Live Ticker in Top Bar ===== */
.top-bar-ticker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  overflow: hidden;
  max-width: 480px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: livePulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 7px rgba(74, 222, 128, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.ticker-content {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f1f5f9;
  font-weight: 500;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ticker-badge {
  background: #4ade80;
  color: #072c21;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
}

/* Active Viewers Counter Badge */
.live-viewers-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.live-viewers-count {
  font-weight: 700;
  color: #a7f3d0;
}

/* ===== Real-Time Toast Notification ===== */
.ws-toast-container {
  position: fixed;
  bottom: 90px;
  left: 28px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.ws-toast-item {
  background: #ffffff;
  color: #1e293b;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #bbf7d0;
  border-left: 4px solid #15803d;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  font-weight: 500;
  transform: translate3d(0, 20px, 0);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.ws-toast-item.active {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.ws-toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #15803d;
  flex-shrink: 0;
}

/* ===== 120 FPS Live Chat Counselor Widget ===== */
.live-chat-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  background: #15803d;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 25px rgba(21, 128, 61, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  z-index: 995;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-primary);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  will-change: transform;
}

.live-chat-toggle:hover {
  background: #166534;
  transform: translate3d(0, -3px, 0) scale(1.02);
  box-shadow: 0 12px 30px rgba(21, 128, 61, 0.5);
}

.toggle-avatar-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #4ade80;
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

.chat-pulse-indicator {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 6px #4ade80;
}

/* Chat Modal Window */
.live-chat-modal {
  position: fixed;
  bottom: 84px;
  left: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 530px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(22, 101, 52, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 30px, 0) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s;
  will-change: transform, opacity;
}

.live-chat-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
}

.chat-modal-header {
  background: linear-gradient(135deg, #072c21 0%, #15803d 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-action-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: rgba(255, 255, 255, 0.9);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  transform: scale(1.06);
}

.chat-action-icon-btn.active {
  background: #4ade80;
  color: #064e3b;
}

.chat-counselor-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  padding: 1px;
  border: 2px solid #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.chat-counselor-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-counselor-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.chat-status-text {
  font-size: 0.68rem;
  color: #bbf7d0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0 0;
}

.chat-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.chat-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Chat Messages Area */
.chat-messages-scroll {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.chat-message-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: bubblePop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bubblePop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.bot-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.user-bubble {
  background: #15803d;
  color: #ffffff;
  border-top-right-radius: 4px;
  align-self: flex-end;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
}

.chat-time-meta {
  font-size: 0.62rem;
  margin-top: 4px;
  text-align: right;
  opacity: 0.7;
}

/* Action Cards inside Anamika Chat Bubbles */
.chat-action-card {
  margin-top: 10px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.08);
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff !important;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 8px rgba(21, 128, 61, 0.28);
}

.chat-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(21, 128, 61, 0.4);
  background: #14532d;
}

.chat-action-btn.action-secondary {
  background: #ffffff;
  color: #15803d !important;
  border: 1.5px solid #15803d;
  box-shadow: none;
}

.chat-action-btn.action-secondary:hover {
  background: #f0fdf4;
}

.chat-action-subtext {
  font-size: 0.68rem;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

/* Quick Suggestion Chips */
.chat-quick-chips {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  scrollbar-width: none;
}

.chat-quick-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: #15803d;
  color: #ffffff;
}

.chip-btn.chip-highlight {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  border-color: #166534;
  font-weight: 600;
}

.chip-btn.chip-highlight:hover {
  background: #14532d;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-mic-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.chat-mic-btn.listening {
  background: #fee2e2;
  color: #dc2626;
  border-color: #f87171;
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.chat-input-field {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.86rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input-field:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #15803d;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

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

/* In-Page Form Pre-fill Glow Highlight */
.anamika-prefill-glow {
  animation: anamikaFieldGlow 1.6s ease-in-out 3;
  border-color: #15803d !important;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.45) !important;
  background-color: #f0fdf4 !important;
  transition: all 0.3s ease;
}

@keyframes anamikaFieldGlow {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
}

.anamika-floating-badge {
  position: fixed;
  top: 90px;
  right: 28px;
  background: #0f4c3a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 1.5px solid #4ade80;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDownBadge 0.4s ease-out;
}

@keyframes slideDownBadge {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 6px 12px;
}

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

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

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

/* Live Form Tracker Card */
.anamika-live-tracker {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px;
  font-size: 0.82rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.anamika-live-tracker.completed-tracker {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.tracker-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #166534;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.tracker-badge.done-badge {
  color: #047857;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.tracker-steps-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tracker-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.tracker-step-item.done {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
  font-weight: 600;
}

.tracker-step-item.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.step-icon {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.tracker-step-item.done .step-icon {
  background: #16a34a;
}

.tracker-step-item.active .step-icon {
  background: #2563eb;
}

.tracker-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  background: #ffffff;
  border: 1px solid #dcfce7;
  padding: 9px 11px;
  border-radius: 8px;
  margin-bottom: 9px;
  font-size: 0.79rem;
  color: #14532d;
}

.tracker-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-submit-direct-btn {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  padding: 9px 14px !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.3) !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  font-size: 0.82rem !important;
}

.chat-submit-direct-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(21, 128, 61, 0.4) !important;
}

.chat-action-btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 7px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
}

.chat-action-btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

@media (max-width: 768px) {
  .live-chat-toggle {
    bottom: calc(72px + var(--safe-area-bottom));
    left: 14px;
    padding: 8px 14px;
    font-size: 0.78rem;
    box-shadow: 0 4px 16px rgba(21, 128, 61, 0.35);
  }

  .live-chat-modal {
    left: 10px;
    right: 10px;
    bottom: calc(68px + var(--safe-area-bottom));
    width: auto;
    max-width: calc(100vw - 20px);
    height: min(480px, 75vh);
    border-radius: 18px;
  }

  .chat-modal-header {
    padding: 12px 16px;
  }

  .chat-counselor-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-counselor-name {
    font-size: 0.86rem;
  }

  .chat-status-text {
    font-size: 0.64rem;
  }

  .chat-messages-scroll {
    padding: 12px;
    gap: 10px;
  }

  .chat-message-bubble {
    font-size: 0.82rem;
    max-width: 90%;
    padding: 8px 12px;
  }

  .chip-btn {
    font-size: 0.7rem;
    padding: 4px 9px;
  }

  .chat-input-bar {
    padding: 8px 10px;
  }

  .chat-input-field {
    font-size: 16px; /* iOS auto-zoom prevention */
    padding: 8px 14px;
  }

  .chat-send-btn {
    width: 34px;
    height: 34px;
  }
}

