/* ==========================================================================
   AFSS INTELLIGENCE CHATBOT - WHITE PILL LAUNCHER & BLUE ACCENTS
   ========================================================================== */

.afss-chatbot-system {
  position: relative;
  z-index: 99990;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Launcher Pill Button - Clean White Background */
.afss-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 10px;
  background: #ffffff !important;
  color: #0b1d36 !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(11, 29, 54, 0.12), 0 3px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  user-select: none;
  text-decoration: none;
}

.afss-chat-launcher:hover {
  transform: translateY(-2px);
  background: #ffffff !important;
  border-color: #1c4d9c !important;
  box-shadow: 0 14px 36px rgba(11, 29, 54, 0.18), 0 4px 12px rgba(28, 77, 156, 0.15);
}

.afss-chat-launcher:active,
.afss-chat-launcher.is-active {
  background: #f8fafc !important;
  border-color: #1c4d9c !important;
  box-shadow: 0 8px 24px rgba(28, 77, 156, 0.2) !important;
}

.afss-chat-launcher-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0b1d36;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(11, 29, 54, 0.2);
}

.afss-chat-launcher:hover .afss-chat-launcher-icon,
.afss-chat-launcher.is-active .afss-chat-launcher-icon {
  background: #1c4d9c;
  transform: scale(1.04);
}

.afss-chat-online-pulse {
  position: absolute;
  top: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: afssPulseDot 2s infinite;
}

@keyframes afssPulseDot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.afss-chat-launcher-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.afss-chat-launcher-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0b1d36 !important;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.afss-chat-launcher-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #1c4d9c !important;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Chat Window Box Container - Fixed Height to NEVER overlap header */
.afss-chat-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 530px;
  max-height: calc(100vh - 150px);
  background: #ffffff !important;
  border-radius: 16px;
  border: 1px solid rgba(11, 29, 54, 0.14);
  box-shadow: 0 20px 50px rgba(11, 29, 54, 0.22), 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.afss-chat-window.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

/* Header - Pure Dark Navy */
.afss-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: #0b1d36 !important;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.afss-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.afss-chat-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1c4d9c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.afss-chat-header-meta {
  min-width: 0;
}

.afss-chat-header-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff !important;
  margin: 0;
  line-height: 1.25;
}

.afss-chat-header-status {
  font-size: 11px;
  color: #94a3b8;
  margin: 2px 0 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.afss-status-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.afss-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.afss-chat-hdr-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.afss-chat-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Body / Chat Stream */
.afss-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

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

/* Welcome Card - Clean Blue & White */
.afss-chat-welcome-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: 0 1px 4px rgba(11, 29, 54, 0.04);
}

.afss-chat-welcome-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c4d9c;
  flex-shrink: 0;
}

.afss-chat-welcome-content h4 {
  font-size: 13px;
  font-weight: 700;
  color: #0b1d36;
  margin: 0 0 3px 0;
  line-height: 1.3;
}

.afss-chat-welcome-content p {
  font-size: 11.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* Quick Chips - Clean minimalist pills without emojis */
.afss-chat-quick-chips {
  margin-top: 2px;
}

.afss-chips-title {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.afss-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.afss-chip-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0b1d36 !important;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.25;
  text-align: left;
}

.afss-chip-btn:hover {
  background: #0b1d36 !important;
  color: #ffffff !important;
  border-color: #0b1d36 !important;
  transform: translateY(-1px);
}

/* Messages Wrap */
.afss-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.afss-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: afssFadeIn 0.18s ease forwards;
}

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

.afss-chat-msg.afss-msg-user {
  align-self: flex-end;
}

.afss-chat-msg.afss-msg-user .afss-msg-bubble {
  background: #0b1d36 !important;
  color: #ffffff !important;
  border-radius: 14px 14px 2px 14px;
  padding: 9px 13px;
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
}

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

.afss-chat-msg.afss-msg-bot .afss-msg-bubble {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #e2e8f0;
  border-radius: 14px 14px 14px 2px;
  padding: 11px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 1px 4px rgba(11, 29, 54, 0.03);
  word-break: break-word;
}

.afss-msg-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0b1d36 !important;
  margin: 0 0 5px 0;
  line-height: 1.3;
}

.afss-msg-bubble p {
  margin: 0 0 6px 0;
}
.afss-msg-bubble p:last-child {
  margin-bottom: 0;
}

.afss-msg-bubble ul, .afss-msg-bubble ol {
  margin: 4px 0 6px 0;
  padding-left: 16px;
}
.afss-msg-bubble li {
  margin-bottom: 3px;
}

.afss-msg-bubble strong {
  font-weight: 700;
  color: #0b1d36;
}

.afss-msg-time {
  font-size: 9.5px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 2px;
}
.afss-chat-msg.afss-msg-user .afss-msg-time {
  text-align: right;
}

/* Call to Action - Blue & White */
.afss-msg-cta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.afss-msg-cta-wrap { margin-top: 8px; }

.afss-chat-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: #0b1d36 !important;
  color: #ffffff !important;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #0b1d36;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.18s ease;
  width: 100%;
}

.afss-chat-cta-btn:hover {
  background: #1c4d9c !important;
  border-color: #1c4d9c !important;
}

/* Primary CTA - solid blue (new) */
.afss-chat-cta-primary {
  background: linear-gradient(180deg, #1c4d9c 0%, #0b1d36 100%) !important;
  color: #ffffff !important;
  border-color: #0b1d36 !important;
  box-shadow: 0 2px 6px rgba(11, 29, 54, 0.18);
}
.afss-chat-cta-primary:hover {
  background: linear-gradient(180deg, #2563b8 0%, #1c4d9c 100%) !important;
  border-color: #1c4d9c !important;
  box-shadow: 0 4px 10px rgba(28, 77, 156, 0.28);
  transform: translateY(-1px);
}

/* Secondary CTA - outline (new) */
.afss-chat-cta-secondary {
  background: #ffffff !important;
  color: #0b1d36 !important;
  border: 1px solid #cbd5e1 !important;
}
.afss-chat-cta-secondary:hover {
  background: #f1f5f9 !important;
  color: #0b1d36 !important;
  border-color: #94a3b8 !important;
}

.afss-cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.afss-cta-label {
  display: inline-block;
}

/* Quick Reply buttons (new) */
.afss-msg-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed #e2e8f0;
}

.afss-quick-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: #f8fafc !important;
  color: #0b1d36 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.25;
  font-family: inherit;
}
.afss-quick-reply-btn:hover {
  background: #0b1d36 !important;
  color: #ffffff !important;
  border-color: #0b1d36 !important;
  transform: translateY(-1px);
}
.afss-quick-reply-btn .afss-qr-icon {
  display: inline-flex;
  align-items: center;
  color: #1c4d9c;
}
.afss-quick-reply-btn:hover .afss-qr-icon {
  color: #ffffff;
}

/* Follow-up tag (More detailed answer chip) */
.afss-msg-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1c4d9c;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 5px;
}
.afss-msg-followup .afss-msg-bubble {
  background: #f8fafc !important;
  border-color: #dbeafe !important;
}

/* Streaming body — subtle cursor while text streams */
.afss-msg-body-streaming {
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
  min-height: 1.4em;
}
.afss-msg-body-streaming::after {
  content: '▍';
  display: inline-block;
  margin-left: 1px;
  color: #1c4d9c;
  animation: afssCursorBlink 0.7s infinite step-end;
}
@keyframes afssCursorBlink {
  50% { opacity: 0; }
}

/* Error / Retry styling */
.afss-msg-error .afss-msg-bubble {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}
.afss-msg-error .afss-msg-title {
  color: #9a3412 !important;
}
.afss-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 12px;
  background: #1c4d9c !important;
  color: #ffffff !important;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.afss-retry-btn:hover {
  background: #0b1d36 !important;
}

/* Status dot offline variant */
.afss-status-dot-offline {
  background: #94a3b8 !important;
  box-shadow: none !important;
}

/* Typing Indicator */
.afss-chat-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  align-self: flex-start;
}

.afss-typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.afss-typing-dots span {
  width: 5px;
  height: 5px;
  background: #1c4d9c;
  border-radius: 50%;
  animation: afssTypingBounce 1.2s infinite ease-in-out;
}

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

@keyframes afssTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #0b1d36; }
}

.afss-typing-text {
  font-size: 10.5px;
  color: #64748b;
  font-style: italic;
}

/* Chat Footer / Input Row */
.afss-chat-footer {
  padding: 10px 14px;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.afss-chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 3px 5px 3px 10px;
  transition: border-color 0.2s ease;
}

.afss-chat-input-row:focus-within {
  border-color: #1c4d9c;
  background: #ffffff;
}

.afss-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 12.5px;
  color: #0b1d36;
  outline: none;
  font-family: inherit;
}

.afss-chat-input::placeholder {
  color: #94a3b8;
}

.afss-chat-send {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #0b1d36;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease;
  flex-shrink: 0;
}

.afss-chat-send:hover {
  background: #1c4d9c;
}

.afss-chat-disclaimer {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
  line-height: 1.3;
}

.afss-chat-disclaimer a {
  color: #1c4d9c;
  font-weight: 600;
  text-decoration: none;
}
.afss-chat-disclaimer a:hover {
  text-decoration: underline;
}

/* Voice / Microphone input button (new) */
.afss-chat-mic {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #1c4d9c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  padding: 0;
  margin: 0 2px 0 0;
}
.afss-chat-mic:hover {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #0b1d36;
}
.afss-chat-mic.is-listening {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
  animation: afssMicPulse 1.2s infinite;
}
.afss-chat-mic .afss-mic-icon {
  display: inline-flex;
  align-items: center;
}
@keyframes afssMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(185, 28, 28, 0); }
}

/* Status bar at footer (new) */
.afss-chat-statusbar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #64748b;
  margin-top: 5px;
  padding: 3px 8px;
  background: #f8fafc;
  border-radius: 999px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.afss-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: afssStatusPulse 2.4s infinite;
}
.afss-chat-status-dot-online {
  background: #10b981;
}
.afss-chat-status-dot-offline {
  background: #94a3b8;
  animation: none;
}
@keyframes afssStatusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50%      { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
}

/* Suggestion chips — horizontally scrollable */
.afss-chips-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.afss-chips-list::-webkit-scrollbar {
  height: 4px;
}
.afss-chips-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.afss-chips-list::-webkit-scrollbar-track {
  background: transparent;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .afss-chat-launcher {
    bottom: 16px;
    right: 16px;
    padding: 6px 14px 6px 8px;
    gap: 8px;
  }

  .afss-chat-launcher-icon {
    width: 32px;
    height: 32px;
  }

  .afss-chat-launcher-title {
    font-size: 12.5px;
  }

  .afss-chat-launcher-badge {
    font-size: 9.5px;
  }

  .afss-chat-window {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 80vh !important;
    max-height: 80vh !important;
    border-radius: 18px 18px 0 0 !important;
    border: none !important;
    border-top: 1px solid rgba(11, 29, 54, 0.15) !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(100%) !important;
  }

  .afss-chat-window.is-open {
    transform: translateY(0) !important;
  }
}
