/* —— MCI AI assistant (aligned with .mci-floating-actions) —— */
.mci-ai-assistant {
  position: fixed;
  z-index: 10000;
  right: 30px;
  bottom: 30px;
  width: 0;
  height: 0;
  pointer-events: none;
}

html[dir="rtl"] .mci-ai-assistant {
  right: auto;
  left: 30px;
}

.mci-ai-assistant__panel {
  pointer-events: auto;
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: min(400px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(0, 24, 69, 0.08);
  box-shadow:
    0 24px 64px rgba(0, 24, 69, 0.2),
    0 8px 20px rgba(0, 102, 204, 0.08);
  transform-origin: bottom right;
  animation: mci-ai-panel-in 0.22s ease;
}

/* Hide float stack while chat is open so panel aligns cleanly to the corner */
body.mci-ai-open .mci-floating-actions {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

html[dir="rtl"] .mci-ai-assistant__panel {
  right: auto;
  left: 30px;
  transform-origin: bottom left;
}

@keyframes mci-ai-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* FAB — same size / corner as WhatsApp & call buttons */
.mci-floating-actions .mci-ai-assistant__fab {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: none;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #0066cc 0%, #001845 100%);
  box-shadow:
    0 4px 20px rgba(0, 102, 204, 0.4),
    0 2px 10px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  line-height: 1;
}

.mci-floating-actions .mci-ai-assistant__fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 6px 30px rgba(0, 102, 204, 0.5),
    0 4px 15px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mci-floating-actions .mci-ai-assistant__fab:active {
  transform: scale(0.95);
}

.mci-floating-actions .mci-ai-assistant__fab.is-open {
  background: linear-gradient(135deg, #001845 0%, #003366 100%);
}

.mci-ai-assistant__fab-icon {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mci-ai-assistant__fab-svg {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.mci-ai-assistant__avatar svg {
  display: block;
}

.mci-ai-assistant__fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 102, 204, 0.45);
  animation: mci-ai-pulse 2.2s ease-out infinite;
  pointer-events: none;
}

@keyframes mci-ai-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

.mci-ai-assistant__tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: #001845;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.mci-ai-assistant__tooltip .tooltip-arrow {
  position: absolute;
  right: -5px;
  top: 50%;
  margin-top: -5px;
  border: 5px solid transparent;
  border-left-color: #001845;
  border-right: 0;
}

html[dir="rtl"] .mci-ai-assistant__tooltip {
  right: auto;
  left: calc(100% + 12px);
}

html[dir="rtl"] .mci-ai-assistant__tooltip .tooltip-arrow {
  right: auto;
  left: -5px;
  border-left: 0;
  border-right-color: #001845;
}

.mci-floating-actions .mci-ai-assistant__fab:hover .mci-ai-assistant__tooltip {
  opacity: 1;
  visibility: visible;
}

/* Header */
.mci-ai-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  background: linear-gradient(135deg, #001845 0%, #0066cc 100%);
  color: #fff;
  flex-shrink: 0;
}

.mci-ai-assistant__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.mci-ai-assistant__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.mci-ai-assistant__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.mci-ai-assistant__status {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mci-ai-assistant__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.25);
  flex-shrink: 0;
}

.mci-ai-assistant__header-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mci-ai-assistant__icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.mci-ai-assistant__icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Messages */
.mci-ai-assistant__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  background: #f4f8fc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.mci-ai-msg {
  max-width: 86%;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mci-ai-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #001845;
  border: 1px solid #e4eef7;
  border-start-start-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 24, 69, 0.04);
}

.mci-ai-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #fff;
  border-start-end-radius: 4px;
}

.mci-ai-msg__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: #0066cc;
  color: #fff !important;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.mci-ai-msg__cta:hover {
  background: #0052a3;
  color: #fff !important;
}

.mci-ai-msg--typing {
  padding: 0.85rem 1rem;
  min-width: 64px;
  opacity: 1;
  font-style: normal;
}

.mci-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 14px;
}

.mci-ai-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0066cc;
  opacity: 0.35;
  animation: mci-ai-dot-bounce 1.05s ease-in-out infinite;
}

.mci-ai-typing__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.mci-ai-typing__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes mci-ai-dot-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.mci-ai-msg--streaming {
  position: relative;
}

.mci-ai-msg__caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: -0.12em;
  background: #0066cc;
  border-radius: 1px;
  animation: mci-ai-caret-blink 0.8s step-end infinite;
}

@keyframes mci-ai-caret-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Footer / chips / composer */
.mci-ai-assistant__footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e8f0f7;
  padding: 0.75rem 0.85rem 0.85rem;
}

.mci-ai-assistant__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.mci-ai-assistant__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #d5e6f5;
  background: #f3f9fd;
  color: #001845;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.mci-ai-assistant__chip i {
  color: #0066cc;
  font-size: 0.75rem;
}

.mci-ai-assistant__chip:hover {
  background: #e8f3fc;
  border-color: #0066cc;
}

.mci-ai-assistant__composer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mci-ai-assistant__panel[dir="rtl"] .mci-ai-assistant__send i {
  transform: scaleX(-1);
}

.mci-ai-assistant__panel[dir="rtl"] .mci-ai-assistant__title,
.mci-ai-assistant__panel[dir="rtl"] .mci-ai-assistant__status,
.mci-ai-assistant__panel[dir="rtl"] .mci-ai-assistant__chip,
.mci-ai-assistant__panel[dir="rtl"] .mci-ai-msg {
  text-align: right;
}

.mci-ai-assistant__panel[dir="rtl"] .mci-ai-assistant__composer input {
  text-align: right;
}

.mci-ai-assistant__composer input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 1px solid #d5e6f5;
  border-radius: 999px;
  padding: 0 1rem;
  font-size: 0.9rem;
  background: #f8fbfe;
  outline: none;
  color: #001845;
}

.mci-ai-assistant__composer input:focus {
  border-color: #0066cc;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

.mci-ai-assistant__send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #0066cc 0%, #001845 100%);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.28);
  transition: transform 0.2s ease;
}

.mci-ai-assistant__send:hover {
  transform: scale(1.05);
}

@media (max-width: 575.98px) {
  .mci-ai-assistant,
  .mci-ai-assistant__panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 12px;
  }

  html[dir="rtl"] .mci-ai-assistant,
  html[dir="rtl"] .mci-ai-assistant__panel {
    right: 12px;
    left: 12px;
  }

  .mci-ai-assistant__panel {
    height: min(78vh, 560px);
  }
}
