/* =====================================================
   ANSOFTIO AI — Floating Chatbot (premium)
   ===================================================== */
.asf-ai-chatbot-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9100;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Floating action button */
.asf-ai-chatbot-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 60px;
  height: 60px;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #2563EB 0%, #1E3A8A 60%, #06B6D4 100%);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(37,99,235,0.45);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.asf-ai-chatbot-toggle::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.45;
  filter: blur(8px);
  z-index: -1;
  animation: asf-ai-glow 2.4s ease-in-out infinite;
}
.asf-ai-chatbot-toggle:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 20px 44px rgba(37,99,235,0.55); }
.asf-ai-chatbot-toggle.is-active { display: none; }
.asf-ai-chatbot-toggle-text { display: none; }
.asf-ai-chatbot-toggle::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 12px; height: 12px;
  background: #16A34A;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: asf-ai-pulse 1.6s ease-in-out infinite;
}
@keyframes asf-ai-glow {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50%      { opacity: 0.7;  transform: scale(1.08); }
}

@media (max-width: 600px) {
  .asf-ai-chatbot-root { right: 14px; bottom: 14px; }
  .asf-ai-chatbot-toggle { width: 56px; height: 56px; }
}

/* Panel */
.asf-ai-chatbot-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 600px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(7,27,61,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #E2E8F0;
  animation: asf-ai-pop 320ms cubic-bezier(0.16,1,0.3,1);
}
@keyframes asf-ai-pop {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 480px) {
  .asf-ai-chatbot-panel {
    right: 6px; left: 6px; bottom: 6px;
    width: auto;
    height: calc(100vh - 12px);
    max-height: none;
    border-radius: 18px;
  }
}

/* Head */
.asf-ai-chatbot-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #071B3D 0%, #1E3A8A 60%, #2563EB 100%);
  color: #fff;
}
.asf-ai-chatbot-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}
.asf-ai-chatbot-head-meta { flex: 1; min-width: 0; }
.asf-ai-chatbot-head strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.asf-ai-chatbot-status {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255,255,255,0.78);
  margin-top: 2px;
}
.asf-ai-chatbot-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16A34A;
  margin-right: 6px;
  vertical-align: middle;
  animation: asf-ai-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 2px rgba(22,163,74,0.25);
}
@keyframes asf-ai-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.asf-ai-chatbot-close-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 160ms;
}
.asf-ai-chatbot-close-btn:hover { background: rgba(255,255,255,0.22); }

/* Messages */
.asf-ai-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: linear-gradient(180deg, #F8FAFC 0%, #EFF6FF 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.asf-ai-msg {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.asf-ai-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563EB, #1E40AF);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.asf-ai-msg-assistant {
  align-self: flex-start;
  background: #fff;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
}
.asf-ai-msg-error {
  align-self: stretch;
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  font-size: 0.8125rem;
}
.asf-ai-msg-error a {
  color: #B91C1C;
  font-weight: 700;
  text-decoration: underline;
}
.asf-ai-msg code {
  background: rgba(15,23,42,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8125rem;
}
.asf-ai-msg pre {
  background: #0F172A;
  color: #E2E8F0;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.75rem;
  margin: 6px 0 0;
}

/* Quick reply chips */
.asf-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
  background: linear-gradient(180deg, transparent 0%, #F8FAFC 100%);
}
.asf-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms;
}
.asf-ai-chip:hover {
  background: #EFF6FF;
  border-color: #2563EB;
  transform: translateY(-1px);
}

/* Typing indicator */
.asf-ai-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #E2E8F0;
  padding: 12px 16px;
  border-radius: 16px;
  display: inline-flex;
  gap: 4px;
}
.asf-ai-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94A3B8;
  animation: asf-ai-bounce 1.4s ease-in-out infinite;
}
.asf-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.asf-ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes asf-ai-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Form */
.asf-ai-chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #E2E8F0;
}
.asf-ai-chatbot-input {
  flex: 1;
  min-height: 44px;
  padding: 10px 16px;
  border: 1.5px solid #E2E8F0;
  border-radius: 999px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}
.asf-ai-chatbot-input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.asf-ai-chatbot-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2563EB, #1E40AF);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms, box-shadow 160ms;
  box-shadow: 0 6px 14px rgba(37,99,235,0.3);
}
.asf-ai-chatbot-send:hover { transform: scale(1.06); box-shadow: 0 8px 18px rgba(37,99,235,0.4); }
.asf-ai-chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.asf-ai-chatbot-foot {
  font-size: 0.6875rem;
  color: #94A3B8;
  text-align: center;
  padding: 8px 12px;
  margin: 0;
  background: #fff;
  border-top: 1px solid #F1F5F9;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .asf-ai-chatbot-panel,
  .asf-ai-chatbot-toggle,
  .asf-ai-chatbot-send,
  .asf-ai-typing span,
  .asf-ai-chatbot-status::before,
  .asf-ai-chatbot-toggle::before,
  .asf-ai-chatbot-toggle::after {
    animation: none !important;
    transition: none !important;
  }
}
