/* چت‌باکس راهنمای تایریار — آقای تایر */
.mt-ai {
  --mt-ai-accent: #c2410c;
  --mt-ai-accent-2: #9a3412;
  --mt-ai-ink: #1b242e;
  --mt-ai-muted: #5b6775;
  --mt-ai-fab-bottom: 1.25rem;
  position: relative;
  z-index: 1200;
}

.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__fab {
  position: fixed;
  left: 1rem;
  bottom: var(--mt-ai-fab-bottom);
  z-index: 1201;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.15rem;
  padding: 0.55rem 0.95rem 0.55rem 0.65rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #141a22 0%, #1f2937 42%, #c2410c 100%);
  box-shadow: 0 14px 36px -12px rgb(194 65 12 / 0.5), 0 6px 16px -8px rgb(15 23 42 / 0.45);
  cursor: pointer;
  font-family: inherit;
}
.mt-ai__fab-mark {
  width: 1.35rem;
  height: 1.35rem;
  filter: brightness(0) invert(1);
}
.mt-ai__fab i { font-size: 1.2rem; }
.mt-ai__fab-label {
  font-size: 0.92rem;
  font-weight: 700;
}
.mt-ai__fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgb(194 65 12 / 0.4);
  animation: mt-ai-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
.mt-ai.is-open .mt-ai__fab-pulse { display: none; }

@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(22.5rem, calc(100vw - 1.5rem));
  max-height: min(34rem, calc(100dvh - 8rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.25rem;
  background: rgb(255 255 255 / 0.92);
  border: 1px solid rgb(255 255 255 / 0.8);
  box-shadow: 0 24px 60px -24px rgb(15 23 42 / 0.35), 0 8px 24px -12px rgb(194 65 12 / 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.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, #141a22 0%, #1f2937 52%, #9a3412 100%);
  color: #fff;
}
.mt-ai__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.mt-ai__avatar {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 0.85rem;
  background: rgb(255 255 255 / 0.16);
  overflow: hidden;
}
.mt-ai__avatar img {
  width: 1.55rem;
  height: 1.55rem;
  filter: brightness(0) invert(1);
}
.mt-ai__brand strong {
  display: block;
  font-size: 0.98rem;
}
.mt-ai__brand small {
  display: block;
  opacity: 0.82;
  font-size: 0.75rem;
}
.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;
}
.mt-ai__head .mt-ai__icon-btn:hover { background: rgb(255 255 255 / 0.22); }

.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(194 65 12 / 0.18);
  background: #fff7ed;
  color: #9a3412;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.mt-ai__chip:hover { background: #ffedd5; }

.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.7;
  color: var(--mt-ai-ink);
}
.mt-ai__msg p { margin: 0; }
.mt-ai__msg--bot {
  align-self: flex-start;
  background: #f3f6fb;
  border-bottom-right-radius: 0.35rem;
}
.mt-ai__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #1f2937, #c2410c);
  color: #fff;
  border-bottom-left-radius: 0.35rem;
}
.mt-ai__msg--pending { opacity: 0.72; font-style: italic; }
.mt-ai__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.mt-ai__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  padding: 0.35rem 0.65rem;
  border-radius: 0.85rem;
  background: #fff;
  color: #9a3412;
  font-size: 0.75rem;
  text-decoration: none;
  border: 1px solid rgb(194 65 12 / 0.2);
  line-height: 1.45;
}
.mt-ai__link small {
  display: block;
  font-size: 0.68rem;
  opacity: 0.8;
  font-weight: 500;
}
.mt-ai__link--product { background: #fff7ed; color: #9a3412; border-color: rgb(234 88 12 / 0.25); }
.mt-ai__link--car { background: #ecfeff; color: #155e75; border-color: rgb(8 145 178 / 0.28); }

.mt-ai__composer {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border-top: 1px solid rgb(15 23 42 / 0.06);
  background: rgb(255 255 255 / 0.75);
}
.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(194 65 12 / 0.35);
  border-color: transparent;
}
.mt-ai__send {
  width: 2.45rem;
  height: 2.45rem;
  border: 0;
  border-radius: 0.85rem;
  background: #c2410c;
  color: #fff;
  cursor: pointer;
}
.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));
}

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