/* دکمه چت */
.systemafarin-chatbox-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background-color 0.18s ease-out;
}

.systemafarin-chatbox-button-icon {
  font-size: 24px;
  line-height: 1;
}

.systemafarin-chatbox-button:hover {
  background-color: #111111; 
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
}

.systemafarin-chatbox-button:active {
  background-color: #000000;
  transform: translateY(0) scale(0.98);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* پنجره چت */
.systemafarin-chatbox-container {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 420px;              /* یکم عریض‌تر */
  height: 98vh;              /* ارتفاع خیلی بیشتر */
  max-height: 640px;
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.45);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transform-origin: bottom left;
  transition:
    opacity 0.25s ease-out,
    transform 0.25s ease-out,
    visibility 0.25s ease-out;
}

/* حالت بسته با ترنزیشن (نامرئی + پایین‌تر + کمی کوچک‌تر) */
.systemafarin-chatbox-closed {
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
}

/* حالت باز */
.systemafarin-chatbox-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* هدر چت */
.systemafarin-chatbox-header {
  height: 44px;
  background: #020617;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 8px;
  font-size: 13px;
  font-weight: 500;
}

.systemafarin-chatbox-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* دکمه ضربدر */
.systemafarin-chatbox-close-btn {
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 999px;
  transition:
    background-color 0.15s ease-out,
    color 0.15s ease-out,
    transform 0.1s ease-out;
}

.systemafarin-chatbox-close-btn:hover {
  background-color: #ef4444; /* قرمز قشنگ روی hover */
  color: #ffffff;
  transform: scale(1.05);
}

.systemafarin-chatbox-close-btn:active {
  transform: scale(0.94);
}

/* iframe */
.systemafarin-chatbox-iframe {
  flex: 1;
  width: 100%;
  border: none;
}

/* ===== ریسپانسیو موبایل ===== */
@media (max-width: 768px) {
  .systemafarin-chatbox-container {
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
  }

  .systemafarin-chatbox-header {
    height: 48px;
    padding: 0 14px 0 10px;
    font-size: 14px;
  }

  .systemafarin-chatbox-button {
    /* روی موبایل هم سر جای خودش بمونه، فقط کمی نزدیک‌تر به گوشه */
    bottom: 16px;
    left: 16px;
  }
}
