.goftyar-message-bubble {
  position: absolute;
  bottom: 100%;
  margin-bottom: 15px;
  background: #ffffff;
  color: #333;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: max-content;
  max-width: 250px;
  min-width: 120px;
  min-height: 40px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: goftyar-pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
}

.goftyar-message-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

.goftyar-pos-bottom-right .goftyar-message-bubble {
  right: 0;
  transform-origin: bottom right;
}

.goftyar-pos-bottom-right .goftyar-message-bubble::after {
  right: 20px;
  border-top-color: #ffffff;
}

.goftyar-pos-bottom-left .goftyar-message-bubble {
  left: 0;
  transform-origin: bottom left;
}

.goftyar-pos-bottom-left .goftyar-message-bubble::after {
  left: 20px;
  border-top-color: #ffffff;
}

.goftyar-close-bubble {
  position: absolute;
  top: -10px;
  width: 24px;
  height: 24px;
  background: #ff4d4f;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 0;
  z-index: 25;
  opacity: 0;
  animation: goftyar-fade-in 0.3s 0.8s forwards;
}

.goftyar-close-bubble:hover {
  background: #ff7875;
  transform: scale(1.1);
}

.goftyar-message-text {
  width: 100%;
  text-align: right;
  direction: rtl;
  line-height: 1.6;
  font-size: 13px;
}

.goftyar-typing-indicator {
  display: flex;
  gap: 4px;
}

.goftyar-typing-indicator span {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: goftyar-typing 1.4s infinite ease-in-out both;
}

.goftyar-typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}
.goftyar-typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

.goftyar-msg-row {
  display: flex;
  margin-bottom: 12px;
  width: 100%;
}

.goftyar-msg-row.is-user {
  justify-content: flex-start;
}

.goftyar-body {
  direction: ltr;
}

.goftyar-msg-row.user {
  justify-content: flex-end;
}

.goftyar-msg-row.user .goftyar-msg-content {
  background: #6366f1;
  color: white;
  border-radius: 12px 12px 0 12px;
}

.goftyar-msg-row.assistant {
  justify-content: flex-start;
}

.goftyar-msg-row.assistant .goftyar-msg-content {
  background: white;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 12px 12px 12px 0;
}

.goftyar-msg-row.error .goftyar-msg-content {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 12px;
}

.goftyar-msg-content {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
  word-wrap: break-word;
  direction: rtl;
  text-align: right;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  animation: goftyar-pop-in 0.3s ease-out forwards;
}

.goftyar-loading-dots span {
  width: 5px;
  height: 5px;
  background-color: #6b7280;
  display: inline-block;
  border-radius: 50%;
  animation: goftyar-typing 1.4s infinite ease-in-out both;
  margin: 0 2px;
}
