@font-face {
  font-family: "IRANYekanWebFn";
  src: url("../fonts/IRANYekanWebFn.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANYekanWebFn";
  src: url("../fonts/IRANYekanWebFn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --chat-bot-primary: #6eac8b;
  --chat-bot-bg: #ffffff;
  --chat-bot-border: #e5e7eb;
  --chat-bot-text: #111827;
  --chat-bot-muted: #6b7280;
}

.chat-bot {
  position: fixed;
  bottom: 20px;
  right: 0;
  z-index: 9999;
  font-family: "IRANYekanWebFn", Tahoma, Arial, sans-serif;
  color: var(--chat-bot-text);
}

.chat-bot--left {
  right: auto;
  left: 0;
}

.chat-bot--right {
  right: 0;
  left: auto;
}

.chat-bot__overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.chat-bot--open .chat-bot__overlay {
  opacity: 1;
  pointer-events: auto;
}

.chat-bot__input,
.chat-bot__send,
.chat-bot__close,
.chat-bot__toggle {
  font-family: inherit;
  font-size: inherit;
}

.chat-bot__input::placeholder {
  font-family: inherit;
}

.chat-bot__panel {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--chat-bot-bg) url("chat-bot-modal-bg.jpg") center/cover no-repeat;
  border: 1px solid var(--chat-bot-border);
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1;
  overflow: hidden;
}

.chat-bot--ready .chat-bot__overlay {
  display: block;
}

.chat-bot--ready .chat-bot__panel {
  display: flex;
}

.chat-bot__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  z-index: 0;
}

.chat-bot__header,
.chat-bot__body,
.chat-bot__footer {
  position: relative;
  z-index: 1;
}

.chat-bot--rounded .chat-bot__panel {
  border-radius: 16px;
}

.chat-bot__panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

.chat-bot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--chat-bot-primary);
  color: #ffffff;
}

.chat-bot__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-bot__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.chat-bot__heading {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.chat-bot__subheading {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
}

.chat-bot__close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

.chat-bot__body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}

.chat-bot__message {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 13px;
  word-wrap: break-word;
  white-space: pre-wrap;
  border: 1px solid var(--chat-bot-border);
  background: #ffffff;
}

.chat-bot__message--bot {
  align-self: flex-start;
}

.chat-bot__message--user {
  align-self: flex-end;
  background: var(--chat-bot-primary);
  color: #ffffff;
  border-color: transparent;
}

.chat-bot__loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-bot__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--chat-bot-primary);
  animation: chatBotPulse 0.8s infinite alternate;
}

.chat-bot__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-bot__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatBotPulse {
  to {
    transform: translateY(-3px);
    opacity: 0.7;
  }
}

.chat-bot__footer {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 0;
  padding: 12px;
  border-top: none;
  background: transparent;
  position: relative;
}

[dir="rtl"] .chat-bot__footer,
body.rtl .chat-bot__footer {
  flex-direction: row-reverse;
}

.chat-bot__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  height: 46px;
  max-height: 120px;
  resize: none;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid var(--chat-bot-border);
  background: #ffffff;
  padding: 12px;
  padding-inline-end: 52px;
  font-size: 13px;
  outline: none;
  text-align: right;
}

.chat-bot__input:focus {
  border-color: var(--chat-bot-primary);
  background: #ffffff;
}

.chat-bot__send {
  position: absolute;
  inset-inline-end: 18px;
  top: 50%;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: var(--chat-bot-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.16);
  transform: translateY(-50%);
}

.chat-bot__send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-bot__send:hover {
  opacity: 0.9;
}

.chat-bot__send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform: rotate(180deg);
}

.chat-bot__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--chat-bot-border);
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.chat-bot__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--chat-bot-primary);
  color: #ffffff;
}

.chat-bot__toggle-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-bot__toggle-icon svg.chat-bot__toggle-icon--close {
  display: none;
}

.chat-bot--open .chat-bot__toggle-icon svg.chat-bot__toggle-icon--open {
  display: none;
}

.chat-bot--open .chat-bot__toggle-icon svg.chat-bot__toggle-icon--close {
  display: block;
}

.chat-bot--open .chat-bot__toggle-text {
  display: none;
}

.chat-bot--open .chat-bot__toggle {
  padding: 6px;
  gap: 0;
}

.chat-bot__toggle-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--chat-bot-text);
}

@media (min-width: 640px) {
  .chat-bot__panel {
    position: absolute;
    inset: auto;
    bottom: 68px;
    right: 0;
    width: 360px;
    height: 520px;
    overflow: hidden;
  }

  .chat-bot--left .chat-bot__panel {
    right: auto;
    left: 0;
  }
}

@media (max-width: 639px) {
  .chat-bot__panel {
    border-radius: 0;
  }

  .chat-bot {
    bottom: var(--chat-bot-mobile-bottom, 88px);
  }

  .chat-bot__toggle {
    width: 56px;
    min-width: 56px;
    justify-content: flex-start;
    flex-direction: row-reverse;
    padding: 6px 6px 6px 8px;
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    overflow: hidden;
    gap: 0;
    box-sizing: border-box;
    transition: width 0.35s ease, padding 0.35s ease, box-shadow 0.2s ease;
  }

  .chat-bot__toggle-text {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: translateX(12px);
    margin-right: 0;
    transition: max-width 0.35s ease, opacity 0.2s ease, transform 0.35s ease, margin-right 0.35s ease,
      margin-left 0.35s ease;
  }

  .chat-bot--armed .chat-bot__toggle-text {
    display: inline-block;
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
    margin-right: 0;
    margin-inline-end: 8px;
  }

  .chat-bot--armed .chat-bot__toggle {
    padding: 6px 6px 6px 8px;
    gap: 0;
    width: auto;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  }

  .chat-bot--left .chat-bot__toggle {
    flex-direction: row;
    padding: 6px 8px 6px 6px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
  }

  .chat-bot--left .chat-bot__toggle-text {
    transform: translateX(-12px);
  }

  .chat-bot--left.chat-bot--armed .chat-bot__toggle-text {
    margin-inline-end: 0;
    margin-left: 8px;
  }

  .chat-bot--open .chat-bot__toggle {
    display: none;
  }
}
