/* چت‌باکس ایران‌یار — کلینیک علوم ایران */
.mt-ai {
  --mt-ai-brand: #0078d4;
  --mt-ai-brand-2: #106ebe;
  --mt-ai-heat: #10b981;
  --mt-ai-cool: #38bdf8;
  --mt-ai-ink: #0f172a;
  --mt-ai-muted: #5b6775;
  --mt-ai-fab-bottom: 1.25rem;
  position: relative;
  z-index: 1200;
  font-family: inherit;
}

.mt-ai .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mt-ai__scrim {
  position: fixed;
  inset: 0;
  z-index: 1201;
  display: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgb(15 23 42 / 0.32);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mt-ai__scrim[hidden] {
  display: none !important;
}
.mt-ai.is-open .mt-ai__scrim:not([hidden]) {
  display: block;
}

.mt-ai__fab {
  position: fixed;
  left: 1rem;
  bottom: var(--mt-ai-fab-bottom);
  z-index: 1203;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.15rem;
  padding: 0.5rem 1.05rem 0.5rem 0.55rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #0078d4 0%, #106ebe 58%, #0b5cab 100%);
  box-shadow: 0 14px 36px -12px rgb(0 120 212 / 0.5), 0 4px 14px -8px rgb(16 185 129 / 0.35);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, width 0.18s ease, padding 0.18s ease;
}
.mt-ai__fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -12px rgb(0 120 212 / 0.55), 0 8px 18px -8px rgb(56 189 248 / 0.35);
}
.mt-ai__fab:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 3px;
}
.mt-ai__fab-mark {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.45rem;
  background: #fff;
  padding: 0.12rem;
}
.mt-ai__fab-label {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.mt-ai__fab-x {
  display: none;
  font-size: 1.15rem;
  line-height: 1;
}
.mt-ai__fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgb(56 189 248 / 0.5);
  animation: mt-ai-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
.mt-ai.is-open .mt-ai__fab {
  width: 3.15rem;
  min-width: 3.15rem;
  padding: 0.55rem;
  justify-content: center;
  background: #0078d4;
}
.mt-ai.is-open .mt-ai__fab-pulse,
.mt-ai.is-open .mt-ai__fab-mark,
.mt-ai.is-open .mt-ai__fab-label {
  display: none;
}
.mt-ai.is-open .mt-ai__fab-x {
  display: block;
}

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

.mt-ai__panel {
  position: fixed;
  left: 1rem;
  bottom: calc(var(--mt-ai-fab-bottom) + 4.1rem);
  z-index: 1202;
  width: min(23.5rem, calc(100vw - 1.5rem));
  max-height: min(36rem, calc(100dvh - 8rem));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.25rem;
  background: rgb(255 255 255 / 0.97);
  border: 1px solid rgb(0 120 212 / 0.12);
  box-shadow: 0 28px 64px -24px rgb(0 120 212 / 0.42), 0 8px 24px -12px rgb(15 23 42 / 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform-origin: bottom left;
}
.mt-ai__panel[hidden] {
  display: none !important;
}
.mt-ai.is-open .mt-ai__panel {
  display: flex;
  animation: mt-ai-pop 0.22s ease-out;
}

@keyframes mt-ai-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mt-ai__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem 0.7rem;
  background: linear-gradient(128deg, #0078d4 0%, #106ebe 62%, #0b5cab 100%);
  color: #fff;
}
.mt-ai__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.mt-ai__avatar {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  border-radius: 0.85rem;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgb(16 185 129 / 0.65);
}
.mt-ai__avatar img {
  width: 1.7rem;
  height: 1.7rem;
}
.mt-ai__brand strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
}
.mt-ai__brand small {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  opacity: 0.9;
  font-size: 0.74rem;
}
.mt-ai__live {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgb(52 211 153 / 0.22);
  flex: 0 0 auto;
}
.mt-ai__head-actions { display: flex; gap: 0.2rem; }
.mt-ai__icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 0.7rem;
  background: rgb(255 255 255 / 0.12);
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mt-ai__head .mt-ai__icon-btn:hover { background: rgb(255 255 255 / 0.22); }
.mt-ai__icon-btn--close { background: rgb(16 185 129 / 0.28); }
.mt-ai__icon-btn:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 1px;
}

.mt-ai__chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.55rem 0.7rem 0.35rem;
  scrollbar-width: none;
}
.mt-ai__chips::-webkit-scrollbar { display: none; }
.mt-ai__chip {
  flex: 0 0 auto;
  border: 1px solid rgb(0 120 212 / 0.16);
  background: #eef6f7;
  color: #0078d4;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.mt-ai__chip:hover { background: #dff3f4; border-color: rgb(56 189 248 / 0.45); }

.mt-ai__log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.4rem 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mt-ai__msg {
  max-width: 92%;
  padding: 0.65rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.86rem;
  line-height: 1.75;
  color: var(--mt-ai-ink);
}
.mt-ai__msg p { margin: 0; }
.mt-ai__msg p + p { margin-top: 0.45rem; }
.mt-ai__msg--bot {
  align-self: flex-start;
  background: #f3f7f8;
  border-bottom-right-radius: 0.35rem;
  border: 1px solid rgb(0 120 212 / 0.06);
}
.mt-ai__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0078d4, #0b5cab);
  color: #fff;
  border-bottom-left-radius: 0.35rem;
}
.mt-ai__msg--pending {
  opacity: 1;
  font-style: normal;
}
.mt-ai__typing {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.1rem;
}
.mt-ai__typing span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #0078d4;
  animation: mt-ai-dot 1.1s ease-in-out infinite;
}
.mt-ai__typing span:nth-child(2) { animation-delay: 0.15s; background: #38bdf8; }
.mt-ai__typing span:nth-child(3) { animation-delay: 0.3s; background: #10b981; }
@keyframes mt-ai-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.mt-ai__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.mt-ai__metric {
  display: flex;
  flex-direction: column;
  padding: 0.28rem 0.55rem;
  border-radius: 0.7rem;
  background: #fff;
  border: 1px solid rgb(0 120 212 / 0.12);
  font-size: 0.72rem;
  line-height: 1.4;
}
.mt-ai__metric strong { font-size: 0.78rem; color: #0078d4; }
.mt-ai__metric span { opacity: 0.75; }

.mt-ai__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.mt-ai__link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.4rem 0.7rem;
  border-radius: 0.85rem;
  background: #fff;
  color: #0078d4;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgb(0 120 212 / 0.16);
  line-height: 1.45;
}
.mt-ai__link:hover { background: #eef6f7; }
.mt-ai__link img {
  width: 3.2rem;
  height: 2.4rem;
  object-fit: cover;
  border-radius: 0.45rem;
  background: #eef4f4;
  flex: 0 0 auto;
}
.mt-ai__link-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.mt-ai__link-copy strong { font-size: 0.78rem; }
.mt-ai__link small,
.mt-ai__link-copy small {
  display: block;
  font-size: 0.68rem;
  opacity: 0.8;
  font-weight: 500;
}
.mt-ai__link--product { background: #ecfdf5; color: #0078d4; border-color: rgb(16 185 129 / 0.28); }
.mt-ai__links--products { flex-direction: column; }
.mt-ai__link--car { background: #ecfeff; color: #155e75; border-color: rgb(56 189 248 / 0.28); }

.mt-ai__followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
}
.mt-ai__follow {
  border: 1px dashed rgb(0 120 212 / 0.28);
  background: transparent;
  color: #0078d4;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.mt-ai__follow:hover { background: #eef6f7; }

.mt-ai__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border-top: 1px solid rgb(0 120 212 / 0.08);
  background: rgb(255 255 255 / 0.9);
}
.mt-ai__composer textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 2.4rem;
  max-height: 6.5rem;
  border: 1px solid rgb(15 23 42 / 0.1);
  border-radius: 0.9rem;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
}
.mt-ai__composer textarea:focus {
  outline: 2px solid rgb(56 189 248 / 0.4);
  border-color: transparent;
}
.mt-ai__send {
  width: 2.45rem;
  height: 2.45rem;
  border: 0;
  border-radius: 0.85rem;
  background: #0078d4;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mt-ai__send:hover { background: #106ebe; }
.mt-ai__send:disabled { opacity: 0.55; cursor: wait; }
.mt-ai__mic { color: #0f172a; background: #eef3f8; }
.mt-ai__mic.is-live { background: #fee2e2; color: #b91c1c; }

html.isc-layout--mobile .mt-ai {
  --mt-ai-fab-bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
}
html.isc-layout--mobile .mt-ai__panel {
  width: calc(100vw - 1rem);
  left: 0.5rem;
  max-height: min(70dvh, calc(100dvh - 9.5rem));
}
html.isc-layout--tablet .mt-ai {
  --mt-ai-fab-bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
}
html.mt-ai-open.isc-layout--mobile {
  overflow: hidden;
}

@media print {
  .mt-ai { display: none !important; }
}
