/* دکمه شناور — بالای دکمه واتساپ (همان گوشهٔ end در RTL) */
.ai-support-float {
  position: fixed;
  z-index: 1000;
  bottom: 5.25rem;
  inset-inline-end: 1rem;
  width: 56px;
  height: 56px;
  background: linear-gradient(145deg, #6366f1 0%, #4f46e5 45%, #4338ca 100%);
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.ai-support-float:hover {
  color: #fff !important;
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
  filter: brightness(1.05);
}

.ai-support-float:focus-visible {
  outline: 3px solid rgba(129, 140, 248, 0.85);
  outline-offset: 3px;
}

.ai-support-float__icon {
  font-size: 1.65rem;
}

@media (max-width: 575.98px) {
  .ai-support-float {
    width: 48px;
    height: 48px;
    bottom: 4.5rem;
    inset-inline-end: 0.75rem;
  }

  .ai-support-float__icon {
    font-size: 1.45rem;
  }
}

/* مودال */
.ai-support-modal .modal-dialog {
  max-width: min(420px, calc(100vw - 1.5rem));
}

.ai-support-modal__shell {
  border-radius: 1.15rem;
  background: #f8fafc;
}

.ai-support-modal__header {
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #4f46e5 100%);
}

.ai-support-modal__header-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.15);
  font-size: 1.25rem;
}

.ai-support-modal__subtitle {
  font-size: 0.78rem;
  line-height: 1.45;
}

.ai-support-modal__body {
  min-height: 280px;
  max-height: min(70vh, 520px);
}

.ai-support-messages {
  padding: 1rem 1rem 0.75rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  font-family: var(--font-persian, inherit);
  direction: rtl;
}

.ai-support-msg {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  align-items: flex-end;
}

.ai-support-msg--user {
  flex-direction: row-reverse;
}

.ai-support-msg__avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #6366f1, #4338ca);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.ai-support-msg--user .ai-support-msg__avatar {
  background: linear-gradient(145deg, #0ea5e9, #0284c7);
}

.ai-support-msg__bubble {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.ai-support-msg--user .ai-support-msg__bubble {
  background: linear-gradient(145deg, #e0f2fe 0%, #dbeafe 100%);
  border-color: rgba(56, 189, 248, 0.35);
}

.ai-support-msg--bot .ai-support-msg__bubble {
  border-start-start-radius: 0.35rem;
}

.ai-support-msg--error .ai-support-msg__bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.ai-support-msg--typing .ai-support-msg__bubble {
  padding: 0.55rem 1rem;
}

.ai-support-msg__typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline: 2px;
  border-radius: 50%;
  background: #64748b;
  animation: ai-support-typing 1.2s infinite ease-in-out both;
}

.ai-support-msg__typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-support-msg__typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ai-support-typing {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.ai-support-modal__composer {
  padding: 0.75rem 1rem 1rem;
  background: #fff;
}

.ai-support-modal__input {
  resize: none;
  border-radius: 0.85rem !important;
  border: 1px solid #e2e8f0 !important;
  font-size: 0.9rem;
}

.ai-support-modal__input:focus {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2) !important;
}

.ai-support-modal__send {
  margin-inline-start: 0.35rem;
  border-radius: 0.85rem !important;
  padding-inline: 1rem;
  background: linear-gradient(145deg, #6366f1, #4f46e5);
  color: #fff !important;
  border: none !important;
}

.ai-support-modal__send:hover {
  filter: brightness(1.08);
  color: #fff !important;
}

.ai-support-modal__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-support-modal__human {
  text-align: center;
}

.ai-support-modal__human-link {
  color: #4338ca;
  font-weight: 600;
  text-decoration: none;
}

.ai-support-modal__human-link:hover {
  text-decoration: underline;
}

.ai-support-modal__human--pulse {
  animation: ai-support-human-pulse 0.6s ease 2;
}

@keyframes ai-support-human-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.05);
  }
}
