/* ── Floating launcher ── */
.ai-support-float {
  position: fixed;
  z-index: 1000;
  bottom: 5.25rem;
  inset-inline-end: 1rem;
  width: 54px;
  height: 54px;
  background: #0f172a;
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-support-float:hover {
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.48);
}

.ai-support-float:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 3px;
}

.ai-support-float__icon {
  font-size: 1.45rem;
}

@media (max-width: 575.98px) {
  .ai-support-float {
    width: 48px;
    height: 48px;
    bottom: 4.5rem;
    inset-inline-end: 0.75rem;
  }
}

/* ── Modal shell ── */
.ai-support-modal .modal-dialog {
  max-width: min(392px, calc(100vw - 1rem));
  margin: 0.75rem auto;
}

.ai-support-shell {
  display: flex;
  flex-direction: column;
  height: min(86vh, 640px);
  border-radius: 1.15rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

/* ── Header ── */
.ai-support-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #0f172a;
  color: #fff;
}

.ai-support-head__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.ai-support-head__icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.ai-support-head__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.ai-support-head__sub {
  margin: 0.1rem 0 0;
  font-size: 0.68rem;
  opacity: 0.7;
  line-height: 1.2;
}

.ai-support-head__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ai-support-head__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ── Compact chips ── */
.ai-support-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.ai-support-chip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ai-support-chip i {
  font-size: 0.72rem;
  opacity: 0.85;
}

.ai-support-chip:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.ai-support-chip.is-active {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}

.ai-support-chip--soft:hover {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

/* ── Stage: chat + composer + overlay ── */
.ai-support-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
}

.ai-support-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.85rem 0.9rem;
  direction: rtl;
  font-family: var(--font-persian, inherit);
  scroll-behavior: smooth;
}

.ai-support-msg {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  align-items: flex-end;
}

.ai-support-msg--user {
  flex-direction: row-reverse;
}

.ai-support-msg__avatar {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.ai-support-msg--user .ai-support-msg__avatar {
  background: #0284c7;
}

.ai-support-msg__bubble {
  max-width: 80%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.95rem;
  font-size: 0.84rem;
  line-height: 1.55;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ai-support-msg--user .ai-support-msg__bubble {
  background: #e0f2fe;
  border-color: #bae6fd;
}

.ai-support-msg--bot .ai-support-msg__bubble {
  border-start-start-radius: 0.25rem;
}

.ai-support-msg--error .ai-support-msg__bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.ai-support-msg__actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.ai-support-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.7rem;
  background: #0f172a;
  color: #fff !important;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.ai-support-cta:hover {
  filter: brightness(1.12);
  color: #fff !important;
  transform: translateY(-1px);
}

.ai-support-msg__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.ai-support-suggest {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-support-suggest:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.ai-support-msg__typing-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  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); }
}

/* Composer — always at bottom of stage */
.ai-support-composer {
  flex-shrink: 0;
  padding: 0.6rem 0.85rem 0.75rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  z-index: 1;
}

.ai-support-composer__box {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem 0.35rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
}

.ai-support-composer__box:focus-within {
  border-color: #38bdf8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

#ai-support-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  resize: none;
  min-height: 2.1rem;
  max-height: 5.5rem;
  padding: 0.4rem 0.25rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #0f172a;
  outline: none;
}

.ai-support-composer__send {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ai-support-composer__send:hover {
  filter: brightness(1.12);
}

.ai-support-composer__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-support-wa {
  margin-top: 0.45rem;
  text-align: center;
}

.ai-support-wa a,
.ai-support-wa__live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
}

.ai-support-wa__live {
  width: 100%;
  margin: 0;
  padding: 0.15rem 0.25rem;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: #0f766e;
  font-weight: 700;
}

.ai-support-wa a:hover,
.ai-support-wa__live:hover {
  color: #0f172a;
}

.ai-support-wa .fa-whatsapp {
  color: #16a34a;
  font-size: 0.95rem;
}

.ai-support-wa--hide {
  display: none;
}

.ai-support-wa.ai-support-modal__human--pulse a,
.ai-support-wa.ai-support-modal__human--pulse .ai-support-wa__live,
#ai-support-human-cta.ai-support-modal__human--pulse a,
#ai-support-human-cta.ai-support-modal__human--pulse .ai-support-wa__live {
  animation: ai-support-human-pulse 0.6s ease 2;
}

@keyframes ai-support-human-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ── Full overlay: covers chat + composer (no peeking) ── */
.ai-support-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  padding: 0.75rem;
}

.ai-support-overlay[hidden] {
  display: none !important;
}

.ai-support-overlay__panel {
  margin-top: auto;
  background: #fff;
  border-radius: 1.1rem 1.1rem 0.85rem 0.85rem;
  padding: 1rem 1rem 1.1rem;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
  animation: ai-support-sheet-up 0.22s ease;
}

@keyframes ai-support-sheet-up {
  from { transform: translateY(18px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.ai-support-overlay__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.ai-support-overlay__top h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.ai-support-overlay__hint {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  line-height: 1.45;
  color: #64748b;
}

.ai-support-overlay__x {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.55rem;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ai-support-overlay__x:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-support-overlay__fields {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ai-support-field {
  display: block;
  margin: 0;
}

.ai-support-field span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.ai-support-field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: #f8fafc;
  color: #0f172a;
}

.ai-support-field input:focus {
  outline: none;
  border-color: #38bdf8;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.ai-support-overlay__btn {
  margin-top: 0.95rem;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  border: none;
  border-radius: 0.8rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.ai-support-overlay__btn:hover {
  filter: brightness(1.1);
}

.ai-support-overlay__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* legacy class hooks used by JS for pulse */
.ai-support-modal__human--pulse {
  /* marker class on #ai-support-human-cta */
}
